弃用fastjson1.2.8,改用hutool的jsonutil

This commit is contained in:
周源 2022-08-11 09:40:20 +08:00
parent 63cb5c000e
commit a5a05aefc1
15 changed files with 82 additions and 55 deletions

10
pom.xml
View File

@ -35,11 +35,6 @@
<artifactId>mybatis-plus-generator</artifactId> <artifactId>mybatis-plus-generator</artifactId>
<version>3.3.2</version> <version>3.3.2</version>
</dependency> </dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.80</version>
</dependency>
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-extra</artifactId> <artifactId>hutool-extra</artifactId>
@ -55,6 +50,11 @@
<artifactId>hutool-crypto</artifactId> <artifactId>hutool-crypto</artifactId>
<version>${hutool.version}</version> <version>${hutool.version}</version>
</dependency> </dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-json</artifactId>
<version>${hutool.version}</version>
</dependency>
<!--swagger--> <!--swagger-->
<dependency> <dependency>

View File

@ -3,8 +3,8 @@ package com.ydool.boot.api.controller;
import cn.hutool.core.codec.Base64; import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import cn.hutool.json.JSONObject;
import com.alibaba.fastjson.JSONObject; import cn.hutool.json.JSONUtil;
import com.alibaba.xxpt.gateway.shared.client.http.ExecutableClient; import com.alibaba.xxpt.gateway.shared.client.http.ExecutableClient;
import com.alibaba.xxpt.gateway.shared.client.http.GetClient; import com.alibaba.xxpt.gateway.shared.client.http.GetClient;
import com.alibaba.xxpt.gateway.shared.client.http.PostClient; import com.alibaba.xxpt.gateway.shared.client.http.PostClient;
@ -463,11 +463,11 @@ public class ApiAuthController extends ApiBaseController {
String apiResult = getClient.get(); String apiResult = getClient.get();
executableClient.destroy(); executableClient.destroy();
try { try {
JSONObject jsonObject = JSON.parseObject(apiResult); JSONObject jsonObject = JSONUtil.parseObj(apiResult);
System.out.println(jsonObject); System.out.println(jsonObject);
JSONObject content = jsonObject.getJSONObject("content"); JSONObject content = jsonObject.getJSONObject("content");
if (content.getBoolean("success")) { if (content.getBool("success")) {
return content.getJSONObject("data").getString("accessToken"); return content.getJSONObject("data").getStr("accessToken");
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -492,11 +492,11 @@ public class ApiAuthController extends ApiBaseController {
String apiResult = postClient.post(); String apiResult = postClient.post();
executableClient.destroy(); executableClient.destroy();
try { try {
JSONObject jsonObject = JSON.parseObject(apiResult); JSONObject jsonObject = JSONUtil.parseObj(apiResult);
System.out.println("jsonObject:"+jsonObject); System.out.println("jsonObject:"+jsonObject);
JSONObject content = jsonObject.getJSONObject("content"); JSONObject content = jsonObject.getJSONObject("content");
if (content.getBoolean("success")) { if (content.getBool("success")) {
return content.getJSONObject("data").getString("openid"); return content.getJSONObject("data").getStr("openid");
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -521,10 +521,10 @@ public class ApiAuthController extends ApiBaseController {
String apiResult = postClient.post(); String apiResult = postClient.post();
executableClient.destroy(); executableClient.destroy();
try { try {
JSONObject jsonObject = JSON.parseObject(apiResult); JSONObject jsonObject = JSONUtil.parseObj(apiResult);
JSONObject content = jsonObject.getJSONObject("content"); JSONObject content = jsonObject.getJSONObject("content");
if (content.getBoolean("success")) { if (content.getBool("success")) {
return content.getJSONObject("data").getString("accountId"); return content.getJSONObject("data").getStr("accountId");
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -4,7 +4,8 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -323,7 +324,8 @@ public class AppointService extends BaseService<AppointMapper, Appoint> {
.eq(AppointAttachment::getAppointId, appointId) .eq(AppointAttachment::getAppointId, appointId)
.eq(AppointAttachment::getType, state)); .eq(AppointAttachment::getType, state));
if (StrUtil.isNotBlank(appointAttachmentArrStr)) { if (StrUtil.isNotBlank(appointAttachmentArrStr)) {
List<AppointAttachment> appointAttachmentList = JSONObject.parseArray(appointAttachmentArrStr, AppointAttachment.class); JSONArray objects = JSONUtil.parseArray(appointAttachmentArrStr);
List<AppointAttachment> appointAttachmentList = JSONUtil.toList(objects, AppointAttachment.class);
appointAttachmentList.forEach(item -> { appointAttachmentList.forEach(item -> {
item.setAppointId(appointId); item.setAppointId(appointId);
item.setType(state); item.setType(state);

View File

@ -2,15 +2,13 @@ package com.ydool.boot.modules.rddb.service;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray; import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.boot.common.result.Ret; import com.ydool.boot.common.result.Ret;
import com.ydool.boot.core.service.BaseService; import com.ydool.boot.core.service.BaseService;
import com.ydool.boot.modules.rddb.entity.Conference; import com.ydool.boot.modules.rddb.entity.*;
import com.ydool.boot.modules.rddb.entity.ConferenceAttachment;
import com.ydool.boot.modules.rddb.entity.ConferenceUser;
import com.ydool.boot.modules.rddb.entity.Message;
import com.ydool.boot.modules.rddb.mapper.ConferenceMapper; import com.ydool.boot.modules.rddb.mapper.ConferenceMapper;
import com.ydool.boot.modules.sys.entity.User; import com.ydool.boot.modules.sys.entity.User;
import com.ydool.boot.modules.sys.service.UserService; import com.ydool.boot.modules.sys.service.UserService;
@ -97,7 +95,8 @@ public class ConferenceService extends BaseService<ConferenceMapper, Conference>
if (StringUtils.isNotBlank(fileJson)) { if (StringUtils.isNotBlank(fileJson)) {
//之前指定的全删掉 //之前指定的全删掉
conferenceAttachmentService.remove(new QueryWrapper<ConferenceAttachment>().eq("conference_id", conference.getId())); conferenceAttachmentService.remove(new QueryWrapper<ConferenceAttachment>().eq("conference_id", conference.getId()));
List<ConferenceAttachment> conferenceAttachments = JSONArray.parseArray(fileJson, ConferenceAttachment.class); JSONArray objects = JSONUtil.parseArray(fileJson);
List<ConferenceAttachment> conferenceAttachments = JSONUtil.toList(objects, ConferenceAttachment.class);
//重新指定 //重新指定
Iterator<ConferenceAttachment> iterator = conferenceAttachments.iterator(); Iterator<ConferenceAttachment> iterator = conferenceAttachments.iterator();
int sortNo = 1; int sortNo = 1;

View File

@ -4,7 +4,8 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -336,7 +337,9 @@ public class ContactDbService extends BaseService<ContactDbMapper, ContactDb> {
private void saveAttachment(String contactDbId, String attachmentArrStr, User loginUser, String type) { private void saveAttachment(String contactDbId, String attachmentArrStr, User loginUser, String type) {
contactDbAttachmentService.remove(new LambdaQueryWrapper<ContactDbAttachment>().eq(ContactDbAttachment::getContactDbId, contactDbId).eq(ContactDbAttachment::getType, type)); contactDbAttachmentService.remove(new LambdaQueryWrapper<ContactDbAttachment>().eq(ContactDbAttachment::getContactDbId, contactDbId).eq(ContactDbAttachment::getType, type));
if (StrUtil.isNotBlank(attachmentArrStr)) { if (StrUtil.isNotBlank(attachmentArrStr)) {
List<ContactDbAttachment> attachmentList = JSONObject.parseArray(attachmentArrStr, ContactDbAttachment.class); JSONArray objects = JSONUtil.parseArray(attachmentArrStr);
List<ContactDbAttachment> attachmentList = JSONUtil.toList(objects, ContactDbAttachment.class);
attachmentList.forEach(item -> { attachmentList.forEach(item -> {
item.setContactDbId(contactDbId); item.setContactDbId(contactDbId);
item.setType(type); item.setType(type);

View File

@ -2,7 +2,8 @@ package com.ydool.boot.modules.rddb.service;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@ -16,7 +17,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.lang.reflect.Type;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -100,7 +100,9 @@ public class NoticeService extends ServiceImpl<NoticeMapper, Notice> {
.eq(NoticeAttachment::getType,type) .eq(NoticeAttachment::getType,type)
); );
if (StrUtil.isNotBlank(attachmentArrStr)) { if (StrUtil.isNotBlank(attachmentArrStr)) {
List<NoticeAttachment> attachmentList = JSONObject.parseArray(attachmentArrStr, NoticeAttachment.class); JSONArray objects = JSONUtil.parseArray(attachmentArrStr);
List<NoticeAttachment> attachmentList = JSONUtil.toList(objects, NoticeAttachment.class);
attachmentList.forEach(item -> { attachmentList.forEach(item -> {
item.setNoticeId(noticeId); item.setNoticeId(noticeId);
item.setCreatedId(loginUser.getId()); item.setCreatedId(loginUser.getId());

View File

@ -2,7 +2,8 @@ package com.ydool.boot.modules.rddb.service;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ydool.boot.core.service.BaseService; import com.ydool.boot.core.service.BaseService;
import com.ydool.boot.modules.rddb.entity.RdNotice; import com.ydool.boot.modules.rddb.entity.RdNotice;
@ -69,7 +70,8 @@ public class RdNoticeService extends BaseService<RdNoticeMapper, RdNotice> {
.eq(RdNoticeAttachment::getRdNoticeId, noticeId) .eq(RdNoticeAttachment::getRdNoticeId, noticeId)
); );
if (StrUtil.isNotBlank(attachmentArrStr)) { if (StrUtil.isNotBlank(attachmentArrStr)) {
List<RdNoticeAttachment> attachmentList = JSONObject.parseArray(attachmentArrStr, RdNoticeAttachment.class); JSONArray objects = JSONUtil.parseArray(attachmentArrStr);
List<RdNoticeAttachment> attachmentList = JSONUtil.toList(objects, RdNoticeAttachment.class);
attachmentList.forEach(item -> { attachmentList.forEach(item -> {
item.setRdNoticeId(noticeId); item.setRdNoticeId(noticeId);
item.setCreatedId(loginUser.getId()); item.setCreatedId(loginUser.getId());

View File

@ -2,7 +2,8 @@ package com.ydool.boot.modules.rddb.service;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray; import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ydool.boot.common.result.Ret; import com.ydool.boot.common.result.Ret;
import com.ydool.boot.core.service.BaseService; import com.ydool.boot.core.service.BaseService;
@ -65,7 +66,10 @@ public class ResearchArticleService extends BaseService<ResearchArticleMapper, R
if (StringUtils.isNotBlank(fileJson)) { if (StringUtils.isNotBlank(fileJson)) {
//之前指定的全删掉 //之前指定的全删掉
researchArticleAttachmentService.remove(new QueryWrapper<ResearchArticleAttachment>().eq("research_article_id", researchArticle.getId())); researchArticleAttachmentService.remove(new QueryWrapper<ResearchArticleAttachment>().eq("research_article_id", researchArticle.getId()));
List<ResearchArticleAttachment> researchArticleAttachments = JSONArray.parseArray(fileJson, ResearchArticleAttachment.class);
JSONArray objects = JSONUtil.parseArray(fileJson);
List<ResearchArticleAttachment> researchArticleAttachments = JSONUtil.toList(objects, ResearchArticleAttachment.class);
//重新指定 //重新指定
Iterator<ResearchArticleAttachment> iterator = researchArticleAttachments.iterator(); Iterator<ResearchArticleAttachment> iterator = researchArticleAttachments.iterator();
int sortNo = 1; int sortNo = 1;

View File

@ -5,7 +5,8 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -385,7 +386,8 @@ public class ReviewOfficerService extends BaseService<ReviewOfficerMapper, Revie
.eq(ReviewOfficerAttachment::getReviewId, reviewId) .eq(ReviewOfficerAttachment::getReviewId, reviewId)
.eq(ReviewOfficerAttachment::getType, state)); .eq(ReviewOfficerAttachment::getType, state));
if (StrUtil.isNotBlank(reviewAttachmentArrStr)) { if (StrUtil.isNotBlank(reviewAttachmentArrStr)) {
List<ReviewOfficerAttachment> reviewAttachmentList = JSONObject.parseArray(reviewAttachmentArrStr, ReviewOfficerAttachment.class); JSONArray objects = JSONUtil.parseArray(reviewAttachmentArrStr);
List<ReviewOfficerAttachment> reviewAttachmentList = JSONUtil.toList(objects, ReviewOfficerAttachment.class);
reviewAttachmentList.forEach(item -> { reviewAttachmentList.forEach(item -> {
item.setReviewId(reviewId); item.setReviewId(reviewId);
item.setType(state); item.setType(state);

View File

@ -4,7 +4,8 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ydool.boot.common.result.Ret; import com.ydool.boot.common.result.Ret;
@ -378,7 +379,8 @@ public class ReviewService extends BaseService<ReviewMapper, Review> {
.eq(ReviewAttachment::getReviewId, reviewId) .eq(ReviewAttachment::getReviewId, reviewId)
.eq(ReviewAttachment::getType, state)); .eq(ReviewAttachment::getType, state));
if (StrUtil.isNotBlank(reviewAttachmentArrStr)) { if (StrUtil.isNotBlank(reviewAttachmentArrStr)) {
List<ReviewAttachment> reviewAttachmentList = JSONObject.parseArray(reviewAttachmentArrStr, ReviewAttachment.class); JSONArray objects = JSONUtil.parseArray(reviewAttachmentArrStr);
List<ReviewAttachment> reviewAttachmentList = JSONUtil.toList(objects, ReviewAttachment.class);
reviewAttachmentList.forEach(item -> { reviewAttachmentList.forEach(item -> {
item.setReviewId(reviewId); item.setReviewId(reviewId);
item.setType(state); item.setType(state);

View File

@ -5,7 +5,8 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -385,7 +386,8 @@ public class ReviewSubjectService extends BaseService<ReviewSubjectMapper, Revie
.eq(ReviewSubjectAttachment::getReviewId, reviewId) .eq(ReviewSubjectAttachment::getReviewId, reviewId)
.eq(ReviewSubjectAttachment::getType, state)); .eq(ReviewSubjectAttachment::getType, state));
if (StrUtil.isNotBlank(reviewAttachmentArrStr)) { if (StrUtil.isNotBlank(reviewAttachmentArrStr)) {
List<ReviewSubjectAttachment> reviewAttachmentList = JSONObject.parseArray(reviewAttachmentArrStr, ReviewSubjectAttachment.class); JSONArray objects = JSONUtil.parseArray(reviewAttachmentArrStr);
List<ReviewSubjectAttachment> reviewAttachmentList = JSONUtil.toList(objects, ReviewSubjectAttachment.class);
reviewAttachmentList.forEach(item -> { reviewAttachmentList.forEach(item -> {
item.setReviewId(reviewId); item.setReviewId(reviewId);
item.setType(state); item.setType(state);

View File

@ -4,7 +4,8 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -248,7 +249,9 @@ public class ReviewSuperviseService extends BaseService<ReviewSuperviseMapper, R
private void saveAttachment(String reviewSuperviseId, String attachmentArrStr, User loginUser, String type) { private void saveAttachment(String reviewSuperviseId, String attachmentArrStr, User loginUser, String type) {
reviewSuperviseAttachmentService.remove(new LambdaQueryWrapper<ReviewSuperviseAttachment>().eq(ReviewSuperviseAttachment::getReviewSuperviseId, reviewSuperviseId).eq(ReviewSuperviseAttachment::getType, type)); reviewSuperviseAttachmentService.remove(new LambdaQueryWrapper<ReviewSuperviseAttachment>().eq(ReviewSuperviseAttachment::getReviewSuperviseId, reviewSuperviseId).eq(ReviewSuperviseAttachment::getType, type));
if (StrUtil.isNotBlank(attachmentArrStr)) { if (StrUtil.isNotBlank(attachmentArrStr)) {
List<ReviewSuperviseAttachment> attachmentList = JSONObject.parseArray(attachmentArrStr, ReviewSuperviseAttachment.class); JSONArray objects = JSONUtil.parseArray(attachmentArrStr);
List<ReviewSuperviseAttachment> attachmentList = JSONUtil.toList(objects, ReviewSuperviseAttachment.class);
attachmentList.forEach(item -> { attachmentList.forEach(item -> {
item.setReviewSuperviseId(reviewSuperviseId); item.setReviewSuperviseId(reviewSuperviseId);
item.setType(type); item.setType(type);

View File

@ -5,7 +5,8 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -14,7 +15,6 @@ import com.ydool.boot.core.exception.ResultException;
import com.ydool.boot.core.service.BaseService; import com.ydool.boot.core.service.BaseService;
import com.ydool.boot.modules.rddb.entity.*; import com.ydool.boot.modules.rddb.entity.*;
import com.ydool.boot.modules.rddb.entity.bo.ReviewWorkBo; import com.ydool.boot.modules.rddb.entity.bo.ReviewWorkBo;
import com.ydool.boot.modules.rddb.entity.request.review_work.ReviewWorkAuditRequest; import com.ydool.boot.modules.rddb.entity.request.review_work.ReviewWorkAuditRequest;
import com.ydool.boot.modules.rddb.entity.request.review_work.ReviewWorkCheckRequest; import com.ydool.boot.modules.rddb.entity.request.review_work.ReviewWorkCheckRequest;
import com.ydool.boot.modules.rddb.entity.request.review_work.ReviewWorkCommentRequest; import com.ydool.boot.modules.rddb.entity.request.review_work.ReviewWorkCommentRequest;
@ -386,7 +386,8 @@ public class ReviewWorkService extends BaseService<ReviewWorkMapper, ReviewWork>
.eq(ReviewWorkAttachment::getReviewId, reviewId) .eq(ReviewWorkAttachment::getReviewId, reviewId)
.eq(ReviewWorkAttachment::getType, state)); .eq(ReviewWorkAttachment::getType, state));
if (StrUtil.isNotBlank(reviewAttachmentArrStr)) { if (StrUtil.isNotBlank(reviewAttachmentArrStr)) {
List<ReviewWorkAttachment> reviewAttachmentList = JSONObject.parseArray(reviewAttachmentArrStr, ReviewWorkAttachment.class); JSONArray objects = JSONUtil.parseArray(reviewAttachmentArrStr);
List<ReviewWorkAttachment> reviewAttachmentList = JSONUtil.toList(objects, ReviewWorkAttachment.class);
reviewAttachmentList.forEach(item -> { reviewAttachmentList.forEach(item -> {
item.setReviewId(reviewId); item.setReviewId(reviewId);
item.setType(state); item.setType(state);

View File

@ -4,7 +4,8 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import cn.hutool.crypto.SecureUtil; import cn.hutool.crypto.SecureUtil;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject; import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ydool.boot.api.util.CodecUtils; import com.ydool.boot.api.util.CodecUtils;
import com.ydool.boot.api.util.Kv; import com.ydool.boot.api.util.Kv;
@ -49,22 +50,22 @@ public class SSOService extends BaseService<UserMapper, User> {
params.put("st",ticket); params.put("st",ticket);
params.put("datatype","json"); params.put("datatype","json");
String result = HttpUtil.get("https://appapi.zjzwfw.gov.cn/sso/servlet/simpleauth", params); String result = HttpUtil.get("https://appapi.zjzwfw.gov.cn/sso/servlet/simpleauth", params);
JSONObject jsonObject = JSONObject.parseObject(result); JSONObject jsonObject = JSONUtil.parseObj(result);
if("0".equals(jsonObject.getString("result"))){ if("0".equals(jsonObject.getStr("result"))){
params.remove("st"); params.remove("st");
params.put("method","getUserInfo"); params.put("method","getUserInfo");
params.put("token",jsonObject.getString("token")); params.put("token",jsonObject.getStr("token"));
String userInfo = HttpUtil.get("https://appapi.zjzwfw.gov.cn/sso/servlet/simpleauth", params); String userInfo = HttpUtil.get("https://appapi.zjzwfw.gov.cn/sso/servlet/simpleauth", params);
JSONObject userInfoObj = JSONObject.parseObject(userInfo); JSONObject userInfoObj = JSONUtil.parseObj(userInfo);
String userid = userInfoObj.getString("userid"); String userid = userInfoObj.getStr("userid");
User zlbUser = userService.getOne(new QueryWrapper<User>().eq("zlb_user_id", userid)); User zlbUser = userService.getOne(new QueryWrapper<User>().eq("zlb_user_id", userid));
if(zlbUser==null){ if(zlbUser==null){
String mobile = userInfoObj.getString("mobile"); String mobile = userInfoObj.getStr("mobile");
String encryptMobile = CodecUtils.encrypt(mobile); String encryptMobile = CodecUtils.encrypt(mobile);
zlbUser = userService.getOne(new QueryWrapper<User>().eq("login_name", encryptMobile)); zlbUser = userService.getOne(new QueryWrapper<User>().eq("login_name", encryptMobile));
if(zlbUser==null){ if(zlbUser==null){
String username = userInfoObj.getString("username"); String username = userInfoObj.getStr("username");
String sex = userInfoObj.getString("sex"); String sex = userInfoObj.getStr("sex");
if("0".equals(sex)) sex = "1"; if("0".equals(sex)) sex = "1";
if("1".equals(sex)) sex = "0"; if("1".equals(sex)) sex = "0";
zlbUser = new User(); zlbUser = new User();

View File

@ -1,7 +1,8 @@
package com.ydool.boot.modules.rddb.service; package com.ydool.boot.modules.rddb.service;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray; import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ydool.boot.common.result.Ret; import com.ydool.boot.common.result.Ret;
@ -178,7 +179,10 @@ public class SuperviseThingService extends BaseService<SuperviseThingMapper, Sup
if (StringUtils.isNotBlank(fileJson)) { if (StringUtils.isNotBlank(fileJson)) {
//之前指定的全删掉 //之前指定的全删掉
superviseThingAttachmentService.remove(new QueryWrapper<SuperviseThingAttachment>().eq("supervise_thing_id", superviseThing.getId())); superviseThingAttachmentService.remove(new QueryWrapper<SuperviseThingAttachment>().eq("supervise_thing_id", superviseThing.getId()));
List<SuperviseThingAttachment> SuperviseThingAttachments = JSONArray.parseArray(fileJson, SuperviseThingAttachment.class);
JSONArray objects = JSONUtil.parseArray(fileJson);
List<SuperviseThingAttachment> SuperviseThingAttachments = JSONUtil.toList(objects, SuperviseThingAttachment.class);
//重新指定 //重新指定
Iterator<SuperviseThingAttachment> iterator = SuperviseThingAttachments.iterator(); Iterator<SuperviseThingAttachment> iterator = SuperviseThingAttachments.iterator();
int sortNo = 1; int sortNo = 1;