共享文档重构
This commit is contained in:
@ -1,12 +1,8 @@
|
||||
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<BizBidNotice> {
|
||||
@ -20,11 +16,11 @@ public interface BizBidNoticeMapper extends IBaseMapper<BizBidNotice> {
|
||||
|
||||
// public List<BizBidNotice> 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);
|
||||
}
|
||||
|
@ -26,49 +26,49 @@
|
||||
create_date, update_by, update_date,tenant_id,tenant_name,last_update_time, delete_flag from biz_bid_notice
|
||||
</sql>
|
||||
|
||||
<!-- <select id="getList" resultMap="BaseResultMap">-->
|
||||
<!-- <include refid="selectSzReplenishVo"/>-->
|
||||
<!-- where-->
|
||||
<!-- delete_flag = "normal" -->
|
||||
<!-- <if test="null != noticeTitle and '' != noticeTitle">-->
|
||||
<!-- and notice_title like '%${noticeTitle}%'-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="null != noticeName and '' != noticeName">-->
|
||||
<!-- and notice_name like '%${noticeName}%'-->
|
||||
<!-- </if>-->
|
||||
<!-- and notice_release="open" -->
|
||||
<!-- ORDER BY notice_top limit #{pageIndex},#{pageSize}-->
|
||||
<!-- </select>-->
|
||||
<!-- <select id="getList" resultMap="BaseResultMap">-->
|
||||
<!-- <include refid="selectSzReplenishVo"/>-->
|
||||
<!-- where-->
|
||||
<!-- delete_flag = "normal" -->
|
||||
<!-- <if test="null != noticeTitle and '' != noticeTitle">-->
|
||||
<!-- and notice_title like '%${noticeTitle}%'-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="null != noticeName and '' != noticeName">-->
|
||||
<!-- and notice_name like '%${noticeName}%'-->
|
||||
<!-- </if>-->
|
||||
<!-- and notice_release="open" -->
|
||||
<!-- ORDER BY notice_top limit #{pageIndex},#{pageSize}-->
|
||||
<!-- </select>-->
|
||||
|
||||
<!-- <select id="getListByTitle" resultMap="BaseResultMap">-->
|
||||
<!-- <include refid="selectSzReplenishVo"/>-->
|
||||
<!-- where-->
|
||||
<!-- delete_flag = "normal" -->
|
||||
<!-- -->
|
||||
<!-- and notice_release="open" and notice_title like '%${noticeTitle}%' ORDER BY notice_top limit #{pageIndex},#{pageSize}-->
|
||||
<!-- </select>-->
|
||||
<!-- <select id="getListByTitle" resultMap="BaseResultMap">-->
|
||||
<!-- <include refid="selectSzReplenishVo"/>-->
|
||||
<!-- where-->
|
||||
<!-- delete_flag = "normal" -->
|
||||
<!-- -->
|
||||
<!-- and notice_release="open" and notice_title like '%${noticeTitle}%' ORDER BY notice_top limit #{pageIndex},#{pageSize}-->
|
||||
<!-- </select>-->
|
||||
|
||||
<!-- <select id="getAllList" resultMap="BaseResultMap">-->
|
||||
<!-- <include refid="selectSzReplenishVo"/>-->
|
||||
<!-- where-->
|
||||
<!-- delete_flag = "normal"-->
|
||||
<!-- <if test="null != noticeTitle and '' != noticeTitle">-->
|
||||
<!-- and notice_title like '%${noticeTitle}%'-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="null != noticeName and '' != noticeName">-->
|
||||
<!-- and notice_name like '%${noticeName}%'-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="null != noticeRelease and '' != noticeRelease">-->
|
||||
<!-- and notice_release = #{noticeRelease}-->
|
||||
<!-- </if>-->
|
||||
<!-- ORDER BY notice_top limit #{pageIndex},#{pageSize}-->
|
||||
<!-- </select>-->
|
||||
<!-- <select id="getAllList" resultMap="BaseResultMap">-->
|
||||
<!-- <include refid="selectSzReplenishVo"/>-->
|
||||
<!-- where-->
|
||||
<!-- delete_flag = "normal"-->
|
||||
<!-- <if test="null != noticeTitle and '' != noticeTitle">-->
|
||||
<!-- and notice_title like '%${noticeTitle}%'-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="null != noticeName and '' != noticeName">-->
|
||||
<!-- and notice_name like '%${noticeName}%'-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="null != noticeRelease and '' != noticeRelease">-->
|
||||
<!-- and notice_release = #{noticeRelease}-->
|
||||
<!-- </if>-->
|
||||
<!-- ORDER BY notice_top limit #{pageIndex},#{pageSize}-->
|
||||
<!-- </select>-->
|
||||
|
||||
<!-- <select id="getAllListByTitle" resultMap="BaseResultMap">-->
|
||||
<!-- <include refid="selectSzReplenishVo"/>-->
|
||||
<!-- where-->
|
||||
<!-- delete_flag = "normal" and notice_title like '%${noticeTitle}%' ORDER BY notice_top limit #{pageIndex},#{pageSize}-->
|
||||
<!-- </select>-->
|
||||
<!-- <select id="getAllListByTitle" resultMap="BaseResultMap">-->
|
||||
<!-- <include refid="selectSzReplenishVo"/>-->
|
||||
<!-- where-->
|
||||
<!-- delete_flag = "normal" and notice_title like '%${noticeTitle}%' ORDER BY notice_top limit #{pageIndex},#{pageSize}-->
|
||||
<!-- </select>-->
|
||||
|
||||
<update id="delete" parameterType="com.chinaunicom.mall.ebtp.extend.bizbidnotice.entity.BizBidNotice">
|
||||
update biz_bid_notice
|
||||
|
@ -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;
|
||||
|
@ -40,7 +40,8 @@ public class BizBidNoticeServiceImpl extends BaseServiceImpl<BizBidNoticeMapper,
|
||||
wrapper.eq(BizBidNotice::getNoticeRelease, "open")
|
||||
.like(StrUtil.isNotEmpty(bizBidNotice.getNoticeTitle()), BizBidNotice::getNoticeTitle, bizBidNotice.getNoticeTitle())
|
||||
.like(StrUtil.isNotEmpty(bizBidNotice.getNoticeName()), BizBidNotice::getNoticeName, bizBidNotice.getNoticeName())
|
||||
.orderByAsc(BizBidNotice::getNoticeTop);
|
||||
.orderByDesc(BizBidNotice::getCreateDate);
|
||||
|
||||
|
||||
if (bizBidNotice.getCreateDate() != null) {
|
||||
wrapper.between(BizBidNotice::getCreateDate, bizBidNotice.getCreateDate(), bizBidNotice.getCreateDate().plusDays(1L));
|
||||
@ -57,7 +58,9 @@ public class BizBidNoticeServiceImpl extends BaseServiceImpl<BizBidNoticeMapper,
|
||||
wrapper.eq(StrUtil.isNotEmpty(bizBidNotice.getNoticeRelease()), BizBidNotice::getNoticeRelease, bizBidNotice.getNoticeRelease())
|
||||
.like(StrUtil.isNotEmpty(bizBidNotice.getNoticeTitle()), BizBidNotice::getNoticeTitle, bizBidNotice.getNoticeTitle())
|
||||
.like(StrUtil.isNotEmpty(bizBidNotice.getNoticeName()), BizBidNotice::getNoticeName, bizBidNotice.getNoticeName())
|
||||
.orderByAsc(BizBidNotice::getNoticeTop);
|
||||
.orderByAsc(BizBidNotice::getNoticeTop)
|
||||
.orderByDesc(BizBidNotice::getUpdateDate)
|
||||
.orderByDesc(BizBidNotice::getCreateDate);
|
||||
|
||||
IPage<BizBidNotice> page = this.page(new Page<>(bizBidNotice.getPageNo(), bizBidNotice.getPageSize()), wrapper);
|
||||
listRelease(page.getRecords());
|
||||
|
@ -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);
|
||||
|
@ -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<String> sharedRoles;
|
||||
private List<String> 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;
|
||||
|
||||
}
|
||||
|
@ -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<BizBidSharedMapper, BizBidShared> implements IBizBidSharedService {
|
||||
|
||||
@Autowired
|
||||
private AttachmentClient attachmentClient;
|
||||
private IBaseCacheUserService cacheUserService;
|
||||
|
||||
@Override
|
||||
public IPage<BizBidShared> getList(BizBidSharedVO bizBidNotice) {
|
||||
BaseCacheUser user = cacheUserService.getCacheUser();
|
||||
LambdaQueryWrapper<BizBidShared> 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<BizBidSharedMapper,
|
||||
|
||||
Page<BizBidShared> page = this.page(new Page<>(bizBidNotice.getPageNo(), bizBidNotice.getPageSize()), wrapper);
|
||||
|
||||
List<String> collect = page.getRecords().stream().map(BizBidShared::getSharedFile).distinct().collect(Collectors.toList());
|
||||
Optional<AttachmentDetail> optional = attachmentClient.findByBusinessId(collect);
|
||||
optional.ifPresent(o -> {
|
||||
page.getRecords().forEach(r -> {
|
||||
Optional<AttachmentEntity> 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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -71,5 +71,4 @@ public class BizBidSharedRecord extends BaseEntity implements Serializable {
|
||||
private String recordAccount;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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<BizBidSharedRecordMapper, BizBidSharedRecord> implements IBizBidSharedRecordService {
|
||||
|
||||
@Autowired
|
||||
BizBidSharedRecordMapper bizBidSharedRecordMapper;
|
||||
|
||||
@Override
|
||||
public IPage<BizBidSharedRecord> getList(BizBidSharedRecordVO recordVO) {
|
||||
@ -38,13 +36,11 @@ public class BizBidSharedRecordServiceImpl extends BaseServiceImpl<BizBidSharedR
|
||||
if (recordVO.getCreateDate() != null) {
|
||||
wrapper.between(BizBidSharedRecord::getCreateDate, recordVO.getCreateDate(), recordVO.getCreateDate().plusDays(1L));
|
||||
}
|
||||
return this.page(new Page<>(recordVO.getPageNo(), recordVO.getPageSize()), wrapper);
|
||||
}
|
||||
Page<BizBidSharedRecord> 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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user