From da5642e47785e38970b376946a55e95dbb37f9de Mon Sep 17 00:00:00 2001 From: rouchen <3133657697@qq.com> Date: Sun, 21 Apr 2024 14:31:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=BA=90=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- muyu-modules/muyu-kvt/muyu-kvt-common/pom.xml | 26 ++++ muyu-modules/muyu-kvt/muyu-kvt-server/pom.xml | 116 ++++++++++++++++++ muyu-modules/muyu-kvt/pom.xml | 26 ++++ .../controller/SysDictTypeController.java | 1 + .../controller/SysNoticeController.java | 6 + .../com/muyu/system/domain/SysNotice.java | 10 +- .../muyu/system/mapper/SysNoticeMapper.java | 8 ++ .../com/muyu/system/mapper/SysUserMapper.java | 2 + .../muyu/system/service/SysNoticeService.java | 5 + .../service/impl/SysNoticeServiceImpl.java | 78 +++++++++++- .../service/impl/SysPostServiceImpl.java | 1 + .../mapper/system/SysNoticeMapper.xml | 12 ++ .../resources/mapper/system/SysUserMapper.xml | 7 ++ muyu-modules/pom.xml | 1 + 14 files changed, 296 insertions(+), 3 deletions(-) create mode 100644 muyu-modules/muyu-kvt/muyu-kvt-common/pom.xml create mode 100644 muyu-modules/muyu-kvt/muyu-kvt-server/pom.xml create mode 100644 muyu-modules/muyu-kvt/pom.xml diff --git a/muyu-modules/muyu-kvt/muyu-kvt-common/pom.xml b/muyu-modules/muyu-kvt/muyu-kvt-common/pom.xml new file mode 100644 index 0000000..4e53d45 --- /dev/null +++ b/muyu-modules/muyu-kvt/muyu-kvt-common/pom.xml @@ -0,0 +1,26 @@ + + + 4.0.0 + + com.muyu + muyu-kvt + 3.6.3 + + + muyu-kvt-common + + + 17 + 17 + UTF-8 + + + + + com.muyu + muyu-common-core + + + diff --git a/muyu-modules/muyu-kvt/muyu-kvt-server/pom.xml b/muyu-modules/muyu-kvt/muyu-kvt-server/pom.xml new file mode 100644 index 0000000..9512600 --- /dev/null +++ b/muyu-modules/muyu-kvt/muyu-kvt-server/pom.xml @@ -0,0 +1,116 @@ + + + 4.0.0 + + com.muyu + muyu-kvt + 3.6.3 + + + muyu-kvt-server + + + 17 + 17 + UTF-8 + + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-sentinel + + + + + org.springframework.boot + spring-boot-starter-actuator + + + + + io.springfox + springfox-swagger-ui + ${swagger.fox.version} + + + + + com.mysql + mysql-connector-j + + + + + com.muyu + muyu-common-datasource + + + + + com.muyu + muyu-common-datascope + + + + + com.muyu + muyu-common-log + + + + + com.muyu + muyu-common-swagger + + + + com.muyu + muyu-kvt-common + 3.6.3 + compile + + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + + + diff --git a/muyu-modules/muyu-kvt/pom.xml b/muyu-modules/muyu-kvt/pom.xml new file mode 100644 index 0000000..bcdd76a --- /dev/null +++ b/muyu-modules/muyu-kvt/pom.xml @@ -0,0 +1,26 @@ + + + 4.0.0 + + com.muyu + muyu-modules + 3.6.3 + + + muyu-kvt + pom + + muyu-kvt-common + muyu-kvt-remote + muyu-kvt-server + + + + 17 + 17 + UTF-8 + + + diff --git a/muyu-modules/muyu-system/src/main/java/com/muyu/system/controller/SysDictTypeController.java b/muyu-modules/muyu-system/src/main/java/com/muyu/system/controller/SysDictTypeController.java index 4d1325c..cee5340 100644 --- a/muyu-modules/muyu-system/src/main/java/com/muyu/system/controller/SysDictTypeController.java +++ b/muyu-modules/muyu-system/src/main/java/com/muyu/system/controller/SysDictTypeController.java @@ -45,6 +45,7 @@ public class SysDictTypeController extends BaseController { util.exportExcel(response, list, "字典类型"); } + /** * 查询字典类型详细 */ diff --git a/muyu-modules/muyu-system/src/main/java/com/muyu/system/controller/SysNoticeController.java b/muyu-modules/muyu-system/src/main/java/com/muyu/system/controller/SysNoticeController.java index 9706350..c619e66 100644 --- a/muyu-modules/muyu-system/src/main/java/com/muyu/system/controller/SysNoticeController.java +++ b/muyu-modules/muyu-system/src/main/java/com/muyu/system/controller/SysNoticeController.java @@ -8,6 +8,8 @@ import com.muyu.common.log.enums.BusinessType; import com.muyu.common.security.annotation.RequiresPermissions; import com.muyu.common.security.utils.SecurityUtils; import com.muyu.system.domain.SysNotice; +import com.muyu.system.domain.req.SysNoticeRequest; +import com.muyu.system.domain.resp.SysNoticeResponse; import com.muyu.system.service.SysNoticeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; @@ -36,6 +38,10 @@ public class SysNoticeController extends BaseController { List list = noticeService.selectNoticeList(notice); return getDataTable(list); } + @PostMapping("/GetNoticeList") + public Result> getNoticeList(@RequestBody SysNoticeRequest sysNoticeRequest){ + return noticeService.getNoticeList(sysNoticeRequest); + } /** * 根据通知公告编号获取详细信息 diff --git a/muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/SysNotice.java b/muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/SysNotice.java index 69675c1..8ce06e7 100644 --- a/muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/SysNotice.java +++ b/muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/SysNotice.java @@ -12,6 +12,7 @@ import org.apache.commons.lang3.builder.ToStringStyle; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; +import java.util.List; /** * 通知公告表 sys_notice @@ -50,7 +51,14 @@ public class SysNotice extends BaseEntity { * 公告状态(0正常 1关闭) */ private String status; - + /** + * 部门id集合 + */ + private List> sectionList; + /** + * 用户id集合 + */ + private List personnelList; public Long getNoticeId () { return noticeId; } diff --git a/muyu-modules/muyu-system/src/main/java/com/muyu/system/mapper/SysNoticeMapper.java b/muyu-modules/muyu-system/src/main/java/com/muyu/system/mapper/SysNoticeMapper.java index fee9930..c85d1ee 100644 --- a/muyu-modules/muyu-system/src/main/java/com/muyu/system/mapper/SysNoticeMapper.java +++ b/muyu-modules/muyu-system/src/main/java/com/muyu/system/mapper/SysNoticeMapper.java @@ -2,6 +2,8 @@ package com.muyu.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.muyu.system.domain.SysNotice; +import com.muyu.system.domain.req.SysNoticeRequest; +import com.muyu.system.domain.resp.SysNoticeResponse; import java.util.List; @@ -64,4 +66,10 @@ public interface SysNoticeMapper extends BaseMapper { * @return 结果 */ public int deleteNoticeByIds (Long[] noticeIds); + + List getNoticeList(SysNoticeRequest sysNoticeRequest); + + List selectUser(); + + } diff --git a/muyu-modules/muyu-system/src/main/java/com/muyu/system/mapper/SysUserMapper.java b/muyu-modules/muyu-system/src/main/java/com/muyu/system/mapper/SysUserMapper.java index e037b34..548d56f 100644 --- a/muyu-modules/muyu-system/src/main/java/com/muyu/system/mapper/SysUserMapper.java +++ b/muyu-modules/muyu-system/src/main/java/com/muyu/system/mapper/SysUserMapper.java @@ -139,4 +139,6 @@ public interface SysUserMapper extends BaseMapper { * @return 结果 */ public SysUser checkEmailUnique (String email); + + List selectDtptUser(@Param("sectionIds") List sectionIds); } diff --git a/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/SysNoticeService.java b/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/SysNoticeService.java index a1afe02..60118bf 100644 --- a/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/SysNoticeService.java +++ b/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/SysNoticeService.java @@ -1,7 +1,10 @@ package com.muyu.system.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.muyu.common.core.domain.Result; import com.muyu.system.domain.SysNotice; +import com.muyu.system.domain.req.SysNoticeRequest; +import com.muyu.system.domain.resp.SysNoticeResponse; import java.util.List; @@ -64,4 +67,6 @@ public interface SysNoticeService extends IService { * @return 结果 */ public int deleteNoticeByIds (Long[] noticeIds); + + Result> getNoticeList(SysNoticeRequest sysNoticeRequest); } diff --git a/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/impl/SysNoticeServiceImpl.java b/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/impl/SysNoticeServiceImpl.java index 8c0c8d5..99ac3ed 100644 --- a/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/impl/SysNoticeServiceImpl.java +++ b/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/impl/SysNoticeServiceImpl.java @@ -1,13 +1,24 @@ package com.muyu.system.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.muyu.common.core.domain.Result; +import com.muyu.common.security.utils.SecurityUtils; +import com.muyu.system.domain.AsUserDept; import com.muyu.system.domain.SysNotice; +import com.muyu.system.domain.req.SysNoticeRequest; +import com.muyu.system.domain.resp.SysNoticeResponse; +import com.muyu.system.mapper.AsUserDeptMapper; import com.muyu.system.mapper.SysNoticeMapper; +import com.muyu.system.mapper.SysUserMapper; import com.muyu.system.service.SysNoticeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; +import java.util.Date; import java.util.List; +import java.util.stream.Collectors; /** * 公告 服务层实现 @@ -19,6 +30,10 @@ public class SysNoticeServiceImpl extends ServiceImpl selectNoticeList (SysNotice notice) { + public List selectNoticeList(SysNotice notice) { return noticeMapper.selectNoticeList(notice); } + + public List handleList(List personnelList ,List> sectionList,Long noticeId){ + ArrayList longs = new ArrayList<>(); + if (sectionList!=null && sectionList.size()!=0){ + sectionList.stream() + .map(section -> { + for (Long aLong : section) { + longs.add(aLong); + } + return null; + }).collect(Collectors.toList()); + List sectionIds =longs.stream().distinct().toList(); + List userIds= sysUserMapper.selectDtptUser(sectionIds); + if (userIds !=null){ + personnelList.addAll(userIds); + } + } + personnelList= personnelList.stream().distinct().toList(); + System.out.println(personnelList); + List asUserDepts = personnelList.stream() + .map(personnel -> { + AsUserDept asUserDept = new AsUserDept(); + asUserDept.setNoticeId(personnel); + asUserDept.setNoticeId(noticeId); + asUserDept.setCreateBy(SecurityUtils.getUsername()); + asUserDept.setCreateTime(new Date()); + return asUserDept; + }).toList(); + return asUserDepts; + } /** * 新增公告 * @@ -51,8 +96,28 @@ public class SysNoticeServiceImpl extends ServiceImpl personnnelList = notice.getPersonnelList(); + List> sectionList = notice.getSectionList(); + List asUserDepts = handleList(personnnelList, sectionList, noticeId); + asUserDeptMapper.insertBachAsUserDept(asUserDepts); + }else { + List userIds = noticeMapper.selectUser(); + List asUserDepts = userIds.stream().map(id -> { + AsUserDept asUserDept = new AsUserDept(); + asUserDept.setNoticeId(notice.getNoticeId()); + asUserDept.setCreateTime(new Date()); + asUserDept.setUserId(id); + asUserDept.setCreateBy(SecurityUtils.getUsername()); + return asUserDept; + }).toList(); + asUserDeptMapper.insertBachAsUserDept(asUserDepts); + } + return i; } /** @@ -90,4 +155,13 @@ public class SysNoticeServiceImpl extends ServiceImpl> getNoticeList(SysNoticeRequest sysNoticeRequest) { + sysNoticeRequest.setNoticeId( + SecurityUtils.getUserId() + ); + List noticeList= noticeMapper.getNoticeList(sysNoticeRequest); + return Result.success(noticeList); + } } diff --git a/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/impl/SysPostServiceImpl.java b/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/impl/SysPostServiceImpl.java index 457ac5a..b9c784a 100644 --- a/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/impl/SysPostServiceImpl.java +++ b/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/impl/SysPostServiceImpl.java @@ -26,6 +26,7 @@ public class SysPostServiceImpl extends ServiceImpl impl @Autowired private SysUserPostMapper userPostMapper; + /** * 查询岗位信息集合 * diff --git a/muyu-modules/muyu-system/src/main/resources/mapper/system/SysNoticeMapper.xml b/muyu-modules/muyu-system/src/main/resources/mapper/system/SysNoticeMapper.xml index 0687403..0444b47 100644 --- a/muyu-modules/muyu-system/src/main/resources/mapper/system/SysNoticeMapper.xml +++ b/muyu-modules/muyu-system/src/main/resources/mapper/system/SysNoticeMapper.xml @@ -50,6 +50,18 @@ + insert into sys_notice ( diff --git a/muyu-modules/muyu-system/src/main/resources/mapper/system/SysUserMapper.xml b/muyu-modules/muyu-system/src/main/resources/mapper/system/SysUserMapper.xml index a35e8eb..89824eb 100644 --- a/muyu-modules/muyu-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/muyu-modules/muyu-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -183,6 +183,13 @@ and del_flag = '0' limit 1 + insert into sys_user( diff --git a/muyu-modules/pom.xml b/muyu-modules/pom.xml index 846198c..b4ae4b7 100644 --- a/muyu-modules/pom.xml +++ b/muyu-modules/pom.xml @@ -13,6 +13,7 @@ muyu-gen muyu-job muyu-file + muyu-kvt muyu-modules