Compare commits
2 Commits
7bf0b7584d
...
6a7762f2d0
Author | SHA1 | Date |
---|---|---|
|
6a7762f2d0 | |
|
e537836571 |
|
@ -25,7 +25,7 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* @Description: 服务类型
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,7 @@ import lombok.experimental.Accessors;
|
|||
|
||||
/**
|
||||
* @Description: 服务类型
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
|
||||
/**
|
||||
* @Description: 服务类型
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
|
||||
/**
|
||||
* @Description: 服务类型
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
|
||||
/**
|
||||
* @Description: 服务类型
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|||
|
||||
/**
|
||||
* @Description: 供应商
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,7 @@ import lombok.experimental.Accessors;
|
|||
|
||||
/**
|
||||
* @Description: 供应商
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
|
||||
/**
|
||||
* @Description: 供应商
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
|
||||
/**
|
||||
* @Description: 供应商
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
|
||||
/**
|
||||
* @Description: 供应商
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.util.Arrays;
|
|||
|
||||
/**
|
||||
* @Description: 业务字典主表
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.util.Arrays;
|
|||
|
||||
/**
|
||||
* @Description: dict_type_item
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -18,7 +18,7 @@ import java.util.Date;
|
|||
|
||||
/**
|
||||
* @Description: 业务字典主表
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,7 @@ import lombok.experimental.Accessors;
|
|||
|
||||
/**
|
||||
* @Description: dict_type_item
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.nu.modules.dictType.entity.DictTypeItem;
|
|||
|
||||
/**
|
||||
* @Description: dict_type_item
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.nu.modules.dictType.entity.DictType;
|
|||
|
||||
/**
|
||||
* @Description: 业务字典主表
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.nu.modules.dictType.entity.DictTypeItem;
|
|||
|
||||
/**
|
||||
* @Description: dict_type_item
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.nu.modules.dictType.entity.DictType;
|
|||
|
||||
/**
|
||||
* @Description: 业务字典主表
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
/**
|
||||
* @Description: dict_type_item
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-12
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
|
||||
/**
|
||||
* @Description: 业务字典主表
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* @Description: 服务类别
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -22,7 +22,7 @@ import lombok.experimental.Accessors;
|
|||
|
||||
/**
|
||||
* @Description: 服务类别
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
|
||||
/**
|
||||
* @Description: 服务类别
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
|
||||
/**
|
||||
* @Description: 服务类别
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
|
||||
/**
|
||||
* @Description: 服务类别
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* @Description: 服务指令
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
@ -70,112 +70,8 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
|
|||
QueryWrapper<ConfigServiceDirective> queryWrapper = QueryGenerator.initQueryWrapper(configServiceDirective, req.getParameterMap(), customeRuleMap);
|
||||
Page<ConfigServiceDirective> page = new Page<ConfigServiceDirective>(pageNo, pageSize);
|
||||
IPage<ConfigServiceDirective> pageList = configServiceDirectiveService.page(page, queryWrapper);
|
||||
|
||||
//处理单元格合并所需数据
|
||||
{
|
||||
List<ConfigServiceDirective> records_ = pageList.getRecords();
|
||||
List<ConfigServiceDirective> records = BeanUtil.copyToList(records_, ConfigServiceDirective.class);
|
||||
String fwlb = "";//存储循环到的服务类别值
|
||||
int fwlb_repCount = 0;//存储服务类别重复了几次
|
||||
String fwlx = "";//存储循环到的服务类型值
|
||||
int fwlx_repCount = 0;//存储服务类型重复了几次
|
||||
String zlbq = "";//存储循环到的指令标签值
|
||||
int zlbq_repCount = 0;//存储指令标签重复了几次
|
||||
for (int i = 0; i < records.size(); i++) {
|
||||
if (i == 0) {
|
||||
fwlb = records.get(i).getCategoryId();
|
||||
fwlx = records.get(i).getTypeId();
|
||||
zlbq = records.get(i).getInstructionTagId();
|
||||
} else {
|
||||
//服务类别
|
||||
{
|
||||
if (fwlb.equals(records.get(i).getCategoryId())) {
|
||||
//如果是重复数据则存储对应数据
|
||||
fwlb_repCount++;
|
||||
records.get(i).setCategoryRowSpan(0);
|
||||
if (i == records.size() - 1) {
|
||||
records.get(i - fwlb_repCount).setCategoryRowSpan(fwlb_repCount + 1);
|
||||
}
|
||||
} else {
|
||||
//需要做服务类别重复数据记录
|
||||
if (fwlb_repCount > 0) {
|
||||
records.get(i - fwlb_repCount).setCategoryRowSpan(fwlb_repCount + 1);
|
||||
}
|
||||
//处理服务类型
|
||||
{
|
||||
if (fwlx_repCount > 0) {
|
||||
records.get(i - fwlx_repCount).setTypeRowSpan(fwlx_repCount + 1);
|
||||
}
|
||||
//重置数据
|
||||
fwlx = "";
|
||||
fwlx_repCount = 0;
|
||||
}
|
||||
//处理指令标签
|
||||
{
|
||||
if (zlbq_repCount > 0) {
|
||||
records.get(i - zlbq_repCount).setInstructionRowSpan(zlbq_repCount + 1);
|
||||
}
|
||||
//重置数据
|
||||
zlbq = "";
|
||||
zlbq_repCount = 0;
|
||||
}
|
||||
//重置数据
|
||||
fwlb = records.get(i).getCategoryId();
|
||||
fwlb_repCount = 0;
|
||||
}
|
||||
}
|
||||
//服务类型
|
||||
{
|
||||
if (fwlx.equals(records.get(i).getTypeId())) {
|
||||
//如果是重复数据则存储对应数据
|
||||
fwlx_repCount++;
|
||||
records.get(i).setTypeRowSpan(0);
|
||||
if (i == records.size() - 1) {
|
||||
records.get(i - fwlx_repCount).setTypeRowSpan(fwlx_repCount + 1);
|
||||
}
|
||||
} else {
|
||||
//需要做重复数据记录
|
||||
if (fwlx_repCount > 0) {
|
||||
records.get(i - fwlx_repCount).setTypeRowSpan(fwlx_repCount + 1);
|
||||
}
|
||||
//处理指令标签
|
||||
{
|
||||
if (zlbq_repCount > 0) {
|
||||
records.get(i - zlbq_repCount).setInstructionRowSpan(zlbq_repCount + 1);
|
||||
}
|
||||
//重置数据
|
||||
zlbq = "";
|
||||
zlbq_repCount = 0;
|
||||
}
|
||||
//重置数据
|
||||
fwlx = records.get(i).getTypeId();
|
||||
fwlx_repCount = 0;
|
||||
}
|
||||
}
|
||||
//指令标签
|
||||
{
|
||||
if (zlbq.equals(records.get(i).getInstructionTagId())) {
|
||||
//如果是重复数据则存储对应数据
|
||||
zlbq_repCount++;
|
||||
records.get(i).setInstructionRowSpan(0);
|
||||
if (i == records.size() - 1) {
|
||||
records.get(i - zlbq_repCount).setInstructionRowSpan(zlbq_repCount + 1);
|
||||
}
|
||||
} else {
|
||||
//需要做重复数据记录
|
||||
if (zlbq_repCount > 0) {
|
||||
records.get(i - zlbq_repCount).setInstructionRowSpan(zlbq_repCount + 1);
|
||||
}
|
||||
//重置数据
|
||||
zlbq = records.get(i).getInstructionTagId();
|
||||
zlbq_repCount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pageList.setRecords(records);
|
||||
}
|
||||
|
||||
service.merge(pageList.getRecords());
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import lombok.experimental.Accessors;
|
|||
|
||||
/**
|
||||
* @Description: 服务指令
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
|
||||
/**
|
||||
* @Description: 服务指令
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
|
|
@ -3,12 +3,15 @@ package com.nu.modules.serviceDirective.service;
|
|||
import com.nu.modules.serviceDirective.entity.ConfigServiceDirective;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 服务指令
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IConfigServiceDirectiveService extends IService<ConfigServiceDirective> {
|
||||
|
||||
void merge(List<ConfigServiceDirective> records);
|
||||
}
|
||||
|
|
|
@ -7,13 +7,123 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 服务指令
|
||||
* @Author: jeecg-boot
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigServiceDirectiveMapper, ConfigServiceDirective> implements IConfigServiceDirectiveService {
|
||||
|
||||
|
||||
/**
|
||||
* 主合并方法
|
||||
* @param records 已排序的记录列表(需先按categoryId→typeId→instructionTagId排序)
|
||||
*/
|
||||
@Override
|
||||
public void merge(List<ConfigServiceDirective> records) {
|
||||
if (records == null || records.isEmpty()) return;
|
||||
|
||||
int outerStart = 0; // 一级分组起始索引
|
||||
String currentCategoryId = records.get(0).getCategoryId();
|
||||
|
||||
// 一级循环:遍历所有记录处理categoryId分组
|
||||
for (int i = 1; i < records.size(); i++) {
|
||||
// 当遇到不同的categoryId时处理当前分组
|
||||
if (!records.get(i).getCategoryId().equals(currentCategoryId)) {
|
||||
processAllGroups(records, outerStart, i - 1); // 处理完整个一级分组
|
||||
outerStart = i; // 重置一级起始位置
|
||||
currentCategoryId = records.get(i).getCategoryId();
|
||||
}
|
||||
}
|
||||
processAllGroups(records, outerStart, records.size() - 1); // 处理最后一组
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理完整个一级分组(包含二级和三级分组)
|
||||
* @param records 记录列表
|
||||
* @param start 当前分组的起始索引
|
||||
* @param end 当前分组的结束索引
|
||||
*/
|
||||
private void processAllGroups(List<ConfigServiceDirective> records, int start, int end) {
|
||||
processOuterGroup(records, start, end); // 处理一级categoryRowSpan
|
||||
|
||||
int innerStart = start; // 二级分组起始索引
|
||||
String currentTypeId = records.get(innerStart).getTypeId();
|
||||
|
||||
// 二级循环:处理当前一级分组内的typeId分组
|
||||
for (int j = innerStart + 1; j <= end; j++) {
|
||||
if (!records.get(j).getTypeId().equals(currentTypeId)) {
|
||||
processMiddleGroup(records, innerStart, j - 1); // 处理完整个二级分组
|
||||
innerStart = j;
|
||||
currentTypeId = records.get(j).getTypeId();
|
||||
}
|
||||
}
|
||||
processMiddleGroup(records, innerStart, end); // 处理最后一组二级数据
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理二级typeId分组(包含三级instructionTagId分组)
|
||||
* @param records 记录列表
|
||||
* @param start 当前分组的起始索引
|
||||
* @param end 当前分组的结束索引
|
||||
*/
|
||||
private void processMiddleGroup(List<ConfigServiceDirective> records, int start, int end) {
|
||||
processTypeRowSpan(records, start, end); // 设置二级typeRowSpan
|
||||
|
||||
int instructionStart = start; // 三级分组起始索引
|
||||
String currentInstructionId = records.get(instructionStart).getInstructionTagId();
|
||||
|
||||
// 三级循环:处理当前二级分组内的instructionTagId分组
|
||||
for (int k = instructionStart + 1; k <= end; k++) {
|
||||
if (!records.get(k).getInstructionTagId().equals(currentInstructionId)) {
|
||||
processInnerGroup(records, instructionStart, k - 1); // 处理完整个三级分组
|
||||
instructionStart = k;
|
||||
currentInstructionId = records.get(k).getInstructionTagId();
|
||||
}
|
||||
}
|
||||
processInnerGroup(records, instructionStart, end); // 处理最后一组三级数据
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理三级instructionTagId分组
|
||||
* @param records 记录列表
|
||||
* @param start 当前分组的起始索引
|
||||
* @param end 当前分组的结束索引
|
||||
*/
|
||||
private void processInnerGroup(List<ConfigServiceDirective> records, int start, int end) {
|
||||
int count = end - start + 1;
|
||||
if (count > 1) {
|
||||
records.get(start).setInstructionRowSpan(count);
|
||||
// 将后续记录的instructionRowSpan置0
|
||||
for (int i = start + 1; i <= end; i++) {
|
||||
records.get(i).setInstructionRowSpan(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 处理一级categoryRowSpan(与之前保持一致)
|
||||
private void processOuterGroup(List<ConfigServiceDirective> records, int start, int end) {
|
||||
int count = end - start + 1;
|
||||
if (count > 1) {
|
||||
records.get(start).setCategoryRowSpan(count);
|
||||
for (int i = start + 1; i <= end; i++) {
|
||||
records.get(i).setCategoryRowSpan(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 处理二级typeRowSpan(与之前保持一致)
|
||||
private void processTypeRowSpan(List<ConfigServiceDirective> records, int start, int end) {
|
||||
int count = end - start + 1;
|
||||
if (count > 1) {
|
||||
records.get(start).setTypeRowSpan(count);
|
||||
for (int i = start + 1; i <= end; i++) {
|
||||
records.get(i).setTypeRowSpan(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ spring:
|
|||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
minEvictableIdleTimeMillis: 3600000
|
||||
validationQuery: SELECT 1
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
|
|
Loading…
Reference in New Issue