Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoban3.0
haoban-manage3.0
Commits
6f3a26a8
Commit
6f3a26a8
authored
Sep 19, 2022
by
墨竹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:前端丢失精度问题
parent
744e0ee4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletions
+27
-1
LongHttpMessageConverter.java
...ic/haoban/manage/web/config/LongHttpMessageConverter.java
+25
-0
spring-servlet.xml
...-operation-web/src/main/webapp/WEB-INF/spring-servlet.xml
+2
-1
No files found.
haoban-manage3-operation-web/src/main/java/com/gic/haoban/manage/web/config/LongHttpMessageConverter.java
0 → 100644
View file @
6f3a26a8
package
com
.
gic
.
haoban
.
manage
.
web
.
config
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.module.SimpleModule
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
;
/**
* Created 2021/12/23.
*
* @author hua
*/
public
class
LongHttpMessageConverter
extends
MappingJackson2HttpMessageConverter
{
public
LongHttpMessageConverter
()
{
super
();
//修复:前端js 精度问题
ObjectMapper
objectMapper
=
getObjectMapper
();
SimpleModule
simpleModule
=
new
SimpleModule
();
simpleModule
.
addSerializer
(
Long
.
class
,
ToStringSerializer
.
instance
);
simpleModule
.
addSerializer
(
Long
.
TYPE
,
ToStringSerializer
.
instance
);
objectMapper
.
registerModule
(
simpleModule
);
setObjectMapper
(
objectMapper
);
}
}
haoban-manage3-operation-web/src/main/webapp/WEB-INF/spring-servlet.xml
View file @
6f3a26a8
...
@@ -30,12 +30,13 @@
...
@@ -30,12 +30,13 @@
<mvc:annotation-driven>
<mvc:annotation-driven>
<!-- 设置不使用默认的消息转换器 -->
<!-- 设置不使用默认的消息转换器 -->
<mvc:message-converters
register-defaults=
"false"
>
<mvc:message-converters
register-defaults=
"false"
>
<bean
class=
"com.gic.haoban.manage.web.config.LongHttpMessageConverter"
/>
<bean
class=
"com.gic.haoban.common.ext.MappingJackson2HttpMessagePropertyViewConverter"
/>
<bean
class=
"com.gic.haoban.common.ext.MappingJackson2HttpMessagePropertyViewConverter"
/>
<bean
class=
"org.springframework.http.converter.StringHttpMessageConverter"
>
<bean
class=
"org.springframework.http.converter.StringHttpMessageConverter"
>
<property
name=
"supportedMediaTypes"
>
<property
name=
"supportedMediaTypes"
>
<list>
<list>
<value>
text/html;charset=UTF-8
</value>
<value>
text/html;charset=UTF-8
</value>
<value>
application/x-www-form-urlencoded;charset=UTF-8
</value>
<value>
application/x-www-form-urlencoded;charset=UTF-8
</value>
<!--默认是 iso-8859-1 -->
<!--默认是 iso-8859-1 -->
</list>
</list>
</property>
</property>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment