From 51658a1632359dbaea33547aeb2a498dc173167f Mon Sep 17 00:00:00 2001 From: yeqd Date: Mon, 29 Mar 2021 16:56:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=94=B5=E5=B7=A5=E7=BB=84?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=8C=BA=E5=9F=9F=E6=98=AF=E5=90=A6=E5=9C=A8?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=95=86=E7=9A=84=E6=9C=8D=E5=8A=A1=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ElectricianGroupServiceImpl.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/user-service/src/main/java/com/hp/user/service/impl/ElectricianGroupServiceImpl.java b/user-service/src/main/java/com/hp/user/service/impl/ElectricianGroupServiceImpl.java index c720189..5c2a46d 100644 --- a/user-service/src/main/java/com/hp/user/service/impl/ElectricianGroupServiceImpl.java +++ b/user-service/src/main/java/com/hp/user/service/impl/ElectricianGroupServiceImpl.java @@ -26,8 +26,10 @@ import com.hp.user.client.service.ElectricianGroupService; import com.hp.user.service.constants.UserConstants; import com.hp.user.service.dao.ElectricianElectricianGroupMapper; import com.hp.user.service.dao.ElectricianGroupMapper; +import com.hp.user.service.dao.ServiceProviderAreaMapper; import com.hp.user.service.entity.ElectricianElectricianGroup; import com.hp.user.service.entity.ElectricianGroup; +import com.hp.user.service.entity.ServiceProviderArea; import com.hp.user.service.redis.RedisOperation; import redis.clients.jedis.Jedis; @@ -42,6 +44,9 @@ public class ElectricianGroupServiceImpl implements ElectricianGroupService{ @Autowired private ElectricianElectricianGroupMapper electricianElectricianGroupMapper; + + @Autowired + private ServiceProviderAreaMapper serviceProviderAreaMapper; @Override @Transactional(rollbackFor = {Exception.class}) @@ -72,6 +77,16 @@ public class ElectricianGroupServiceImpl implements ElectricianGroupService{ result.setMessage("组长Id不能为空!"); return result; } + String area = electricianGroupVO.getCountCode(); + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("service_provider_id", serviceProviderId); + queryWrapper.eq("service_area", area); + Integer count = serviceProviderAreaMapper.selectCount(queryWrapper); + if(count == 0) { + result.setCode("-1"); + result.setMessage("电工组的服务区域超过服务商的服务区域"); + return result; + } ElectricianGroup electricianGroup = new ElectricianGroup(); String electricianGroupId = IdWorker.getIdStr(); BeanUtils.copyProperties(electricianGroupVO, electricianGroup); @@ -135,6 +150,16 @@ public class ElectricianGroupServiceImpl implements ElectricianGroupService{ result.setMessage("组长Id不能为空!"); return result; } + String area = electricianGroupVO.getCountCode(); + QueryWrapper areaQueryWrapper = new QueryWrapper(); + areaQueryWrapper.eq("service_provider_id", serviceProviderId); + areaQueryWrapper.eq("service_area", area); + Integer count = serviceProviderAreaMapper.selectCount(areaQueryWrapper); + if(count == 0) { + result.setCode("-1"); + result.setMessage("电工组的服务区域超过服务商的服务区域"); + return result; + } String[] electricianIds = StringUtils.split(electricianId,","); ElectricianElectricianGroup electricianElectricianGroup; List electricianElectricianGroupList = new ArrayList<>();