This commit is contained in:
Paidax
2024-08-02 16:07:40 +08:00
parent eed2d41b09
commit efdedc3405
7 changed files with 274 additions and 13 deletions
@@ -0,0 +1,66 @@
package io.v.nutz.wakershome.controller.declaration;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.dao.CndPlus;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.util.ShiroUtil;
import io.v.nutz.wakershome.service.IWakesHomeApplyService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
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 org.nutz.mvc.annotation.Param;
/**
* @version 1.0
* @Author zzr
* @name:WakesHomeDeclarationStatisticsController
* @Date 2024/8/2 15:00
* @注释 申报,查询统计
*/
@IocBean
@Ok("json:full")
@At("/platform/wakeshome/declaration/statistics")
public class WakesHomeDeclarationStatisticsController {
@Inject
private IWakesHomeApplyService wakesHomeApplyService;
@At("")
@Ok("beetl:/platform/wakeshome/declaration/statistics.html")
@RequiresPermissions("wakeshome.declaration.statistics")
public void index() {}
@At
@ViReturn
@RequiresPermissions("wakeshome.declaration.statistics")
public Object pageData(PageForm pageForm,
@Param(value = "year", required = false) Integer year,
@Param(value = "unionId", required = false) String unionId){
Sql sql = Sqls.create("""
SELECT
wh.*,
audit.stateName
FROM
`wakes_home_apply` wh
LEFT JOIN audit_state audit ON wh.state = audit.stateId
AND audit.module = 'WakesHome'
$condition
""");
CndPlus cnd = CndPlus.create();
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
cnd.and("wh.unionId", "=", Vi.getUnionId());
} else {
cnd.andEX("wh.unionId", "=", unionId);
}
cnd.andEX("YEAR(wh.applyDate)", "=", year);
cnd.and("wh.state", "=" , 10030);
sql.setCondition(cnd);
return wakesHomeApplyService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
}
@@ -2,7 +2,10 @@ package io.v.nutz.wakershome.controller.review;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.util.ShiroUtil;
import io.v.nutz.wakershome.model.review.CommentZb;
import io.v.nutz.wakershome.service.review.CommentPeoService;
import io.v.nutz.wakershome.service.review.CommentZbService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
@@ -12,6 +15,7 @@ import org.nutz.dao.sql.Sql;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
@@ -39,7 +43,6 @@ public class StatisticsZpController {
@Ok("beetl:/platform/wakeshome/review/statistics.html")
@RequiresPermissions("wakeshome.review.statistics")
public void index() {
}
@At
@@ -48,6 +51,8 @@ public class StatisticsZpController {
public Object pageData(PageForm page,
@Param(value = "zbId", required = false) String zbId,
@Param(value = "unionId", required = false) String unionId) {
CommentZb zb = commentPeoService.dao().fetch(CommentZb.class, Cnd.where("id", "=", zbId));
Sql sql = Sqls.create("""
SELECT
un.id,
@@ -60,7 +65,16 @@ public class StatisticsZpController {
$condition
""").setParam("zbId", zbId);
Cnd cnd = Cnd.NEW();
cnd.andEX("un.id", "=", unionId);
if (Lang.isNotEmpty(zb.getUnionIds())) {
cnd.and("un.id", "in", zb.getUnionIds());
} else {
if (ShiroUtil.hasAnyRoles("sysadmin,A06")) {
cnd.andEX("un.id", "=", unionId);
} else {
cnd.and("un.id", "=", Vi.getUnionId());
}
}
cnd.groupBy("un.id");
cnd.desc("count( peo.id )");
@@ -1,22 +1,30 @@
package io.v.nutz.wakershome.controller.review;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import cn.wizzer.framework.page.Pagination;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.sys.models.Sys_union;
import io.v.nutz.wakershome.model.review.CommentPeo;
import io.v.nutz.wakershome.service.review.CommentZbService;
import io.v.nutz.web.commons.utils.ShiroUtil;
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.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.List;
import java.util.stream.Collectors;
/**
* @version 1.0
* @Author zzr
@@ -34,13 +42,13 @@ public class WakesHomeReviewController {
@At("")
@Ok("beetl:/platform/wakeshome/review/doReview.html")
// @RequiresPermissions("wakeshome.review.doReview")
@RequiresPermissions("wakeshome.review.doReview")
public void index() {
}
@At
@ViReturn
// @RequiresPermissions("wakeshome.review.doReview")
@RequiresPermissions("wakeshome.review.doReview")
public Object pageData(PageForm pageForm,
@Param(value = "annual", required = false) String annual,
@Param(value = "assessment", required = false) String assessment){
@@ -62,13 +70,41 @@ public class WakesHomeReviewController {
cnd.desc("zb.annual");
}
sql.setCondition(cnd);
return commentZbService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
Pagination pagination = commentZbService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
List<NutMap> list = pagination.getList();
List<Sys_union> unionList = commentZbService.dao().query(Sys_union.class, Cnd.NEW());
list.forEach(v -> {
//自评模式
boolean reviewMode = v.getInt("reviewMode") == 1;
if (reviewMode && v.getInt("commentTarget") == 1) {
//校工会自评,判断有没有校工会管理员的权限
v.put("canJoin", ShiroUtil.hasRole("A06"));
} else if (reviewMode && v.getInt("commentTarget") == 2){
//分工会自评,判断有没有分工会管理员
v.put("canJoin", ShiroUtil.hasRole("H04"));
}
//自选分工会的模式
if (StrUtil.isNotBlank(v.getString("unionIds"))) {
List<String> unionIdList = JSONUtil.parseArray(v.getString("unionIds")).toList(String.class);
String string = unionList.stream().filter(item -> unionIdList.contains(item.getId()))
.map(Sys_union::getUnionname).collect(Collectors.joining(","));
v.put("unionNames", string);
//如果是自评,只有分工会主席才能自评
if (reviewMode) {
v.put("canJoin", (unionIdList.contains(Vi.getUnionId()) && ShiroUtil.hasRole("H04")));
} else {
v.put("canJoin", unionIdList.contains(Vi.getUnionId()));
}
}
});
return pagination;
}
@At
@ViReturn
// @RequiresPermissions("wakeshome.review.doReview")
@RequiresPermissions("wakeshome.review.doReview")
public Object getPeoId(String id){
CommentPeo peo = commentZbService.dao().fetch(CommentPeo.class, Cnd.where("zbId", "=", id).and("userId", "=", ShiroUtil.getUserId()));
return peo.getId();
@@ -126,6 +126,7 @@
<el-col :span="8">
<el-form-item prop="unionIds" label="自选分工会" class="is-required">
<el-select v-model="data.unionIds" style="width: 100%"
:disabled="is_view"
multiple clearable filterable
placeholder="请选择分工会">
<el-option
@@ -146,6 +147,7 @@
range-separator="-"
start-placeholder="开始时间"
style="width: 100%"
:disabled="is_view"
type="datetimerange"
v-model="data.applyTime"
value-format="yyyy-MM-dd HH:mm:ss">
@@ -0,0 +1,143 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-clock>
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">年度:</div>
<div class="search-item-option">
<el-date-picker
v-model="pageForm.year"
value-format="yyyy"
formData="yyyy"
type="year"
@change="doSearch"
style="width: 100%"
placeholder="请选择年度">
</el-date-picker>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select placeholder="所属工会" v-model="pageForm.unionId"
style="width: 100%;"
clearable="true"
@change="doSearch"
filterable="true">
<el-option v-for="item in unions" :label="item.unionname"
:value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-query">
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索
</el-button>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<table-tool label="申报列表" :app="this">
<template #func>
</template>
</table-tool>
<el-table ref="table" :data="tableData" style="width: 100%" row-key="id"
@sort-change="pageOrder"
v-loading="tableLoading" :size="tableSize" class="vi-table">
<el-table-column align="center" header-align="center" type="index"
:index="indexMethod" label="序号"
width="80px"></el-table-column>
<el-table-column
align="center"
header-align="center"
v-for="column in tableColumns"
show-overflow-tooltip
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
>
<template scope="{row}" v-if="column.prop === 'applyDate'">
<span>{{ moment(row.applyDate).format('YYYY年MM月DD日') }}</span>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="操作" fixed="right" width="250px">
<template scope="{row}">
<el-button @click="openView(row)" size="mini" type="primary">查看</el-button>
<el-button @click="openExport(row.id)" size="mini" type="primary">导出申报表</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template #view>
<wakes-info-apply ref="viewInfo"></wakes-info-apply>
</template>
</guava>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data: {
id:'',
unions:[],
pageForm:{
isAudit:false,
year: moment().format('YYYY'),
},
tableColumns: [
{prop: 'unionName', label: '申报工会', sortable: true},
{prop: 'username', label: '申报人', sortable: true},
{prop: 'loginName', label: '申报人工号', sortable: true},
{prop: 'mobile', label: '联系方式', sortable: true},
// {prop: 'basicInformation', label: '基本情况简介', sortable: true},
{prop: 'applyDate', label: '申报日期', sortable: true},
{prop: 'stateName', label: '审核状态', sortable: true},
],
formRules: {
auditSign: [{required: true, message: '必填', trigger: ['blur', 'change']}],
auditOpinion: [{required: true, message: '必填', trigger: ['blur', 'change']}],
},
},
components: {
'wakes-info-apply': httpVueLoader('/components/wakeshome/declaration/WakesHomeInfoApply.vue')
},
methods: {
openExport(id) {
window.open("/platform/wakeshome/declaration/mine/openExport?id=" + id)
},
openView(row){
this.$refs.guava.view()
this.$refs.viewInfo.openView(row.id)
},
async flushUnits() {
this.$set(this.pageForm, "unitId", null)
this.units = []
if (this.pageForm.unionId) {
this.units = await getUnits(this.pageForm.unionId)
}
},
},
async created(){
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') {
this.unions = await getUnions(null, false)
} else {
this.unions = await getUnions(null, true)
this.$set(this.pageForm, 'unionId', this.unions ? this.unions[0].id : null)
this.flushUnits()
}
this.pageData();
}
})
</script>
<!--#
}
#-->
@@ -32,6 +32,7 @@ layout("/layouts/platform.html"){
:picker-options="pickerOptions"
v-model="pageForm.annual"
type="year"
style="width: 100%"
value-format="yyyy"
placeholder="选择年度">
</el-date-picker>
@@ -357,9 +358,10 @@ layout("/layouts/platform.html"){
async openView(id) {
this.$refs.guava.view()
this.loading = true;
const {code, data, msg} = await $.get(loc() + '/edit', {id})
const {code, data, msg} = await $.get('/platform/wakeshome/review/khzb/edit', {id})
if (code === 0) {
this.viewData = data
this.viewData.applyTime = [this.viewData.startTime,this.viewData.endTime]
}
this.loading = false;
},
@@ -79,12 +79,11 @@ layout("/layouts/platform.html"){
:prop="column.prop" :width="column.width" min-width="100px">
</el-table-column>
<el-table-column prop="userOnline" align="center" header-align="center" label="操作"
width="100px"
width="200px"
fixed="right">
<template scope="{row}">
<el-button plain size="mini" @click="openView(row)">
查看
</el-button>
<el-button size="mini" @click="openView(row)">查看</el-button>
<el-button v-if="canDownload()" size="mini" type="primary" @click="openView(row)">查看</el-button>
</template>
</el-table-column>
</el-table>
@@ -309,7 +308,6 @@ layout("/layouts/platform.html"){
}
this.doSearch()
},
},
async created() {
await this.getZbList()