我的收藏、我的订阅。
分页查询修改,数据安全校验。 表头、搜索条件 中英文切换接口修改。
This commit is contained in:
+37
-1
@@ -52,6 +52,8 @@ public class OnlCgformCollectionController extends JeroController<OnlCgformColle
|
||||
@AutoLog(value = "我的收藏-分页列表查询")
|
||||
@ApiOperation(value="我的收藏-分页列表查询", notes="我的收藏-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(@RequestParam Map<String,Object> params){
|
||||
/*
|
||||
public Result<?> queryPageList(OnlCgformCollection onlCgformCollection,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
@@ -59,6 +61,8 @@ public class OnlCgformCollectionController extends JeroController<OnlCgformColle
|
||||
QueryWrapper<OnlCgformCollection> queryWrapper = QueryGenerator.initQueryWrapper(onlCgformCollection, req.getParameterMap());
|
||||
Page<OnlCgformCollection> page = new Page<OnlCgformCollection>(pageNo, pageSize);
|
||||
IPage<OnlCgformCollection> pageList = onlCgformCollectionService.page(page, queryWrapper);
|
||||
*/
|
||||
IPage<OnlCgformCollection> pageList = onlCgformCollectionService.queryPageList(params);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@@ -67,6 +71,7 @@ public class OnlCgformCollectionController extends JeroController<OnlCgformColle
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
/*
|
||||
@AutoLog(value = "标签管理-表头中英文切换")
|
||||
@ApiOperation(value="标签管理-表头中英文切换", notes="标签管理-表头中英文切换")
|
||||
@GetMapping(value = "/getHeader")
|
||||
@@ -75,12 +80,14 @@ public class OnlCgformCollectionController extends JeroController<OnlCgformColle
|
||||
List<Map<String, Object>> list =onlCgformCollectionService.queryCondition(flag, cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* 查询条件中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
/*
|
||||
@AutoLog(value = "OCR识别转换记录表-查询条件中英文切换")
|
||||
@ApiOperation(value="OCR识别转换记录表-查询条件中英文切换", notes="OCR识别转换记录表-查询条件中英文切换")
|
||||
@GetMapping(value = "/queryCondition")
|
||||
@@ -89,7 +96,7 @@ public class OnlCgformCollectionController extends JeroController<OnlCgformColle
|
||||
List<Map<String, Object>> list = onlCgformCollectionService.queryCondition(flag, cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
@@ -170,4 +177,33 @@ public class OnlCgformCollectionController extends JeroController<OnlCgformColle
|
||||
}
|
||||
return Result.OK(onlCgformCollection);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 表头中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-表头中英文切换")
|
||||
@ApiOperation(value="我的收藏-表头中英文切换", notes="我的收藏-表头中英文切换")
|
||||
@GetMapping(value = "/getHeader")
|
||||
public Result<List<Map<String, Object>>> getHeader(@RequestParam(name = "flag") String flag,
|
||||
@RequestParam(name = "cut") String cut) {
|
||||
List<Map<String, Object>> list =onlCgformCollectionService.getHeader(flag, cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询条件中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-查询条件中英文切换")
|
||||
@ApiOperation(value="我的收藏-查询条件中英文切换", notes="我的收藏-查询条件中英文切换")
|
||||
@GetMapping(value = "/queryCondition")
|
||||
public Result<List<Map<String, Object>>> queryCondition(@RequestParam(name = "flag") String flag,
|
||||
@RequestParam(name = "cut") String cut) {
|
||||
List<Map<String, Object>> list = onlCgformCollectionService.queryCondition(flag, cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -1,11 +1,13 @@
|
||||
package com.jero.modules.collection.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jero.modules.collection.entity.OnlCgformCollection;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 我的收藏
|
||||
@@ -18,4 +20,6 @@ public interface OnlCgformCollectionMapper extends BaseMapper<OnlCgformCollectio
|
||||
@Select("select * from buss_document_library as document LEFT JOIN onl_cgform_collection as collection\n" +
|
||||
" on document.id= collection.document_id;")
|
||||
List<OnlCgformCollection> queryListByDocumentId(@Param("document_id") String document_id);
|
||||
|
||||
IPage queryPageList(IPage page,@Param("params") Map<String, Object> params);
|
||||
}
|
||||
|
||||
+24
@@ -10,4 +10,28 @@
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="document_id" property="documentId" />
|
||||
</resultMap>
|
||||
|
||||
<select id="queryPageList" resultType="hashmap">
|
||||
select
|
||||
occ.id,
|
||||
occ.create_time as createTime,
|
||||
occ.create_by as createBy,
|
||||
bdl.serial_number as serialNumber,
|
||||
bdl.title,
|
||||
bdl.state
|
||||
from
|
||||
onl_cgform_collection occ
|
||||
left join buss_document_library bdl on occ.document_id = bdl.id
|
||||
where occ.create_by = #{params.createBy}
|
||||
<if test="params.serialNumber != null and params.serialNumber != '' ">
|
||||
and bdl.serial_number like concat(concat('%',#{params.serialNumber}),'%')
|
||||
</if>
|
||||
<if test="params.title != null and params.title != '' ">
|
||||
and bdl.title like concat(concat('%',#{params.title}),'%')
|
||||
</if>
|
||||
<if test="params.state != null and params.state != '' ">
|
||||
and bdl.state = #{params.state}
|
||||
</if>
|
||||
order by occ.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
+7
@@ -1,5 +1,6 @@
|
||||
package com.jero.modules.collection.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.collection.entity.OnlCgformCollection;
|
||||
|
||||
@@ -69,4 +70,10 @@ public interface IOnlCgformCollectionService extends IService<OnlCgformCollectio
|
||||
*/
|
||||
public List<Map<String, Object>> queryCondition(String flag, String cut);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
IPage<OnlCgformCollection> queryPageList(Map<String, Object> params);
|
||||
}
|
||||
|
||||
+101
-4
@@ -1,17 +1,28 @@
|
||||
package com.jero.modules.collection.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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.common.constant.enums.YesOrNoEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
|
||||
import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl;
|
||||
import com.jero.modules.collection.entity.OnlCgformCollection;
|
||||
import com.jero.modules.collection.mapper.OnlCgformCollectionMapper;
|
||||
import com.jero.modules.collection.service.IOnlCgformCollectionService;
|
||||
import com.jero.modules.ocr.util.LineHumpUtil;
|
||||
import com.jero.modules.system.entity.SysDictItem;
|
||||
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -27,6 +38,8 @@ public class OnlCgformCollectionServiceImpl extends ServiceImpl<OnlCgformCollect
|
||||
private OnlCgformFieldServiceImpl onlCgformFieldService;
|
||||
@Autowired
|
||||
OnlCgformCollectionMapper onlCgformCollectionMapper;
|
||||
@Autowired
|
||||
private SysDictItemServiceImpl sysDictItemServiceImpl;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
@@ -50,6 +63,10 @@ public class OnlCgformCollectionServiceImpl extends ServiceImpl<OnlCgformCollect
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
boolean checkData = checkData(id);
|
||||
if(!checkData){
|
||||
throw new JeroBootException("该用户没有权限!");
|
||||
}
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
@@ -61,6 +78,12 @@ public class OnlCgformCollectionServiceImpl extends ServiceImpl<OnlCgformCollect
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
for (String id : ids) {
|
||||
boolean checkData = checkData(id);
|
||||
if(!checkData){
|
||||
throw new JeroBootException("该用户没有权限!");
|
||||
}
|
||||
}
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
@@ -72,6 +95,10 @@ public class OnlCgformCollectionServiceImpl extends ServiceImpl<OnlCgformCollect
|
||||
*/
|
||||
@Override
|
||||
public OnlCgformCollection queryById(String id) {
|
||||
boolean checkData = checkData(id);
|
||||
if(!checkData){
|
||||
throw new JeroBootException("该用户没有权限!");
|
||||
}
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
@@ -95,8 +122,14 @@ public class OnlCgformCollectionServiceImpl extends ServiceImpl<OnlCgformCollect
|
||||
public List<Map<String, Object>> getHeader(String flag, String cut) {
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(flag);
|
||||
if (fieldList.size() != 0) {
|
||||
//过滤列表字段(is_show_list-->列表是否显示0否 1是)
|
||||
fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowList()))).collect(Collectors.toList());
|
||||
//过滤列表字段(is_show_list-->列表是否显示0否 1是) 过滤出需要的表头字段
|
||||
fieldList = fieldList.stream().filter(
|
||||
e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowList()))
|
||||
&& (
|
||||
e.getDbFieldEnName().equals("serial_number")||e.getDbFieldEnName().equals("title")
|
||||
||e.getDbFieldEnName().equals("state")
|
||||
)
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (OnlCgformField onlCgformField : fieldList) {
|
||||
@@ -129,8 +162,14 @@ public class OnlCgformCollectionServiceImpl extends ServiceImpl<OnlCgformCollect
|
||||
public List<Map<String, Object>> queryCondition(String flag, String cut) {
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(flag);
|
||||
if (fieldList.size() != 0) {
|
||||
//过滤出搜索条件()
|
||||
fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsQuery()))).collect(Collectors.toList());
|
||||
//过滤出需要的搜索条件()
|
||||
fieldList = fieldList.stream().filter(
|
||||
e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsQuery()))
|
||||
&& (
|
||||
e.getDbFieldEnName().equals("serial_number")||e.getDbFieldEnName().equals("title")
|
||||
||e.getDbFieldEnName().equals("state")
|
||||
)
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (OnlCgformField onlCgformField : fieldList) {
|
||||
@@ -147,4 +186,62 @@ public class OnlCgformCollectionServiceImpl extends ServiceImpl<OnlCgformCollect
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<OnlCgformCollection> queryPageList(Map<String, Object> params) {
|
||||
Integer pageNo = Integer.parseInt(params.get("pageNo").toString());
|
||||
Integer pageSize = Integer.parseInt(params.get("pageSize").toString());
|
||||
IPage page = new Page(pageNo, pageSize);
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
params.put("createBy",sysUser.getUsername());
|
||||
IPage result = onlCgformCollectionMapper.queryPageList(page,params);
|
||||
List<Map<String,Object>> records = result.getRecords();
|
||||
dataDispose(records);
|
||||
return result;
|
||||
}
|
||||
|
||||
public void dataDispose(List<Map<String,Object>> datas){
|
||||
if(CollectionUtils.isNotEmpty(datas)){
|
||||
List<SysDictItem> sysDictItems = sysDictItemServiceImpl.selectItemsAll();
|
||||
//获取所有文本状态数据字典
|
||||
List<SysDictItem> stateList = sysDictItems.stream()
|
||||
.filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals("file_type"))
|
||||
.collect(Collectors.toList());
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
|
||||
for (Map<String, Object> data : datas) {
|
||||
Date createTime = (Date) data.get("createTime");
|
||||
data.put("createTime",sdf.format(createTime));
|
||||
String state = (String) data.get("state");
|
||||
for (SysDictItem sysDictItem : stateList) {
|
||||
if(StringUtils.equals(state,sysDictItem.getItemValue())){
|
||||
data.put("state",sysDictItem.getItemText());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public boolean checkData(String id){
|
||||
boolean result = false;
|
||||
try {
|
||||
QueryWrapper<OnlCgformCollection> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(OnlCgformCollection::getId,id);
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
queryWrapper.lambda().eq(OnlCgformCollection::getCreateBy,sysUser.getUsername());
|
||||
Integer integer = onlCgformCollectionMapper.selectCount(queryWrapper);
|
||||
if(integer>0){
|
||||
result = true;
|
||||
}
|
||||
}catch (Exception ex){
|
||||
log.error("验证我的收藏数据异常:" + ex.getMessage());
|
||||
throw new JeroBootException("验证我的收藏数据异常!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+8
-4
@@ -51,6 +51,8 @@ public class OnlCgformSubscribeController extends JeroController<OnlCgformSubscr
|
||||
@AutoLog(value = "我的订阅-分页列表查询")
|
||||
@ApiOperation(value="我的订阅-分页列表查询", notes="我的订阅-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(@RequestParam Map<String,Object> params) {
|
||||
/*
|
||||
public Result<?> queryPageList(OnlCgformSubscribe onlCgformSubscribe,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
@@ -58,6 +60,8 @@ public class OnlCgformSubscribeController extends JeroController<OnlCgformSubscr
|
||||
QueryWrapper<OnlCgformSubscribe> queryWrapper = QueryGenerator.initQueryWrapper(onlCgformSubscribe, req.getParameterMap());
|
||||
Page<OnlCgformSubscribe> page = new Page<OnlCgformSubscribe>(pageNo, pageSize);
|
||||
IPage<OnlCgformSubscribe> pageList = onlCgformSubscribeService.page(page, queryWrapper);
|
||||
*/
|
||||
IPage<OnlCgformSubscribe> pageList = onlCgformSubscribeService.queryPageList(params);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@@ -66,8 +70,8 @@ public class OnlCgformSubscribeController extends JeroController<OnlCgformSubscr
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "标签管理-表头中英文切换")
|
||||
@ApiOperation(value="标签管理-表头中英文切换", notes="标签管理-表头中英文切换")
|
||||
@AutoLog(value = "我的订阅-表头中英文切换")
|
||||
@ApiOperation(value="我的订阅-表头中英文切换", notes="我的订阅-表头中英文切换")
|
||||
@GetMapping(value = "/getHeader")
|
||||
public Result<List<Map<String, Object>>> getHeader(@RequestParam(name = "flag") String flag,
|
||||
@RequestParam(name = "cut") String cut) {
|
||||
@@ -80,8 +84,8 @@ public class OnlCgformSubscribeController extends JeroController<OnlCgformSubscr
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "OCR识别转换记录表-查询条件中英文切换")
|
||||
@ApiOperation(value="OCR识别转换记录表-查询条件中英文切换", notes="OCR识别转换记录表-查询条件中英文切换")
|
||||
@AutoLog(value = "我的订阅-查询条件中英文切换")
|
||||
@ApiOperation(value="我的订阅-查询条件中英文切换", notes="我的订阅-查询条件中英文切换")
|
||||
@GetMapping(value = "/queryCondition")
|
||||
public Result<List<Map<String, Object>>> queryCondition(@RequestParam(name = "flag") String flag,
|
||||
@RequestParam(name = "cut") String cut) {
|
||||
|
||||
+4
@@ -1,11 +1,13 @@
|
||||
package com.jero.modules.subscribe.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jero.modules.subscribe.entity.OnlCgformSubscribe;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 我的订阅
|
||||
@@ -17,4 +19,6 @@ public interface OnlCgformSubscribeMapper extends BaseMapper<OnlCgformSubscribe>
|
||||
@Select("select * from buss_document_library as document LEFT JOIN onl_cgform_subscribe\n" +
|
||||
"as subscribe on document.id= subscribe.document_id;")
|
||||
List<OnlCgformSubscribe> queryListByDocumentId(@Param("document_id") String document_id);
|
||||
|
||||
IPage queryPageList(IPage page, @Param("params") Map<String,Object> params);
|
||||
}
|
||||
|
||||
+25
@@ -10,4 +10,29 @@
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="document_id" property="documentId" />
|
||||
</resultMap>
|
||||
|
||||
<select id="queryPageList" resultType="hashmap">
|
||||
select
|
||||
ocs.id,
|
||||
ocs.create_time as createTime,
|
||||
ocs.create_by as createBy,
|
||||
bdl.serial_number as serialNumber,
|
||||
bdl.title,
|
||||
bdl.state
|
||||
from
|
||||
onl_cgform_subscribe ocs
|
||||
left join
|
||||
buss_document_library bdl on ocs.document_id = bdl.id
|
||||
where ocs.create_by = #{params.createBy}
|
||||
<if test="params.serialNumber != null and params.serialNumber != '' ">
|
||||
and bdl.serial_number like concat(concat('%',#{params.serialNumber}),'%')
|
||||
</if>
|
||||
<if test="params.title != null and params.title != '' ">
|
||||
and bdl.title like concat(concat('%',#{params.title}),'%')
|
||||
</if>
|
||||
<if test="params.state != null and params.state != '' ">
|
||||
and bdl.state = #{params.state}
|
||||
</if>
|
||||
order by ocs.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
+8
@@ -1,5 +1,6 @@
|
||||
package com.jero.modules.subscribe.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jero.modules.subscribe.entity.OnlCgformSubscribe;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
@@ -75,4 +76,11 @@ public interface IOnlCgformSubscribeService extends IService<OnlCgformSubscribe>
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> queryCondition(String flag, String cut);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
IPage<OnlCgformSubscribe> queryPageList(Map<String,Object> params);
|
||||
}
|
||||
|
||||
+107
-5
@@ -1,17 +1,28 @@
|
||||
package com.jero.modules.subscribe.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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.common.constant.enums.YesOrNoEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
|
||||
import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl;
|
||||
import com.jero.modules.ocr.util.LineHumpUtil;
|
||||
import com.jero.modules.subscribe.entity.OnlCgformSubscribe;
|
||||
import com.jero.modules.subscribe.mapper.OnlCgformSubscribeMapper;
|
||||
import com.jero.modules.subscribe.service.IOnlCgformSubscribeService;
|
||||
import com.jero.modules.system.entity.SysDictItem;
|
||||
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -27,7 +38,8 @@ public class OnlCgformSubscribeServiceImpl extends ServiceImpl<OnlCgformSubscrib
|
||||
private OnlCgformFieldServiceImpl onlCgformFieldService;
|
||||
@Autowired
|
||||
private OnlCgformSubscribeMapper onlCgformSubscribeMapper;
|
||||
|
||||
@Autowired
|
||||
private SysDictItemServiceImpl sysDictItemServiceImpl;
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
@@ -50,6 +62,10 @@ public class OnlCgformSubscribeServiceImpl extends ServiceImpl<OnlCgformSubscrib
|
||||
*/
|
||||
@Override
|
||||
public void editById(OnlCgformSubscribe onlCgformSubscribe) {
|
||||
boolean checkData = checkData(onlCgformSubscribe.getId());
|
||||
if(!checkData){
|
||||
throw new JeroBootException("该用户没有权限!");
|
||||
}
|
||||
Date now = new Date();
|
||||
onlCgformSubscribe.setUpdateTime(now);
|
||||
saveOrUpdate(onlCgformSubscribe);
|
||||
@@ -63,6 +79,10 @@ public class OnlCgformSubscribeServiceImpl extends ServiceImpl<OnlCgformSubscrib
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
boolean checkData = checkData(id);
|
||||
if(!checkData){
|
||||
throw new JeroBootException("该用户没有权限!");
|
||||
}
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
@@ -74,6 +94,12 @@ public class OnlCgformSubscribeServiceImpl extends ServiceImpl<OnlCgformSubscrib
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
ids.forEach(id -> {
|
||||
boolean checkData = checkData(id);
|
||||
if(!checkData){
|
||||
throw new JeroBootException("该用户没有权限!");
|
||||
}
|
||||
});
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
@@ -85,6 +111,10 @@ public class OnlCgformSubscribeServiceImpl extends ServiceImpl<OnlCgformSubscrib
|
||||
*/
|
||||
@Override
|
||||
public OnlCgformSubscribe queryById(String id) {
|
||||
boolean checkData = checkData(id);
|
||||
if(!checkData){
|
||||
throw new JeroBootException("该用户没有权限!");
|
||||
}
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
@@ -109,8 +139,13 @@ public class OnlCgformSubscribeServiceImpl extends ServiceImpl<OnlCgformSubscrib
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(flag);
|
||||
if (fieldList.size() != 0) {
|
||||
//过滤列表字段(is_show_list-->列表是否显示0否 1是)
|
||||
fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowList()))).collect(Collectors.toList());
|
||||
}
|
||||
fieldList = fieldList.stream().filter(
|
||||
e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsQuery()))
|
||||
&& (
|
||||
e.getDbFieldEnName().equals("serial_number")||e.getDbFieldEnName().equals("title")
|
||||
||e.getDbFieldEnName().equals("state")
|
||||
)
|
||||
).collect(Collectors.toList()); }
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (OnlCgformField onlCgformField : fieldList) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
@@ -143,8 +178,13 @@ public class OnlCgformSubscribeServiceImpl extends ServiceImpl<OnlCgformSubscrib
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(flag);
|
||||
if (fieldList.size() != 0) {
|
||||
//过滤出搜索条件()
|
||||
fieldList = fieldList.stream().filter(e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsQuery()))).collect(Collectors.toList());
|
||||
}
|
||||
fieldList = fieldList.stream().filter(
|
||||
e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsQuery()))
|
||||
&& (
|
||||
e.getDbFieldEnName().equals("serial_number")||e.getDbFieldEnName().equals("title")
|
||||
||e.getDbFieldEnName().equals("state")
|
||||
)
|
||||
).collect(Collectors.toList()); }
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (OnlCgformField onlCgformField : fieldList) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
@@ -160,4 +200,66 @@ public class OnlCgformSubscribeServiceImpl extends ServiceImpl<OnlCgformSubscrib
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<OnlCgformSubscribe> queryPageList(Map<String,Object> params) {
|
||||
Integer pageNo = Integer.parseInt(params.get("pageNo").toString());
|
||||
Integer pageSize = Integer.parseInt(params.get("pageSize").toString());
|
||||
IPage page = new Page(pageNo, pageSize);
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
params.put("createBy",sysUser.getUsername());
|
||||
IPage result = onlCgformSubscribeMapper.queryPageList(page,params);
|
||||
List<Map<String,Object>> records = result.getRecords();
|
||||
dataDispose(records);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public boolean checkData(String id){
|
||||
boolean result = false;
|
||||
try {
|
||||
QueryWrapper<OnlCgformSubscribe> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(OnlCgformSubscribe::getId,id);
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
queryWrapper.lambda().eq(OnlCgformSubscribe::getCreateBy,sysUser.getUsername());
|
||||
Integer integer = onlCgformSubscribeMapper.selectCount(queryWrapper);
|
||||
if(integer>0){
|
||||
result = true;
|
||||
}
|
||||
}catch (Exception ex){
|
||||
log.error("验证我的订阅数据异常:" + ex.getMessage());
|
||||
throw new JeroBootException("验证我的订阅数据异常!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据处理
|
||||
* @param datas
|
||||
*/
|
||||
public void dataDispose(List<Map<String,Object>> datas){
|
||||
if(CollectionUtils.isNotEmpty(datas)){
|
||||
List<SysDictItem> sysDictItems = sysDictItemServiceImpl.selectItemsAll();
|
||||
//获取所有文本状态数据字典
|
||||
List<SysDictItem> stateList = sysDictItems.stream()
|
||||
.filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals("file_type"))
|
||||
.collect(Collectors.toList());
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
|
||||
for (Map<String, Object> data : datas) {
|
||||
Date createTime = (Date) data.get("createTime");
|
||||
data.put("createTime",sdf.format(createTime));
|
||||
String state = (String) data.get("state");
|
||||
for (SysDictItem sysDictItem : stateList) {
|
||||
if(StringUtils.equals(state,sysDictItem.getItemValue())){
|
||||
data.put("state",sysDictItem.getItemText());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -119,12 +119,12 @@ public class OnlCgformTagController extends JeroController<OnlCgformTag, IOnlCgf
|
||||
@ApiOperation(value="标签管理-添加", notes="标签管理-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody OnlCgformTag onlCgformTag) {
|
||||
Integer count=onlCgformTagService.queryExitData(onlCgformTag);
|
||||
if (count > 0) {
|
||||
onlCgformTag.setIsDelete(0);
|
||||
} else {
|
||||
onlCgformTagService.add(onlCgformTag);
|
||||
}
|
||||
// Integer count=onlCgformTagService.queryExitData(onlCgformTag);
|
||||
// if (count > 0) {
|
||||
// onlCgformTag.setIsDelete(0);
|
||||
// } else {
|
||||
// onlCgformTagService.add(onlCgformTag);
|
||||
// }
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user