From fab63c6ba71febe9305b6ee5aa94797c907cd105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=98=E5=BA=86=E5=90=89?= <51312040@qq.com> Date: Fri, 14 May 2021 08:57:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B1=E4=BA=AB=E6=96=87=E6=A1=A3=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bizbidnotice/dao/BizBidNoticeMapper.java | 16 +- .../dao/mapper/BizBidNoticeMapper.xml | 186 +++++++++--------- .../bizbidnotice/entity/BizBidNoticeVO.java | 83 ++++---- .../service/impl/BizBidNoticeServiceImpl.java | 7 +- .../controller/BizBidSharedController.java | 5 +- .../bizbidshared/entity/BizBidShared.java | 12 +- .../service/impl/BizBidSharedServiceImpl.java | 25 +-- .../BizBidSharedRecordController.java | 3 +- .../entity/BizBidSharedRecord.java | 1 - .../entity/BizBidSharedRecordVO.java | 2 - .../impl/BizBidSharedRecordServiceImpl.java | 14 +- 11 files changed, 170 insertions(+), 184 deletions(-) diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidnotice/dao/BizBidNoticeMapper.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidnotice/dao/BizBidNoticeMapper.java index 7be1ea5..54456d6 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidnotice/dao/BizBidNoticeMapper.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidnotice/dao/BizBidNoticeMapper.java @@ -1,30 +1,26 @@ package com.chinaunicom.mall.ebtp.extend.bizbidnotice.dao; -import java.time.LocalDateTime; -import java.util.List; - -import org.apache.ibatis.annotations.Param; - import com.chinaunicom.mall.ebtp.common.base.dao.IBaseMapper; import com.chinaunicom.mall.ebtp.extend.bizbidnotice.entity.BizBidNotice; +import org.apache.ibatis.annotations.Param; public interface BizBidNoticeMapper extends IBaseMapper { // public int deleteOff(String id); // public List getList(@Param("noticeTitle")String noticeTitle,@Param("noticeName") String noticeName, @Param("createDate")LocalDateTime createDate,@Param("noticeRelease") String noticeRelease, @Param("pageIndex") Integer getPageNo,@Param("pageSize") Integer pageSize); - + // public List getListByTitle(@Param("noticeTitle")String noticeTitle,@Param("pageIndex") Integer getPageNo,@Param("pageSize") Integer pageSize); // public List getAllList(@Param("noticeTitle")String noticeTitle,@Param("noticeName") String noticeName, @Param("createDate")LocalDateTime createDate,@Param("noticeRelease") String noticeRelease,@Param("pageIndex") Integer getPageNo,@Param("pageSize") Integer pageSize); // public List getAllListByTitle(@Param("noticeTitle")String noticeTitle,@Param("pageIndex") Integer getPageNo,@Param("pageSize") Integer pageSize); - public Boolean fabu(@Param("id")String id); + public Boolean fabu(@Param("id") String id); - public Boolean qxfabu(@Param("id")String id); + public Boolean qxfabu(@Param("id") String id); - public Boolean top(@Param("id")String id); + public Boolean top(@Param("id") String id); - public Boolean qxtop(@Param("id")String id); + public Boolean qxtop(@Param("id") String id); } diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidnotice/dao/mapper/BizBidNoticeMapper.xml b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidnotice/dao/mapper/BizBidNoticeMapper.xml index 1690a6d..b5af82a 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidnotice/dao/mapper/BizBidNoticeMapper.xml +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidnotice/dao/mapper/BizBidNoticeMapper.xml @@ -2,130 +2,130 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + select id,notice_name, notice_title, notice_content, notice_file,notice_release,notice_top, create_by, create_date, update_by, update_date,tenant_id,tenant_name,last_update_time, delete_flag from biz_bid_notice - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + update biz_bid_notice set delete_flag="deleted" where notice_id=#{notice_id} limit #{pageIndex},#{pageSize} - - + + update biz_bid_notice set notice_release="open" where id=#{id} - - + + update biz_bid_notice set notice_release="close" where id=#{id} - - + + update biz_bid_notice set notice_top="0" where id=#{id} - - + + update biz_bid_notice set notice_top="1" where id=#{id} - - - - update biz_bid_notice - - notice_name = #{noticeName}, - notice_title = #{noticeTitle}, - notice_content = #{noticeContent}, - notice_file = #{noticeFile}, - notice_release=#{noticeRelease} - notice_top=#{noticeTop} - update_by = #{updatBy}, - update_date = #{updateDate}, - tenant_id = #{tenantId}, - tenant_name = #{tenantName}, - last_update_time = #{lastTpdateTime}, - - where ID=#{id} - - - + + + update biz_bid_notice + + notice_name = #{noticeName}, + notice_title = #{noticeTitle}, + notice_content = #{noticeContent}, + notice_file = #{noticeFile}, + notice_release=#{noticeRelease} + notice_top=#{noticeTop} + update_by = #{updatBy}, + update_date = #{updateDate}, + tenant_id = #{tenantId}, + tenant_name = #{tenantName}, + last_update_time = #{lastTpdateTime}, + + where ID=#{id} + + + + update biz_bid_notice set delete_flag="deleted" diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidnotice/entity/BizBidNoticeVO.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidnotice/entity/BizBidNoticeVO.java index 661a7e5..603d043 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidnotice/entity/BizBidNoticeVO.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidnotice/entity/BizBidNoticeVO.java @@ -1,10 +1,5 @@ package com.chinaunicom.mall.ebtp.extend.bizbidnotice.entity; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.baomidou.mybatisplus.annotation.TableName; -import com.chinaunicom.mall.ebtp.common.base.entity.BaseEntity; import com.chinaunicom.mall.ebtp.common.base.entity.BasePageRequest; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; @@ -26,49 +21,49 @@ import java.time.LocalDateTime; @ApiModel public class BizBidNoticeVO extends BasePageRequest implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * - */ - @ApiModelProperty(value = "ID") - private String id; + /** + * + */ + @ApiModelProperty(value = "ID") + private String id; - /** - * - */ - @ApiModelProperty(value = "noticeName") - private String noticeName; + /** + * + */ + @ApiModelProperty(value = "noticeName") + private String noticeName; - /** - * 标题 - */ - @ApiModelProperty(value = "标题") - private String noticeTitle; + /** + * 标题 + */ + @ApiModelProperty(value = "标题") + private String noticeTitle; - /** - * 内容 - */ - @ApiModelProperty(value = "内容") - private String noticeContent; - /** - * 文件ID - */ - @ApiModelProperty(value = "文件ID") - private String noticeFile; - /** - * 是否发布 - */ - @ApiModelProperty(value = "是否发布") - private String noticeRelease; + /** + * 内容 + */ + @ApiModelProperty(value = "内容") + private String noticeContent; + /** + * 文件ID + */ + @ApiModelProperty(value = "文件ID") + private String noticeFile; + /** + * 是否发布 + */ + @ApiModelProperty(value = "是否发布") + private String noticeRelease; - /** - * 是否置顶 - */ - @ApiModelProperty(value = "是否置顶") - private String noticeTop; + /** + * 是否置顶 + */ + @ApiModelProperty(value = "是否置顶") + private String noticeTop; - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createDate; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createDate; } diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidnotice/service/impl/BizBidNoticeServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidnotice/service/impl/BizBidNoticeServiceImpl.java index ef67461..68d3a0c 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidnotice/service/impl/BizBidNoticeServiceImpl.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidnotice/service/impl/BizBidNoticeServiceImpl.java @@ -40,7 +40,8 @@ public class BizBidNoticeServiceImpl extends BaseServiceImpl page = this.page(new Page<>(bizBidNotice.getPageNo(), bizBidNotice.getPageSize()), wrapper); listRelease(page.getRecords()); diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidshared/controller/BizBidSharedController.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidshared/controller/BizBidSharedController.java index 7744bfd..4a166c6 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidshared/controller/BizBidSharedController.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidshared/controller/BizBidSharedController.java @@ -4,6 +4,7 @@ package com.chinaunicom.mall.ebtp.extend.bizbidshared.controller; import cn.hutool.core.util.StrUtil; import com.chinaunicom.mall.ebtp.common.base.entity.BasePageResponse; import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse; +import com.chinaunicom.mall.ebtp.common.constant.EbtpRoleEnum; import com.chinaunicom.mall.ebtp.common.util.PropertyUtils; import com.chinaunicom.mall.ebtp.extend.bizbidshared.entity.BizBidShared; import com.chinaunicom.mall.ebtp.extend.bizbidshared.entity.BizBidSharedVO; @@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.validation.Valid; +import java.util.stream.Collectors; @RestController @Api(tags = "") @@ -51,7 +53,8 @@ public class BizBidSharedController { if (StringUtils.isEmpty(bizBidShared.getId())) { bizBidShared.setId(PropertyUtils.getSnowflakeId()); } - bizBidShared.setSharedRole(StrUtil.join(",", bizBidShared.getSharedRoles())); + bizBidShared.setSharedRole(StrUtil.join(",", bizBidShared.getRoles().stream().map(m -> EbtpRoleEnum.matchRole(m).getDesc()).collect(Collectors.toList()))); + bizBidShared.setSharedRoles(StrUtil.join(",", bizBidShared.getRoles())); boolean save = ibizBidSharedService.saveOrUpdate(bizBidShared); return BaseResponse.success(save); diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidshared/entity/BizBidShared.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidshared/entity/BizBidShared.java index ee8f73a..4ae4b4c 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidshared/entity/BizBidShared.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidshared/entity/BizBidShared.java @@ -44,6 +44,12 @@ public class BizBidShared extends BaseEntity implements Serializable { @ApiModelProperty(value = "共享文档文件名") private String sharedName; + /** + * 共享文档使用角色 + */ + @ApiModelProperty(value = "共享文档使用角色") + private String sharedRoles; + /** * 共享文档使用角色 */ @@ -52,10 +58,9 @@ public class BizBidShared extends BaseEntity implements Serializable { /** * 共享文档使用角色list */ - @Transient @TableField(exist = false) - private List sharedRoles; + private List roles; /** * 共享文档ID */ @@ -78,4 +83,7 @@ public class BizBidShared extends BaseEntity implements Serializable { @TableField(exist = false) private String fileSuffix; + @TableField(exist = false) + private boolean isAllowDownload; + } diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidshared/service/impl/BizBidSharedServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidshared/service/impl/BizBidSharedServiceImpl.java index 2f2e235..d52a108 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidshared/service/impl/BizBidSharedServiceImpl.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidshared/service/impl/BizBidSharedServiceImpl.java @@ -1,17 +1,14 @@ package com.chinaunicom.mall.ebtp.extend.bizbidshared.service.impl; -import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.api.AttachmentClient; -import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.AttachmentDetail; -import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.AttachmentEntity; +import com.chinaunicom.mall.ebtp.common.base.entity.BaseCacheUser; +import com.chinaunicom.mall.ebtp.common.base.service.IBaseCacheUserService; import com.chinaunicom.mall.ebtp.common.base.service.impl.BaseServiceImpl; -import com.chinaunicom.mall.ebtp.extend.bizbidnotice.entity.BizBidNotice; import com.chinaunicom.mall.ebtp.extend.bizbidshared.dao.BizBidSharedMapper; import com.chinaunicom.mall.ebtp.extend.bizbidshared.entity.BizBidShared; import com.chinaunicom.mall.ebtp.extend.bizbidshared.entity.BizBidSharedVO; @@ -19,10 +16,6 @@ import com.chinaunicom.mall.ebtp.extend.bizbidshared.service.IBizBidSharedServic import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; - /** * 对数据表 biz_bid_shared 操作的 serviceImpl * @@ -32,10 +25,11 @@ import java.util.stream.Collectors; public class BizBidSharedServiceImpl extends BaseServiceImpl implements IBizBidSharedService { @Autowired - private AttachmentClient attachmentClient; + private IBaseCacheUserService cacheUserService; @Override public IPage getList(BizBidSharedVO bizBidNotice) { + BaseCacheUser user = cacheUserService.getCacheUser(); LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); wrapper.like(StrUtil.isNotEmpty(bizBidNotice.getSharedName()), BizBidShared::getSharedName, bizBidNotice.getSharedName()) .like(StrUtil.isNotEmpty(bizBidNotice.getSharedRole()), BizBidShared::getSharedRole, bizBidNotice.getSharedRole()) @@ -47,14 +41,9 @@ public class BizBidSharedServiceImpl extends BaseServiceImpl page = this.page(new Page<>(bizBidNotice.getPageNo(), bizBidNotice.getPageSize()), wrapper); - List collect = page.getRecords().stream().map(BizBidShared::getSharedFile).distinct().collect(Collectors.toList()); - Optional optional = attachmentClient.findByBusinessId(collect); - optional.ifPresent(o -> { - page.getRecords().forEach(r -> { - Optional first = o.get(r.getSharedFile()).stream().findFirst(); - first.ifPresent(f -> r.setFileName(f.getFilename()).setFileSuffix(FileUtil.getSuffix(f.getFilename()))); - }); - }); + //是否可下载 + page.getRecords().forEach(p -> p.setAllowDownload(p.getSharedRoles().contains(user.getCurrentRoleCode()))); + return page; } diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/controller/BizBidSharedRecordController.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/controller/BizBidSharedRecordController.java index 5970c70..62c7126 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/controller/BizBidSharedRecordController.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/controller/BizBidSharedRecordController.java @@ -6,7 +6,6 @@ import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse; import com.chinaunicom.mall.ebtp.common.base.service.IBaseCacheUserService; import com.chinaunicom.mall.ebtp.common.util.PropertyUtils; import com.chinaunicom.mall.ebtp.extend.bizbidshared.entity.BizBidShared; -import com.chinaunicom.mall.ebtp.extend.bizbidshared.service.IBizBidSharedService; import com.chinaunicom.mall.ebtp.extend.bizbidsharedrecord.entity.BizBidSharedRecord; import com.chinaunicom.mall.ebtp.extend.bizbidsharedrecord.entity.BizBidSharedRecordVO; import com.chinaunicom.mall.ebtp.extend.bizbidsharedrecord.service.IBizBidSharedRecordService; @@ -60,7 +59,7 @@ public class BizBidSharedRecordController { bizBidSharedRecord.setRecordId(bizBidShared.getId()); bizBidSharedRecord.setRecordAccount(cacheUser.getLoginName()); bizBidSharedRecord.setRecordName(cacheUser.getFullName()); - bizBidSharedRecord.setRecordRole(cacheUser.getRoleIds()); + bizBidSharedRecord.setRecordRole(cacheUser.getCurrentRoleCode()); bizBidSharedRecord.setRecordStaff(cacheUser.getUserId()); boolean save = ibizBidSharedRecordService.save(bizBidSharedRecord); diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/entity/BizBidSharedRecord.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/entity/BizBidSharedRecord.java index 21d34d9..b3c1e1e 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/entity/BizBidSharedRecord.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/entity/BizBidSharedRecord.java @@ -71,5 +71,4 @@ public class BizBidSharedRecord extends BaseEntity implements Serializable { private String recordAccount; - } diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/entity/BizBidSharedRecordVO.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/entity/BizBidSharedRecordVO.java index b127bca..32b0c95 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/entity/BizBidSharedRecordVO.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/entity/BizBidSharedRecordVO.java @@ -1,8 +1,6 @@ package com.chinaunicom.mall.ebtp.extend.bizbidsharedrecord.entity; import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.chinaunicom.mall.ebtp.common.base.entity.BaseEntity; import com.chinaunicom.mall.ebtp.common.base.entity.BasePageRequest; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/service/impl/BizBidSharedRecordServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/service/impl/BizBidSharedRecordServiceImpl.java index ba920be..19992a0 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/service/impl/BizBidSharedRecordServiceImpl.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/service/impl/BizBidSharedRecordServiceImpl.java @@ -7,11 +7,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.chinaunicom.mall.ebtp.common.base.service.impl.BaseServiceImpl; +import com.chinaunicom.mall.ebtp.common.constant.EbtpRoleEnum; import com.chinaunicom.mall.ebtp.extend.bizbidsharedrecord.dao.BizBidSharedRecordMapper; import com.chinaunicom.mall.ebtp.extend.bizbidsharedrecord.entity.BizBidSharedRecord; import com.chinaunicom.mall.ebtp.extend.bizbidsharedrecord.entity.BizBidSharedRecordVO; import com.chinaunicom.mall.ebtp.extend.bizbidsharedrecord.service.IBizBidSharedRecordService; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** @@ -22,8 +22,6 @@ import org.springframework.stereotype.Service; @Service public class BizBidSharedRecordServiceImpl extends BaseServiceImpl implements IBizBidSharedRecordService { - @Autowired - BizBidSharedRecordMapper bizBidSharedRecordMapper; @Override public IPage getList(BizBidSharedRecordVO recordVO) { @@ -38,13 +36,11 @@ public class BizBidSharedRecordServiceImpl extends BaseServiceImpl(recordVO.getPageNo(), recordVO.getPageSize()), wrapper); - } + Page page = this.page(new Page<>(recordVO.getPageNo(), recordVO.getPageSize()), wrapper); -// @Override -// public BizBidSharedRecord getByIdInfo(BizBidSharedRecord bizBidSharedRecord) { -// return bizBidSharedRecordMapper.getByIdInfo(bizBidSharedRecord.getRecordId(), bizBidSharedRecord.getCurrent(), bizBidSharedRecord.getPageSize()); -// } + page.getRecords().forEach(p -> p.setRecordRole(EbtpRoleEnum.matchRole(p.getRecordRole()).getDesc())); + return page; + } }