This commit is contained in:
@jyuhsin
2025-06-11 17:35:30 +08:00
parent 77d9aef4c5
commit c243daddec
2 changed files with 97 additions and 175 deletions
@@ -2,17 +2,22 @@ package io.v.nutz.zhgh.lxy.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
import io.v.nutz.base.annontation.ViReturn;
import io.v.nutz.base.utils.MsgApi;
import io.v.nutz.base.utils.OfficeTemplateUtil;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.zhgh.lxy.model.Lxy_bm;
import io.v.nutz.zhgh.lxy.model.Lxy_hd;
import io.v.nutz.zhgh.lxy.service.LxyGrxxService;
import io.v.nutz.zhgh.lxy.service.LxyHdService;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql;
@@ -29,6 +34,7 @@ import org.nutz.mvc.annotation.Param;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.List;
@@ -45,19 +51,16 @@ public class LxyHdTjController {
@Inject
private LxyHdService lxyHdService;
@Inject
private LxyGrxxService lxyGrxxService;
@Inject
private Vi vi;
@Inject
private OfficeTemplateUtil officeTemplateUtil;
@Inject
private MsgApi msgApi;
@Inject
private Dao dao;
@At("")
@Ok("beetl:/platform/zgfw/lxy/HdTj.html")
@@ -73,9 +76,24 @@ public class LxyHdTjController {
@Param(value = "searchKey", required = false) String searchKey,
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("SELECT gr.* ,u.unionname,u.unioncode,u.unitname unitname,u.unitcode FROM `lxy_grxx` gr \n" +
"LEFT JOIN lxy_bm bm ON bm.userid = gr.userid \n" +
"LEFT JOIN `user` u ON u.id=bm.userid $condition");
Sql sql = Sqls.create("""
SELECT
gr.*,
u.unionname,
u.unioncode,
u.unitname,
u.unitcode,
bm.zyhj,
bm.bz,
bm.talent,
bm.nation,
bm.bmzt
FROM
lxy_grxx gr
LEFT JOIN lxy_bm bm ON bm.userid = gr.userid
LEFT JOIN `user` u ON u.id = bm.userid
$condition
""");
cnd.and(new Static("bm.bmzt = 5"));
cnd.and("gr.hdid", "=", hdid);
@@ -108,56 +126,44 @@ public class LxyHdTjController {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT
gr.*,
bm.unionname,
gr.username as uName,
bm.unitname,
gr.sex,
bm.nation,
bm.zyhj,
bm.bz
bm.idcard,
bm.mobile,
bm.talent
FROM
`lxy_grxx` gr
LEFT JOIN lxy_bm bm ON bm.userid = gr.userid
LEFT JOIN `user` u ON u.id = bm.userid
$condition
""");
cnd.and(new Static("bm.bmzt = 5"));
cnd.and("bm.bmzt", "=", 5);
cnd.and("gr.hdid", "=", hdid);
if (Strings.isNotBlank(ghid)) {
cnd.and("gr.ghid", "=", ghid);
}
cnd.andEX("gr.ghid", "=", ghid);
cnd.groupBy("bm.userid");
cnd.asc("bm.unionname").asc("bm.unitname").asc("gr.age");
cnd.asc("u.unioncode");
sql.setCondition(cnd);
List<Record> list = lxyGrxxService.list(sql);
int i = 1;
for (Record r : list) {
r.set("index", i);
List<NutMap> chry = Json.fromJsonAsList(NutMap.class, r.getString("chry"));
for (NutMap map : chry) {
r.set("rych", (r.getString("rych") == null ? "" : r.getString("rych")) + " " + map.getString("shry"));
}
i++;
for (int i = 0; i < list.size(); i++) {
list.get(i).set("index", i + 1);
}
// HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
// Configure config = Configure.newBuilder().bind("list", policy).build();
HashMap<String, Object> map = new HashMap<>();
map.put("hdmc", hdname);
map.put("mapList", list);
String fileName = "疗休养人员名单汇总表.xls";
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + new String(fileName.getBytes("utf-8"), "ISO8859-1"));
// TemplateExportParams params = new TemplateExportParams("C:\\Users\\mayn\\Desktop\\lxyrymd.xls");
TemplateExportParams params = new TemplateExportParams(officeTemplateUtil.getPath("lxy_lxyrymd"));
// Workbook workbook = ExcelExportUtil.exportExcel(params, map);
// workbook.write(response.getOutputStream());
Workbook workbook = ExcelExportUtil.exportExcel(params, map);
ServletOutputStream outputStream = response.getOutputStream();
workbook.write(outputStream);
outputStream.close();
}
NutMap map = new NutMap();
map.put("list", list);
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
Configure config = Configure.builder().bind("list", policy).build();
String fileName = "疗休养人员名单汇总表.docx";
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment;filename=" + new String(fileName.getBytes(StandardCharsets.UTF_8), "ISO8859-1"));
XWPFTemplate.compile(officeTemplateUtil.getPath("lxy_lxyrymd"), config).render(map).write(response.getOutputStream());
response.getOutputStream().close();
}
@At
@RequiresPermissions("zgfw.lxy.hdtj")
@@ -2,19 +2,10 @@
layout("/layouts/platform.html"){
#-->
<style>
.file-down-span {
background: black;
opacity: 0.5;
z-index: 1000;
width: 100px;
text-align: center;
position: relative;
bottom: -100px;
cursor: pointer;
}
.viewFile {
height: 150px;
.el-descriptions-item__label.is-bordered-label {
max-width: 200px;
min-width: 200px;
width: 200px;
}
</style>
<div id="app" v-cloak>
@@ -63,38 +54,43 @@ layout("/layouts/platform.html"){
<el-button @click="doSearch" icon="el-icon-search" type="primary"></el-button>
</div>
<div class="pull-right offscreen-right mt5">
<el-button :disabled="!pageForm.hdid" @click="$refs.customMessage.open()"
type="primary">一键发送
</el-button>
<el-button @click="doExport" icon="el-icon-download" type="primary">导 出</el-button>
</div>
</el-card>
<el-card class="mt10" shadow="never">
<table-tool label="报名列表" :app="this">
<template #func>
<el-button @click="doExport" icon="el-icon-download" type="primary" size="small">导出</el-button>
</template>
</table-tool>
<el-table :data="tableData" row-key="id" style="width: 100%" v-loading="tabLoading">
<el-table-column align="center" header-align="center" label="序号" width="100px">
<template scope="scope">
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="姓名"
prop="username"></el-table-column>
<el-table-column align="center" header-align="center" label="性别"
prop="sex"></el-table-column>
<el-table-column align="center" header-align="center" label="年龄"
prop="age" sortable></el-table-column>
<el-table-column align="center" header-align="center" label="民族"
prop="mz" sortable></el-table-column>
<el-table-column align="center" header-align="center" label="手机号"
prop="mobile" show-overflow-tooltip></el-table-column>
<el-table-column align="center" header-align="center" label="身份证号" prop="idcard"
width="300px"></el-table-column>
<el-table-column align="center" header-align="center" label="工会"
prop="unionname" show-overflow-tooltip sortable></el-table-column>
<el-table-column align="center" header-align="center" label="单位"
prop="unitname" show-overflow-tooltip sortable></el-table-column>
<el-table-column align="center" header-align="center" label="工号" prop="loginname"></el-table-column>
<el-table-column align="center" header-align="center" label="姓名" prop="username"></el-table-column>
<el-table-column align="center" header-align="center" label="性别" prop="sex" sortable width="80"></el-table-column>
<el-table-column align="center" header-align="center" label="民族" prop="nation" sortable width="80"></el-table-column>
<el-table-column align="center" header-align="center" label="疗休养员身份" prop="zyhj" show-overflow-tooltip></el-table-column>
<el-table-column align="center" header-align="center" label="身份证号" prop="idcard"></el-table-column>
<el-table-column align="center" header-align="center" label="联系电话" prop="mobile"></el-table-column>
<el-table-column
align="center"
header-align="center"
label="是否为ABCDE类高层次人才"
prop="talent"
show-overflow-tooltip
></el-table-column>
<el-table-column align="center" header-align="center" label="报名状态" prop="bmzt">
<template scope="scope">
<span style="color: #e6a23c" v-if="scope.row.bmzt==1">待分工会审核</span>
<span style="color: #f56c6c" v-if="scope.row.bmzt==2">分工会审核未通过</span>
<span style="color: #e6a23c" v-if="scope.row.bmzt==3">待校工会审核</span>
<span style="color: #f56c6c" v-if="scope.row.bmzt==4">校工会审核未通过</span>
<span style="color: #67c23a" v-if="scope.row.bmzt==5">报名成功</span>
</template>
</el-table-column>
<el-table-column align="center" fixed="right" header-align="center" label="操作"
width="120px">
@@ -120,101 +116,21 @@ layout("/layouts/platform.html"){
</el-card>
<template #view>
<el-row style="padding: 50px 150px">
<el-form label-position="right" label-width="120px" style="padding: 20px 0">
<vi-title title="个人信息"></vi-title>
<el-row gutter="20">
<el-col :span="12">
<el-form-item label="工号:">
{{viewData.loginname}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="姓名:">
{{viewData.username}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="人事编制:">
{{viewData.rsbz}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="性别:">
{{viewData.sex}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="年龄:">
{{viewData.age}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所在单位:">
{{viewData.unitname}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="手机号:">
{{viewData.mobile}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="身份证号:">
{{viewData.idcard}}
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="获奖名称:">
{{viewData.zyhj}}
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注:">
{{viewData.bz}}
</el-form-item>
</el-col>
</el-row>
<template v-if="viewData.files&&viewData.files.length">
<vi-title title="身份证复印件"></vi-title>
<div style="text-align: left;">
<div style="display: inline-block;width: 100px;margin-right:10px"
v-for="item in viewData.files">
<div @click="dd3s.download(item.filepath,item.filename)"
class="file-down-span">
<i class="el-icon-download"></i>
</div>
<el-image :src="'${AppFileDomain!}'+item.filepath"
@click="dd3s.showpic(item.filepath)"
fit="cover"
style="width: 100px;height: 100px;box-shadow: 0 0 5px rgb(200,200,200)"
v-if="dd3s.isPic(item.filepath)">
</el-image>
<el-image src="***"
style="width: 100px;height: 100px;box-shadow: 0 0 5px rgb(200,200,200)"
v-else>
<div class="image-slot" slot="error"
style="width: 100%;height: 100%; display:flex;align-items: center;text-align: center">
<span style="font-size: 12px;color: rgb(180,180,180);width: 100%;text-align: center;overflow: hidden;padding: 0 10px;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical">{{item.filename}}</span>
</div>
</el-image>
</div>
</div>
</template>
<vi-title title="个人材料"></vi-title>
<file-upload :files="viewData.bmFiles"
:view="true"
v-if="viewData.bmFiles && viewData.bmFiles.length > 0"></file-upload>
<span v-else>暂无个人材料</span>
</el-form>
</el-row>
<el-descriptions class="margin-top" title="" :column="3" border>
<el-descriptions-item label="工号">{{ viewData.loginname }}</el-descriptions-item>
<el-descriptions-item label="姓名">{{ viewData.username }}</el-descriptions-item>
<el-descriptions-item label="人事编制">{{ viewData.rsbz }}</el-descriptions-item>
<el-descriptions-item label="性别">{{ viewData.sex }}</el-descriptions-item>
<el-descriptions-item label="年龄">{{ viewData.age }}</el-descriptions-item>
<el-descriptions-item label="所在单位">{{ viewData.unitname }}</el-descriptions-item>
<el-descriptions-item label="手机号">{{ viewData.mobile }}</el-descriptions-item>
<el-descriptions-item label="身份证号">{{ viewData.idcard }}</el-descriptions-item>
<el-descriptions-item label="获奖名称">{{ viewData.zyhj }}</el-descriptions-item>
<el-descriptions-item label="民族">{{ viewData.nation }}</el-descriptions-item>
<el-descriptions-item label="疗休养身份">{{ viewData.zyhj }}</el-descriptions-item>
<el-descriptions-item label="是否为ABCDE类高层次人才">{{ viewData.talent }}</el-descriptions-item>
<el-descriptions-item label="备注">{{ viewData.bz }}</el-descriptions-item>
</el-descriptions>
</template>
<custom-message @confirm="confirmMsg" ref="customMessage"></custom-message>
@@ -289,7 +205,7 @@ display: -webkit-box;
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
window.location.href = '/platform/zgfw/lxy/hdtj/doExport?hdid=' + this.pageForm.hdid + '&ghid=' + this.pageForm.ghid + '&hdname=' + obj.name
window.open('/platform/zgfw/lxy/hdtj/doExport?hdid=' + this.pageForm.hdid + '&ghid=' + this.pageForm.ghid + '&hdname=' + obj.name)
})
},