commit
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
package io.v.nutz.activity.controller.site;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.activity.services.SiteReserveService;
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.util.ShiroUtil;
|
||||
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;
|
||||
@@ -12,10 +17,18 @@ 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.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @FileName io.v.nutz.activity.controller.site.SiteRecordController
|
||||
* @Description: 预约记录查询
|
||||
@@ -41,7 +54,7 @@ public class SiteRecordController {
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
public Object pageData(String month, String siteType, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
|
||||
public Object pageData(String startTime, String endTime, String siteType, String searchName, String searchKeyword, int pageNumber, int pageSize, String pageOrderName, String pageOrderBy) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
@@ -64,6 +77,9 @@ public class SiteRecordController {
|
||||
$condition
|
||||
""");
|
||||
|
||||
cnd.andEX("reserve_day", ">=", startTime);
|
||||
cnd.andEX("reserve_day", "<=", endTime);
|
||||
|
||||
if (ShiroUtil.hasAnyRoles(new String[]{"gh10"})) {
|
||||
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
|
||||
cnd.and("u.unitid", "=", user.getUnitid());
|
||||
@@ -73,10 +89,6 @@ public class SiteRecordController {
|
||||
cnd.and("asi.typeId", "=", siteType);
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(month)) {
|
||||
cnd.and("left(reserve_day, 7)", "=", month);
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
||||
cnd.where().andLike(searchName, searchKeyword);
|
||||
}
|
||||
@@ -84,7 +96,7 @@ public class SiteRecordController {
|
||||
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderName)) {
|
||||
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
|
||||
} else {
|
||||
cnd.asc("asr.reserve_state").desc("u.unitid");
|
||||
cnd.desc("reserve_day").asc("asi.sortNum");
|
||||
}
|
||||
|
||||
cnd.groupBy("sqid");
|
||||
@@ -93,5 +105,87 @@ public class SiteRecordController {
|
||||
return siteReserveService.listPage(pageNumber, pageSize, sql);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
public void exportExcel(String startTime,
|
||||
String endTime,
|
||||
String siteType,
|
||||
String searchName,
|
||||
String searchKeyword, HttpServletResponse response) throws IOException {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
asr.*,
|
||||
asi.address,
|
||||
asi.`name` site_name,
|
||||
ass.`stateName` state_name,
|
||||
ass.`stateColor` state_color,
|
||||
ass.stateAuditType,
|
||||
count(sqid) days,
|
||||
u.loginname,
|
||||
GROUP_CONCAT(reserve_day order by reserve_day asc) concat_day
|
||||
FROM
|
||||
activity_site_reserve asr
|
||||
LEFT JOIN
|
||||
activity_site_info asi ON asi.id = asr.site_id
|
||||
LEFT JOIN
|
||||
audit_state ass ON ass.stateId = asr.reserve_state
|
||||
LEFT JOIN
|
||||
sys_user u on u.id = asr.reserve_person_id
|
||||
$condition
|
||||
""");
|
||||
|
||||
cnd.andEX("reserve_day", ">=", startTime);
|
||||
cnd.andEX("reserve_day", "<=", endTime);
|
||||
|
||||
if (ShiroUtil.hasAnyRoles(new String[]{"gh10"})) {
|
||||
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
|
||||
cnd.and("u.unitid", "=", user.getUnitid());
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(siteType)) {
|
||||
cnd.and("asi.typeId", "=", siteType);
|
||||
}
|
||||
|
||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
||||
cnd.where().andLike(searchName, searchKeyword);
|
||||
}
|
||||
cnd.desc("reserve_day").asc("asi.sortNum");
|
||||
cnd.groupBy("sqid");
|
||||
|
||||
sql.setCondition(cnd);
|
||||
|
||||
List<NutMap> listMap = siteReserveService.listMap(sql);
|
||||
for (int i = 0; i < listMap.size(); i++) {
|
||||
NutMap nutMap = listMap.get(i);
|
||||
nutMap.put("index", i + 1);
|
||||
if(StrUtil.isBlank(nutMap.getString("auditList"))) {
|
||||
continue;
|
||||
}
|
||||
List<NutMap> auditList = Json.fromJsonAsList(NutMap.class, nutMap.getString("auditList"));
|
||||
if(Lang.isEmpty(auditList)) {
|
||||
continue;
|
||||
}
|
||||
String auditOption = auditList.stream().map(o -> o.getString("auditOption")).collect(Collectors.joining(";"));
|
||||
nutMap.put("auditOpinion", auditOption);
|
||||
}
|
||||
|
||||
Sys_user user = (Sys_user) ShiroUtil.getPrincipal();
|
||||
NutMap resultMap = new NutMap();
|
||||
|
||||
resultMap.put("username", user.getUsername());
|
||||
resultMap.put("mobile", user.getMobile());
|
||||
resultMap.put("date", DateUtil.today());
|
||||
if(StrUtil.isNotBlank(startTime) && StrUtil.isNotBlank(endTime)) {
|
||||
resultMap.put("time", "(统计时间" + startTime + "至" + endTime + ")");
|
||||
}
|
||||
resultMap.put("list", listMap);
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;filename=" + new String(("场地预约名单.xlsx").getBytes("utf-8"), "ISO8859-1"));
|
||||
|
||||
TemplateExportParams params = new TemplateExportParams("templates/site/site.xlsx");
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(params, resultMap);
|
||||
workbook.write(response.getOutputStream());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package io.v.nutz.activity.services;
|
||||
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseService;
|
||||
import io.v.nutz.activity.models.ActivitySiteReserve;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package io.v.nutz.activity.services.impl;
|
||||
|
||||
|
||||
import cn.wizzer.framework.base.service.BaseServiceImpl;
|
||||
import io.v.nutz.activity.models.ActivitySiteInfo;
|
||||
import io.v.nutz.activity.models.ActivitySiteReserve;
|
||||
import io.v.nutz.activity.models.ActivityType;
|
||||
import io.v.nutz.activity.services.SiteReserveService;
|
||||
import io.v.nutz.base.service.impl.BaseServiceImpl;
|
||||
import io.v.nutz.constant.AuditTypeEnum;
|
||||
import io.v.nutz.modules.models.AuditState;
|
||||
import org.nutz.dao.Cnd;
|
||||
|
||||
@@ -81,7 +81,7 @@ public class MsgApi {
|
||||
String content = Http.post(url, bodyMap, Sender.Default_Read_Timeout);
|
||||
NutMap contentMap = Json.fromJson(NutMap.class, content);
|
||||
log.info("成功》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》");
|
||||
log.info(Json.toJson(contentMap));
|
||||
log.info("消息接口响应:"+Json.toJson(contentMap));
|
||||
if (contentMap.getString("rspCode").equals("000000")) {
|
||||
log.info("消息发送,发送内容" + Json.toJson(bodyMap));
|
||||
} else {
|
||||
|
||||
@@ -120,25 +120,27 @@ public class TrainEduVideoController {
|
||||
TrainEduVideo trainEduVideo = Json.fromJson(TrainEduVideo.class, data);
|
||||
|
||||
//有新上传的文件采取删除旧文件
|
||||
if (file != null) {
|
||||
try {
|
||||
DeleteMediaResponse response = TencentVideoService.deleteFile(trainEduVideo.getFileId(), TencentVideoService.subAppId);
|
||||
VodUploadResponse uploadResponse = TencentVideoService.uploadFile(file.getFile(), TencentVideoService.trainEducationClassId);
|
||||
String fileId = uploadResponse.getFileId();
|
||||
String mediaUrl = uploadResponse.getMediaUrl();
|
||||
// if (file != null) {
|
||||
// try {
|
||||
// DeleteMediaResponse response = TencentVideoService.deleteFile(trainEduVideo.getFileId(), TencentVideoService.subAppId);
|
||||
// VodUploadResponse uploadResponse = TencentVideoService.uploadFile(file.getFile(), TencentVideoService.trainEducationClassId);
|
||||
// String fileId = uploadResponse.getFileId();
|
||||
// String mediaUrl = uploadResponse.getMediaUrl();
|
||||
//
|
||||
// trainEduVideo.setFileSize(TencentVideoService.getFileLength(file.getFile()));
|
||||
// trainEduVideo.setFileDuration(TencentVideoService.getFileDuration(file.getFile()));
|
||||
//
|
||||
// trainEduVideo.setMediaUrl(mediaUrl);
|
||||
// trainEduVideo.setFileId(fileId);
|
||||
// dao.updateIgnoreNull(trainEduVideo);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// } else {
|
||||
// dao.updateIgnoreNull(trainEduVideo);
|
||||
// }
|
||||
|
||||
trainEduVideo.setFileSize(TencentVideoService.getFileLength(file.getFile()));
|
||||
trainEduVideo.setFileDuration(TencentVideoService.getFileDuration(file.getFile()));
|
||||
|
||||
trainEduVideo.setMediaUrl(mediaUrl);
|
||||
trainEduVideo.setFileId(fileId);
|
||||
dao.updateIgnoreNull(trainEduVideo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
dao.updateIgnoreNull(trainEduVideo);
|
||||
}
|
||||
dao.updateIgnoreNull(trainEduVideo);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -7,9 +7,16 @@ layout("/layouts/platform.html"){
|
||||
<el-card shadow="never">
|
||||
<div class="btn-group tool-button">
|
||||
<el-date-picker
|
||||
v-model="pageForm.month" clearable value-format="yyyy-MM"
|
||||
type="month"
|
||||
placeholder="选择月">
|
||||
v-model="pageForm.startTime" clearable value-format="yyyy-MM-dd"
|
||||
type="date"
|
||||
placeholder="请选择开始时间">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
<div class="btn-group tool-button">
|
||||
<el-date-picker
|
||||
v-model="pageForm.endTime" clearable value-format="yyyy-MM-dd"
|
||||
type="date"
|
||||
placeholder="请选择结束时间">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
<div class="btn-group tool-button">
|
||||
@@ -35,6 +42,11 @@ layout("/layouts/platform.html"){
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never" class="mt20">
|
||||
<table-tool :app="this" label="申请列表">
|
||||
<template #func>
|
||||
<el-button @click="exportExcel" size="small" type="primary">导出</el-button>
|
||||
</template>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" row-key="id" @sort-change="pageOrder"
|
||||
v-loading="tableLoading">
|
||||
<el-table-column align="center" header-align="center" label="序号" type="index">
|
||||
@@ -141,6 +153,9 @@ layout("/layouts/platform.html"){
|
||||
pageOrderName: "",
|
||||
pageOrderBy: "",
|
||||
isAudit: false,
|
||||
siteType: '',
|
||||
startTime: new Date().getFullYear() + '-01-01',
|
||||
endTime: new Date().getFullYear() + '-12-31',
|
||||
},
|
||||
}
|
||||
},
|
||||
@@ -148,6 +163,15 @@ layout("/layouts/platform.html"){
|
||||
'reserve-info': httpVueLoader('/components/activity/site/ReserveInfo.vue'),
|
||||
},
|
||||
methods: {
|
||||
exportExcel() {
|
||||
window.location.href = "/platform/activity/site/record/exportExcel" +
|
||||
"?startTime=" + this.pageForm.startTime + "" +
|
||||
"&endTime=" + this.pageForm.endTime + "" +
|
||||
"&searchName=" + this.pageForm.searchName + "" +
|
||||
"&searchKeyword=" + this.pageForm.searchKeyword + "" +
|
||||
"&siteType=" + this.pageForm.siteType
|
||||
;
|
||||
},
|
||||
openView(id) {
|
||||
this.$refs.guava.view()
|
||||
this.$refs.reserve.openView(id)
|
||||
|
||||
@@ -257,7 +257,9 @@ layout("/layouts/platform.html"){
|
||||
title: null,
|
||||
sortNo: null,
|
||||
disabled: false,
|
||||
url: null
|
||||
url: null,
|
||||
endDate: null,
|
||||
startDate: null
|
||||
},
|
||||
tableColumns: [
|
||||
{prop: 'title', label: '标题'},
|
||||
@@ -300,12 +302,15 @@ layout("/layouts/platform.html"){
|
||||
},
|
||||
openAdd() {
|
||||
this.$refs['guava'].edit()
|
||||
if (this.$refs.uploadForm) {
|
||||
this.$refs.uploadForm.clean()
|
||||
}
|
||||
this.$refs['ruleForm'].resetFields()
|
||||
this.formData.id = undefined
|
||||
this.formData.albumId = this.pageForm.albumId
|
||||
|
||||
|
||||
|
||||
// if (this.$refs.uploadForm) {
|
||||
// this.$refs.uploadForm.clean()
|
||||
// }
|
||||
// this.$refs['ruleForm'].resetFields()
|
||||
// this.formData.id = undefined
|
||||
// this.formData.albumId = this.pageForm.albumId
|
||||
|
||||
},
|
||||
selectFile(preUploadFiles) {
|
||||
|
||||
Reference in New Issue
Block a user