This commit is contained in:
Paidax
2024-10-11 16:22:21 +08:00
parent b5f156e3ab
commit dbdf74e628
8 changed files with 167 additions and 16 deletions
@@ -9,6 +9,7 @@ import io.v.nutz.base.utils.Roles;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.sys.models.Sys_file;
import io.v.nutz.sys.models.Sys_union;
import io.v.nutz.sys.models.Sys_user_role;
import io.v.nutz.sys.models.User;
import io.v.nutz.wakershome.model.WakesHomeDataRevel;
@@ -31,6 +32,8 @@ import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@@ -71,7 +74,7 @@ public class WakesHomeDataRevelController {
Sql sql = Sqls.create("""
select
un.*,
(select count(*) from wakes_home_data_revel whdr where whdr.unionId = un.id $revelCount) as revelCount
(select count(*) from wakes_home_data_revel whdr where whdr.belongToUnionId = un.id $revelCount) as revelCount
from
sys_union un
$condition
@@ -142,7 +145,7 @@ public class WakesHomeDataRevelController {
@At
@ViReturn
// @RequiresPermissions("wakeshome.data.revel")
@RequiresPermissions("wakeshome.data.revel")
public Object doAdd(WakesHomeDataRevel wakesHomeDataRevel) {
User user = dao.fetch(User.class, Cnd.where("id", "=", ShiroUtil.getUserId()));
wakesHomeDataRevel.setId(R.UU32());
@@ -154,6 +157,13 @@ public class WakesHomeDataRevelController {
wakesHomeDataRevel.setUnionId(user.getUnionid());
wakesHomeDataRevel.setUnionName(user.getUnionname());
wakesHomeDataRevel.setTime(DateUtil.now());
if (StrUtil.isNotBlank(wakesHomeDataRevel.getBelongToUnionId())) {
Sys_union union = dao.fetch(Sys_union.class, wakesHomeDataRevel.getBelongToUnionId());
wakesHomeDataRevel.setBelongToUnionName(union.getUnionname());
} else {
wakesHomeDataRevel.setBelongToUnionId(user.getUnionid());
wakesHomeDataRevel.setBelongToUnionName(user.getUnionname());
}
dao.fastInsert(wakesHomeDataRevel);
return null;
}
@@ -161,7 +171,7 @@ public class WakesHomeDataRevelController {
@At
@ViReturn
// @RequiresPermissions("wakeshome.data.revel")
@RequiresPermissions("wakeshome.data.revel")
public Object doEdit(WakesHomeDataRevel wakesHomeDataRevel) {
dao.update(wakesHomeDataRevel);
return null;
@@ -171,7 +181,7 @@ public class WakesHomeDataRevelController {
@At
@ViReturn
@Aop(TransAop.READ_COMMITTED)
// @RequiresPermissions("wakeshome.data.revel")
@RequiresPermissions("wakeshome.data.revel")
public Object doDelete(String id) {
WakesHomeDataRevel revel = dao.fetch(WakesHomeDataRevel.class, id);
if (revel != null) {
@@ -183,4 +193,23 @@ public class WakesHomeDataRevelController {
}
return null;
}
@At
@Ok("void")
@RequiresPermissions("wakeshome.data.revel")
public void exportAllFileByUnionId(String unionId, String unionName, HttpServletResponse response) {
response.reset();
response.setContentType("application/x-msdownload;charset=utf-8");
/**
* 创建临时文件夹
*/
String tmpPath = "tmp/" + R.UU32();
File tmpDir = new File(tmpPath + "/" + unionName + "附件汇总");
tmpDir.mkdirs();
List<WakesHomeDataRevel> query = dao.query(WakesHomeDataRevel.class, Cnd.where("belongToUnionId", "=", unionId));
}
}
@@ -2,10 +2,13 @@ package io.v.nutz.wakershome.controller.declaration;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.wakershome.model.WakesHomeApply;
import io.v.nutz.wakershome.service.IWakesHomeApplyService;
import io.v.nutz.web.commons.utils.ShiroUtil;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.random.R;
@@ -77,4 +80,11 @@ public class WakesHomeDeclarationApplyController {
return wakesHomeApplyService.findById(id);
}
@At
@ViReturn
@RequiresPermissions("wakeshome.declaration.apply")
public Object getWakesHomeUnitInfo() {
return wakesHomeApplyService.fetch(Cnd.where("unionId", "=", Vi.getUnionId()));
}
}
@@ -1,12 +1,14 @@
package io.v.nutz.wakershome.model;
import io.v.nutz.base.model.BaseModel;
import io.v.nutz.sys.models.Sys_file;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable;
import java.util.List;
/**
* @version 1.0
@@ -100,4 +102,29 @@ public class WakesHomeApply extends BaseModel implements Serializable {
@Comment("申报时间")
@ColDefine(type = ColType.DATE)
private String applyDate;
@Column
@Comment("创办时间")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String foundTime;
@Column
@Comment("单位位置")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String position;
@Column
@Comment("单位面积")
@ColDefine(type = ColType.VARCHAR, width = 10)
private String area;
@Column
@Comment("单位信息")
@ColDefine(type = ColType.TEXT)
private String details;
@Column
@Comment("附件")
@ColDefine(type = ColType.MYSQL_JSON)
private List<Sys_file> files;
}
@@ -68,6 +68,16 @@ public class WakesHomeDataRevel extends BaseModel {
@ColDefine(type = ColType.VARCHAR, width = 100)
private String unionName;
@Column
@Comment("资料归属分工会id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String belongToUnionId;
@Column
@Comment("资料归属分工会名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String belongToUnionName;
@Column
@Comment("上传时间")
@ColDefine(type = ColType.VARCHAR, width = 20)
@@ -79,7 +79,11 @@ layout("/layouts/platform.html"){
</div>
</el-card>
<el-card shadow="never" style="margin:10px 10px 0 10px">
<vi-title2 title="资料列表"></vi-title2>
<table-tool :label="( checkData.unionname ? checkData.unionname : '全部分工会' ) + '资料列表'" :app="this">
<template #func>
<el-button v-if="checkData.unionname" type="primary" size="small" @click="exportAllFileByUnionId">导出全部资料</el-button>
</template>
</table-tool>
<el-table :data="tableData" @sort-change='pageOrder' height="626">
<el-table-column label="序号" type="index" header-align="center" align="center">
<template scope="scope"><span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span></template>
@@ -87,7 +91,8 @@ layout("/layouts/platform.html"){
<el-table-column prop="revelName" label="资料名称"></el-table-column>
<el-table-column sortable prop="typeName" label="资料类型"></el-table-column>
<el-table-column sortable prop="username" label="上传人"></el-table-column>
<el-table-column sortable prop="unionName" label="工会"></el-table-column>
<el-table-column sortable prop="unionName" label="上传人工会"></el-table-column>
<el-table-column sortable prop="belongToUnionName" label="资料归属工会"></el-table-column>
<el-table-column sortable prop="time" label="上传时间"></el-table-column>
<el-table-column prop="userOnline" label="操作" width="100px">
<template slot-scope="scope">
@@ -135,6 +140,9 @@ layout("/layouts/platform.html"){
<el-form-item label="上传人">
<el-input readonly value="${@shiro.getPrincipalProperty('username')}"></el-input>
</el-form-item>
<el-form-item label="所属工会">
<el-input readonly :value="checkData.unionname ? checkData.unionname : '${@shiro.getPrincipalProperty('union').getUnionname()}'"></el-input>
</el-form-item>
<el-form-item prop="revelName" label="资料名称">
<el-input placeholder="请填写工作资料名称" v-model="formData.revelName"></el-input>
</el-form-item>
@@ -149,7 +157,12 @@ layout("/layouts/platform.html"){
</el-select>
</el-form-item>
<el-form-item prop="files" label="附件上传">
<file-upload :files.sync="formData.files"></file-upload>
<file-upload :files.sync="formData.files" card
:type="['doc','docx','xls','xlsx','pdf','ppt', 'jpg', 'png', 'jpeg']">
<template #el-upload__tip>
</template>
</file-upload>
<div class="el-upload__tip">可上传照片、文档等资料</div>
</el-form-item>
</el-form>
</el-form>
@@ -221,7 +234,6 @@ layout("/layouts/platform.html"){
</span>
</el-dialog>
</div>
<script>
@@ -270,6 +282,13 @@ layout("/layouts/platform.html"){
}
},
methods: {
exportAllFileByUnionId() {
const unionId = this.checkData.id
const unionName = this.checkData.unionname
const url = '/platform/wakeshome/data/revel/exportAllFileByUnionId?unionId=' + unionId + '&unionName=' + unionName
window.open(url)
},
},
async handleNodeClick(data, node) {
this.checkData = data
this.checkNode = node
@@ -388,6 +407,9 @@ layout("/layouts/platform.html"){
spinner: 'el-icon-loading',
background: COVER_LAYER_COLOR
});
if (this.checkData.id) {
this.formData.belongToUnionId = this.checkData.id
}
const resp = await $.post('/platform/wakeshome/data/revel/doAdd', formData)
loading.close()
if (resp.code === 0) {
@@ -56,11 +56,44 @@ layout("/layouts/platform.html"){
<el-input readonly v-model="formData.unionName"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="创办时间" prop="foundTime">
<el-date-picker
v-model="formData.foundTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择创办日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="填报时间" prop="applyTime">
<el-input readonly v-model="formData.applyDate"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="单位位置" prop="position">
<el-input placeholder="请填写单位位置" v-model="formData.position"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="单位面积" prop="area">
<el-input placeholder="请填写单位面积" v-model="formData.area"></el-input>
</el-form-item>
</el-col>
<el-col :lg="24" :sm="24">
<el-form-item label="单位信息" prop="details">
<el-input type="textarea" :rows="4"
placeholder="请填写单位信息"
v-model="formData.details"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
@@ -80,6 +113,15 @@ layout("/layouts/platform.html"){
<el-form-item label="教工小家建设方案" prop="constructionPlan">
<text-editor v-model="formData.constructionPlan"></text-editor>
</el-form-item>
<el-form-item required label="文档上传" prop="files">
<file-upload :files.sync="formData.files" card :max="10"
:type="['doc','docx','xls','xlsx','pdf','ppt', 'jpg', 'png', 'jpeg']">
<template #el-upload__tip>
</template>
</file-upload>
<div class="el-upload__tip">请上传党组织盖章文档</div>
</el-form-item>
</el-form>
<el-row class="mt10" justify="center" type="flex">
@@ -45,7 +45,7 @@ layout("/layouts/platform.html"){
<el-col :lg="8" :sm="24">
<el-form-item label="联系方式" prop="mobile">
<el-input v-model="formData.mobile"></el-input>
<el-input v-model="formData.mobile" placeholder="请填写联系方式" maxlength="18"></el-input>
</el-form-item>
</el-col>
@@ -224,6 +224,7 @@ layout("/layouts/platform.html"){
id: '',
formRules: {
position: [{required: true, message: '必填', trigger: ['blur', 'change']}],
mobile: [{required: true, message: '必填', trigger: ['blur', 'change']}],
picFiles: [{required: true, message: '必填', trigger: ['blur', 'change']}],
files: [{required: true, message: '必填', trigger: ['blur', 'change']}],
},
@@ -238,9 +239,9 @@ layout("/layouts/platform.html"){
async doSave() {
let postUrl = ''
if (this.formData.id) {
postUrl = loc()+'/doEdit'
postUrl = loc() + '/doEdit'
} else {
postUrl = loc()+'/doAdd'
postUrl = loc() + '/doAdd'
}
const formData = this.doJsonStr(this.formData)
formData.isSubmit = false;
@@ -260,9 +261,9 @@ layout("/layouts/platform.html"){
if (valid) {
let postUrl = ''
if (this.formData.id) {
postUrl = loc()+'/doEdit'
postUrl = loc() + '/doEdit'
} else {
postUrl = loc()+'/doAdd'
postUrl = loc() + '/doAdd'
}
const formData = this.doJsonStr(this.formData)
formData.isSubmit = true
@@ -296,8 +297,8 @@ layout("/layouts/platform.html"){
this.$set(this.formData, 'applyTime', moment().format('YYYY-MM-DD'))
this.$set(this.formData, 'unionName', "${@shiro.getPrincipalProperty('union').getUnionname()}")
} else {
const resp = await $.get('/platform/wakeshome/info/mine/getInfoById',{id:this.id})
if (resp.code === 0){
const resp = await $.get('/platform/wakeshome/info/mine/getInfoById', {id: this.id})
if (resp.code === 0) {
this.formData = {...resp.data}
}
}
@@ -309,10 +310,11 @@ layout("/layouts/platform.html"){
formData.files = JSON.stringify(this.formData.files)
return formData;
},
async validateApply(){
async validateApply() {
const resp = await $.get(loc() + '/validateApply')
if (resp.code === 0) {
this.disabled = true
await this.getWakesHomeUnitInfo()
} else {
this.disabled = false
this.$confirm('未获取到单位的建家申报记录,是否前往申报?', '提示', {
@@ -325,6 +327,15 @@ layout("/layouts/platform.html"){
}, 500)
})
}
},
async getWakesHomeUnitInfo() {
const resp = await $.get('/platform/wakeshome/declaration/apply/getWakesHomeUnitInfo')
if (resp.code === 0 && resp.data) {
this.$set(this.formData, 'foundTime', resp.data.foundTime)
this.$set(this.formData, 'position', resp.data.position)
this.$set(this.formData, 'area', resp.data.area)
this.$set(this.formData, 'details', resp.data.details)
}
}
},
async created() {