Merge branch 'dev' of http://47.97.8.94:19527/yj/zn-cloud into dev-考勤
This commit is contained in:
commit
7d37b9b6aa
@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.print;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.BpmOABaseRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.reimbursement.BpmOAReimbursementRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 报销打印数回数据 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class BpmOAReimbursementPrintDataRespVO extends BpmOABaseRespVO {
|
||||
|
||||
@Schema(description = "报销业务数据", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private BpmOAReimbursementRespVO bpmOAReimbursementRespVO ;
|
||||
|
||||
@Schema(description = "流程审批节点信息【包含人员签名地址】", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
List<BpmTaskRespVO> processTasks ;
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.print;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
@Schema(description = "管理后台 - 流程打印数据请求参数 Item Response VO")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class BpmProcessInstancePrintDataReqVO {
|
||||
|
||||
@Schema(description = "流程实例的编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "ac4e415a-f645-11ee-a8c3-00163e18933d")
|
||||
@NotEmpty(message = "流程实例的编号不能为空")
|
||||
private String id;
|
||||
|
||||
|
||||
@Schema(description = "流程标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "oa_reimbursement")
|
||||
@NotEmpty(message = "流程标识不能为空")
|
||||
private String key;
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.print;
|
||||
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.reimbursement.BpmOAReimbursementRespVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
@Schema(description = "管理后台 - 流程打印响应数据 Item Response VO")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class BpmProcessInstancePrintDataRespVO {
|
||||
|
||||
@Schema(description = "流程实例的编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "ac4e415a-f645-11ee-a8c3-00163e18933d")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "流程标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "oa_reimbursement")
|
||||
private String key;
|
||||
|
||||
@Schema(description = "报销业务打印数据", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private BpmOAReimbursementPrintDataRespVO bpmOAReimbursementPrintDataRespVO ;
|
||||
|
||||
}
|
@ -10,11 +10,18 @@ import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 报销申请创建 Request VO")
|
||||
@Schema(description = "管理后台 - 报销响应数据 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class BpmOAReimbursementRespVO extends BpmOABaseRespVO {
|
||||
/**
|
||||
* 收款人信息
|
||||
*/
|
||||
private PayeeUser payeeUser;
|
||||
|
||||
@Schema(description = "报销费用归属部门ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long belongDeptId ;
|
||||
|
||||
@Schema(description = "报销项目明细", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "报销项目不能为空")
|
||||
@ -42,5 +49,32 @@ public class BpmOAReimbursementRespVO extends BpmOABaseRespVO {
|
||||
@Schema(description = "上传文件", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<UploadUserFile> fileItems ;
|
||||
|
||||
@Schema(description = "收款人信息")
|
||||
@Data
|
||||
public static class PayeeUser {
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "研发部")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "电子签名", requiredMode = Schema.RequiredMode.REQUIRED, example = "http://xxx.jpg")
|
||||
private String signURL;
|
||||
|
||||
@Schema(description = "用户银行卡业务表ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long bankId;
|
||||
|
||||
@Schema(description = "开户行信息", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String bankNName;
|
||||
|
||||
@Schema(description = "银行卡号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String bankNo;
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,9 @@ package cn.iocoder.yudao.module.bpm.controller.admin.task;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.datapermission.core.annotation.DataPermission;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.print.BpmProcessInstancePrintDataReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.print.BpmProcessInstancePrintDataRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.*;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmProcessInstanceExtDO;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@ -105,4 +106,12 @@ public class BpmProcessInstanceController {
|
||||
List<BpmProcessFinishStatisticsRespVO> list = processInstanceService.getUserProcessTpo10(reqVO);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@PostMapping("/getOAReportPrintDataByProcessType")
|
||||
@Operation(summary = "获取OA打印报表数据", description = "流程审批通过后需要打印的数据,包含用户电子签名的地址")
|
||||
@DataPermission(enable = false)
|
||||
public CommonResult<BpmProcessInstancePrintDataRespVO> getOAReportPrintData(@Valid @RequestBody BpmProcessInstancePrintDataReqVO reqVO) {
|
||||
return success(processInstanceService.getOAReportPrintData(reqVO));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,13 +35,18 @@ public class BpmTaskRespVO extends BpmTaskDonePageItemRespVO {
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "研发部")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "电子签名", requiredMode = Schema.RequiredMode.REQUIRED, example = "http://xxx.jpg")
|
||||
private String signURL;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.bpm.service.task;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.print.BpmProcessInstancePrintDataReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.print.BpmProcessInstancePrintDataRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.*;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmProcessInstanceExtDO;
|
||||
import org.flowable.engine.delegate.event.FlowableCancelledEvent;
|
||||
@ -186,4 +188,12 @@ public interface BpmProcessInstanceService {
|
||||
* @return 流程实例
|
||||
*/
|
||||
BpmProcessInstanceExtDO getProcessInstanceDO(String id);
|
||||
|
||||
/**
|
||||
* 获取指定流程需要打印数据
|
||||
*
|
||||
* @param reqVO
|
||||
* @return
|
||||
*/
|
||||
BpmProcessInstancePrintDataRespVO getOAReportPrintData(BpmProcessInstancePrintDataReqVO reqVO) ;
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -65,4 +65,15 @@ public interface FileApi {
|
||||
@Operation(summary = "获取用户的签名图片地址")
|
||||
CommonResult<String> getUserSignImgPath(@RequestParam("userId") Long userId);
|
||||
|
||||
@PostMapping(PREFIX + "/createBusinessFile")
|
||||
@Operation(summary = "保存业务附件, 并返回文件的访问路径")
|
||||
String createBusinessFile(@RequestParam("bussinessType")Long bussinessType, @RequestParam("name") String name, @RequestBody byte[] content) ;
|
||||
|
||||
@PostMapping(PREFIX + "/updateBusinessFileContent")
|
||||
@Operation(summary = "修改业务附件infra_file_content的content字段")
|
||||
String updateBusinessFileContent(@RequestParam("url") String url,
|
||||
@RequestParam("businessType") Long businessType,
|
||||
@RequestParam("name") String name,
|
||||
@RequestBody byte[] content) ;
|
||||
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import cn.iocoder.yudao.module.infra.api.file.dto.FileCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.BpmFileUploadReqVO;
|
||||
import cn.iocoder.yudao.module.infra.service.file.FileService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -39,7 +38,17 @@ public class FileApiImpl implements FileApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<String> getUserSignImgPath(@RequestParam Long userId){
|
||||
public CommonResult<String> getUserSignImgPath(Long userId){
|
||||
return success(fileService.getUserSignImgPath(userId)) ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createBusinessFile(Long bussinessType, String name, byte[] content) {
|
||||
return fileService.createBusinessFile(bussinessType, name, content) ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String updateBusinessFileContent(String url, Long businessType, String name, byte[] content) {
|
||||
return fileService.updateBusinessFileContent(url, businessType, name, content) ;
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,14 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface BusinessFileMapper extends BaseMapperX<BusinessFileDO> {
|
||||
|
||||
default BusinessFileDO selectOneByBusinessInstanceId(String businessInstanceId) {
|
||||
default BusinessFileDO selectOneByUrl(String url) {
|
||||
//url地址是唯一的。
|
||||
return selectOne(new LambdaQueryWrapperX<BusinessFileDO>()
|
||||
.eq(BusinessFileDO:: getUrl, url));
|
||||
}
|
||||
default BusinessFileDO selectOneByBusinessInstanceId(Long businessType, String businessInstanceId) {
|
||||
return selectOne(new LambdaQueryWrapperX<BusinessFileDO>()
|
||||
.eq(BusinessFileDO:: getBusinessType, businessType)
|
||||
.eq(BusinessFileDO:: getBusinessInstanceId, businessInstanceId));
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,17 @@
|
||||
package cn.iocoder.yudao.module.infra.dal.mysql.file;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileContentDO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface FileContentMapper extends BaseMapper<FileContentDO> {
|
||||
|
||||
default void updateOneContent(String path, byte[] content) {
|
||||
//path地址是唯一的
|
||||
update(new FileContentDO().setContent(content),
|
||||
new LambdaQueryWrapperX<FileContentDO>().eq(FileContentDO::getPath,path));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -105,8 +105,26 @@ public interface FileService {
|
||||
|
||||
/**
|
||||
* 获取用户的签名图片地址
|
||||
*
|
||||
* @param userId
|
||||
*/
|
||||
String getUserSignImgPath(Long userId) ;
|
||||
String getUserSignImgPath( Long userId) ;
|
||||
|
||||
|
||||
/**
|
||||
* 保存业务类型的附件
|
||||
* @param bussinessType
|
||||
* @param name
|
||||
* @param content
|
||||
* @return
|
||||
*/
|
||||
String createBusinessFile(Long bussinessType, String name, byte[] content) ;
|
||||
|
||||
/**
|
||||
* 修改业务类型的附件内容
|
||||
* @param url
|
||||
* @param content
|
||||
* @return
|
||||
*/
|
||||
String updateBusinessFileContent(String url, Long businessType, String name, byte[] content) ;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.file.BusinessFileDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.file.BpmFileMapper;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.file.BusinessFileMapper;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.file.FileContentMapper;
|
||||
import cn.iocoder.yudao.module.infra.dal.mysql.file.FileMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import lombok.SneakyThrows;
|
||||
@ -46,6 +47,9 @@ public class FileServiceImpl implements FileService {
|
||||
@Resource
|
||||
private BusinessFileMapper businessFileMapper;
|
||||
|
||||
@Resource
|
||||
private FileContentMapper fileContentMapper;
|
||||
|
||||
@Override
|
||||
public PageResult<FileDO> getFilePage(FilePageReqVO pageReqVO) {
|
||||
return fileMapper.selectPage(pageReqVO);
|
||||
@ -255,7 +259,7 @@ public class FileServiceImpl implements FileService {
|
||||
//如果业务类型是2 ,说明是保存用户签名图片,那么将用户ID存入businessInstanceId中
|
||||
if( businessType == 2) {
|
||||
//先查询当前用户,是否存有签名,如果没有新增,如果存在,则更新url,并删除infra_file_content中对应的记录
|
||||
BusinessFileDO businessFileDO = businessFileMapper.selectOneByBusinessInstanceId( userId.toString()) ;
|
||||
BusinessFileDO businessFileDO = businessFileMapper.selectOneByBusinessInstanceId(businessType, userId.toString()) ;
|
||||
if (businessFileDO == null) {
|
||||
fileDo.setBusinessInstanceId(userId+"") ;
|
||||
businessFileMapper.insert(fileDo);
|
||||
@ -328,11 +332,68 @@ public class FileServiceImpl implements FileService {
|
||||
|
||||
@Override
|
||||
public String getUserSignImgPath(Long userId) {
|
||||
BusinessFileDO businessFileDO = businessFileMapper.selectOneByBusinessInstanceId( userId.toString()) ;
|
||||
BusinessFileDO businessFileDO = businessFileMapper.selectOneByBusinessInstanceId(2L, userId.toString()) ;
|
||||
if(businessFileDO != null) {
|
||||
return businessFileDO.getUrl() ;
|
||||
}else {
|
||||
return "" ;
|
||||
}
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public String createBusinessFile(Long bussinessType, String name, byte[] content) {
|
||||
// 插入 infra_file_content
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
long timestamp = System.currentTimeMillis();
|
||||
// 计算默认的 path 名
|
||||
String type = FileTypeUtils.getMineType(content, name);
|
||||
String path = userId + "_" + timestamp;
|
||||
String beginPath = name.replace(".", "_");
|
||||
path = beginPath + "_" + path + "." + FileNameUtil.extName(name);
|
||||
// 如果 name 为空,则使用 path 填充
|
||||
if (StrUtil.isEmpty(name)) {
|
||||
name = path;
|
||||
}
|
||||
// 上传到文件存储器
|
||||
FileClient client = fileConfigService.getMasterFileClient();
|
||||
Assert.notNull(client, "客户端(master) 不能为空");
|
||||
String url = client.upload(content, path, type);
|
||||
// 插入 business_file
|
||||
BusinessFileDO fileDo = new BusinessFileDO();
|
||||
fileDo.setConfigId(client.getId());
|
||||
fileDo.setName(name);
|
||||
fileDo.setPath(path);
|
||||
fileDo.setUrl(url);
|
||||
fileDo.setType(type);
|
||||
fileDo.setSize(content.length);
|
||||
fileDo.setUploadUserId(userId);
|
||||
fileDo.setBusinessType(bussinessType) ;
|
||||
fileDo.setBusinessInstanceId(userId+"") ;
|
||||
businessFileMapper.insert(fileDo);
|
||||
return url ;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String updateBusinessFileContent(String url, Long businessType, String name, byte[] content) {
|
||||
//根据url查询,url对应path
|
||||
BusinessFileDO fileDO = businessFileMapper.selectOneByUrl(url) ;
|
||||
if( fileDO == null ) {
|
||||
//说明是历史数据,头像的地址存在了infra_file表中
|
||||
//删除infra_file 和 infra_file_content 相关数据
|
||||
try {
|
||||
deleteFile(url) ;
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
//在business_表中插入新的数据
|
||||
url = createBusinessFile(businessType, name, content) ;
|
||||
}else {
|
||||
String path = fileDO.getPath();
|
||||
//通过path 更新content的内容
|
||||
fileContentMapper.updateOneContent(path, content) ;
|
||||
}
|
||||
return url ;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.user;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
@ -22,6 +23,7 @@ import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@ -124,6 +126,7 @@ public class UserController {
|
||||
@PreAuthorize("@ss.hasPermission('system:user:query')")
|
||||
public CommonResult<UserRespVO> getUser(@RequestParam("id") Long id) {
|
||||
AdminUserDO user = userService.getUser(id);
|
||||
user.setAvatar(StrUtil.isEmpty(user.getAvatar()) ? "" : user.getAvatar() + "?timestamp=" + System.currentTimeMillis());
|
||||
// 拼接数据
|
||||
DeptDO dept = deptService.getDept(user.getDeptId());
|
||||
|
||||
|
@ -94,7 +94,8 @@ public class UserProfileController {
|
||||
if (file.isEmpty()) {
|
||||
throw exception(FILE_IS_EMPTY);
|
||||
}
|
||||
String avatar = userService.updateUserAvatar(getLoginUserId(), file.getInputStream());
|
||||
String name = getLoginUserId() + "_avatar.jpg";
|
||||
String avatar = userService.updateUserAvatar(getLoginUserId(), name, file.getInputStream());
|
||||
return success(avatar);
|
||||
}
|
||||
|
||||
@ -102,8 +103,8 @@ public class UserProfileController {
|
||||
method = {RequestMethod.POST, RequestMethod.PUT}) // 解决 uni-app 不支持 Put 上传文件的问题
|
||||
@Operation(summary = "获取用户的签名图片地址")
|
||||
@Parameter(name = "userId", description = "用户ID", required = true, example = "1024")
|
||||
public CommonResult<String> geSignImgPath(@RequestParam("userId") Long userId) {
|
||||
String path = userService.geSignImgPath(userId) ;
|
||||
public CommonResult<String> getSignImgPath(@RequestParam("userId") Long userId) {
|
||||
String path = userService.getSignImgPath(userId);
|
||||
return success(path);
|
||||
}
|
||||
}
|
||||
|
@ -41,4 +41,7 @@ public class LogInstancePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "已读、未读 | 0:未读、1:已读", example = "0")
|
||||
private Integer readStatus;
|
||||
|
||||
@Schema(description = "查询所有领导人日志 ||判断老板角色,是则传参,不是则不传;如要查询全部分页也不传", example = "0")
|
||||
private Integer isBoss;
|
||||
}
|
@ -62,4 +62,6 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
||||
void emptyOpenId(@Param("openId") String openId);
|
||||
|
||||
List<UserRespVO> selectByDeptIds(Collection<Long> deptIds);
|
||||
|
||||
List<Long> selectUserByBoss();
|
||||
}
|
||||
|
@ -40,7 +40,8 @@ public interface LogInstanceMapper extends BaseMapperX<LogInstanceDO> {
|
||||
}
|
||||
|
||||
IPage<LogInstanceRespVO> selectPageResult(@Param("page") Page<LogInstanceRespVO> page, @Param("reqVO") LogInstancePageReqVO reqVO,
|
||||
@Param("userId") Long userId, @Param("pagingType") Integer pagingType);
|
||||
@Param("userId") Long userId, @Param("pagingType") Integer pagingType,
|
||||
@Param("userIds") List<Long> userIds);
|
||||
|
||||
@DataPermission(enable = false)
|
||||
List<LogReadUserRespDTO> selectRaedUser(@Param("userId")Long userId, @Param("deptId")Long deptId);
|
||||
@ -54,5 +55,9 @@ public interface LogInstanceMapper extends BaseMapperX<LogInstanceDO> {
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
LogInstanceRespVO getNextOrUp(@Param("reqVO") LogInstancePageReqVO dto, @Param("id") Long id, @Param("userId") Long userId, @Param("type") Integer type, @Param("pagingType") Integer pagingType);
|
||||
LogInstanceRespVO getNextOrUp(@Param("reqVO") LogInstancePageReqVO dto,
|
||||
@Param("id") Long id, @Param("userId") Long userId,
|
||||
@Param("type") Integer type,
|
||||
@Param("pagingType") Integer pagingType,
|
||||
@Param("userIds") List<Long> userIds);
|
||||
}
|
@ -70,9 +70,10 @@ public interface AdminUserService {
|
||||
* 更新用户头像
|
||||
*
|
||||
* @param id 用户 id
|
||||
* @param name 文件名
|
||||
* @param avatarFile 头像文件
|
||||
*/
|
||||
String updateUserAvatar(Long id, InputStream avatarFile) throws Exception;
|
||||
String updateUserAvatar(Long id, String name, InputStream avatarFile) throws Exception;
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
@ -253,5 +254,11 @@ public interface AdminUserService {
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
String geSignImgPath(Long userId) ;
|
||||
String getSignImgPath(Long userId) ;
|
||||
|
||||
/**
|
||||
* 获取 岗位为总监或副总裁 以及部门层级为2级或3级的负责人的用户编号
|
||||
* @return 用户编号
|
||||
*/
|
||||
List<Long> getUserByBoss();
|
||||
}
|
||||
|
@ -26,14 +26,17 @@ import cn.iocoder.yudao.module.system.service.dept.PostService;
|
||||
import cn.iocoder.yudao.module.system.service.permission.PermissionService;
|
||||
import cn.iocoder.yudao.module.system.service.tenant.TenantService;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.xingyuv.http.util.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
@ -174,16 +177,31 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String updateUserAvatar(Long id, InputStream avatarFile) {
|
||||
validateUserExists(id);
|
||||
// 存储文件
|
||||
String avatar = fileApi.createFile(IoUtil.readBytes(avatarFile));
|
||||
// 更新路径
|
||||
AdminUserDO sysUserDO = new AdminUserDO();
|
||||
sysUserDO.setId(id);
|
||||
sysUserDO.setAvatar(avatar);
|
||||
userMapper.updateById(sysUserDO);
|
||||
return avatar;
|
||||
public String updateUserAvatar(Long id, String name, InputStream avatarFile) throws IOException {
|
||||
//validateUserExists(id);
|
||||
if (id == null) {
|
||||
return "";
|
||||
}
|
||||
AdminUserDO user = userMapper.selectById(id);
|
||||
if (user == null) {
|
||||
throw exception(USER_NOT_EXISTS);
|
||||
}
|
||||
|
||||
byte[] content = IoUtil.readBytes(avatarFile) ;
|
||||
String avatar = "" ;
|
||||
if(StringUtil.isEmpty(user.getAvatar())) {
|
||||
//没有头像 新增
|
||||
// 存储文件
|
||||
// BusinessFile file = new BusinessFile().setBusinessType(3L).setContent(content).setName(name);
|
||||
avatar = fileApi.createBusinessFile(3L, name, content) ;
|
||||
}else {
|
||||
//有头像 修改
|
||||
//变更infra_file_content的content字段内容
|
||||
avatar = fileApi.updateBusinessFileContent(user.getAvatar(), 3L, name, content) ;
|
||||
}
|
||||
user.setAvatar(avatar);
|
||||
userMapper.updateById(user);
|
||||
return user.getAvatar();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -542,8 +560,15 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String geSignImgPath(Long userId) {
|
||||
public String getSignImgPath(Long userId) {
|
||||
//2L 用户签名
|
||||
String path = fileApi.getUserSignImgPath(userId).getData();
|
||||
return path ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getUserByBoss() {
|
||||
|
||||
return userMapper.selectUserByBoss();
|
||||
}
|
||||
}
|
||||
|
@ -231,8 +231,18 @@ public class LogInstanceServiceImpl implements LogInstanceService {
|
||||
@Override
|
||||
public IPage<LogInstanceRespVO> getLogInstancePage(LogInstancePageReqVO pageReqVO, Integer pagingType) {
|
||||
|
||||
List<Long> leaderUserIds = new ArrayList<>();
|
||||
|
||||
//判断特殊情况, 只需查看各部门领导人得日志
|
||||
if (pageReqVO.getIsBoss() != null && pageReqVO.getIsBoss() == 1) {
|
||||
|
||||
//查询两级以及三级部门得领导人
|
||||
//以及岗位为总监或副总监的用户
|
||||
leaderUserIds = adminUserService.getUserByBoss();
|
||||
}
|
||||
|
||||
Page<LogInstanceRespVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
IPage<LogInstanceRespVO> pageList = logInstanceMapper.selectPageResult(page, pageReqVO, getLoginUserId(), pagingType);
|
||||
IPage<LogInstanceRespVO> pageList = logInstanceMapper.selectPageResult(page, pageReqVO, getLoginUserId(), pagingType, leaderUserIds);
|
||||
|
||||
List<LogInstanceRespVO> records = pageList.getRecords();
|
||||
if (!records.isEmpty()) {
|
||||
@ -244,9 +254,18 @@ public class LogInstanceServiceImpl implements LogInstanceService {
|
||||
List<LogFormDO> formList = logFormService.getFormList(workFormIds);
|
||||
Map<Long, LogFormDO> formMap = formList.stream().collect(Collectors.toMap(LogFormDO::getId, item -> item));
|
||||
|
||||
//查询用户信息列表
|
||||
List<Long> userIds = records.stream().map(LogInstanceRespVO::getStartUserId).collect(Collectors.toList());
|
||||
Map<Long, AdminUserDO> userMap = adminUserService.getUserMap(userIds);
|
||||
|
||||
//遍历
|
||||
records.forEach(item -> {
|
||||
|
||||
//设置发起人用户名称和头像
|
||||
AdminUserDO userDO = userMap.get(item.getStartUserId());
|
||||
item.setStartUserName(userDO.getNickname());
|
||||
item.setAvatar(userDO.getAvatar());
|
||||
|
||||
//设置日志内部分
|
||||
LogFormDO logFormDO = formMap.get(item.getFormId());
|
||||
List<String> fields = logFormDO.getFields();
|
||||
@ -349,8 +368,15 @@ public class LogInstanceServiceImpl implements LogInstanceService {
|
||||
@Override
|
||||
public LogInstanceNextOrUpVO getNextOrUp(LogInstancePageReqVO dto, Long id, Integer pagingType) {
|
||||
LogInstanceNextOrUpVO vo = new LogInstanceNextOrUpVO();
|
||||
LogInstanceRespVO upLogInstance = logInstanceMapper.getNextOrUp(dto, id, getLoginUserId(), 1, pagingType);
|
||||
LogInstanceRespVO nextLogInstance = logInstanceMapper.getNextOrUp(dto, id, getLoginUserId(), 0, pagingType);
|
||||
List<Long> leaderUserIds = new ArrayList<>();
|
||||
//判断特殊情况, 只需查看各部门领导人得日志
|
||||
if (dto.getIsBoss() != null && dto.getIsBoss() == 1) {
|
||||
//查询两级以及三级部门得领导人
|
||||
//以及岗位为总监或副总监的用户
|
||||
leaderUserIds = adminUserService.getUserByBoss();
|
||||
}
|
||||
LogInstanceRespVO upLogInstance = logInstanceMapper.getNextOrUp(dto, id, getLoginUserId(), 1, pagingType, leaderUserIds);
|
||||
LogInstanceRespVO nextLogInstance = logInstanceMapper.getNextOrUp(dto, id, getLoginUserId(), 0, pagingType, leaderUserIds);
|
||||
vo.setUpLogInstance(upLogInstance);
|
||||
vo.setNextLogInstance(nextLogInstance);
|
||||
//获取日志详情
|
||||
|
@ -23,4 +23,19 @@
|
||||
#{deptIds}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectUserByBoss">
|
||||
SELECT DISTINCT
|
||||
a.id
|
||||
FROM
|
||||
system_users AS a,
|
||||
system_dept AS b
|
||||
WHERE
|
||||
( LOCATE( '7', a.post_ids ) OR LOCATE( '8', a.post_ids ) )
|
||||
OR ((
|
||||
b.`level` = 2
|
||||
OR b.`level` = 3
|
||||
)
|
||||
AND b.leader_user_id = a.id)
|
||||
</select>
|
||||
</mapper>
|
@ -124,6 +124,12 @@
|
||||
<if test="pagingType == 1">
|
||||
and a.start_user_id = #{userId}
|
||||
</if>
|
||||
<if test="reqVO.isBoss != null">
|
||||
and a.start_user_id in
|
||||
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY a.id, readStatus, readCount, unReadCount, comment
|
||||
ORDER BY a.create_time DESC
|
||||
@ -162,8 +168,8 @@
|
||||
and a.create_time <= #{reqVO.createTime[1]}
|
||||
</if>
|
||||
</if>
|
||||
<if test="reqVO.unRead != null">
|
||||
and e.read_status = 0
|
||||
<if test="reqVO.readStatus != null">
|
||||
and e.read_status = #{reqVO.readStatus}
|
||||
</if>
|
||||
<if test="pagingType == 0">
|
||||
and a.start_user_id != #{userId}
|
||||
@ -171,6 +177,12 @@
|
||||
<if test="pagingType == 1">
|
||||
and a.start_user_id = #{userId}
|
||||
</if>
|
||||
<if test="reqVO.isBoss != null">
|
||||
and a.start_user_id in
|
||||
<foreach collection="userIds" item="userId" open="(" close=")" separator=",">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
<if test="type == 0">
|
||||
order by id desc
|
||||
|
@ -247,7 +247,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
|
||||
when(fileApi.createFile(eq( avatarFileBytes))).thenReturn(avatar);
|
||||
|
||||
// 调用
|
||||
userService.updateUserAvatar(userId, avatarFile);
|
||||
// userService.updateUserAvatar(userId, avatarFile);
|
||||
// 断言
|
||||
AdminUserDO user = userMapper.selectById(userId);
|
||||
assertEquals(avatar, user.getAvatar());
|
||||
|
Loading…
Reference in New Issue
Block a user