refactor: 接口调整

This commit is contained in:
裴浩宇 2024-04-10 18:38:46 +08:00
parent 8fe5f81f1c
commit a078896306
8 changed files with 126 additions and 54 deletions

View File

@ -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<Map<String, Object>> 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<PxToDo> pxToDos = pxToDoService.selectPxToDoList(pxToDo);
result.put("todo", pxToDos);
// 情侣卡券
List<PxCardRecordVo> toDoCard = pxLoversCardService.getToDoCard();
result.put("card", toDoCard);
// 留言审核
PxLeaveMessage pxLeaveMessage = new PxLeaveMessage();
// 状态
pxLeaveMessage.setState("0");
List<PxLeaveMessage> leaveMessages = pxMessageService.selectPxLeaveMessageExamine(pxLeaveMessage);
result.put("message", leaveMessages);
// 友链审核
PxFriendLink pxFriendLink = new PxFriendLink();
// 状态
pxFriendLink.setStatus("0");
List<PxFriendLink> friendLinks = pxFriendLinkService.selectPxFriendLinkList(pxFriendLink);
result.put("link", friendLinks);
// 通知公告
SysNoticeRead sysNoticeRead = new SysNoticeRead();
sysNoticeRead.setCreateBy(SecurityUtils.getUserId().toString());
List<SysNotice> unreadNoticeList = noticeService.getUnreadNoticeList(sysNoticeRead);
result.put("notice", unreadNoticeList);
// 纪念日
List<PxCommemorationDay> commemorationDayList = pxCommemorationDayService.getCommemorationDayList(null);
result.put("commemoration", commemorationDayList);
return AjaxResult.success(result);
}
}

View File

@ -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));
}
}

View File

@ -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));
}
/**
* 导出情侣卡券列表
*/

View File

@ -58,7 +58,6 @@ public class SysNoticeController extends BaseController {
*/
@GetMapping("/getUnreadNoticeList")
public List<SysNotice> getUnreadNoticeList(SysNoticeRead sysNoticeRead) {
sysNoticeRead.setCreateBy(SecurityUtils.getUserId().toString());
return noticeService.getUnreadNoticeList(sysNoticeRead);
}

View File

@ -19,7 +19,7 @@ public interface PxCardRecordMapper {
* @param id 情侣卡使用记录ID
* @return 情侣卡使用记录
*/
public PxCardRecord selectPxCardRecordById(Long id);
public PxCardRecordVo selectPxCardRecordById(Long id);
/**
* 查询情侣卡使用记录列表

View File

@ -29,6 +29,13 @@ public interface IPxLoversCardService {
* @return 情侣卡券集合
*/
public List<PxLoversCard> selectPxLoversCardList(PxLoversCard pxLoversCard);
/**
* 查询情侣卡使用记录
*
* @param id 情侣卡使用记录ID
* @return 情侣卡使用记录
*/
public PxCardRecordVo selectPxCardRecordById(Long id);
/**
* 查询情侣卡券使用记录列表
*

View File

@ -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);
}
/**
* 查询情侣卡券使用记录列表
*

View File

@ -23,25 +23,6 @@
</resultMap>
<sql id="selectPxCardRecordVo">
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
</sql>
<select id="selectPxCardRecordList" parameterType="PxCardRecordVo" resultType="com.pnkx.domain.vo.PxCardRecordVo">
select r.id,
c.title cardName,
u.nick_name userName,
@ -61,6 +42,10 @@
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
</sql>
<select id="selectPxCardRecordList" parameterType="com.pnkx.domain.vo.PxCardRecordVo" resultType="com.pnkx.domain.vo.PxCardRecordVo">
<include refid="selectPxCardRecordVo"/>
<where>
<if test="cardName != null ">
and c.title like concat('%', #{cardName}, '%')
@ -79,9 +64,9 @@
</select>
<select id="selectPxCardRecordById" parameterType="Long"
resultMap="PxCardRecordResult">
resultType="com.pnkx.domain.vo.PxCardRecordVo">
<include refid="selectPxCardRecordVo"/>
where id = #{id}
where r.id = #{id}
</select>
<!--获取待处理的卡券-->