From a078896306ec249a7d7e937b822f79e8290fa402 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A3=B4=E6=B5=A9=E5=AE=87?= <617594538@qq.com> Date: Wed, 10 Apr 2024 18:38:46 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=8E=A5=E5=8F=A3=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../blog/admin/PxAdminController.java | 87 ++++++++++++++++--- .../life/PxAppHomepageController.java | 3 +- .../life/PxLoversCardController.java | 8 ++ .../system/SysNoticeController.java | 1 - .../com/pnkx/mapper/PxCardRecordMapper.java | 2 +- .../pnkx/service/IPxLoversCardService.java | 7 ++ .../service/impl/PxLoversCardServiceImpl.java | 11 +++ .../resources/mapper/PxCardRecordMapper.xml | 61 +++++-------- 8 files changed, 126 insertions(+), 54 deletions(-) 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 fa8974c..58cba8e 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 @@ -1,23 +1,25 @@ package com.pnkx.web.controller.blog.admin; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.pnkx.common.core.controller.BaseController; import com.pnkx.common.core.domain.AjaxResult; +import com.pnkx.common.utils.DateUtils; import com.pnkx.common.utils.SecurityUtils; -import com.pnkx.domain.po.PxBookkeepingRecord; -import com.pnkx.domain.po.PxDiary; -import com.pnkx.domain.po.PxNoteFolder; -import com.pnkx.domain.po.PxToDo; +import com.pnkx.domain.po.*; import com.pnkx.domain.vo.PxArticleVo; +import com.pnkx.domain.vo.PxCardRecordVo; import com.pnkx.service.*; +import com.pnkx.system.domain.SysNotice; +import com.pnkx.system.domain.SysNoticeRead; +import com.pnkx.system.service.ISysNoticeService; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.stream.Stream; /** * 管理端controller @@ -30,21 +32,31 @@ import java.util.Map; public class PxAdminController extends BaseController { @Resource - IPxArticleService pxArticleService; + private IPxArticleService pxArticleService; @Resource - IPxToDoService pxToDoService; + private IPxToDoService pxToDoService; @Resource - IPxBookkeepingRecordService pxBookkeepingRecordService; + private IPxBookkeepingRecordService pxBookkeepingRecordService; @Resource - IPxDiaryService pxDiaryService; + private IPxDiaryService pxDiaryService; @Resource private IPxNoteFolderService pxNoteFolderService; + @Resource + private IPxLoversCardService pxLoversCardService; + @Resource + private IPxMessageService pxMessageService; + @Resource + private IPxFriendLinkService pxFriendLinkService; + @Resource + private ISysNoticeService noticeService; + @Resource + private IPxCommemorationDayService pxCommemorationDayService; /** * 全文检索 */ @GetMapping("/fullRetrieval") public AjaxResult retrieval(String searchCode) { - logger.info("全文检索-检索条件为:" + searchCode); + logger.info("全文检索-检索条件为:{}", searchCode); List> result = new ArrayList<>(); // 文章列表 PxArticleVo pxArticle = new PxArticleVo(); @@ -87,4 +99,53 @@ public class PxAdminController extends BaseController { result.add(note); return AjaxResult.success(result); } + + /** + * 获取所有代办 + */ + @GetMapping("/getAllToDo") + public AjaxResult getAllToDo() { + // 所有的待办 + JSONObject result = new JSONObject(); + + // 待办事项TODO + PxToDo pxToDo = new PxToDo(); + // 创建人 + pxToDo.setCreateBy(SecurityUtils.getUserId().toString()); + // 未完成 + pxToDo.setStatus(false); + // 结束时间 + pxToDo.setPlanEndTime(DateUtils.getTime()); + List pxToDos = pxToDoService.selectPxToDoList(pxToDo); + result.put("todo", pxToDos); + + // 情侣卡券 + List toDoCard = pxLoversCardService.getToDoCard(); + result.put("card", toDoCard); + + // 留言审核 + PxLeaveMessage pxLeaveMessage = new PxLeaveMessage(); + // 状态 + pxLeaveMessage.setState("0"); + List leaveMessages = pxMessageService.selectPxLeaveMessageExamine(pxLeaveMessage); + result.put("message", leaveMessages); + + // 友链审核 + PxFriendLink pxFriendLink = new PxFriendLink(); + // 状态 + pxFriendLink.setStatus("0"); + List friendLinks = pxFriendLinkService.selectPxFriendLinkList(pxFriendLink); + result.put("link", friendLinks); + + // 通知公告 + SysNoticeRead sysNoticeRead = new SysNoticeRead(); + sysNoticeRead.setCreateBy(SecurityUtils.getUserId().toString()); + List unreadNoticeList = noticeService.getUnreadNoticeList(sysNoticeRead); + result.put("notice", unreadNoticeList); + + // 纪念日 + List commemorationDayList = pxCommemorationDayService.getCommemorationDayList(null); + result.put("commemoration", commemorationDayList); + return AjaxResult.success(result); + } } diff --git a/pnkx-admin/src/main/java/com/pnkx/web/controller/life/PxAppHomepageController.java b/pnkx-admin/src/main/java/com/pnkx/web/controller/life/PxAppHomepageController.java index b32e545..96fdb1f 100644 --- a/pnkx-admin/src/main/java/com/pnkx/web/controller/life/PxAppHomepageController.java +++ b/pnkx-admin/src/main/java/com/pnkx/web/controller/life/PxAppHomepageController.java @@ -3,6 +3,7 @@ package com.pnkx.web.controller.life; import com.pnkx.common.core.controller.BaseController; import com.pnkx.common.core.domain.AjaxResult; import com.pnkx.domain.po.PxCommemorationDay; +import com.pnkx.domain.po.PxMenstruationRecord; import com.pnkx.service.IPxCommemorationDayService; import com.pnkx.service.IPxMenstruationRecordService; import org.springframework.web.bind.annotation.GetMapping; @@ -38,7 +39,7 @@ public class PxAppHomepageController extends BaseController { * APP首页获取姨妈提醒列表 */ @GetMapping("/selectMenstruationRecordList") - public AjaxResult selectMenstruationRecordList(com.pnkx.domain.po.PxMenstruationRecord pxMenstruationRecord) { + public AjaxResult selectMenstruationRecordList(PxMenstruationRecord pxMenstruationRecord) { return AjaxResult.success("获取首页姨妈提醒列表成功", pxMenstruationRecordService.selectMenstruationRecordList(pxMenstruationRecord)); } } diff --git a/pnkx-admin/src/main/java/com/pnkx/web/controller/life/PxLoversCardController.java b/pnkx-admin/src/main/java/com/pnkx/web/controller/life/PxLoversCardController.java index 3ca280e..4a7883b 100644 --- a/pnkx-admin/src/main/java/com/pnkx/web/controller/life/PxLoversCardController.java +++ b/pnkx-admin/src/main/java/com/pnkx/web/controller/life/PxLoversCardController.java @@ -47,6 +47,14 @@ public class PxLoversCardController extends BaseController { return getDataTable(list); } + /** + * 查询情侣卡券使用记录 + */ + @GetMapping("/record/{id}") + public AjaxResult getRecordById(@PathVariable("id") Long id) { + return AjaxResult.success(pxLoversCardService.selectPxCardRecordById(id)); + } + /** * 导出情侣卡券列表 */ 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 6c32c2d..bbf4d39 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 @@ -58,7 +58,6 @@ public class SysNoticeController extends BaseController { */ @GetMapping("/getUnreadNoticeList") public List getUnreadNoticeList(SysNoticeRead sysNoticeRead) { - sysNoticeRead.setCreateBy(SecurityUtils.getUserId().toString()); return noticeService.getUnreadNoticeList(sysNoticeRead); } diff --git a/pnkx-life/src/main/java/com/pnkx/mapper/PxCardRecordMapper.java b/pnkx-life/src/main/java/com/pnkx/mapper/PxCardRecordMapper.java index 5d6d186..2836c46 100644 --- a/pnkx-life/src/main/java/com/pnkx/mapper/PxCardRecordMapper.java +++ b/pnkx-life/src/main/java/com/pnkx/mapper/PxCardRecordMapper.java @@ -19,7 +19,7 @@ public interface PxCardRecordMapper { * @param id 情侣卡使用记录ID * @return 情侣卡使用记录 */ - public PxCardRecord selectPxCardRecordById(Long id); + public PxCardRecordVo selectPxCardRecordById(Long id); /** * 查询情侣卡使用记录列表 diff --git a/pnkx-life/src/main/java/com/pnkx/service/IPxLoversCardService.java b/pnkx-life/src/main/java/com/pnkx/service/IPxLoversCardService.java index fcfa7ee..39b715f 100644 --- a/pnkx-life/src/main/java/com/pnkx/service/IPxLoversCardService.java +++ b/pnkx-life/src/main/java/com/pnkx/service/IPxLoversCardService.java @@ -29,6 +29,13 @@ public interface IPxLoversCardService { * @return 情侣卡券集合 */ public List selectPxLoversCardList(PxLoversCard pxLoversCard); + /** + * 查询情侣卡使用记录 + * + * @param id 情侣卡使用记录ID + * @return 情侣卡使用记录 + */ + public PxCardRecordVo selectPxCardRecordById(Long id); /** * 查询情侣卡券使用记录列表 * 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 fd6c8d3..baf3613 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 @@ -54,6 +54,17 @@ public class PxLoversCardServiceImpl implements IPxLoversCardService { return pxLoversCardMapper.selectPxLoversCardList(pxLoversCard); } + /** + * 查询情侣卡使用记录 + * + * @param id 情侣卡使用记录ID + * @return 情侣卡使用记录 + */ + @Override + public PxCardRecordVo selectPxCardRecordById(Long id) { + return pxCardRecordMapper.selectPxCardRecordById(id); + } + /** * 查询情侣卡券使用记录列表 * diff --git a/pnkx-life/src/main/resources/mapper/PxCardRecordMapper.xml b/pnkx-life/src/main/resources/mapper/PxCardRecordMapper.xml index 4c2a5fe..23a1320 100644 --- a/pnkx-life/src/main/resources/mapper/PxCardRecordMapper.xml +++ b/pnkx-life/src/main/resources/mapper/PxCardRecordMapper.xml @@ -23,44 +23,29 @@ - select id, - card_id, - user_id, - instructions, - confirm, - confirm_time, - score, - score_time, - del_flag, - version, - create_by, - create_time, - update_by, - update_time, - remark - from px_card_record + select r.id, + c.title cardName, + u.nick_name userName, + r.card_id cardId, + r.user_id userId, + r.instructions, + r.confirm, + r.confirm_time confirmTime, + r.score, + r.score_time scoreTime, + r.del_flag delFlag, + r.version, + r.create_by createBy, + r.create_time createTime, + r.update_by updateBy, + r.update_time updateTime, + r.remark + from px_card_record r left join px_lovers_card c on r.card_id = c.id + left join sys_user u on r.user_id = u.user_id - + and c.title like concat('%', #{cardName}, '%') @@ -79,9 +64,9 @@