From e26eee87d0b9e1e2bba64d409a0b64f73435b113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A3=B4=E6=B5=A9=E5=AE=87?= <617594538@qq.com> Date: Thu, 23 May 2024 10:21:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=8E=B7=E5=8F=96=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E4=B8=9A=E5=8A=A1=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../blog/admin/PxAdminChatController.java | 6 +- .../blog/admin/PxAdminController.java | 6 +- .../web/controller/common/OpenController.java | 105 ++++++++++++++++++ .../web/controller/life/PxToDoController.java | 4 +- .../system/SysConfigController.java | 2 +- .../controller/system/SysDeptController.java | 2 +- .../system/SysDictDataController.java | 2 +- .../system/SysDictTypeController.java | 2 +- .../controller/system/SysMenuController.java | 2 +- .../system/SysNoticeController.java | 2 +- .../controller/system/SysPostController.java | 2 +- .../controller/system/SysRoleController.java | 2 +- .../controller/system/SysUserController.java | 2 +- .../service/impl/PxArticleServiceImpl.java | 4 +- .../service/impl/PxFriendLinkServiceImpl.java | 2 +- .../service/impl/PxLikeRecordServiceImpl.java | 2 +- .../service/impl/PxMessageServiceImpl.java | 4 +- .../pnkx/service/impl/PxPhotoServiceImpl.java | 2 +- .../pnkx/service/impl/PxVideoServiceImpl.java | 2 +- .../service/impl/PxVisitsServiceImpl.java | 2 +- .../com/pnkx/common/utils/SecurityUtils.java | 13 ++- .../impl/PxBookkeepingAccountServiceImpl.java | 8 +- ...xBookkeepingClassificationServiceImpl.java | 4 +- .../PxBookkeepingRecordModelServiceImpl.java | 4 +- .../impl/PxBookkeepingRecordServiceImpl.java | 4 +- .../service/impl/PxLoversCardServiceImpl.java | 4 +- .../impl/PxMenstruationRecordServiceImpl.java | 8 +- .../service/impl/PxNoteFolderServiceImpl.java | 6 +- .../pnkx/service/impl/PxNoteServiceImpl.java | 6 +- .../quartz/controller/SysJobController.java | 2 +- .../service/impl/SysAppServiceImpl.java | 4 +- .../service/impl/SysDictTypeServiceImpl.java | 2 +- .../service/impl/SysFileServiceImpl.java | 2 +- .../service/impl/SysNoticeServiceImpl.java | 2 +- 34 files changed, 169 insertions(+), 57 deletions(-) diff --git a/pnkx-admin/src/main/java/com/pnkx/web/controller/blog/admin/PxAdminChatController.java b/pnkx-admin/src/main/java/com/pnkx/web/controller/blog/admin/PxAdminChatController.java index 0ada106..f771ff8 100644 --- a/pnkx-admin/src/main/java/com/pnkx/web/controller/blog/admin/PxAdminChatController.java +++ b/pnkx-admin/src/main/java/com/pnkx/web/controller/blog/admin/PxAdminChatController.java @@ -66,9 +66,9 @@ public class PxAdminChatController { public AjaxResult signOut() { WebSocketMessage webSocketMessage = new WebSocketMessage(); webSocketMessage.setWebSocket(MessageType.LOG_OUT); - webSocketMessage.setUserId(SecurityUtils.getUserId().toString()); + webSocketMessage.setUserId(SecurityUtils.getUserId()); webSocketController.sendAllMessage(webSocketMessage); - pxChatMemberService.signOut(SecurityUtils.getUserId().toString()); + pxChatMemberService.signOut(SecurityUtils.getUserId()); return AjaxResult.success("退出成功"); } @@ -89,7 +89,7 @@ public class PxAdminChatController { pxChatMessage.setLocation(location); WebSocketMessage webSocketMessage = new WebSocketMessage(); webSocketMessage.setWebSocket(MessageType.CHAT_MESSAGE); - webSocketMessage.setUserId(SecurityUtils.getUserId().toString()); + webSocketMessage.setUserId(SecurityUtils.getUserId()); webSocketMessage.setMessage(pxChatMessage); webSocketController.sendAllMessage(webSocketMessage); return AjaxResult.success("发送成功", pxChatMessageService.sendMessage(pxChatMessage)); diff --git a/pnkx-admin/src/main/java/com/pnkx/web/controller/blog/admin/PxAdminController.java b/pnkx-admin/src/main/java/com/pnkx/web/controller/blog/admin/PxAdminController.java index ce25295..1916649 100644 --- a/pnkx-admin/src/main/java/com/pnkx/web/controller/blog/admin/PxAdminController.java +++ b/pnkx-admin/src/main/java/com/pnkx/web/controller/blog/admin/PxAdminController.java @@ -67,7 +67,7 @@ public class PxAdminController extends BaseController { // 文章列表 PxArticleVo pxArticle = new PxArticleVo(); pxArticle.setSearchValue(searchCode); - pxArticle.setCreateBy(SecurityUtils.getUserId().toString()); + pxArticle.setCreateBy(SecurityUtils.getUserId()); List pxArticles = pxArticleService.selectPxArticleNotContent(pxArticle); Map article = new HashMap<>(); article.put("label", "博客文章"); @@ -117,7 +117,7 @@ public class PxAdminController extends BaseController { // 待办事项TODO PxToDo pxToDo = new PxToDo(); // 创建人 - pxToDo.setCreateBy(SecurityUtils.getUserId().toString()); + pxToDo.setCreateBy(SecurityUtils.getUserId()); // 未完成 pxToDo.setStatus(false); // 结束时间 @@ -145,7 +145,7 @@ public class PxAdminController extends BaseController { // 通知公告 SysNoticeRead sysNoticeRead = new SysNoticeRead(); - sysNoticeRead.setCreateBy(SecurityUtils.getUserId().toString()); + sysNoticeRead.setCreateBy(SecurityUtils.getUserId()); List unreadNoticeList = noticeService.getUnreadNoticeList(sysNoticeRead); result.put("notice", unreadNoticeList); diff --git a/pnkx-admin/src/main/java/com/pnkx/web/controller/common/OpenController.java b/pnkx-admin/src/main/java/com/pnkx/web/controller/common/OpenController.java index 22ba1a2..ac52e73 100644 --- a/pnkx-admin/src/main/java/com/pnkx/web/controller/common/OpenController.java +++ b/pnkx-admin/src/main/java/com/pnkx/web/controller/common/OpenController.java @@ -5,12 +5,21 @@ import com.pnkx.common.core.controller.BaseController; import com.pnkx.common.core.domain.AjaxResult; import com.pnkx.common.enums.OperatorType; import com.pnkx.common.utils.ip.IpUtils; +import com.pnkx.domain.po.*; +import com.pnkx.domain.vo.PxArticleVo; +import com.pnkx.domain.vo.PxCardRecordVo; +import com.pnkx.service.*; import io.swagger.annotations.ApiOperation; +import org.apache.poi.ss.formula.functions.T; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.List; /** * 开放式接口Controller @@ -21,6 +30,32 @@ import javax.servlet.http.HttpServletRequest; @RestController @RequestMapping("/open") public class OpenController extends BaseController { + @Resource + private IPxArticleService pxArticleService; + @Resource + private IPxBookKeepingAccountService pxBookkeepingAccountService; + @Resource + private IPxBookkeepingClassificationService pxBookkeepingClassificationService; + @Resource + private IPxBookkeepingRecordService pxBookkeepingRecordService; + @Resource + private IPxLoversCardService pxLoversCardService; + @Resource + private IPxCommemorationDayService pxCommemorationDayService; + @Resource + private IPxDiaryService pxDiaryService; + @Resource + private IPxFriendLinkService pxFriendLinkService; + @Resource + private IPxMessageService pxMessageService; + @Resource + private IPxMenstruationRecordService pxMenstruationRecordService; + @Resource + private IPxNoteService pxNoteService; + @Resource + private IPxToDoService pxToDoService; + @Resource + private IPxVisitsService pxVisitsService; /** * 获取ip @@ -31,4 +66,74 @@ public class OpenController extends BaseController { public AjaxResult getIp(HttpServletRequest request) { return AjaxResult.success("获取IP成功!", IpUtils.getIpAddr(request)); } + + @ApiOperation("获取指定业务数据") + @Log(title = "获取指定业务数据", operatorType = OperatorType.MANAGE) + @GetMapping("/getSpecifyBusinessData/{businessType}") + public AjaxResult getSpecifyBusinessData(@PathVariable("businessType")String businessType) { + if (businessType == null) { + return AjaxResult.error("业务类型不能为空!"); + } + // 业务数据 + List list = new ArrayList<>(); + switch (businessType) { + case "article": + // 文章 + list = pxArticleService.selectPxArticleList(new PxArticle()); + break; + case "friend_link": + // 友链 + list = pxFriendLinkService.selectPxFriendLinkList(new PxFriendLink()); + break; + case "leave_message": + // 留言 + list = pxMessageService.selectPxLeaveMessageList(new PxLeaveMessage()); + break; + case "visits": + // 访客 + list = pxVisitsService.selectPxVisitsList(new PxVisits()); + break; + case "bookkeeping_account": + // 账本用户 + list = pxBookkeepingAccountService.selectPxBookkeepingAccountList(new PxBookkeepingAccount()); + break; + case "bookkeeping_classification": + // 账本分类 + list = pxBookkeepingClassificationService.selectPxBookkeepingClassificationList(new PxBookkeepingClassification()); + break; + case "bookkeeping_record": + // 账本记录 + list = pxBookkeepingRecordService.selectPxBookkeepingRecordList(new PxBookkeepingRecord()).getRows(); + break; + case "love_card": + // 情侣卡券 + list = pxLoversCardService.selectPxLoversCardList(new PxLoversCard()); + break; + case "card_record": + // 情侣卡券使用记录 + list = pxLoversCardService.selectPxLoversCardRecordList(new PxCardRecordVo()); + break; + case "commemoration_day": + // 纪念日 + list = pxCommemorationDayService.selectPxCommemorationDayList(new PxCommemorationDay()); + break; + case "diary": + // 日记 + list = pxDiaryService.selectPxDiaryList(new PxDiary()); + break; + case "menstruation_record": + // 姨妈助手记录 + list = pxMenstruationRecordService.selectMenstruationRecordList(new PxMenstruationRecord()); + break; + case "note": + // 笔记 + list = pxNoteService.selectPxNoteList(new PxNote()); + break; + case "to_do": + // 待办事项 + list = pxToDoService.selectPxToDoList(new PxToDo()); + break; + } + return AjaxResult.success("获取指定业务数据成功!", list); + } } diff --git a/pnkx-admin/src/main/java/com/pnkx/web/controller/life/PxToDoController.java b/pnkx-admin/src/main/java/com/pnkx/web/controller/life/PxToDoController.java index db64ae6..a1c5737 100644 --- a/pnkx-admin/src/main/java/com/pnkx/web/controller/life/PxToDoController.java +++ b/pnkx-admin/src/main/java/com/pnkx/web/controller/life/PxToDoController.java @@ -66,8 +66,8 @@ public class PxToDoController extends BaseController { @Log(title = "待办事项", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody PxToDo pxToDo) { - pxToDo.setCreateBy(SecurityUtils.getUserId().toString()); - pxToDo.setPerformer(SecurityUtils.getUserId().toString()); + pxToDo.setCreateBy(SecurityUtils.getUserId()); + pxToDo.setPerformer(SecurityUtils.getUserId()); return toAjax(pxToDoService.insertPxToDo(pxToDo)); } diff --git a/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysConfigController.java b/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysConfigController.java index 2c275c8..b12d3f1 100644 --- a/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysConfigController.java +++ b/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysConfigController.java @@ -79,7 +79,7 @@ public class SysConfigController extends BaseController { if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) { return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); } - config.setCreateBy(SecurityUtils.getUserId().toString()); + config.setCreateBy(SecurityUtils.getUserId()); return toAjax(configService.insertConfig(config)); } diff --git a/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysDeptController.java b/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysDeptController.java index 6594286..420bcba 100644 --- a/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysDeptController.java +++ b/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysDeptController.java @@ -99,7 +99,7 @@ public class SysDeptController extends BaseController { if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) { return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); } - dept.setCreateBy(SecurityUtils.getUserId().toString()); + dept.setCreateBy(SecurityUtils.getUserId()); return toAjax(deptService.insertDept(dept)); } diff --git a/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysDictDataController.java b/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysDictDataController.java index 052fe11..83e3b79 100644 --- a/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysDictDataController.java +++ b/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysDictDataController.java @@ -92,7 +92,7 @@ public class SysDictDataController extends BaseController { @Log(title = "字典数据", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@Validated @RequestBody SysDictData dict) { - dict.setCreateBy(SecurityUtils.getUserId().toString()); + dict.setCreateBy(SecurityUtils.getUserId()); return toAjax(dictDataService.insertDictData(dict)); } diff --git a/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysDictTypeController.java b/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysDictTypeController.java index 47a33d7..ad71f1f 100644 --- a/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysDictTypeController.java +++ b/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysDictTypeController.java @@ -66,7 +66,7 @@ public class SysDictTypeController extends BaseController { if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) { return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); } - dict.setCreateBy(SecurityUtils.getUserId().toString()); + dict.setCreateBy(SecurityUtils.getUserId()); return toAjax(dictTypeService.insertDictType(dict)); } diff --git a/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysMenuController.java b/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysMenuController.java index 90ee991..eb621a7 100644 --- a/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysMenuController.java +++ b/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysMenuController.java @@ -103,7 +103,7 @@ public class SysMenuController extends BaseController { && !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS)) { return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); } - menu.setCreateBy(SecurityUtils.getUserId().toString()); + menu.setCreateBy(SecurityUtils.getUserId()); return toAjax(menuService.insertMenu(menu)); } diff --git a/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysNoticeController.java b/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysNoticeController.java index bbf4d39..9d6b404 100644 --- a/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysNoticeController.java +++ b/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysNoticeController.java @@ -75,7 +75,7 @@ public class SysNoticeController extends BaseController { @Log(title = "通知公告", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@Validated @RequestBody SysNotice notice) { - notice.setCreateBy(SecurityUtils.getUserId().toString()); + notice.setCreateBy(SecurityUtils.getUserId()); int sysNotice = noticeService.insertNotice(notice); webSocketController.sendAllMessage(notice); return toAjax(sysNotice); diff --git a/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysPostController.java b/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysPostController.java index e0cc55c..8305983 100644 --- a/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysPostController.java +++ b/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysPostController.java @@ -71,7 +71,7 @@ public class SysPostController extends BaseController { } else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) { return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); } - post.setCreateBy(SecurityUtils.getUserId().toString()); + post.setCreateBy(SecurityUtils.getUserId()); return toAjax(postService.insertPost(post)); } diff --git a/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysRoleController.java b/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysRoleController.java index 518d179..c3f99b8 100644 --- a/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysRoleController.java +++ b/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysRoleController.java @@ -83,7 +83,7 @@ public class SysRoleController extends BaseController { } else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) { return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); } - role.setCreateBy(SecurityUtils.getUserId().toString()); + role.setCreateBy(SecurityUtils.getUserId()); return toAjax(roleService.insertRole(role)); } diff --git a/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysUserController.java b/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysUserController.java index 5b0322e..0c767a6 100644 --- a/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysUserController.java +++ b/pnkx-admin/src/main/java/com/pnkx/web/controller/system/SysUserController.java @@ -112,7 +112,7 @@ public class SysUserController extends BaseController { && UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) { return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); } - user.setCreateBy(SecurityUtils.getUserId().toString()); + user.setCreateBy(SecurityUtils.getUserId()); user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); return toAjax(userService.insertUser(user)); } diff --git a/pnkx-blog/src/main/java/com/pnkx/service/impl/PxArticleServiceImpl.java b/pnkx-blog/src/main/java/com/pnkx/service/impl/PxArticleServiceImpl.java index 87b4dac..798ddb4 100644 --- a/pnkx-blog/src/main/java/com/pnkx/service/impl/PxArticleServiceImpl.java +++ b/pnkx-blog/src/main/java/com/pnkx/service/impl/PxArticleServiceImpl.java @@ -79,7 +79,7 @@ public class PxArticleServiceImpl implements IPxArticleService { */ @Override public List selectPxArticleList(PxArticle pxArticle) { - pxArticle.setCreateBy(SecurityUtils.getUserId().toString()); + pxArticle.setCreateBy(SecurityUtils.getUserId()); return pxArticleMapper.selectPxArticleList(pxArticle); } @@ -92,7 +92,7 @@ public class PxArticleServiceImpl implements IPxArticleService { @Override public Integer insertPxArticle(PxArticleVo pxArticle) { pxArticle.setCreateTime(DateUtils.getNowDate()); - pxArticle.setCreateBy(SecurityUtils.getUserId().toString()); + pxArticle.setCreateBy(SecurityUtils.getUserId()); pxArticleMapper.insertPxArticle(pxArticle); return pxArticle.getId(); } diff --git a/pnkx-blog/src/main/java/com/pnkx/service/impl/PxFriendLinkServiceImpl.java b/pnkx-blog/src/main/java/com/pnkx/service/impl/PxFriendLinkServiceImpl.java index b5365e6..b6dc86d 100644 --- a/pnkx-blog/src/main/java/com/pnkx/service/impl/PxFriendLinkServiceImpl.java +++ b/pnkx-blog/src/main/java/com/pnkx/service/impl/PxFriendLinkServiceImpl.java @@ -58,7 +58,7 @@ public class PxFriendLinkServiceImpl implements IPxFriendLinkService { */ @Override public int insertPxFriendLink(PxFriendLink pxFriendLink) { - pxFriendLink.setCreateBy(SecurityUtils.getUserId().toString()); + pxFriendLink.setCreateBy(SecurityUtils.getUserId()); pxFriendLink.setCreateTime(DateUtils.getNowDate()); return pxFriendLinkMapper.insertPxFriendLink(pxFriendLink); } diff --git a/pnkx-blog/src/main/java/com/pnkx/service/impl/PxLikeRecordServiceImpl.java b/pnkx-blog/src/main/java/com/pnkx/service/impl/PxLikeRecordServiceImpl.java index 14ad7c5..b2751ff 100644 --- a/pnkx-blog/src/main/java/com/pnkx/service/impl/PxLikeRecordServiceImpl.java +++ b/pnkx-blog/src/main/java/com/pnkx/service/impl/PxLikeRecordServiceImpl.java @@ -49,7 +49,7 @@ public class PxLikeRecordServiceImpl implements IPxLikeRecordService { if (StringUtils.isNotNull(record)) { pxLikeRecordMapper.deletePxLikeRecordById(record.getId()); } else { - pxLikeRecord.setCreateBy(SecurityUtils.getUserId().toString()); + pxLikeRecord.setCreateBy(SecurityUtils.getUserId()); pxLikeRecord.setCreateTime(DateUtils.getNowDate()); pxLikeRecordMapper.insertPxLikeRecord(pxLikeRecord); } diff --git a/pnkx-blog/src/main/java/com/pnkx/service/impl/PxMessageServiceImpl.java b/pnkx-blog/src/main/java/com/pnkx/service/impl/PxMessageServiceImpl.java index 1e5bf35..682e650 100644 --- a/pnkx-blog/src/main/java/com/pnkx/service/impl/PxMessageServiceImpl.java +++ b/pnkx-blog/src/main/java/com/pnkx/service/impl/PxMessageServiceImpl.java @@ -46,7 +46,7 @@ public class PxMessageServiceImpl implements IPxMessageService { */ @Override public Integer addMessage(PxLeaveMessage pxLeaveMessage) { - pxLeaveMessage.setCreateBy(SecurityUtils.getUserId().toString()); + pxLeaveMessage.setCreateBy(SecurityUtils.getUserId()); pxLeaveMessage.setCreateTime(DateUtils.getNowDate()); pxLeaveMessage.setAvatar(SecurityUtils.getLoginUser().getUser().getAvatar()); Integer result = pxMessageMapper.addMessage(pxLeaveMessage); @@ -165,7 +165,7 @@ public class PxMessageServiceImpl implements IPxMessageService { */ @Override public int updatePxLeaveMessage(PxLeaveMessage pxLeaveMessage) { - pxLeaveMessage.setUpdateBy(SecurityUtils.getUserId().toString()); + pxLeaveMessage.setUpdateBy(SecurityUtils.getUserId()); pxLeaveMessage.setUpdateTime(DateUtils.getNowDate()); return pxMessageMapper.updatePxLeaveMessage(pxLeaveMessage); } diff --git a/pnkx-blog/src/main/java/com/pnkx/service/impl/PxPhotoServiceImpl.java b/pnkx-blog/src/main/java/com/pnkx/service/impl/PxPhotoServiceImpl.java index b23db23..b849a1f 100644 --- a/pnkx-blog/src/main/java/com/pnkx/service/impl/PxPhotoServiceImpl.java +++ b/pnkx-blog/src/main/java/com/pnkx/service/impl/PxPhotoServiceImpl.java @@ -64,7 +64,7 @@ public class PxPhotoServiceImpl implements IPxPhotoService { @Override public int insertPxPhoto(PxPhoto pxPhoto) { pxPhoto.setCreateTime(DateUtils.getNowDate()); - pxPhoto.setCreateBy(SecurityUtils.getUserId().toString()); + pxPhoto.setCreateBy(SecurityUtils.getUserId()); return pxPhotoMapper.insertPxPhoto(pxPhoto); } diff --git a/pnkx-blog/src/main/java/com/pnkx/service/impl/PxVideoServiceImpl.java b/pnkx-blog/src/main/java/com/pnkx/service/impl/PxVideoServiceImpl.java index 8fb74ca..abc30c8 100644 --- a/pnkx-blog/src/main/java/com/pnkx/service/impl/PxVideoServiceImpl.java +++ b/pnkx-blog/src/main/java/com/pnkx/service/impl/PxVideoServiceImpl.java @@ -54,7 +54,7 @@ public class PxVideoServiceImpl implements IPxVideoService { @Override public int insertPxVideo(PxVideo pxVideo) { pxVideo.setCreateTime(DateUtils.getNowDate()); - pxVideo.setCreateBy(SecurityUtils.getUserId().toString()); + pxVideo.setCreateBy(SecurityUtils.getUserId()); return pxVideoMapper.insertPxVideo(pxVideo); } diff --git a/pnkx-blog/src/main/java/com/pnkx/service/impl/PxVisitsServiceImpl.java b/pnkx-blog/src/main/java/com/pnkx/service/impl/PxVisitsServiceImpl.java index 97bd7cf..d773026 100644 --- a/pnkx-blog/src/main/java/com/pnkx/service/impl/PxVisitsServiceImpl.java +++ b/pnkx-blog/src/main/java/com/pnkx/service/impl/PxVisitsServiceImpl.java @@ -54,7 +54,7 @@ public class PxVisitsServiceImpl implements IPxVisitsService { public int insertPxVisits(PxVisits pxVisits) { pxVisits.setCreateTime(DateUtils.getNowDate()); try { - pxVisits.setCreateBy(SecurityUtils.getUserId().toString()); + pxVisits.setCreateBy(SecurityUtils.getUserId()); } catch (Exception e) { pxVisits.setCreateBy("游客"); } diff --git a/pnkx-common/src/main/java/com/pnkx/common/utils/SecurityUtils.java b/pnkx-common/src/main/java/com/pnkx/common/utils/SecurityUtils.java index 5651056..93b8994 100644 --- a/pnkx-common/src/main/java/com/pnkx/common/utils/SecurityUtils.java +++ b/pnkx-common/src/main/java/com/pnkx/common/utils/SecurityUtils.java @@ -1,5 +1,8 @@ package com.pnkx.common.utils; +import com.pnkx.common.core.controller.BaseController; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; @@ -13,6 +16,9 @@ import com.pnkx.common.exception.CustomException; * @author phy */ public class SecurityUtils { + + protected static final Logger logger = LoggerFactory.getLogger(SecurityUtils.class); + /** * 获取用户账户 **/ @@ -27,12 +33,13 @@ public class SecurityUtils { /** * 获取用户userId **/ - public static Long getUserId() { + public static String getUserId() { try { - return getLoginUser().getUser().getUserId(); + return getLoginUser().getUser().getUserId().toString(); } catch (Exception e) { - throw new CustomException("获取用户userId异常", HttpStatus.UNAUTHORIZED); + logger.error("获取用户userId异常"); } + return ""; } /** diff --git a/pnkx-life/src/main/java/com/pnkx/service/impl/PxBookkeepingAccountServiceImpl.java b/pnkx-life/src/main/java/com/pnkx/service/impl/PxBookkeepingAccountServiceImpl.java index dc55091..e9455a3 100644 --- a/pnkx-life/src/main/java/com/pnkx/service/impl/PxBookkeepingAccountServiceImpl.java +++ b/pnkx-life/src/main/java/com/pnkx/service/impl/PxBookkeepingAccountServiceImpl.java @@ -60,12 +60,12 @@ public class PxBookkeepingAccountServiceImpl implements IPxBookKeepingAccountSer @Override public int insertPxBookkeepingAccount(PxBookkeepingAccount pxBookkeepingAccount) { pxBookkeepingAccount.setCreateTime(DateUtils.getNowDate()); - pxBookkeepingAccount.setCreateBy(SecurityUtils.getUserId().toString()); + pxBookkeepingAccount.setCreateBy(SecurityUtils.getUserId()); int result = pxBookkeepingAccountMapper.insertPxBookkeepingAccount(pxBookkeepingAccount); PxBookkeepingRecord pxBookkeepingRecord = new PxBookkeepingRecord(); pxBookkeepingRecord.setType(1L); pxBookkeepingRecord.setCreateTime(DateUtils.getNowDate()); - pxBookkeepingRecord.setCreateBy(SecurityUtils.getUserId().toString()); + pxBookkeepingRecord.setCreateBy(SecurityUtils.getUserId()); pxBookkeepingRecord.setAccount(pxBookkeepingAccount.getId()); pxBookkeepingRecord.setMoney(pxBookkeepingAccount.getBalance()); pxBookkeepingRecord.setPayTime(DateUtils.getNowDate()); @@ -83,13 +83,13 @@ public class PxBookkeepingAccountServiceImpl implements IPxBookKeepingAccountSer @Override public int updatePxBookkeepingAccount(PxBookkeepingAccount pxBookkeepingAccount) { pxBookkeepingAccount.setUpdateTime(DateUtils.getNowDate()); - pxBookkeepingAccount.setUpdateBy(SecurityUtils.getUserId().toString()); + pxBookkeepingAccount.setUpdateBy(SecurityUtils.getUserId()); int result = pxBookkeepingAccountMapper.updatePxBookkeepingAccount(pxBookkeepingAccount); PxBookkeepingAccount oldPxBookkeepingAccount = pxBookkeepingAccountMapper.selectPxBookkeepingAccountById(pxBookkeepingAccount.getId()); PxBookkeepingRecord pxBookkeepingRecord = new PxBookkeepingRecord(); pxBookkeepingRecord.setType(1L); pxBookkeepingRecord.setCreateTime(DateUtils.getNowDate()); - pxBookkeepingRecord.setCreateBy(SecurityUtils.getUserId().toString()); + pxBookkeepingRecord.setCreateBy(SecurityUtils.getUserId()); pxBookkeepingRecord.setAccount(pxBookkeepingAccount.getId()); pxBookkeepingRecord.setMoney(String.valueOf(Float.parseFloat(pxBookkeepingAccount.getBalance()) - Float.parseFloat(oldPxBookkeepingAccount.getBalance()))); pxBookkeepingRecord.setPayTime(DateUtils.getNowDate()); diff --git a/pnkx-life/src/main/java/com/pnkx/service/impl/PxBookkeepingClassificationServiceImpl.java b/pnkx-life/src/main/java/com/pnkx/service/impl/PxBookkeepingClassificationServiceImpl.java index 75e4a73..9fd87ad 100644 --- a/pnkx-life/src/main/java/com/pnkx/service/impl/PxBookkeepingClassificationServiceImpl.java +++ b/pnkx-life/src/main/java/com/pnkx/service/impl/PxBookkeepingClassificationServiceImpl.java @@ -50,7 +50,7 @@ public class PxBookkeepingClassificationServiceImpl implements IPxBookkeepingCla @Override public int insertPxBookkeepingClassification(PxBookkeepingClassification pxBookkeepingClassification) { pxBookkeepingClassification.setCreateTime(DateUtils.getNowDate()); - pxBookkeepingClassification.setCreateBy(SecurityUtils.getUserId().toString()); + pxBookkeepingClassification.setCreateBy(SecurityUtils.getUserId()); return pxBookkeepingClassificationMapper.insertPxBookkeepingClassification(pxBookkeepingClassification); } @@ -63,7 +63,7 @@ public class PxBookkeepingClassificationServiceImpl implements IPxBookkeepingCla @Override public int updatePxBookkeepingClassification(PxBookkeepingClassification pxBookkeepingClassification) { pxBookkeepingClassification.setUpdateTime(DateUtils.getNowDate()); - pxBookkeepingClassification.setUpdateBy(SecurityUtils.getUserId().toString()); + pxBookkeepingClassification.setUpdateBy(SecurityUtils.getUserId()); return pxBookkeepingClassificationMapper.updatePxBookkeepingClassification(pxBookkeepingClassification); } diff --git a/pnkx-life/src/main/java/com/pnkx/service/impl/PxBookkeepingRecordModelServiceImpl.java b/pnkx-life/src/main/java/com/pnkx/service/impl/PxBookkeepingRecordModelServiceImpl.java index 937a7a0..0024379 100644 --- a/pnkx-life/src/main/java/com/pnkx/service/impl/PxBookkeepingRecordModelServiceImpl.java +++ b/pnkx-life/src/main/java/com/pnkx/service/impl/PxBookkeepingRecordModelServiceImpl.java @@ -55,7 +55,7 @@ public class PxBookkeepingRecordModelServiceImpl implements IPxBookkeepingRecord @Override public int insertPxBookkeepingRecordModel(PxBookkeepingRecordModel pxBookkeepingRecordModel) { pxBookkeepingRecordModel.setCreateTime(DateUtils.getNowDate()); - pxBookkeepingRecordModel.setCreateBy(SecurityUtils.getUserId().toString()); + pxBookkeepingRecordModel.setCreateBy(SecurityUtils.getUserId()); return pxBookkeepingRecordModelMapper.insertPxBookkeepingRecordModel(pxBookkeepingRecordModel); } @@ -68,7 +68,7 @@ public class PxBookkeepingRecordModelServiceImpl implements IPxBookkeepingRecord @Override public int updatePxBookkeepingRecordModel(PxBookkeepingRecordModel pxBookkeepingRecordModel) { pxBookkeepingRecordModel.setUpdateTime(DateUtils.getNowDate()); - pxBookkeepingRecordModel.setCreateBy(SecurityUtils.getUserId().toString()); + pxBookkeepingRecordModel.setCreateBy(SecurityUtils.getUserId()); return pxBookkeepingRecordModelMapper.updatePxBookkeepingRecordModel(pxBookkeepingRecordModel); } diff --git a/pnkx-life/src/main/java/com/pnkx/service/impl/PxBookkeepingRecordServiceImpl.java b/pnkx-life/src/main/java/com/pnkx/service/impl/PxBookkeepingRecordServiceImpl.java index 8600856..b085408 100644 --- a/pnkx-life/src/main/java/com/pnkx/service/impl/PxBookkeepingRecordServiceImpl.java +++ b/pnkx-life/src/main/java/com/pnkx/service/impl/PxBookkeepingRecordServiceImpl.java @@ -46,7 +46,7 @@ public class PxBookkeepingRecordServiceImpl implements IPxBookkeepingRecordServi @Override public int insertPxBookkeepingRecord(PxBookkeepingRecord pxBookkeepingRecord) { pxBookkeepingRecord.setCreateTime(DateUtils.getNowDate()); - pxBookkeepingRecord.setCreateBy(SecurityUtils.getUserId().toString()); + pxBookkeepingRecord.setCreateBy(SecurityUtils.getUserId()); return pxBookkeepingRecordMapper.insertPxBookkeepingRecord(pxBookkeepingRecord); } @@ -76,7 +76,7 @@ public class PxBookkeepingRecordServiceImpl implements IPxBookkeepingRecordServi @Override public int updatePxBookkeepingRecord(PxBookkeepingRecord pxBookkeepingRecord) { pxBookkeepingRecord.setUpdateTime(DateUtils.getNowDate()); - pxBookkeepingRecord.setUpdateBy(SecurityUtils.getUserId().toString()); + pxBookkeepingRecord.setUpdateBy(SecurityUtils.getUserId()); return pxBookkeepingRecordMapper.updatePxBookkeepingRecord(pxBookkeepingRecord); } diff --git a/pnkx-life/src/main/java/com/pnkx/service/impl/PxLoversCardServiceImpl.java b/pnkx-life/src/main/java/com/pnkx/service/impl/PxLoversCardServiceImpl.java index baf3613..bd2a345 100644 --- a/pnkx-life/src/main/java/com/pnkx/service/impl/PxLoversCardServiceImpl.java +++ b/pnkx-life/src/main/java/com/pnkx/service/impl/PxLoversCardServiceImpl.java @@ -86,7 +86,7 @@ public class PxLoversCardServiceImpl implements IPxLoversCardService { @Override public int insertPxLoversCard(PxLoversCard pxLoversCard) { int result = pxLoversCardMapper.insertPxLoversCard(pxLoversCard); - pxLoversCard.setCreateBy(SecurityUtils.getUserId().toString()); + pxLoversCard.setCreateBy(SecurityUtils.getUserId()); pxLoversCard.setCreateTime(DateUtils.getNowDate()); // 新增男关联 PxCardUser pxCardUserMan = new PxCardUser(); @@ -157,7 +157,7 @@ public class PxLoversCardServiceImpl implements IPxLoversCardService { @Override public int useCard(PxCardRecord pxCardRecord) { pxCardRecord.setUserId(SecurityUtils.getLoginUser().getUser().getUserId()); - pxCardRecord.setCreateBy(SecurityUtils.getUserId().toString()); + pxCardRecord.setCreateBy(SecurityUtils.getUserId()); pxCardRecord.setCreateTime(DateUtils.getNowDate()); pxCardRecordMapper.insertPxCardRecord(pxCardRecord); return pxCardUserMapper.useCard(pxCardRecord); diff --git a/pnkx-life/src/main/java/com/pnkx/service/impl/PxMenstruationRecordServiceImpl.java b/pnkx-life/src/main/java/com/pnkx/service/impl/PxMenstruationRecordServiceImpl.java index d445891..16f2364 100644 --- a/pnkx-life/src/main/java/com/pnkx/service/impl/PxMenstruationRecordServiceImpl.java +++ b/pnkx-life/src/main/java/com/pnkx/service/impl/PxMenstruationRecordServiceImpl.java @@ -42,7 +42,7 @@ public class PxMenstruationRecordServiceImpl implements IPxMenstruationRecordSer */ @Override public List selectPxMenstruationRecordList(PxMenstruationRecord pxMenstruationRecord) { - pxMenstruationRecord.setUserId(SecurityUtils.getUserId()); + pxMenstruationRecord.setUserId(Long.valueOf(SecurityUtils.getUserId())); return pxMenstruationRecordMapper.selectPxMenstruationRecordList(pxMenstruationRecord); } @@ -54,7 +54,7 @@ public class PxMenstruationRecordServiceImpl implements IPxMenstruationRecordSer */ @Override public List getPxMenstruationRecordList(PxMenstruationRecord pxMenstruationRecord) { - pxMenstruationRecord.setUserId(SecurityUtils.getUserId()); + pxMenstruationRecord.setUserId(Long.valueOf(SecurityUtils.getUserId())); return pxMenstruationRecordMapper.getPxMenstruationRecordList(pxMenstruationRecord); } @@ -67,7 +67,7 @@ public class PxMenstruationRecordServiceImpl implements IPxMenstruationRecordSer @Override public int insertPxMenstruationRecord(PxMenstruationRecord pxMenstruationRecord) { pxMenstruationRecord.setCreateTime(DateUtils.getNowDate()); - pxMenstruationRecord.setCreateBy(SecurityUtils.getUserId().toString()); + pxMenstruationRecord.setCreateBy(SecurityUtils.getUserId()); return pxMenstruationRecordMapper.insertPxMenstruationRecord(pxMenstruationRecord); } @@ -80,7 +80,7 @@ public class PxMenstruationRecordServiceImpl implements IPxMenstruationRecordSer @Override public int updatePxMenstruationRecord(PxMenstruationRecord pxMenstruationRecord) { pxMenstruationRecord.setUpdateTime(DateUtils.getNowDate()); - pxMenstruationRecord.setUpdateBy(SecurityUtils.getUserId().toString()); + pxMenstruationRecord.setUpdateBy(SecurityUtils.getUserId()); return pxMenstruationRecordMapper.updatePxMenstruationRecord(pxMenstruationRecord); } diff --git a/pnkx-life/src/main/java/com/pnkx/service/impl/PxNoteFolderServiceImpl.java b/pnkx-life/src/main/java/com/pnkx/service/impl/PxNoteFolderServiceImpl.java index caf9b40..5a12f08 100644 --- a/pnkx-life/src/main/java/com/pnkx/service/impl/PxNoteFolderServiceImpl.java +++ b/pnkx-life/src/main/java/com/pnkx/service/impl/PxNoteFolderServiceImpl.java @@ -70,9 +70,9 @@ public class PxNoteFolderServiceImpl implements IPxNoteFolderService { @Override public PxNoteFolder insertPxNoteFolder(PxNoteFolder pxNoteFolder) { pxNoteFolder.setCreateTime(DateUtils.getNowDate()); - pxNoteFolder.setCreateBy(SecurityUtils.getUserId().toString()); + pxNoteFolder.setCreateBy(SecurityUtils.getUserId()); pxNoteFolder.setUpdateTime(DateUtils.getNowDate()); - pxNoteFolder.setUpdateBy(SecurityUtils.getUserId().toString()); + pxNoteFolder.setUpdateBy(SecurityUtils.getUserId()); pxNoteFolderMapper.insertPxNoteFolder(pxNoteFolder); return pxNoteFolder; } @@ -86,7 +86,7 @@ public class PxNoteFolderServiceImpl implements IPxNoteFolderService { @Override public PxNoteFolder updatePxNoteFolder(PxNoteFolder pxNoteFolder) { pxNoteFolder.setUpdateTime(DateUtils.getNowDate()); - pxNoteFolder.setUpdateBy(SecurityUtils.getUserId().toString()); + pxNoteFolder.setUpdateBy(SecurityUtils.getUserId()); pxNoteFolderMapper.updatePxNoteFolder(pxNoteFolder); return pxNoteFolder; } diff --git a/pnkx-life/src/main/java/com/pnkx/service/impl/PxNoteServiceImpl.java b/pnkx-life/src/main/java/com/pnkx/service/impl/PxNoteServiceImpl.java index cab23ab..1d997c8 100644 --- a/pnkx-life/src/main/java/com/pnkx/service/impl/PxNoteServiceImpl.java +++ b/pnkx-life/src/main/java/com/pnkx/service/impl/PxNoteServiceImpl.java @@ -55,9 +55,9 @@ public class PxNoteServiceImpl implements IPxNoteService { @Override public PxNote insertPxNote(PxNote pxNote) { pxNote.setCreateTime(DateUtils.getNowDate()); - pxNote.setCreateBy(SecurityUtils.getUserId().toString()); + pxNote.setCreateBy(SecurityUtils.getUserId()); pxNote.setUpdateTime(DateUtils.getNowDate()); - pxNote.setUpdateBy(SecurityUtils.getUserId().toString()); + pxNote.setUpdateBy(SecurityUtils.getUserId()); pxNoteMapper.insertPxNote(pxNote); return pxNote; } @@ -71,7 +71,7 @@ public class PxNoteServiceImpl implements IPxNoteService { @Override public PxNote updatePxNote(PxNote pxNote) { pxNote.setUpdateTime(DateUtils.getNowDate()); - pxNote.setUpdateBy(SecurityUtils.getUserId().toString()); + pxNote.setUpdateBy(SecurityUtils.getUserId()); pxNoteMapper.updatePxNote(pxNote); return pxNote; } diff --git a/pnkx-quartz/src/main/java/com/pnkx/quartz/controller/SysJobController.java b/pnkx-quartz/src/main/java/com/pnkx/quartz/controller/SysJobController.java index 39192cd..4537194 100644 --- a/pnkx-quartz/src/main/java/com/pnkx/quartz/controller/SysJobController.java +++ b/pnkx-quartz/src/main/java/com/pnkx/quartz/controller/SysJobController.java @@ -73,7 +73,7 @@ public class SysJobController extends BaseController { if (!CronUtils.isValid(sysJob.getCronExpression())) { return AjaxResult.error("cron表达式不正确"); } - sysJob.setCreateBy(SecurityUtils.getUserId().toString()); + sysJob.setCreateBy(SecurityUtils.getUserId()); return toAjax(jobService.insertJob(sysJob)); } diff --git a/pnkx-system/src/main/java/com/pnkx/system/service/impl/SysAppServiceImpl.java b/pnkx-system/src/main/java/com/pnkx/system/service/impl/SysAppServiceImpl.java index 59625ad..1b6ec18 100644 --- a/pnkx-system/src/main/java/com/pnkx/system/service/impl/SysAppServiceImpl.java +++ b/pnkx-system/src/main/java/com/pnkx/system/service/impl/SysAppServiceImpl.java @@ -64,7 +64,7 @@ public class SysAppServiceImpl implements ISysAppService { @Override public int insertAppUpdateLog(SysAppUpdateLog appUpdateLog) { appUpdateLog.setCreateTime(DateUtils.getNowDate()); - appUpdateLog.setCreateBy(SecurityUtils.getUserId().toString()); + appUpdateLog.setCreateBy(SecurityUtils.getUserId()); return sysAppMapper.insertAppUpdateLog(appUpdateLog); } @@ -77,7 +77,7 @@ public class SysAppServiceImpl implements ISysAppService { @Override public int updateAppUpdateLog(SysAppUpdateLog appUpdateLog) { appUpdateLog.setUpdateTime(DateUtils.getNowDate()); - appUpdateLog.setUpdateBy(SecurityUtils.getUserId().toString()); + appUpdateLog.setUpdateBy(SecurityUtils.getUserId()); return sysAppMapper.updateAppUpdateLog(appUpdateLog); } diff --git a/pnkx-system/src/main/java/com/pnkx/system/service/impl/SysDictTypeServiceImpl.java b/pnkx-system/src/main/java/com/pnkx/system/service/impl/SysDictTypeServiceImpl.java index 2793033..125b12f 100644 --- a/pnkx-system/src/main/java/com/pnkx/system/service/impl/SysDictTypeServiceImpl.java +++ b/pnkx-system/src/main/java/com/pnkx/system/service/impl/SysDictTypeServiceImpl.java @@ -195,7 +195,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService { { SysDictData sysDictData = new SysDictData(); sysDictData.setDictType(dictType); - sysDictData.setCreateBy(SecurityUtils.getUserId().toString()); + sysDictData.setCreateBy(SecurityUtils.getUserId()); return dictDataMapper.selectDictTypeByLogin(sysDictData); } } diff --git a/pnkx-system/src/main/java/com/pnkx/system/service/impl/SysFileServiceImpl.java b/pnkx-system/src/main/java/com/pnkx/system/service/impl/SysFileServiceImpl.java index 2bd7d84..4ad75d8 100644 --- a/pnkx-system/src/main/java/com/pnkx/system/service/impl/SysFileServiceImpl.java +++ b/pnkx-system/src/main/java/com/pnkx/system/service/impl/SysFileServiceImpl.java @@ -103,7 +103,7 @@ public class SysFileServiceImpl implements ISysFileService { */ @Override public int insertSysFile(SysFile sysFile) { - sysFile.setCreateBy(SecurityUtils.getUserId().toString()); + sysFile.setCreateBy(SecurityUtils.getUserId()); sysFile.setCreateTime(DateUtils.getNowDate()); return sysFileMapper.insertSysFile(sysFile); } diff --git a/pnkx-system/src/main/java/com/pnkx/system/service/impl/SysNoticeServiceImpl.java b/pnkx-system/src/main/java/com/pnkx/system/service/impl/SysNoticeServiceImpl.java index 44dcdbe..8922f51 100644 --- a/pnkx-system/src/main/java/com/pnkx/system/service/impl/SysNoticeServiceImpl.java +++ b/pnkx-system/src/main/java/com/pnkx/system/service/impl/SysNoticeServiceImpl.java @@ -41,7 +41,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService { SysNoticeRead sysNoticeRead = new SysNoticeRead(); sysNoticeRead.setNoticeId(noticeId); try { - sysNoticeRead.setCreateBy(SecurityUtils.getUserId().toString()); + sysNoticeRead.setCreateBy(SecurityUtils.getUserId()); } catch (Exception e) { sysNoticeRead.setCreateBy(null); }