文档库--收藏和取消收藏
This commit is contained in:
+4
-4
@@ -38,7 +38,7 @@ public class OnlCgformCollectionController extends JeroController<OnlCgformColle
|
||||
private IOnlCgformCollectionService onlCgformCollectionService;
|
||||
@Autowired
|
||||
BussDocumentLibraryEOController BussDocumentLibraryEOService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
@@ -77,14 +77,14 @@ public class OnlCgformCollectionController extends JeroController<OnlCgformColle
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param bussDocumentLibraryEO
|
||||
* @param onlCgformCollection
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-添加")
|
||||
@ApiOperation(value="我的收藏-添加", notes="我的收藏-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody BussDocumentLibraryEO bussDocumentLibraryEO) {
|
||||
onlCgformCollectionService.add(bussDocumentLibraryEO);
|
||||
public Result<?> add(@Validated @RequestBody OnlCgformCollection onlCgformCollection) {
|
||||
onlCgformCollectionService.add(onlCgformCollection);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -17,10 +17,10 @@ public interface IOnlCgformCollectionService extends IService<OnlCgformCollectio
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param bussDocumentLibraryEO
|
||||
* @param onlCgformCollection
|
||||
* @return
|
||||
*/
|
||||
void add(BussDocumentLibraryEO bussDocumentLibraryEO);
|
||||
void add(OnlCgformCollection onlCgformCollection);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
|
||||
+4
-4
@@ -23,14 +23,14 @@ public class OnlCgformCollectionServiceImpl extends ServiceImpl<OnlCgformCollect
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param bussDocumentLibraryEO
|
||||
* @param onlCgformCollection
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(BussDocumentLibraryEO bussDocumentLibraryEO) {
|
||||
public void add(OnlCgformCollection onlCgformCollection) {
|
||||
Date now = new Date();
|
||||
bussDocumentLibraryEO.setCreateTime(now);
|
||||
save((OnlCgformCollection) bussDocumentLibraryEO);
|
||||
onlCgformCollection.setCreateTime(now);
|
||||
save(onlCgformCollection);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+35
@@ -280,5 +280,40 @@ public class BussDocumentLibraryEOController extends JeroController<BussDocument
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加收藏
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "添加收藏")
|
||||
@ApiOperation(value="添加收藏", notes="添加收藏")
|
||||
@GetMapping(value = "/addCollect")
|
||||
public Result<?> addCollect(String id) {
|
||||
try {
|
||||
bussDocumentLibraryEOService.addCollect(id);
|
||||
} catch (Exception e) {
|
||||
return Result.error("收藏失败");
|
||||
}
|
||||
return Result.OK("收藏成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消收藏
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "取消收藏")
|
||||
@ApiOperation(value="取消收藏", notes="取消收藏")
|
||||
@GetMapping(value = "/cancelCollect")
|
||||
public Result<?> cancelCollect(String id) {
|
||||
try {
|
||||
bussDocumentLibraryEOService.cancelCollect(id);
|
||||
} catch (Exception e) {
|
||||
return Result.error("取消收藏失败");
|
||||
}
|
||||
return Result.OK("取消收藏成功");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+12
@@ -107,5 +107,17 @@ public interface IBussDocumentLibraryEOService extends IService<BussDocumentLibr
|
||||
*/
|
||||
IPage replacePageInfo(Map<String,Object> parameter);
|
||||
|
||||
/**
|
||||
* 添加收藏
|
||||
* @param id
|
||||
*/
|
||||
void addCollect(String id);
|
||||
|
||||
/**
|
||||
* 取消收藏
|
||||
* @param id
|
||||
*/
|
||||
void cancelCollect(String id);
|
||||
|
||||
|
||||
}
|
||||
|
||||
+59
-25
@@ -10,6 +10,8 @@ import com.jero.common.constant.enums.YesOrNoEnum;
|
||||
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.service.IOnlCgformCollectionService;
|
||||
import com.jero.modules.document.entity.BussDocumentLibraryEO;
|
||||
import com.jero.modules.document.enums.FieldTypeEnum;
|
||||
import com.jero.modules.document.mapper.BussDocumentLibraryEOMapper;
|
||||
@@ -55,6 +57,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
private IOSSFileService iOSSFileService;
|
||||
@Autowired
|
||||
private SysDictItemServiceImpl sysDictItemServiceImpl;
|
||||
@Autowired
|
||||
private IOnlCgformCollectionService iOnlCgformCollectionService;
|
||||
|
||||
|
||||
/**
|
||||
@@ -424,31 +428,11 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
* @param map
|
||||
*/
|
||||
public void updateInfo(Map<String, Object> map) {
|
||||
//判断该条数据是否订阅
|
||||
|
||||
|
||||
//处理修改代替标准,发送通知
|
||||
String id = (String) map.get("id");
|
||||
//修改时前端传参
|
||||
String replaceStandard = (String) map.get("replace_standard");
|
||||
//通过id查询数据
|
||||
LambdaQueryWrapper<BussDocumentLibraryEO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BussDocumentLibraryEO::getId, id);
|
||||
List<Map<String, Object>> dataList = bussDocumentLibraryEOMapper.selectMaps(queryWrapper);
|
||||
if(dataList.size() != 0){
|
||||
//代替标准(根据id查询出来的)
|
||||
String replaceStandardTemp = (String) dataList.get(0).get("replace_standard");
|
||||
|
||||
if(StringUtils.isNotBlank(replaceStandardTemp) && !replaceStandard.equals(replaceStandardTemp)){
|
||||
//需要向被替代标准的法规工程师发送站内通知和飞书信息,提醒内容:"新标准编号"已实施,请注意更新“替代标准编号”状态
|
||||
List<String> list = Arrays.asList(replaceStandard.split(","));
|
||||
List<String> listTemp = Arrays.asList(replaceStandardTemp.split(","));
|
||||
List<String> listNew = list.stream().filter(e -> !listTemp.contains(e)).collect(Collectors.toList());
|
||||
//向listNew对应的工程师发飞书通知
|
||||
|
||||
}else{
|
||||
//向replaceStandard对应的工程师发飞书通知
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
sendMessage(map);
|
||||
|
||||
//字段属性
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue());
|
||||
@@ -526,6 +510,37 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理修改代替标准,发送通知
|
||||
* @param map
|
||||
*/
|
||||
private void sendMessage(Map<String, Object> map) {
|
||||
//处理修改代替标准,发送通知
|
||||
String id = (String) map.get("id");
|
||||
//修改时前端传参
|
||||
String replaceStandard = (String) map.get("replace_standard");
|
||||
//通过id查询数据
|
||||
LambdaQueryWrapper<BussDocumentLibraryEO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BussDocumentLibraryEO::getId, id);
|
||||
List<Map<String, Object>> dataList = bussDocumentLibraryEOMapper.selectMaps(queryWrapper);
|
||||
if(dataList.size() != 0){
|
||||
//代替标准(根据id查询出来的)
|
||||
String replaceStandardTemp = (String) dataList.get(0).get("replace_standard");
|
||||
|
||||
if(StringUtils.isNotBlank(replaceStandardTemp) && !replaceStandard.equals(replaceStandardTemp)){
|
||||
//需要向被替代标准的法规工程师发送站内通知和飞书信息,提醒内容:"新标准编号"已实施,请注意更新“替代标准编号”状态
|
||||
List<String> list = Arrays.asList(replaceStandard.split(","));
|
||||
List<String> listTemp = Arrays.asList(replaceStandardTemp.split(","));
|
||||
List<String> listNew = list.stream().filter(e -> !listTemp.contains(e)).collect(Collectors.toList());
|
||||
//向listNew对应的工程师发飞书通知
|
||||
|
||||
}else{
|
||||
//向replaceStandard对应的工程师发飞书通知
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getMustValues() {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
@@ -588,7 +603,6 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
return infoPage;
|
||||
}
|
||||
|
||||
|
||||
public IPage getInfoPage(Map<String, Object> parameter) {
|
||||
//需要查询的字段
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList("1");
|
||||
@@ -721,4 +735,24 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
entry.setValue(StringUtils.join(dictItemsCh, ","));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void addCollect(String id) {
|
||||
//收藏表中添加数据
|
||||
OnlCgformCollection onlCgformCollection = new OnlCgformCollection();
|
||||
onlCgformCollection.setDocumentId(id);
|
||||
iOnlCgformCollectionService.add(onlCgformCollection);
|
||||
//订阅表中添加数据
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelCollect(String id) {
|
||||
//收藏表中删除数据
|
||||
LambdaQueryWrapper<OnlCgformCollection> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(OnlCgformCollection::getDocumentId,id);
|
||||
iOnlCgformCollectionService.remove(lambdaQueryWrapper);
|
||||
//订阅表中删除数据
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user