|
@@ -1,80 +0,0 @@
|
|
|
-package com.yonge.cooleshow.admin.controller;
|
|
|
-
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
-import com.microsvc.toolkit.common.response.paging.PageInfo;
|
|
|
-import com.microsvc.toolkit.common.response.paging.QueryInfo;
|
|
|
-import com.microsvc.toolkit.common.response.template.R;
|
|
|
-import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
|
-import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
|
-import com.yonge.cooleshow.biz.dal.dto.search.SysMessageQueryInfo;
|
|
|
-import com.yonge.cooleshow.biz.dal.entity.SysMessage;
|
|
|
-import com.yonge.cooleshow.biz.dal.service.SysMessageService;
|
|
|
-import com.yonge.cooleshow.biz.dal.wrapper.SysMessageWrapper;
|
|
|
-import com.yonge.toolset.base.exception.BizException;
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.http.HttpStatus;
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
-import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
-import javax.annotation.Resource;
|
|
|
-import java.util.List;
|
|
|
-import java.util.regex.Matcher;
|
|
|
-import java.util.regex.Pattern;
|
|
|
-
|
|
|
-@Slf4j
|
|
|
-@Validated
|
|
|
-@RestController
|
|
|
-@RequestMapping("/sysMessage")
|
|
|
-@Api(tags = "系统消息表")
|
|
|
-public class SysMessageController {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private SysMessageService sysMessageService;
|
|
|
- @Resource
|
|
|
- private SysUserFeignService sysUserFeignService;
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询分页
|
|
|
- */
|
|
|
- @ApiOperation(value = "查询分页", notes = "传入SysMessageWrapper.SysMessageQuery")
|
|
|
- @PreAuthorize("@pcs.hasPermissions('sysMessage/page', {'BACKEND'})")
|
|
|
- @PostMapping("/page")
|
|
|
- public R<PageInfo<SysMessageWrapper.SysMessage>> page(@RequestBody SysMessageWrapper.SysMessageQuery query) {
|
|
|
- SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
- if (user == null || null == user.getId()) {
|
|
|
- throw new BizException(HttpStatus.FORBIDDEN.value(), "请登录");
|
|
|
- }
|
|
|
-
|
|
|
- // 用户消息
|
|
|
- SysMessageQueryInfo queryInfo = JSON.parseObject(query.jsonString(),
|
|
|
- SysMessageQueryInfo.class);
|
|
|
- com.yonge.toolset.base.page.PageInfo<SysMessage> pages = sysMessageService.queryPage(queryInfo);
|
|
|
-
|
|
|
- // 数据类型转换
|
|
|
- List<SysMessageWrapper.SysMessage> records = JSON.parseArray(JSON.toJSONString(pages.getRows()),
|
|
|
- SysMessageWrapper.SysMessage.class);
|
|
|
-
|
|
|
- Pattern pattern = Pattern.compile("验证码\\d+");
|
|
|
- records.forEach(next -> {
|
|
|
- String content = next.getContent();
|
|
|
- if (StringUtils.isNotEmpty(content)) {
|
|
|
- Matcher matcher = pattern.matcher(content);
|
|
|
- if (matcher.find()) {
|
|
|
- next.setVerityCode(matcher.group().replace("验证码", ""));
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- PageInfo<SysMessageWrapper.SysMessage> response = QueryInfo.pageInfo(QueryInfo.getPage(query), records);
|
|
|
- response.setTotal(pages.getTotal());
|
|
|
- return R.from(response);
|
|
|
- }
|
|
|
-
|
|
|
-}
|