From 39fbc79c581b308dbbf04f4463fc1bc3b2fb18e2 Mon Sep 17 00:00:00 2001 From: wangsixiang <2970484253@qq.com> Date: Fri, 12 Jul 2024 14:27:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=80=BC=E7=8F=AD=E5=AF=BC=E5=85=A5=E9=AA=8C?= =?UTF-8?q?=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/zc/business/mapper/DcShiftsMapper.java | 2 ++ .../com/zc/business/service/impl/DcShiftsServiceImpl.java | 5 +++++ .../src/main/resources/mapper/business/DcShiftsMapper.xml | 3 +++ 3 files changed, 10 insertions(+) diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcShiftsMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcShiftsMapper.java index a5ec7ff7..83e170b2 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcShiftsMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcShiftsMapper.java @@ -75,6 +75,8 @@ public interface DcShiftsMapper List> selectEmp(@Param("organizationId")Long organizationId,@Param("name") String name); //根据创建时间获取信息 public DcShifts selectDcShiftsByCreateTime(Long id); + //查询具体人员在某天是否存在值班 + public DcShifts selectDcShiftsDay(DcShifts dcShifts); // /** * 查询值班 diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java index 5766dd39..fe2edd29 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcShiftsServiceImpl.java @@ -302,6 +302,7 @@ public class DcShiftsServiceImpl implements IDcShiftsService String contactNumber = dcShifts.getContactNumber();//手机号 String organizationName = dcShifts.getOrganizationName();//驻点 String scheduling = dcShifts.getScheduling();//排班 + Date date = dcShifts.getDate();//值班日期 if (contactNumber == null || contactNumber.equals(UniversalEnum.EMPTY_STRING.getValue())) { msg = UniversalEnum.THE_PHONE_NUMBER_IS_EMPTY.getValue(); throw new ServiceException(msg); @@ -338,6 +339,10 @@ public class DcShiftsServiceImpl implements IDcShiftsService Long id = (Long) map.get("id"); dcShifts.setEmployeesId(id); dcShifts.setCreateTime(DateUtils.getNowDate()); + DcShifts dcShiftsDay = dcShiftsMapper.selectDcShiftsDay(dcShifts);//查看值班是否存在 + if (dcShiftsDay!=null){ //值班存在不在继续查询,执行下一个 + continue; + } int shifts = dcShiftsMapper.insertDcShifts(dcShifts); if (shifts == UniversalEnum.ZERO.getNumber()) { msg = "添加值班信息‘" + dcShifts.getName() + "’失败,请检查后重新导入"; diff --git a/zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml b/zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml index d842ca56..05d57694 100644 --- a/zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcShiftsMapper.xml @@ -128,6 +128,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by shifts.date desc +