From 038cdab4c7ff31000b35d6d8ac03e95c4fa399fe Mon Sep 17 00:00:00 2001 From: wangzhijiang <12345678> Date: Thu, 3 Mar 2022 16:22:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E6=94=B6=E8=97=8F-=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E6=94=B6=E8=97=8F=20=E5=90=8C=E6=97=B6=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E8=AE=A2=E9=98=85=E3=80=82=20=E6=94=B6=E8=97=8F?= =?UTF-8?q?=E3=80=81=E8=AE=A2=E9=98=85=E6=9F=A5=E8=AF=A2=E5=88=97=E8=A1=A8?= =?UTF-8?q?=20=E7=8A=B6=E6=80=81=E5=AD=97=E6=AE=B5=E4=B8=AD=E8=8B=B1?= =?UTF-8?q?=E6=96=87=E5=88=87=E6=8D=A2=E3=80=81=E6=A0=B9=E6=8D=AE=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/xml/OnlCgformCollectionMapper.xml | 5 +- .../impl/OnlCgformCollectionServiceImpl.java | 63 +++++++++++++++++-- .../controller/DomainUserRelController.java | 9 +++ .../mapper/xml/OnlCgformSubscribeMapper.xml | 5 +- .../impl/OnlCgformSubscribeServiceImpl.java | 15 +++-- 5 files changed, 85 insertions(+), 12 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/mapper/xml/OnlCgformCollectionMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/mapper/xml/OnlCgformCollectionMapper.xml index 8bee10736..445bf7e94 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/mapper/xml/OnlCgformCollectionMapper.xml +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/mapper/xml/OnlCgformCollectionMapper.xml @@ -30,7 +30,10 @@ and bdl.title like concat(concat('%',#{params.title}),'%') - and bdl.state = #{params.state} + and bdl.state in + + #{item} + order by occ.create_time desc diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/service/impl/OnlCgformCollectionServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/service/impl/OnlCgformCollectionServiceImpl.java index ee96074c8..e213739b2 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/service/impl/OnlCgformCollectionServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/collection/service/impl/OnlCgformCollectionServiceImpl.java @@ -14,6 +14,8 @@ 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.subscribe.entity.OnlCgformSubscribe; +import com.jero.modules.subscribe.mapper.OnlCgformSubscribeMapper; import com.jero.modules.system.entity.SysDictItem; import com.jero.modules.system.service.impl.SysDictItemServiceImpl; import org.apache.commons.collections4.CollectionUtils; @@ -21,6 +23,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.text.SimpleDateFormat; import java.util.*; @@ -40,6 +43,8 @@ public class OnlCgformCollectionServiceImpl extends ServiceImpl documentIdList = new ArrayList<>(); + documentIdList.add(onlCgformCollection.getDocumentId()); + + //删除订阅 + deleteSubscribe(documentIdList); + + removeById(id); + }catch (Exception ex){ + log.error("取消收藏失败:" + ex.getMessage()); + throw new JeroBootException("取消收藏失败!"); + } } /** @@ -77,6 +95,7 @@ public class OnlCgformCollectionServiceImpl extends ServiceImpl ids) { for (String id : ids) { boolean checkData = checkData(id); @@ -84,7 +103,20 @@ public class OnlCgformCollectionServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().in(OnlCgformCollection::getId,ids); + List onlCgformCollections = super.baseMapper.selectList(queryWrapper); + List documentIdList = onlCgformCollections.stream().map(OnlCgformCollection::getDocumentId).distinct().collect(Collectors.toList()); + + //删除订阅 + deleteSubscribe(documentIdList); + + removeByIds(ids); + }catch (Exception ex){ + log.error("批量取消收藏失败:" + ex.getMessage()); + throw new JeroBootException("批量取消收藏失败!"); + } } /** @@ -196,25 +228,31 @@ public class OnlCgformCollectionServiceImpl extends ServiceImpl> records = result.getRecords(); - dataDispose(records); + dataDispose(records,params); return result; } - public void dataDispose(List> datas){ + public void dataDispose(List> datas, Map params){ if(CollectionUtils.isNotEmpty(datas)){ List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); //获取所有文本状态数据字典 List stateList = sysDictItems.stream() - .filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals("file_type")) + .filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals("state")) .collect(Collectors.toList()); SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss"); + + String cut = (String) params.get("cut"); for (Map 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()); + if(StringUtils.equals(cut,"cn")){ + data.put("state",sysDictItem.getItemText()); + }else { + data.put("state",sysDictItem.getEnName()); + } break; } } @@ -246,4 +284,17 @@ public class OnlCgformCollectionServiceImpl extends ServiceImpl docIdList){ + try { + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + QueryWrapper deleteWarpper = new QueryWrapper<>(); + deleteWarpper.lambda().in(OnlCgformSubscribe::getDocumentId,docIdList); + deleteWarpper.lambda().eq(OnlCgformSubscribe::getCreateBy,sysUser.getUsername()); + onlCgformSubscribeMapper.delete(deleteWarpper); + }catch (Exception ex){ + log.error("删除订阅信息失败:" + ex.getMessage()); + throw new JeroBootException("删除订阅信息失败!"); + } + } } \ No newline at end of file diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/domain/controller/DomainUserRelController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/domain/controller/DomainUserRelController.java index f13f3a736..1cb5937fe 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/domain/controller/DomainUserRelController.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/domain/controller/DomainUserRelController.java @@ -13,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.Map; + /** * 领域与用户关系 @@ -41,4 +43,11 @@ public class DomainUserRelController { public Result queryList(){ return domainUserRelService.queryList(); } + + @AutoLog(value = "查询领域、文档关联的用户Id") + @ApiOperation(value="查询领域、文档关联的用户Id", notes="查询领域、文档关联的用户Id") + @PostMapping("/queryDomainUserRelInfo") + public Result queryDomainUserRelInfo(@RequestBody Map params){ + return Result.ok(domainUserRelService.queryDomainUserRelInfo(params)); + } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/subscribe/mapper/xml/OnlCgformSubscribeMapper.xml b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/subscribe/mapper/xml/OnlCgformSubscribeMapper.xml index bafb9b1bb..cd8d88f85 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/subscribe/mapper/xml/OnlCgformSubscribeMapper.xml +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/subscribe/mapper/xml/OnlCgformSubscribeMapper.xml @@ -31,7 +31,10 @@ and bdl.title like concat(concat('%',#{params.title}),'%') - and bdl.state = #{params.state} + and bdl.state in + + #{item} + order by ocs.create_time desc diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/subscribe/service/impl/OnlCgformSubscribeServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/subscribe/service/impl/OnlCgformSubscribeServiceImpl.java index cf0f1db43..58323e8bd 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/subscribe/service/impl/OnlCgformSubscribeServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/subscribe/service/impl/OnlCgformSubscribeServiceImpl.java @@ -210,7 +210,7 @@ public class OnlCgformSubscribeServiceImpl extends ServiceImpl> records = result.getRecords(); - dataDispose(records); + dataDispose(records,params); return result; } @@ -241,21 +241,28 @@ public class OnlCgformSubscribeServiceImpl extends ServiceImpl> datas){ + public void dataDispose(List> datas,Map params){ if(CollectionUtils.isNotEmpty(datas)){ List sysDictItems = sysDictItemServiceImpl.selectItemsAll(); //获取所有文本状态数据字典 List stateList = sysDictItems.stream() - .filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals("file_type")) + .filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals("state")) .collect(Collectors.toList()); SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss"); + + //cut: cn 中文 en 英文 + String cut = (String) params.get("cut"); for (Map 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()); + if(StringUtils.equals(cut,"cn")){ + data.put("state",sysDictItem.getItemText()); + }else { + data.put("state",sysDictItem.getEnName()); + } break; } }