commit
This commit is contained in:
@@ -264,75 +264,54 @@ public class SysHomeController {
|
||||
// @CacheResult(cacheKey = "news", ignoreNull = true, cacheLiveTime = 60 * 60 * 24)
|
||||
public Result getNews() {
|
||||
// 定义要爬取的URL
|
||||
String domain = "https://www.jshvc.edu.cn/gh/main.psp";
|
||||
String domain = "https://gh.ysu.edu.cn/";
|
||||
try {
|
||||
// 使用Jsoup连接到URL并获取页面内容
|
||||
Document doc = Jsoup.connect(domain).get();
|
||||
|
||||
JSONObject root = new JSONObject();
|
||||
|
||||
// 1. 新闻快讯(来自 .list1)
|
||||
List<JSONObject> newsArray = new ArrayList<>();
|
||||
Elements newsItems = doc.select(".post .post1 .post-15 .mbox");
|
||||
Elements newsItems = doc.select(".home3-t li");
|
||||
for (Element item : newsItems) {
|
||||
String date = item.select(".date").text().trim();
|
||||
Element link = item.select("a.text").first();
|
||||
String title = link.select(".title").text().trim();
|
||||
JSONObject node = new JSONObject();
|
||||
|
||||
Element pElement = item.select("p").first();
|
||||
String date = pElement.text().trim();
|
||||
|
||||
Element link = item.select("a").first();
|
||||
String title = link.attr("title").trim();
|
||||
String url = link.attr("href").trim();
|
||||
|
||||
JSONObject node = new JSONObject();
|
||||
Element imgElement = link.select(".imged").first();
|
||||
if (imgElement != null) {
|
||||
// 获取style属性值
|
||||
String style = imgElement.attr("style");
|
||||
// 解析style以获取背景图片URL
|
||||
String imageUrl = parseBackgroundImageUrl(style);
|
||||
node.set("image", domain + imageUrl);
|
||||
}
|
||||
node.set("title", title);
|
||||
node.set("date", date);
|
||||
node.set("url", domain + url);
|
||||
newsArray.add(node);
|
||||
}
|
||||
root.set("news", newsArray);
|
||||
|
||||
// 2. 通知公告(来自 .list2)
|
||||
List<JSONObject> noticesArray = new ArrayList<>();
|
||||
Elements noticeItems = doc.select(".group2 .list2 li");
|
||||
for (Element item : noticeItems) {
|
||||
String date = item.select(".date").text().trim();
|
||||
Element link = item.select("a.title").first();
|
||||
String title = link.text().trim();
|
||||
String url = link.attr("href").trim();
|
||||
JSONObject node = new JSONObject();
|
||||
node.set("title", title);
|
||||
node.set("date", date);
|
||||
node.set("url", domain + url);
|
||||
noticesArray.add(node);
|
||||
}
|
||||
root.set("notices", noticesArray);
|
||||
|
||||
// 3. 基层风采(来自 .pic-list1)
|
||||
List<JSONObject> grassrootsArray = new ArrayList<>();
|
||||
Elements grassrootsItems = doc.select(".post-15 .news_list li");
|
||||
for (Element item : grassrootsItems) {
|
||||
Element link = item.select(".nr").first();
|
||||
String date = link.select(".date").text().trim();
|
||||
String title = link.select(".news_title a").text().trim();
|
||||
String url = link.select(".news_title a").attr("href").trim();
|
||||
String summary = link.select(".news_text a").text().trim();
|
||||
|
||||
String imageUrl = "";
|
||||
Element img = link.select(".news_imgs").first();
|
||||
if (img != null) {
|
||||
imageUrl = img.attr("src").trim();
|
||||
}
|
||||
|
||||
JSONObject node = new JSONObject();
|
||||
node.set("title", title);
|
||||
node.set("date", date);
|
||||
node.set("url", domain + url);
|
||||
node.set("summary", summary);
|
||||
node.set("image", StrUtil.isNotBlank(imageUrl) ? (domain + imageUrl) : "");
|
||||
grassrootsArray.add(node);
|
||||
}
|
||||
root.set("grassroots", grassrootsArray);
|
||||
return Result.success(root);
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
|
||||
private static String parseBackgroundImageUrl(String style) {
|
||||
String[] styleParts = style.split(" ");
|
||||
for (String part : styleParts) {
|
||||
if (part.startsWith("url(")) {
|
||||
// 去除url( 和 )
|
||||
return part.substring(4, part.length() - 1).replace("\"", "");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -429,8 +429,8 @@ public class SysUnionController {
|
||||
@ApiOperation("分工会组成单位穿梭框数据")
|
||||
@SaCheckPermission("sys.manager.union.partUnit")
|
||||
public Result branchUnionPartUnitTransferData(String unionId) {
|
||||
// List<Sys_unit> units = dao.query(Sys_unit.class, Cnd.where("unitLevel", "=", 2).asc("unitcode"));
|
||||
List<Sys_unit> units = dao.query(Sys_unit.class, Cnd.where("unitTypeCode", "=", "1").asc("unitcode"));
|
||||
List<Sys_unit> units = dao.query(Sys_unit.class, Cnd.where("unitLevel", "=", 2).asc("unitcode"));
|
||||
//List<Sys_unit> units = dao.query(Sys_unit.class, Cnd.where("unitTypeCode", "=", "1").asc("unitcode"));
|
||||
List<String> selectUnitIds = units.stream().filter(unit -> StrUtil.isNotBlank(unit.getUnionId()) && unit.getUnionId().equals(unionId)).map(Sys_unit::getId).toList();
|
||||
List<Sys_unit> matchUnits = units.stream().filter(unit -> StrUtil.isBlank(unit.getUnionId()) || (StrUtil.isNotBlank(unit.getUnionId()) && unit.getUnionId().equals(unionId))).toList();
|
||||
NutMap transferData = NutMap.NEW().addv("selectUnitIds", selectUnitIds).addv("allUnits", matchUnits);
|
||||
|
||||
@@ -315,6 +315,8 @@ public class SysUnitController {
|
||||
|
||||
return Result.success(treeList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,8 +79,8 @@ public class SysDataUnitPullServiceImpl extends BaseServiceImpl<Sys_unit> implem
|
||||
Sys_unit unit = DataCenterUtil.mapJsonToBean(jsonRow, Sys_unit.class, api2db);
|
||||
unit.setUnitcode(unit.getId());
|
||||
unit.setUnitTypeCode(1);
|
||||
unit.setParentId("0000");
|
||||
unit.setUnitLevel(2);
|
||||
unit.setParentId(StrUtil.isNotBlank(row.getString("SJDWMCDM")) ? row.getString("SJDWMCDM") : "0000");
|
||||
unit.setUnitLevel(row.getInt("DWDJ") + 1);
|
||||
|
||||
if (unitIds.contains(unit.getId())) {
|
||||
// 存在则更新
|
||||
|
||||
+54
@@ -1,25 +1,35 @@
|
||||
package com.budwk.app.zhgh.dayofficework.ghkh.controller;
|
||||
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.CommonDownloadUtil;
|
||||
import com.budwk.app.zhgh.dayofficework.ghkh.model.ExamConfig;
|
||||
import com.budwk.app.zhgh.dayofficework.ghkh.model.Kh_record;
|
||||
import com.budwk.app.zhgh.dayofficework.ghkh.model.Kh_zb;
|
||||
import com.budwk.app.zhgh.dayofficework.ghkh.service.KhXghshService;
|
||||
import com.budwk.app.zhgh.dayofficework.ghkh.service.KhZbService;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
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.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -93,4 +103,48 @@ public class GhkhKhphController {
|
||||
khZbService.dao().update(list);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
public void downloadList(Integer annual, String khid, HttpServletResponse response) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT zb.annual,zb.assessment,un.unionname,re.* FROM `kh_record` re
|
||||
LEFT JOIN `vw_user` un ON re.union_id = un.unionId
|
||||
LEFT JOIN kh_zb zb ON zb.id = re.zb_id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("re.zb_id ", "=", khid);
|
||||
cnd.and("re.state", "=", 3);
|
||||
cnd.andEX("zb.`annual`","=",annual);
|
||||
cnd.desc("re.totalScore");
|
||||
cnd.groupBy("re.union_id");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> listMap = khXghshService.listMap(sql);
|
||||
|
||||
for (int i = 0; i < listMap.size(); i++) {
|
||||
listMap.get(i).put("index", i + 1);
|
||||
}
|
||||
|
||||
ExamConfig config = khZbService.dao().fetch(ExamConfig.class, Cnd.NEW());
|
||||
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("序号", "index", 10));
|
||||
exportEntities.add(new ExcelExportEntity("年度", "annual", 10));
|
||||
exportEntities.add(new ExcelExportEntity("分工会名称", "unionname", 30));
|
||||
exportEntities.add(new ExcelExportEntity("线上得分", "xgh_score", 20));
|
||||
exportEntities.add(new ExcelExportEntity("线上最终得分" + (config.getOnLine() != null ? "(" + config.getOnLine() + "%)" : ""), "onLineFinalScore", 20));
|
||||
exportEntities.add(new ExcelExportEntity("线下得分", "offLineScore", 20));
|
||||
exportEntities.add(new ExcelExportEntity("线下最终得分" + (config.getOffLine() != null ? "(" + config.getOffLine() + "%)" : ""), "offLineFinalScore", 20));
|
||||
exportEntities.add(new ExcelExportEntity("最终考核得分", "totalScore", 20));
|
||||
exportEntities.add(new ExcelExportEntity("排名", "sort", 20));
|
||||
try {
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, listMap);
|
||||
CommonDownloadUtil.download("得分列表.xlsx", workbook, response);
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1" />
|
||||
<meta name="description" content="${AppName!}" />
|
||||
<meta name="referrer" content="no-referrer">
|
||||
<title>${AppName!}</title>
|
||||
<meta charset="UTF-8" />
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ layout("/layouts/v4/baseLayout.html"){
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<jcdt :list="websiteNews.grassroots"></jcdt>
|
||||
<jcdt :list="websiteNews.news"></jcdt>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -14,11 +14,11 @@ const jcdt = {
|
||||
<div class="title">{{item.title}}</div>
|
||||
</div>
|
||||
|
||||
<!--<div class="image">
|
||||
<div class="image">
|
||||
<img v-if="item.image" :src="item.image" alt="">
|
||||
<img v-else src="/assets/platform/img/v4/not-image.png" alt="">
|
||||
</div>-->
|
||||
<!-- <div class="summary">{{item.summary}}</div>-->
|
||||
</div>
|
||||
<div class="summary">{{item.summary}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -17,7 +17,6 @@ layout("/layouts/platform.html"){
|
||||
label: 'name'
|
||||
}"
|
||||
node-key="id"
|
||||
default-expand-all
|
||||
@node-click="treeNodeClick"
|
||||
:filter-node-method="filterNode"
|
||||
highlight-current
|
||||
|
||||
@@ -27,7 +27,9 @@ layout("/layouts/platform.html"){
|
||||
</search>
|
||||
</el-card>
|
||||
<el-card shadow="never" class="mt20">
|
||||
<table-tool label="得分列表"></table-tool>
|
||||
<table-tool label="得分列表">
|
||||
<el-button @click="onExport" icon="el-icon-download" size="small" type="primary">导出</el-button>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" style="width: 100%" row-key="record_id"
|
||||
v-loading="tabLoading">
|
||||
<el-table-column align="center" header-align="center" label="序号" width="100px">
|
||||
@@ -110,6 +112,9 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onExport() {
|
||||
this.$downLoad('/platform/ghkh/khph/downloadList', this.pageForm)
|
||||
},
|
||||
async openEdit(row) {
|
||||
this.rowDataEdit = !this.rowDataEdit
|
||||
const res = await $.post(loc() + "/doEditScore", {id: row.record_id, score: row.offLineScore, khId: this.pageForm.khid})
|
||||
|
||||
Reference in New Issue
Block a user