mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-30 03:01:53 +08:00
fix: 修复 CRM 的一些 bug
This commit is contained in:
parent
8920b9787d
commit
d293fdd474
@ -44,6 +44,11 @@ public class CrmFollowUpRecordRespVO {
|
||||
@Schema(description = "关联的联系人名称数组")
|
||||
private List<String> contactNames;
|
||||
|
||||
@Schema(description = "图片")
|
||||
private List<String> picUrls;
|
||||
@Schema(description = "附件")
|
||||
private List<String> fileUrls;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
@ -37,8 +37,12 @@ public class CrmFollowUpRecordSaveReqVO {
|
||||
|
||||
@Schema(description = "关联的商机编号数组")
|
||||
private List<Long> businessIds;
|
||||
|
||||
@Schema(description = "关联的联系人编号数组")
|
||||
private List<Long> contactIds;
|
||||
|
||||
@Schema(description = "图片")
|
||||
private List<String> picUrls;
|
||||
@Schema(description = "附件")
|
||||
private List<String> fileUrls;
|
||||
|
||||
}
|
@ -28,6 +28,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
@ -103,7 +104,12 @@ public class CrmPermissionController {
|
||||
// 拼接数据
|
||||
List<AdminUserRespDTO> userList = adminUserApi.getUserList(convertSet(permission, CrmPermissionDO::getUserId));
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userList, AdminUserRespDTO::getDeptId));
|
||||
Set<Long> postIds = CollectionUtils.convertSetByFlatMap(userList, AdminUserRespDTO::getPostIds, Collection::stream);
|
||||
Set<Long> postIds = CollectionUtils.convertSetByFlatMap(userList, AdminUserRespDTO::getPostIds, item -> {
|
||||
if (item == null) {
|
||||
return Stream.empty();
|
||||
}
|
||||
return item.stream();
|
||||
});
|
||||
Map<Long, PostRespDTO> postMap = postApi.getPostMap(postIds);
|
||||
return success(CrmPermissionConvert.INSTANCE.convert(permission, userList, deptMap, postMap));
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package cn.iocoder.yudao.module.crm.convert.permission;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.permission.vo.CrmPermissionCreateReqVO;
|
||||
@ -49,11 +48,11 @@ public interface CrmPermissionConvert {
|
||||
findAndThen(userMap, item.getUserId(), user -> {
|
||||
item.setNickname(user.getNickname());
|
||||
findAndThen(deptMap, user.getDeptId(), deptRespDTO -> item.setDeptName(deptRespDTO.getName()));
|
||||
List<PostRespDTO> postRespList = MapUtils.getList(Multimaps.forMap(postMap), user.getPostIds());
|
||||
if (CollUtil.isEmpty(postRespList)) {
|
||||
if (user.getPostIds() == null) {
|
||||
item.setPostNames(Collections.emptySet());
|
||||
return;
|
||||
}
|
||||
List<PostRespDTO> postRespList = MapUtils.getList(Multimaps.forMap(postMap), user.getPostIds());
|
||||
item.setPostNames(CollectionUtils.convertSet(postRespList, PostRespDTO::getName));
|
||||
});
|
||||
return item;
|
||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.crm.dal.dataobject.followup;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.type.StringListTypeHandler;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO;
|
||||
import cn.iocoder.yudao.module.crm.enums.DictTypeConstants;
|
||||
@ -66,6 +67,18 @@ public class CrmFollowUpRecordDO extends BaseDO {
|
||||
*/
|
||||
private LocalDateTime nextTime;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
@TableField(typeHandler = StringListTypeHandler.class)
|
||||
private List<String> picUrls;
|
||||
|
||||
/**
|
||||
* 附件
|
||||
*/
|
||||
@TableField(typeHandler = StringListTypeHandler.class)
|
||||
private List<String> fileUrls;
|
||||
|
||||
/**
|
||||
* 关联的商机编号数组
|
||||
*
|
||||
@ -81,4 +94,5 @@ public class CrmFollowUpRecordDO extends BaseDO {
|
||||
@TableField(typeHandler = LongListTypeHandler.class)
|
||||
private List<Long> contactIds;
|
||||
|
||||
|
||||
}
|
||||
|
@ -53,6 +53,11 @@ public interface CrmPermissionMapper extends BaseMapperX<CrmPermissionDO> {
|
||||
.eq(CrmPermissionDO::getId, id).eq(CrmPermissionDO::getUserId, userId));
|
||||
}
|
||||
|
||||
default CrmPermissionDO selectByBizIdAndUserId(Long id, Long userId) {
|
||||
return selectOne(new LambdaQueryWrapperX<CrmPermissionDO>()
|
||||
.eq(CrmPermissionDO::getBizId, id).eq(CrmPermissionDO::getUserId, userId));
|
||||
}
|
||||
|
||||
default int deletePermission(Integer bizType, Long bizId) {
|
||||
return delete(new LambdaQueryWrapperX<CrmPermissionDO>()
|
||||
.eq(CrmPermissionDO::getBizType, bizType)
|
||||
|
@ -167,7 +167,10 @@ public class CrmPermissionServiceImpl implements CrmPermissionService {
|
||||
throw exception(CRM_PERMISSION_DELETE_FAIL);
|
||||
}
|
||||
// 校验操作人是否为负责人
|
||||
CrmPermissionDO permission = permissionMapper.selectByIdAndUserId(permissions.get(0).getBizId(), userId);
|
||||
CrmPermissionDO permission = permissionMapper.selectByBizIdAndUserId(permissions.getFirst().getBizId(), userId);
|
||||
if (permission == null) {
|
||||
throw exception(CRM_PERMISSION_DELETE_DENIED);
|
||||
}
|
||||
if (!CrmPermissionLevelEnum.isOwner(permission.getLevel())) {
|
||||
throw exception(CRM_PERMISSION_DELETE_DENIED);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user