从零开始的 JavaWeb 之旅

本文最后更新于:1 个月前

经验

使用 maven 打个 war 包,报了一连串的错误:

  1. IDEA maven 未配置好,配置一下就行
  2. 有依赖下载失败,换了新的版本解决了
  3. 测试用例有错误,打包时直接忽略掉测试用例就行
  4. Cannot access defaults field of Properties问题,看下面

Cannot access defaults field of Properties问题的解决-CSDN博客

1
2
3
4
5
6
7
8
9
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.1</version>
</plugin>
</plugins>
</build>

有必要图文总结下这方面的经验了。

maven 打包、本地起 tomcat 服务器

image-20240326104155627

image-20240326104311608

像这样的报错,十有八九是项目使用的 Java 版本过低,提高到 JDK8 即可:

image-20240326104422888

最不想看到的就是 tomcat 服务起来之后,出现这样的情况:

image-20240326111338744

真是没有任何可以下手的地方

总结

有必要图文总结下这方面的经验了。

maven 打包、本地起 tomcat 服务器

image-20240327101230706

image-20240327101621140

程序包javax.annotation不存在?_百度知道 (baidu.com)

错误: 程序包javax.annotation不存在_mob64ca12e732bb的技术博客_51CTO博客

报错 java: 程序包javax.servlet.http不存在-CSDN博客

程序包 javax.servlet 不存在 解决办法_helloservlet.java:4: 错误: 程序包javax.servlet.http不存在 -CSDN博客

java: 程序包javax.servlet不存在、 java: 程序包javax.servlet.http不存在 java: 程序包javax.servlet.annotation不存在-CSDN博客

跟着一通操作,还真打包成功了。

朔州市检察院可视化

后端

后端安装子模块出现问题:

关于pom.xml一直提示Could not transfer artifact(无法搬运)+无法解析maven依赖的问题,我在学习springboot的过程中遇到的一些问题-CSDN博客

这个问题我直接执行一键安装全部模块,然后单独安装每个子模块就可以

image-20240327113245582

前端

若依前端出现报错,解决方法:

若依报错解决_> ruoyi@3.8.6 dev > vue-cli-service serve info sta-CSDN博客

1
$env:NODE_OPTIONS="--openssl-legacy-provider"

执行这条命令,确实百分百永久解决问题

image-20240327140712627

image-20240327105609337

image-20240327105629244

Java spring 注解 @PostConstruct 实战讲解-CSDN博客

运行

很好,问题已解决:

这个错误日志显示了一个java.lang.NoClassDefFoundError异常,具体是找不到javax.xml.bind.DatatypeConverter类。DatatypeConverter是Java平台的一个类,用于在不同类型的Java数据类型和字符串之间进行转换,它属于Java的JAXB(Java Architecture for XML Binding)API的一部分。

这个异常通常发生在Java 9及以上版本的环境中,因为从Java 9开始,JAXB不再作为Java SE的一部分,而是被标记为模块化的JDK中的可选部分。如果你的应用是基于Java 9或更高版本,并且你没有显式地将JAXB添加到你的项目依赖中,就可能会遇到这个问题。

要解决这个问题,你有以下几个选项:

  1. 添加JAXB依赖
    在你的项目构建文件(如Maven的pom.xml或Gradle的build.gradle)中,添加JAXB的依赖。例如,如果你使用Maven,可以添加如下依赖:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    <dependency>  
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.3.1</version>
    </dependency>
    <dependency>
    <groupId>org.glassfish.jaxb</groupId>
    <artifactId>jaxb-runtime</artifactId>
    <version>2.3.1</version>
    </dependency>

    确保使用与你项目兼容的JAXB版本。

  2. 使用Java 8
    如果你的项目没有特定的理由必须使用Java 9或更高版本,你可以考虑切换回Java 8,因为JAXB在Java 8中是内置的。

  3. 添加JVM参数
    如果你使用的是Java 9或更高版本,并且不想修改项目依赖,你可以尝试通过添加JVM参数来启用JAXB模块。例如,你可以添加如下JVM参数:

    1
    2
    3
    shell复制代码

    --add-modules java.se.ee

    然而,请注意,这种方法并不是官方推荐的,并且可能在未来的Java版本中不再有效。

  4. 检查代码库
    如果DatatypeConverter是由某个库间接使用的,那么你可能需要更新这个库到支持Java 9及以上版本的版本,或者寻找一个替代库。

请根据你的具体情况选择最合适的解决方案。如果你正在使用Spring Boot,确保你的Spring Boot版本与你的Java版本兼容,因为Spring Boot通常会处理这类依赖问题。如果问题依然存在,可能需要进一步检查你的项目配置和依赖关系。

入参:部门id(belongDeptId),排名(sortNum),日期(time),指标等级(indexLevel)

根据时间(time)获取 newTime;根据部门id(belongDeptId)获取父单位id(parentId);根据(newTime + parentId)更新指标等级(indexLevel);根据指标等级(indexLevel)拿到字典类型(dictType)

联表查询指标库(bus_index_library)、指标数据(bus_index_value)、部门表(bus_dept)

朔州市查询,部门就为朔州市院;各县市查询,部门为对应县市院。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<select id="selectRankingDetails" resultType="com.zw.business.domain.vo.ResultVo">
select d.index_value_id id, d.index_id indexId, belong_dept_id belongDeptId, sort_num sortNum, index_name indexName, index_until indexUntil,
index_type indexType, index_value indexValue, index_parent_value indexParentValue,d.group_sort as groupSort,
e.notification as notification ,e.index_order as indexOrder, e.index_logo as indexLogo
from bus_index_value d left join bus_index_library e on d.index_id=e.index_id left join sys_dept f on belong_dept_id = dept_id
where belong_dept_id = #{belongDeptId}
<if test="indexIds != null and indexIds != ''"> and d.index_id in (${indexIds})</if>
<if test="sortNum != null and sortNum != ''"> and d.sort_num = #{sortNum} </if>
<if test="newTime != null and newTime != ''"> and d.index_time like concat(#{newTime},'%') </if>
<if test="valueLevel != null and valueLevel != ''"> and d.value_level = #{valueLevel} </if>
<if test="indexLevel != null and indexLevel != ''"> and e.index_level = #{indexLevel} </if>
<if test="isCore != null and isCore != ''"> and e.is_core = #{isCore} </if>
<if test="isSort != null and isSort != ''"> and e.is_sort = #{isSort} </if>
</select>

根据字典类型(dictType)查询获取字典标签(dictLabel),给所有记录设置字典标签 / 业务类型。

默认指标等级(index_level)是2,该指标等级对应的指标类型为:DICT_TYPE_INDEX_56,即字典类型。根据字典类型查询字典库(dict_library)获取到的字典标签列表,并按字典数据(dictValue)升序排序。

1
2
3
// 根据dict_type查询指标类型集合
@Select("select dict_value as dictValue, dict_label dictLabel, remark as remark from sys_dict_data where dict_type = #{dictType} ORDER BY dict_value")
public List<SysDictData> getIndexTypeList(String dictType);

根据字典数据(dictValue)升序排序获取的字典标签(dictLabel)。每个指标名称都有所属指标类型(即字典标签 dictLabel),用指标类型(index_type)关联(dictValue)。

1
2
Map<String, String> indexTypeMap = indexUtils.getIndexTypeMap(dictType);
list.forEach(data -> data.setDictLabel(indexTypeMap.get(data.getIndexType())));

一次三表联查 + 单表查询,我们查询到了完整的数据:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
"id": "27777",
"indexParentValue": 1.07,
"sortNum": 1,
"belongDeptId": 140600,
"indexTime": "2023-09-02T00:00:00.000+0800",
"indexId": "277",
"indexName": "刑事“案-件比”",
"indexUntil": "≤1.33",
"indexShort": "刑事“案-件比”",
"indexType": "0",
"indexTypeSecond": "",
"indexTypeThird": "",
"dictLabel": "刑事检察",
"deptId": 140600,
"deptName": "朔州市院",
"sortNumStr": "≤1.33",
"notification": 1.33,
"indexOrder": "1",
"isCore": "0",
"isSort": "0",
"indexLogo": "0",
"groupSort": "---",
"showId": "1"
}

删除了认证授权校验,方便接口测试

废弃代码

serviceImpl 层:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/**
* 查询所有市院前三位指标数据(单项 + 组合)
*
* @param parentId 所属部门 id
* @param time 日期
* @param indexLevel 指标等级
*/
@Override
public ResponseVo selectFirstShanxiDetails(BigInteger parentId, String time, String indexLevel) {
// 1.查询得到所有市院部门id
List<BigInteger> depIdList = new ArrayList<>();
depIdList = busIndexLibraryMapper.selectFirstShanxi(parentId);

// 2.每个市院查询指标排名前三的指标数据
List<Integer> singleResultList = null;
List<ResultVo> multiResultList = null;
for (BigInteger belongDeptId : depIdList) {
// 2.1.单项分析排名前三指标数据
singleResultList = this.getSingleFirstShanxi(belongDeptId, time, indexLevel);
// 2.2.组合分析排名前三指标数据
multiResultList = this.getMultiFirstShanxi(belongDeptId, time, indexLevel);
}

// 3.综合所有市院(全省)前三位指标数据

// 4.返回结果
return null;
}

/**
* 市院单项分析排名前三位指标数据
*
* @param belongDeptId 所属部门 id
* @param time 日期
* @param indexLevel 指标等级
*/
public List<ResultVo> getSingleFirstShanxiDetails(BigInteger belongDeptId, String time, String indexLevel) {
String newTime = checkTime(time);
String parentId = indexUtils.getParentId(belongDeptId);
indexLevel = indexUtils.resetIndexLevel(parentId, newTime);
String dictType = IndexUtils.getDictType(indexLevel);
List<ResultVo> list;

// 获取朔州市检察院前三名指标项详情
list = busIndexLibraryMapper.getFirstXianDetails(null, belongDeptId, newTime, indexLevel, DictDataConstant.VALUE_LEVEL_ONE, DictDataConstant.IS_CORE_FALSE, DictDataConstant.IS_SORT_FALSE);
List<ResultVo> list1 = busIndexLibraryMapper.getFirstXianDetails(null, belongDeptId, newTime, indexLevel, DictDataConstant.VALUE_LEVEL_THREE, DictDataConstant.IS_CORE_FALSE, DictDataConstant.IS_SORT_FALSE);
if (list1.size() > 0) {
String indexIds = IndexUtils.getIndexIds(list1);
List<ResultVo> list2 = busIndexLibraryMapper.selectRankingDetails(indexIds, belongDeptId, "", newTime, indexLevel, DictDataConstant.VALUE_LEVEL_TWO, DictDataConstant.IS_CORE_FALSE, DictDataConstant.IS_SORT_FALSE);
if (list2.size() > 0) {
list.addAll(list2);
}
}
// 设置指标列表序号
this.setShowIdNormal(list);
// 设置业务类型标签
this.setDictLabelByLevel(list, dictType);
if (!indexUtils.checkIndexNumber(newTime)) {
this.resetIndexValue(list);
}

return list;
}

/**
* 市院组合分析排名前三位指标数据
*
* @param belongDeptId 所属部门 id
* @param time 日期
* @param indexLevel 指标等级
*/
public List<ResultVo> getMultiFirstShanxiDetails(BigInteger belongDeptId, String time, String indexLevel) {
String newTime = checkTime(time);
String parentId = indexUtils.getParentId(belongDeptId);
indexLevel = indexUtils.resetIndexLevel(parentId, newTime);
String dictType = IndexUtils.getDictType(indexLevel);
List<ResultVo> list;

// 获取朔州市检察院前三名指标项详情
list = busIndexLibraryMapper.getFirstXianDetails(null, belongDeptId, newTime, indexLevel, DictDataConstant.VALUE_LEVEL_ONE, DictDataConstant.IS_CORE_FALSE, DictDataConstant.IS_SORT_FALSE);
List<ResultVo> list1 = busIndexLibraryMapper.getFirstXianDetails(null, belongDeptId, newTime, indexLevel, DictDataConstant.VALUE_LEVEL_THREE, DictDataConstant.IS_CORE_FALSE, DictDataConstant.IS_SORT_FALSE);
if (list1.size() > 0) {
String indexIds = IndexUtils.getIndexIds(list1);
List<ResultVo> list2 = busIndexLibraryMapper.selectRankingDetails(indexIds, belongDeptId, "", newTime, indexLevel, DictDataConstant.VALUE_LEVEL_TWO, DictDataConstant.IS_CORE_FALSE, DictDataConstant.IS_SORT_FALSE);
if (list2.size() > 0) {
list.addAll(list2);
}
}
// 设置指标列表序号
this.setShowIdNormal(list);
// 设置业务类型标签
this.setDictLabelByLevel(list, dictType);
if (!indexUtils.checkIndexNumber(newTime)) {
this.resetIndexValue(list);
}

return list;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/**
* 查询所有市院前三位指标个数(单项 + 组合)
*
* @param parentId 所属部门 id
* @param time 日期
* @param indexLevel 指标等级
*/
@Override
public ResponseVo selectFirstShanxi(BigInteger parentId, String time, String indexLevel) {
String newTime = checkTime(time);
String parentIdStr = String.valueOf(parentId);
indexLevel = indexUtils.resetIndexLevel(parentIdStr, newTime);

// 1.查询得到所有市院部门id
List<BigInteger> depIdList;
depIdList = busIndexLibraryMapper.selectFirstShanxi(parentId);

// 2.每个市院查询指标排名前三的个数
List<Integer> singleList;
List<List<Integer>> singleResultList = new ArrayList<>();
for (BigInteger belongDeptId : depIdList) {
// 2.1.单项分析排名前三指标个数
singleList = this.getSingleFirstShanxi(belongDeptId, newTime, indexLevel);
singleResultList.add(singleList);
}

// 2.2.组合分析排名前三指标个数(去重)
List<ResultVo> multiResultList = this.getMultiFirstShanxi(parentId, newTime, indexLevel);

// 3.综合所有市院(全省)前三位指标个数

// 4.返回结果
return null;
}

/**
* 市院单项分析排名前三位指标个数
*
* @param belongDeptId 所属部门 id
* @param time 日期
* @param indexLevel 指标等级
*/
public List<Integer> getSingleFirstShanxi(BigInteger belongDeptId, String time, String indexLevel) {
List<String> sortNumList = new ArrayList<>();

// 各级指标数量
List<ResultVo> indexNumList;
// 区间指标数量
List<Integer> resultVoList = new ArrayList<>();
// 山西省
// 靠前方阵 1 - 3
for (int i = 1; i <= 3; i++) {
sortNumList.add(String.valueOf(i));
}
// 根据sortNum获取各排名指标个数
for (String sortNum : sortNumList) {
indexNumList = busIndexLibraryMapper.selectRankBySortNum(belongDeptId, time, indexLevel, sortNum,
DictDataConstant.VALUE_LEVEL_FALSE, DictDataConstant.IS_CORE_FALSE, DictDataConstant.IS_SORT_FALSE);
resultVoList.add(indexNumList.size());
}

return resultVoList;
}

/**
* 市院组合分析排名前三位指标个数
*
* @param belongDeptId 所属部门 id
* @param time 日期
* @param indexLevel 指标等级
*/
public List<ResultVo> getMultiFirstShanxi(BigInteger belongDeptId, String time, String indexLevel) {
String newTime = checkTime(time);
List<ResultVo> resultList;

List<Integer> sortRankList = new ArrayList<>();
sortRankList.add(0, 1);
sortRankList.add(1, 2);
sortRankList.add(2, 3);

Map<String, Map> allDeptSortMap = this.getAllDeptSortMap(newTime, belongDeptId.toString());
Map<BigInteger, Map<Integer, List<ResultVo>>> singleDeptSortMap = allDeptSortMap.get("single");
Map<BigInteger, Map<String, List<ResultVo>>> groupDeptSortMap = allDeptSortMap.get("disGroup");

List<IndexFraction> sortList = this.getSortNumSum(newTime, belongDeptId);
sortList.sort((o1, o2) -> o2.getFraction().compareTo(o1.getFraction()));

// 装配属性
resultList = this.transIndexFractionToResultVo(sortList);
resultList.forEach(data -> {
Map<Integer, List<ResultVo>> singleMap = singleDeptSortMap.get(data.getDeptId());
Map<String, List<ResultVo>> groupMap = groupDeptSortMap.get(data.getDeptId());

Integer first = sortRankList.get(0);
Integer second = sortRankList.get(1);
data.setFirst((singleMap.containsKey(first) ? singleMap.get(first).size() : 0)
+ (groupMap.containsKey(first.toString()) ? groupMap.get(first.toString()).size() : 0));
data.setSecond((singleMap.containsKey(second) ? singleMap.get(second).size() : 0)
+ (groupMap.containsKey(second.toString()) ? groupMap.get(second.toString()).size() : 0));

if (!indexUtils.checkDept(belongDeptId.toString())) {
Integer thild = sortRankList.get(2);
data.setThird((singleMap.containsKey(thild) ? singleMap.get(thild).size() : 0)
+ (groupMap.containsKey(thild.toString()) ? groupMap.get(thild.toString()).size() : 0));
}
});

// 根据 sortNum, 使用Stream API 和 Lambda 表达式对列表进行排序
return resultList.stream()
.sorted(Comparator.comparing(ResultVo::getSortNum)) // 根据fieldName字段进行升序排序
.collect(Collectors.toList());
}

service 层:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/**
* 查询所有市院前三位指标个数(单项 + 组合)
*
* @return com.zw.business.domain.vo.ResponseVo
* @Param parentId 部门Id
* @Param time 查询年月
*/
ResponseVo selectFirstShanxi(BigInteger parentId, String time, String indexLevel);

/**
* 查询所有市院前三位指标数据(单项 + 组合)
*
* @return com.zw.business.domain.vo.ResponseVo
* @Param belongDeptId 部门Id
* @Param time 查询年月
*/
ResponseVo selectFirstShanxiDetails(BigInteger parentId, String time, String indexLevel);

Controller 层:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
* @return com.zw.business.domain.vo.ResponseVo
* @description: 查询所有市院前三位指标个数(单项 + 组合)
* 1
* @Param: parentId 父部门Id
* @Param: time 查询年月
*/
@RequestMapping("/selectFirstShanxi")
public ResponseVo selectFirstShanxi(@RequestParam BigInteger parentId, @RequestParam(required = false, defaultValue = "") String time,
@RequestParam String indexLevel) {
return busIndexLibraryService.selectFirstShanxi(parentId, time, indexLevel);
}

/**
* @return com.zw.business.domain.vo.ResponseVo
* @description: 查询所有市院前三位指标详情(单项 + 组合)
* 1
* @Param: parentId 父部门Id
* @Param: time 查询年月
*/
@RequestMapping("/selectFirstShanxiDetails")
public ResponseVo selectFirstShanxiDetails(@RequestParam BigInteger parentId, @RequestParam(required = false, defaultValue = "") String time,
@RequestParam String indexLevel) {
return busIndexLibraryService.selectFirstShanxiDetails(parentId, time, indexLevel);
}

serviceImpl 层:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/**
* 查询全省前三指标数量(1, 2, 3)
*
* @return ResponseVo
* @Param parentId 父部门Id
* @Param time 查询年月
*/
@Override
public ResponseVo selectSumSortNumQian(BigInteger parentId, String time, String indexLevel) {
String newTime = checkTime(time);
indexLevel = indexUtils.resetIndexLevel(parentId.toString(), newTime);

List<IndexFraction> resultList;
if (checkFiftySixOrFortyEight(indexLevel)) {
// 全省前三指标数量(1, 2, 3) 计算组合指标排名 (组合指标 单项指标排名不做计算)
resultList = this.getSortNumSumQian(newTime, parentId);
} else {
// 设置单项排名之和
// 市/区县院指标排名之和排序
String dictType = IndexUtils.getDictType(indexLevel);
resultList = busIndexLibraryMapper.selectSortSumFraction(dictType, newTime, parentId, indexLevel, DictDataConstant.VALUE_LEVEL_ONE + "," + DictDataConstant.VALUE_LEVEL_TWO, DictDataConstant.IS_CORE_FALSE, DictDataConstant.IS_SORT_FALSE);
resultList.sort(Comparator.comparing(IndexFraction::getFraction));
}

return ResponseVo.returnResponse(200, "成功", resultList);
}

private List<IndexFraction> getSortNumSumQian(String monthId, BigInteger parentId) {
List<IndexFraction> resultList = new ArrayList<>();
// 1.列举所有市院/区县院
List<SysDept> deptTree = deptMapper.getDeptTree(Long.valueOf(parentId.toString()));
// 2.获取全省(11地市)/全市(12区县)(1, 2, 3) 指标数据集合 (含未测算、未排名)
List<ResultVo> resultVos = indexUtils.selectQianMultipleValues(monthId, parentId.toString());

// 3.单项指标 不含未测算 未排名
List<ResultVo> logoZeroStream = resultVos.stream()
.filter(s -> DictDataConstant.DEFAULT_GROUP_SORT.equals(s.getGroupSort())
&& DictDataConstant.IS_CORE_FALSE.equals(s.getIsCore())
&& DictDataConstant.IS_SORT_FALSE.equals(s.getIsSort()))
.collect(Collectors.toList());

// 单项指标 按照 deptId分组
// key: deptId.toString() value: list
Map<BigInteger, List<ResultVo>> logoZeroDeptSortMap = logoZeroStream.stream()
.collect(Collectors.groupingBy(ResultVo::getDeptId));

// 4.组合指标集合
List<ResultVo> logoGroupStream = resultVos.stream()
.filter(s -> !DictDataConstant.DEFAULT_GROUP_SORT.equals(s.getGroupSort()))
.collect(Collectors.toList())
.stream().sorted(Comparator.comparing(ResultVo::getIndexId)).collect(Collectors.toList());
// 组合指标 按照deptId分组
Map<BigInteger, List<ResultVo>> groupDeptMap = logoGroupStream.stream().collect(Collectors.groupingBy(ResultVo::getDeptId));
// 组合指标排名集合 去重
HashMap<BigInteger, List<Integer>> groupSortMap = new HashMap<>();
groupDeptMap.forEach((key, value) -> {
// key 为 deptId
// 组合指标 按照标识分组 *** 此处未按照indexType分组
Map<String, List<ResultVo>> oneDeptGroupMap = value.stream().collect(Collectors.groupingBy(ResultVo::getIndexLogo));
// deptId key value:list<Integer>
List<Integer> sortNumList = new ArrayList<>();
oneDeptGroupMap.forEach((key1, value1) -> {
// key: deptId.toString()+indexLogo value: groupSort deptId:11 * groupSort:14 = 154
// groupSortMap.put(data.getKey().toString()+s.getKey(),s.getValue().get(0).getGroupSort());
sortNumList.add(Integer.valueOf(value1.get(0).getGroupSort()));
});
groupSortMap.put(key, sortNumList);
});

// 5.排名之和累加 装填
deptTree.forEach(data -> {
int num = 0;
List<ResultVo> sigList = logoZeroDeptSortMap.get(new BigInteger(data.getDeptId().toString()));
for (ResultVo resultVo : sigList) {
num = num + (null == resultVo.getSortNum() ? 0 : resultVo.getSortNum());
}

if (groupSortMap.containsKey(new BigInteger(data.getDeptId().toString()))) {
List<Integer> grouplist = groupSortMap.get(new BigInteger(data.getDeptId().toString()));
for (Integer integer : grouplist) {
num = num + integer;
}
}

resultList.add(new IndexFraction(num, data.getDeptName(), Integer.valueOf(data.getDeptId().toString()), 0));
});

resultList.sort(Comparator.comparing(IndexFraction::getFraction));

// 等值等排名
if (CollectionUtils.isNotEmpty(resultList)) {
int sort = 1;
for (int j = 0; j < resultList.size(); j++) {
if (j == 0) {
resultList.get(j).setSortNum(sort);
} else {
if (resultList.get(j - 1).getFraction().equals(resultList.get(j).getFraction())) {
resultList.get(j).setSortNum(resultList.get(j - 1).getSortNum());
} else {
resultList.get(j).setSortNum(sort);
}
}
sort++;
}
}

// 返回全省排名前三
return resultList.stream()
.limit(3)
.collect(Collectors.toList());
}

/**
* 查询全省前三指标数据(1, 2, 3)
*
* @return ResponseVo
* @Param parentId 父部门Id
* @Param time 查询年月
*/
@Override
public ResponseVo selectSumSortNumQianDetails(BigInteger parentId, String time, String indexLevel) {
String newTime = checkTime(time);
indexLevel = indexUtils.resetIndexLevel(parentId.toString(), newTime);

List<IndexFraction> resultList;
if (checkFiftySixOrFortyEight(indexLevel)) {
// 全省前三指标数据(1, 2, 3) 计算组合指标排名 (组合指标 单项指标排名不做计算)
resultList = this.getSortNumSumQian(newTime, parentId);
} else {
// 设置单项排名之和
// 市/区县院指标排名之和排序
String dictType = IndexUtils.getDictType(indexLevel);
resultList = busIndexLibraryMapper.selectSortSumFraction(dictType, newTime, parentId, indexLevel, DictDataConstant.VALUE_LEVEL_ONE + "," + DictDataConstant.VALUE_LEVEL_TWO, DictDataConstant.IS_CORE_FALSE, DictDataConstant.IS_SORT_FALSE);
resultList.sort(Comparator.comparing(IndexFraction::getFraction));
}

return ResponseVo.returnResponse(200, "成功", resultList);
}

service 层:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
* 查询全省前三指标数量(1, 2, 3)
* 0
*
* @return ResponseVo
* @Param parentId 父部门Id
* @Param time 查询年月
*/
ResponseVo selectSumSortNumQian(BigInteger parentId, String time, String indexLevel);

/**
* 查询全省前三指标数据(1, 2, 3)
* 0
*
* @return ResponseVo
* @Param parentId 父部门Id
* @Param time 查询年月
*/
ResponseVo selectSumSortNumQianDetails(BigInteger parentId, String time, String indexLevel);

controller 层:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
* @return com.zw.business.domain.vo.ResponseVo
* @description: 查询全省前三指标数量(1, 2, 3)
* 0
* @Param: parentId 父部门Id
* @Param: time 查询年月
*/
// @RequestMapping("/selectSumSortNumQian")
public ResponseVo selectSumSortNumQian(@RequestParam BigInteger parentId, @RequestParam(required = false, defaultValue = "") String time,
@RequestParam String indexLevel) {
return busIndexLibraryService.selectSumSortNumQian(parentId, time, indexLevel);
}

/**
* @return com.zw.business.domain.vo.ResponseVo
* @description: 查询全省前三指标数据(1, 2, 3)
* 0
* @Param: parentId 父部门Id
* @Param: time 查询年月
*/
// @RequestMapping("/selectSumSortNumQianDetails")
public ResponseVo selectSumSortNumQianDetails(@RequestParam BigInteger parentId, @RequestParam(required = false, defaultValue = "") String time,
@RequestParam String indexLevel) {
return busIndexLibraryService.selectSumSortNumQianDetails(parentId, time, indexLevel);
}

大同检察院

后端

模板路径,后续从配置文件读取

image-20240401105053573

前端

同样的,修改请求的后端地址为本地的 8090 端口

若依前端出现报错,解决方法:

若依报错解决_> ruoyi@3.8.6 dev > vue-cli-service serve info sta-CSDN博客

1
$env:NODE_OPTIONS="--openssl-legacy-provider"

执行这条命令,确实百分百永久解决问题

检察院可视化

丰子恺经典语录34句,精辟走心,句句看透人生,让你受益一生! (baidu.com)

导入数据

IDEA 书签

【效率提升】IDEA中书签功能的妙用_idea 书签-CSDN博客

Spring MySQL 配置:

MySQL 之 InvalidConnectionAttributeException,SQLNonTransientConnectionException_sqlnontransientconnectionexception: server shutdow-CSDN博客

MySQL 的这行配置还有点门道:

1
url: jdbc:mysql://122.9.51.171:3306/test_shuozhou?serverTimezone=UTC&allowMultiQueries=true&autoReconnect=true&useUnicode=true&failOverReadOnly=false&useSSL=false&characterEncoding=utf-8

Postman 测试文件上传接口:

Postman 上传文件 返回 500 报错 “Current request is not a multipart request” 解决_postman current request is not a multipart request-CSDN博客

Excel 表格修改后缀:

The supplied data appears to be in the OLE2 Format.-CSDN博客

推送代码

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘his-CSDN博客

部署项目 Failure obtaining db row lock: Table ‘XXX.qrtz_LOCKS‘ doesn‘t exist-CSDN博客

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘his-CSDN博客

部署项目 Failure obtaining db row lock: Table ‘XXX.qrtz_LOCKS‘ doesn‘t exist-CSDN博客

3.解决方法:

  • (1)win+R,打开命令提示符框,输入cmd,进入命令提示符
  • (2)输入netstat -aon | findstr 1099,找到占用1099端口的进程ID:PID
  • (3)输入taskkill -f -pid PID
  • (4)重启Tomcat

从零开始的 JavaWeb 之旅
http://example.com/2023/07/01/从零开始的 JavaWeb 之旅/
作者
Memory
发布于
2023年7月1日
更新于
2024年3月26日
许可协议