手机端-最近浏览功能开发。
This commit is contained in:
@@ -647,3 +647,16 @@ ALTER TABLE `project_task_planning`
|
||||
|
||||
-- 工作流数据库-增加固定数据 2023-05-17 未同步生产环境
|
||||
INSERT INTO `t_form`(`OBJECT_ID`, `CODE`, `CREATE_TIME`, `WIDGET_JSON`, `JSON`, `NAME`, `SHOW_KEY`, `IS_DELETED`, `MODEL_ID`, `JSON_EVAL`, `HTML`, `RUN_TYPE`, `CATEGORY_ID`, `HTML_READONLY`) VALUES ('xgjfwlc', '0007', '2023-05-17 13:52:26', NULL, NULL, '修改交付物流程', NULL, 0, '15007', NULL, NULL, 'json', '4bdf0b396b4aa6ea10dd5e19956a1e22', NULL);
|
||||
|
||||
-- 最近浏览表 2023-06-08 未同步生产环境
|
||||
CREATE TABLE `recent_browse` (
|
||||
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`create_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime NULL DEFAULT NULL COMMENT '创建日期',
|
||||
`update_by` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime NULL DEFAULT NULL COMMENT '更新日期',
|
||||
`sys_org_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属部门',
|
||||
`browse_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '浏览类型',
|
||||
`browse_data_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '浏览数据id',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '最近浏览' ROW_FORMAT = Dynamic;
|
||||
+163
@@ -0,0 +1,163 @@
|
||||
package com.jero.modules.phone.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.modules.phone.entity.RecentBrowse;
|
||||
import com.jero.modules.phone.service.IRecentBrowseService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 最近浏览表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-06-08
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="最近浏览表")
|
||||
@RestController
|
||||
@RequestMapping("/phone/recentBrowse")
|
||||
@Slf4j
|
||||
public class RecentBrowseController extends JeroController<RecentBrowse, IRecentBrowseService> {
|
||||
@Autowired
|
||||
private IRecentBrowseService recentBrowseService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param recentBrowse
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "最近浏览表-分页列表查询")
|
||||
@ApiOperation(value="最近浏览表-分页列表查询", notes="最近浏览表-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(RecentBrowse recentBrowse,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
return this.recentBrowseService.queryPageList(recentBrowse,pageNo,pageSize,req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "最近浏览表-列表查询")
|
||||
@ApiOperation(value="最近浏览表-列表查询", notes="最近浏览表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<RecentBrowse>> queryList() {
|
||||
List<RecentBrowse> list = recentBrowseService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param recentBrowse
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "最近浏览表-添加")
|
||||
@ApiOperation(value="最近浏览表-添加", notes="最近浏览表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody RecentBrowse recentBrowse) {
|
||||
recentBrowseService.add(recentBrowse);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param recentBrowse
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "最近浏览表-编辑")
|
||||
@ApiOperation(value="最近浏览表-编辑", notes="最近浏览表-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody RecentBrowse recentBrowse) {
|
||||
recentBrowseService.editById(recentBrowse);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "最近浏览表-通过id删除")
|
||||
@ApiOperation(value="最近浏览表-通过id删除", notes="最近浏览表-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
recentBrowseService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "最近浏览表-批量删除")
|
||||
@ApiOperation(value="最近浏览表-批量删除", notes="最近浏览表-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.recentBrowseService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "最近浏览表-通过id查询")
|
||||
@ApiOperation(value="最近浏览表-通过id查询", notes="最近浏览表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
RecentBrowse recentBrowse = recentBrowseService.queryById(id);
|
||||
if(recentBrowse==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(recentBrowse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param recentBrowse
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, RecentBrowse recentBrowse) {
|
||||
return super.exportXls(request, recentBrowse, RecentBrowse.class, "最近浏览表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, RecentBrowse.class);
|
||||
}
|
||||
|
||||
}
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
package com.jero.modules.phone.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 最近浏览表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-06-08
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("recent_browse")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="recent_browse对象", description="最近浏览表")
|
||||
public class RecentBrowse implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private java.lang.String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
|
||||
/**浏览类型*/
|
||||
@Excel(name = "浏览类型", width = 15)
|
||||
@ApiModelProperty(value = "浏览类型")
|
||||
private java.lang.String browseType;
|
||||
|
||||
/**浏览数据id*/
|
||||
@Excel(name = "浏览数据id", width = 15)
|
||||
@ApiModelProperty(value = "浏览数据id")
|
||||
private java.lang.String browseDataId;
|
||||
|
||||
// 展示标题
|
||||
@TableField(exist = false)
|
||||
private String title;
|
||||
|
||||
// 浏览类型展示字段
|
||||
@TableField(exist = false)
|
||||
private String browseTypeName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String cut;
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package com.jero.modules.phone.enums;
|
||||
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.modules.system.util.StringUtils;
|
||||
|
||||
/**
|
||||
* 浏览类型枚举类
|
||||
*/
|
||||
public enum BrowseTypeEnum {
|
||||
WDK("Document Library", "文档库", "Document Library"),
|
||||
ZSFX("Knowledge sharing", "知识分享", "Knowledge sharing"),
|
||||
FGYB("Regulatory Monthly Report", "法规月报", "Regulatory Monthly Report"),
|
||||
;
|
||||
|
||||
|
||||
String cnName;
|
||||
String enName;
|
||||
String value;
|
||||
|
||||
private BrowseTypeEnum(String value, String cnName, String enName) {
|
||||
this.value = value;
|
||||
this.cnName = cnName;
|
||||
this.enName = enName;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getCnName() {
|
||||
return cnName;
|
||||
}
|
||||
|
||||
public void setCnName(String cnName) {
|
||||
this.cnName = cnName;
|
||||
}
|
||||
|
||||
public String getEnName() {
|
||||
return enName;
|
||||
}
|
||||
|
||||
public void setEnName(String enName) {
|
||||
this.enName = enName;
|
||||
}
|
||||
|
||||
public static String getTextByValue(String value, String cut) {
|
||||
BrowseTypeEnum[] values = values();
|
||||
for (BrowseTypeEnum taskStatusEnum : values) {
|
||||
if (taskStatusEnum.value.equals(value)) {
|
||||
if (StringUtils.equals(cut, CutEnum.CN.getValue())) {
|
||||
return taskStatusEnum.cnName;
|
||||
} else {
|
||||
return taskStatusEnum.enName;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.jero.modules.phone.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.jero.modules.phone.entity.RecentBrowse;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 最近浏览表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-06-08
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface RecentBrowseMapper extends BaseMapper<RecentBrowse> {
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.modules.phone.mapper.RecentBrowseMapper">
|
||||
<resultMap id="RecentBrowseResultMap" type="com.jero.modules.phone.entity.RecentBrowse">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="browse_type" property="browseType" />
|
||||
<result column="browse_data_id" property="browseDataId" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package com.jero.modules.phone.service;
|
||||
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.modules.phone.entity.RecentBrowse;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 最近浏览表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-06-08
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IRecentBrowseService extends IService<RecentBrowse> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param recentBrowse
|
||||
* @return
|
||||
*/
|
||||
void add(RecentBrowse recentBrowse);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param recentBrowse
|
||||
* @return
|
||||
*/
|
||||
void editById(RecentBrowse recentBrowse);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
RecentBrowse queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<RecentBrowse> queryList();
|
||||
|
||||
Result<?> queryPageList(RecentBrowse recentBrowse, Integer pageNo, Integer pageSize, HttpServletRequest req);
|
||||
}
|
||||
+217
@@ -0,0 +1,217 @@
|
||||
package com.jero.modules.phone.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.BrowserType;
|
||||
import com.jero.modules.document.entity.BussDocumentLibraryEO;
|
||||
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
|
||||
import com.jero.modules.phone.entity.RecentBrowse;
|
||||
import com.jero.modules.phone.enums.BrowseTypeEnum;
|
||||
import com.jero.modules.phone.mapper.RecentBrowseMapper;
|
||||
import com.jero.modules.phone.service.IRecentBrowseService;
|
||||
import com.jero.modules.problemKnowledgeBase.entity.ProblemKnowledgeBaseEO;
|
||||
import com.jero.modules.problemKnowledgeBase.service.IProblemKnowledgeBaseEOService;
|
||||
import com.jero.modules.report.entity.LawsMonthlyReportManageEO;
|
||||
import com.jero.modules.report.service.ILawsMonthlyReportManageEOService;
|
||||
import com.jero.modules.system.util.StringUtils;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @Description: 最近浏览表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-06-08
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class RecentBrowseServiceImpl extends ServiceImpl<RecentBrowseMapper, RecentBrowse> implements IRecentBrowseService {
|
||||
|
||||
@Autowired
|
||||
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
|
||||
@Autowired
|
||||
private IProblemKnowledgeBaseEOService problemKnowledgeBaseEOService;
|
||||
@Autowired
|
||||
private ILawsMonthlyReportManageEOService lawsMonthlyReportManageEOService;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param recentBrowse
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(RecentBrowse recentBrowse) {
|
||||
Date now = new Date();
|
||||
recentBrowse.setCreateTime(now);
|
||||
recentBrowse.setUpdateTime(now);
|
||||
|
||||
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
// 添加时,只保留最新的一条浏览记录 将之前的浏览记录删掉。
|
||||
QueryWrapper<RecentBrowse> rbRemoveWrap = new QueryWrapper<>();
|
||||
rbRemoveWrap.lambda().eq(RecentBrowse::getCreateBy, currentUser.getUsername());
|
||||
rbRemoveWrap.lambda().eq(RecentBrowse::getBrowseType, recentBrowse.getBrowseType());
|
||||
rbRemoveWrap.lambda().eq(RecentBrowse::getBrowseDataId, recentBrowse.getBrowseDataId());
|
||||
this.remove(rbRemoveWrap);
|
||||
|
||||
this.save(recentBrowse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param recentBrowse
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(RecentBrowse recentBrowse) {
|
||||
Date now = new Date();
|
||||
recentBrowse.setUpdateTime(now);
|
||||
saveOrUpdate(recentBrowse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public RecentBrowse queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<RecentBrowse> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<?> queryPageList(RecentBrowse recentBrowse, Integer pageNo, Integer pageSize, HttpServletRequest req) {
|
||||
QueryWrapper<RecentBrowse> queryWrapper = QueryGenerator.initQueryWrapper(recentBrowse, req.getParameterMap());
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
Page<RecentBrowse> page = new Page<RecentBrowse>(pageNo, pageSize);
|
||||
IPage<RecentBrowse> pageList = this.page(page, queryWrapper);
|
||||
this.disposeData(recentBrowse, pageList.getRecords());
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
public void disposeData(RecentBrowse recentBrowse, List<RecentBrowse> datas) {
|
||||
if (CollectionUtils.isNotEmpty(datas)) {
|
||||
String cut = recentBrowse.getCut();
|
||||
|
||||
List<String> wdkIdList = datas.stream().filter(data -> {
|
||||
boolean flag = (StringUtils.equals(data.getBrowseType(), BrowseTypeEnum.WDK.getValue()));
|
||||
return flag;
|
||||
}).map(RecentBrowse::getBrowseDataId).distinct().collect(Collectors.toList());
|
||||
List<BussDocumentLibraryEO> bdlEoList = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(wdkIdList)) {
|
||||
QueryWrapper<BussDocumentLibraryEO> bdlQueryWrap = new QueryWrapper<>();
|
||||
bdlQueryWrap.lambda().in(BussDocumentLibraryEO::getId, wdkIdList);
|
||||
bdlEoList = this.bussDocumentLibraryEOService.list(bdlQueryWrap);
|
||||
}
|
||||
|
||||
List<String> zsfxIdList = datas.stream().filter(data -> {
|
||||
boolean flag = (StringUtils.equals(data.getBrowseType(), BrowseTypeEnum.ZSFX.getValue()));
|
||||
return flag;
|
||||
}).map(RecentBrowse::getBrowseDataId).distinct().collect(Collectors.toList());
|
||||
List<ProblemKnowledgeBaseEO> pkbEoList = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(zsfxIdList)) {
|
||||
QueryWrapper<ProblemKnowledgeBaseEO> pkbQueryWrap = new QueryWrapper<>();
|
||||
pkbQueryWrap.lambda().in(ProblemKnowledgeBaseEO::getId, zsfxIdList);
|
||||
pkbEoList = this.problemKnowledgeBaseEOService.list(pkbQueryWrap);
|
||||
}
|
||||
|
||||
List<String> fgybIdList = datas.stream().filter(data -> {
|
||||
boolean flag = (StringUtils.equals(data.getBrowseType(), BrowseTypeEnum.FGYB.getValue()));
|
||||
return flag;
|
||||
}).map(RecentBrowse::getBrowseDataId).distinct().collect(Collectors.toList());
|
||||
List<LawsMonthlyReportManageEO> lmrEoList = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(fgybIdList)) {
|
||||
QueryWrapper<LawsMonthlyReportManageEO> lmrQueryWrap = new QueryWrapper<>();
|
||||
lmrQueryWrap.lambda().in(LawsMonthlyReportManageEO::getId, fgybIdList);
|
||||
lmrEoList = this.lawsMonthlyReportManageEOService.list(lmrQueryWrap);
|
||||
}
|
||||
|
||||
for (RecentBrowse data : datas) {
|
||||
StringBuilder titleSb = new StringBuilder();
|
||||
if (StringUtils.equals(data.getBrowseType(), BrowseTypeEnum.WDK.getValue())) {
|
||||
List<BussDocumentLibraryEO> bdlEos = bdlEoList.stream().filter(bdlEo -> {
|
||||
boolean flag = (StringUtils.equals(bdlEo.getId(), data.getBrowseDataId()));
|
||||
return flag;
|
||||
}).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(bdlEos)) {
|
||||
BussDocumentLibraryEO bdlEo = bdlEos.get(0);
|
||||
String title = bdlEo.getTitle();
|
||||
if (StringUtils.equals(cut, CutEnum.EN.getValue())) {
|
||||
title = bdlEo.getTitleEn();
|
||||
}
|
||||
titleSb.append(title).append(" ").append(bdlEo.getSerialNumber());
|
||||
}
|
||||
} else if (StringUtils.equals(data.getBrowseType(), BrowseTypeEnum.ZSFX.getValue())) {
|
||||
List<ProblemKnowledgeBaseEO> pkbEos = pkbEoList.stream().filter(pkbEo -> {
|
||||
boolean flag = (StringUtils.equals(pkbEo.getId(), data.getBrowseDataId()));
|
||||
return flag;
|
||||
}).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(pkbEos)) {
|
||||
ProblemKnowledgeBaseEO pkbEo = pkbEos.get(0);
|
||||
titleSb.append(pkbEo.getTitle());
|
||||
}
|
||||
} else if (StringUtils.equals(data.getBrowseType(), BrowseTypeEnum.FGYB.getValue())) {
|
||||
List<LawsMonthlyReportManageEO> lmrEos = lmrEoList.stream().filter(lmrEo -> {
|
||||
boolean flag = false;
|
||||
return flag;
|
||||
}).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(lmrEos)) {
|
||||
LawsMonthlyReportManageEO lmrEo = lmrEos.get(0);
|
||||
titleSb.append(lmrEo.getName());
|
||||
}
|
||||
}
|
||||
data.setTitle(titleSb.toString());
|
||||
data.setBrowseTypeName(BrowseTypeEnum.getTextByValue(data.getBrowseType(), cut));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user