From e993e6aa2dd4a8734ed4d6eeb18ed299ced8ace8 Mon Sep 17 00:00:00 2001 From: LingWei <485412@qq.com> Date: Sat, 15 Mar 2025 15:11:58 +0800 Subject: [PATCH] =?UTF-8?q?feat(oa):=20=E8=B7=9F=E8=BF=9B=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E5=8A=9F=E8=83=BD=E4=BF=AE=E5=A4=8D=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=A1=BE=E5=AE=A2=E9=87=8Did=EF=BC=8C=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/OaFollowUpRecordController.java | 2 +- .../impl/OaFollowUpRecordServiceImpl.java | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ruoyi-oa/src/main/java/com/ruoyi/oa/controller/OaFollowUpRecordController.java b/ruoyi-oa/src/main/java/com/ruoyi/oa/controller/OaFollowUpRecordController.java index c2490e7..1b6fda6 100644 --- a/ruoyi-oa/src/main/java/com/ruoyi/oa/controller/OaFollowUpRecordController.java +++ b/ruoyi-oa/src/main/java/com/ruoyi/oa/controller/OaFollowUpRecordController.java @@ -118,7 +118,7 @@ public class OaFollowUpRecordController extends BaseController { */ @GetMapping("/list/{customerId}") public R selectByCustomerIdId( - @NotNull(message = "主键不能为空") + @NotNull(message = "顾客id不能为空") @PathVariable Long customerId) { return R.ok(iOaFollowUpRecordService.selectByCustomerId(customerId)); } diff --git a/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/OaFollowUpRecordServiceImpl.java b/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/OaFollowUpRecordServiceImpl.java index 3ee958c..07db245 100644 --- a/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/OaFollowUpRecordServiceImpl.java +++ b/ruoyi-oa/src/main/java/com/ruoyi/oa/service/impl/OaFollowUpRecordServiceImpl.java @@ -1,6 +1,7 @@ package com.ruoyi.oa.service.impl; import cn.hutool.core.bean.BeanUtil; +import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.domain.PageQuery; @@ -106,7 +107,11 @@ public class OaFollowUpRecordServiceImpl implements IOaFollowUpRecordService { * 保存前的数据校验 */ private void validEntityBeforeSave(OaFollowUpRecord entity){ - //TODO 做一些数据校验,如唯一约束 + //TODO 做一些数据校验,如唯一约束--(仅仅验证了顾客id唯一,如有不对可删去) + if(!checkCustomerId(entity)){ + throw new ServiceException("操作跟进记录失败, 跟进记录客服ID已存在!"); + } + } /** @@ -133,6 +138,17 @@ public class OaFollowUpRecordServiceImpl implements IOaFollowUpRecordService { return baseMapper.selectVoList(queryWrapper); } + /** + * 验证customerid是否可以操作 + */ + public Boolean checkCustomerId(OaFollowUpRecord entity) { + if(entity.getCustomerId() != null){ + OaFollowUpRecord followUpRecord=baseMapper.selectOne(new LambdaQueryWrapper().eq(OaFollowUpRecord::getCustomerId,entity.getCustomerId())); + if(followUpRecord!=null&&!entity.getFollowId().equals(followUpRecord.getFollowId()))return false; + } + return true; + } + /** * 添加跟进记录 */