代码提交

This commit is contained in:
liang.chao 2026-02-02 16:34:39 +08:00
parent 9de98ef70a
commit 4325d8c2ca
7 changed files with 238 additions and 172 deletions

View File

@ -671,6 +671,9 @@ public class OutsourcerEvaluateServiceImpl implements OutsourcerEvaluateService
childMap.put("totalScore", String.format("%.2f", score));
childDataList.add(childMap);
}
List<Map<String, Object>> collectTitleData = getCollectTitleData(o);
childDataList.addAll(collectTitleData);
childDataList.sort(Comparator.comparing(map -> String.valueOf(map.get("subName"))));
finalList.add(oneList);
String resParams = JSONArray.toJSON(finalList).toString();
@ -804,6 +807,126 @@ public class OutsourcerEvaluateServiceImpl implements OutsourcerEvaluateService
ar.setSucceed(resParams, childParams);
return ar;
}
public List<Map<String, Object>> getCollectTitleData(EvaluateSubBean o) {
o.setType("collect");
EvaluateDataBean bean = outsourcerEvaluateDao.getSummaryJsonData(o);
String jsonData = bean.getJsonData();
List<Map<String, Object>> list = JSONArray.parseObject(jsonData, List.class);
List<List<Map<String, Object>>> finalList = new ArrayList<>();
//获取所有带total的字段
Set<String> titleSet = new HashSet<>();
for (Map<String, Object> map : list) {
for (String key : map.keySet()) {
if (key.contains("-total")) {
titleSet.add(key);
}
}
}
//对titleSet排序 根据title.split("-")[0]排序
List<String> sortList = titleSet.stream().sorted(Comparator.comparing(s -> s.split("-")[0])).collect(Collectors.toList());
List<Map<String, Object>> oneList = new ArrayList<>();
//添加一级标题
addTitleMap(oneList, "序号", "index", 1, 100);
addTitleMap(oneList, "施工业务外包商", "subName", 1, 180);
for (String title : sortList) {
String name = outsourcerEvaluateDao.getIndexNameById(title.split("-")[0]);
String countType = outsourcerEvaluateDao.getCountTypeById(title.split("-")[0]);
String standardScore = outsourcerEvaluateDao.getStandardScoreById(title.split("-")[0]);
addCollectTitleMap(oneList, name, title, 1, 180, countType, standardScore);
}
addTitleMap(oneList, "合计", "totalScore", 1, 180);
List<Map<String, Object>> childDataList = new ArrayList<>();
for (Map<String, Object> map : list) {
Map<String, Object> childMap = new LinkedHashMap<>();
childMap.put("subName", map.get("subName"));
childMap.put("subId", map.get("subId"));
childMap.put("proId", map.get("proId"));
Float score = 0.0F;
for (String title : sortList) {
childMap.put(title, map.get(title));
score += Float.parseFloat(map.get(title).toString());
}
//合计为加和
childMap.put("totalScore", score);
childDataList.add(childMap);
}
//获取所有的承包商 从childDataList
Set<String> subNameSet = new HashSet<>();
for (Map<String, Object> map : childDataList) {
subNameSet.add(map.get("subName").toString());
}
List<Map<String, Object>> finalChildList = new ArrayList<>();
for (String subName : subNameSet) {
Map<String, Object> childMap = new LinkedHashMap<>();
childMap.put("subName", subName);
//从childDataList中获取subId proId 根据subName
String subId = "";
String proId = "";
for (Map<String, Object> map : childDataList) {
if (subName.equals(map.get("subName").toString())) {
subId = map.get("subId").toString();
proId = map.get("proId").toString();
}
}
childMap.put("subId", subId);
childMap.put("proId", proId);
Float score = 0.0F;
for (String title : sortList) {
//从oneList中获取title的countType standardScore
String countType = "";
String standardScore = "";
for (Map<String, Object> oneMap : oneList) {
if (title.equals(oneMap.get("field").toString())) {
countType = oneMap.get("countType").toString();
standardScore = oneMap.get("standardScore").toString();
}
}
ArrayList<Float> total = new ArrayList<>();
for (Map<String, Object> map : childDataList) {
if (subName.equals(map.get("subName").toString())) {
total.add(Float.parseFloat(map.get(title).toString()));
}
}
Float totalScore = 0.0F;
if ("累加".equals(countType)) {
for (Float aFloat : total) {
totalScore += aFloat;
}
childMap.put(title, totalScore);
} else if ("累减".equals(countType)) {
for (Float aFloat : total) {
totalScore += aFloat;
}
totalScore = Float.parseFloat(standardScore) - totalScore;
} else if ("平均值".equals(countType)) {
for (Float aFloat : total) {
totalScore += aFloat;
}
totalScore = totalScore / total.size();
} else if ("最大值".equals(countType)) {
for (Float aFloat : total) {
if (aFloat > totalScore) {
totalScore = aFloat;
}
}
} else if ("最小值".equals(countType)) {
totalScore = total.get(0);
for (Float aFloat : total) {
if (aFloat < totalScore) {
totalScore = aFloat;
}
}
}
score += totalScore;
childMap.put(title, String.format("%.2f", totalScore));
}
childMap.put("totalScore", String.format("%.2f", score));
finalChildList.add(childMap);
}
return finalChildList;
}
@Override
public AjaxRes getCollectData(EvaluateSubBean o) {

View File

@ -52,6 +52,7 @@ public class SecurityHandlerConfig {
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws IOException, ServletException {
LoginUser loginUser = (LoginUser) authentication.getPrincipal();
loginUser.setPassword(null);
// 检查账号是否被锁定
if (loginAttemptService.isAccountLocked(loginUser.getUsername())) {

View File

@ -0,0 +1,32 @@
package com.bonus.gs.sub.evaluate.manager.config;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @Authorliang.chao
* @Date2025/10/20 - 10:49
*/
@Configuration
public class ServerConfig {
@Bean
public TomcatServletWebServerFactory servletContainer() {
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
tomcat.addConnectorCustomizers(connector -> {
// 设置连接超时
connector.setProperty("connectionTimeout", "60000");
// 设置最大连接数
connector.setProperty("maxConnections", "10000");
// 针对Slowloris的防护
connector.setProperty("maxThreads", "200");
connector.setProperty("minSpareThreads", "10");
connector.setProperty("maxKeepAliveRequests", "100");
connector.setProperty("keepAliveTimeout", "15000");
});
return tomcat;
}
}

View File

@ -10,8 +10,8 @@ public class ResponseUtil {
public static void responseJson(HttpServletResponse response, int status, Object data) {
try {
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "*");
// response.setHeader("Access-Control-Allow-Origin", "*");
// response.setHeader("Access-Control-Allow-Methods", "*");
response.setContentType("application/json;charset=UTF-8");
response.setStatus(status);

View File

@ -68,9 +68,9 @@
<if test="status != null and status != ''">
having status = #{status}
</if>
<if test="type == 'view'">
having status = 1
</if>
<!-- <if test="type == 'view'">-->
<!-- having status = 1-->
<!-- </if>-->
order by MAX(per.create_time) desc
</select>

File diff suppressed because one or more lines are too long

View File

@ -211,11 +211,26 @@
}
var widthArr = []; //这里改宽
// ========== 新增:处理施工业务外包商合并 ==========
var subNameMergeInfo = processSubNameMerge(btrs, bodysArr.length);
// 将施工业务外包商的合并信息添加到mergeArr中
if (subNameMergeInfo.mergeArr.length > 0) {
mergeArr = mergeArr.concat(subNameMergeInfo.mergeArr);
}
// ========== 新增结束 ==========
for (var j = 0; j < btrs.length; j++) {
var contents = [];
var btds = Array.from(btrs[j].querySelectorAll("td"));
for (var i = 0; i < btds.length; i++) {
contents.push(btds[i].innerText);
// 如果是施工业务外包商列且需要合并,则设置为空
if (i === 1 && subNameMergeInfo.shouldSkip[j]) {
contents.push(""); // 合并的单元格留空
} else {
contents.push(btds[i].innerText);
}
if (j == 0) { //只跑一圈
widthArr.push({wpx: btds[i].scrollWidth});
}
@ -323,6 +338,63 @@
})
}
// ==========处理施工业务外包商合并的函数 ==========
function processSubNameMerge(btrs, headerRowCount) {
var mergeArr = [];
var shouldSkip = {}; // 记录哪些行需要跳过显示subName
var currentSubName = null;
var startRow = -1;
var rowCount = 0;
// 遍历所有数据行
for (var j = 0; j < btrs.length; j++) {
var btds = Array.from(btrs[j].querySelectorAll("td"));
var subNameCell = btds[1]; // 施工业务外包商在第二列索引为1
var currentRowSubName = subNameCell ? subNameCell.innerText.trim() : "";
// 如果是新的承包商
if (currentSubName === null || currentRowSubName !== currentSubName) {
// 如果之前有需要合并的,添加到合并数组
if (rowCount > 1) {
mergeArr.push({
s: {r: headerRowCount + startRow, c: 1}, // 第二列
e: {r: headerRowCount + startRow + rowCount - 1, c: 1}
});
// 标记需要跳过的行
for (var k = startRow + 1; k < startRow + rowCount; k++) {
shouldSkip[k] = true;
}
}
// 开始新的合并组
currentSubName = currentRowSubName;
startRow = j;
rowCount = 1;
} else {
// 相同的承包商,增加行数
rowCount++;
}
}
// 处理最后一组合并
if (rowCount > 1) {
mergeArr.push({
s: {r: headerRowCount + startRow, c: 1}, // 第二列
e: {r: headerRowCount + startRow + rowCount - 1, c: 1}
});
for (var k = startRow + 1; k < startRow + rowCount; k++) {
shouldSkip[k] = true;
}
}
return {
mergeArr: mergeArr,
shouldSkip: shouldSkip
};
}
function initTable() {
tableCode = 1
$("#btn1").attr("class", "layui-btn layui-btn-sm");