Sfoglia il codice sorgente

添加电工组服务区域是否在服务商的服务区域判断

dev
yeqd 4 anni fa
parent
commit
51658a1632
1 ha cambiato i file con 25 aggiunte e 0 eliminazioni
  1. +25
    -0
      user-service/src/main/java/com/hp/user/service/impl/ElectricianGroupServiceImpl.java

+ 25
- 0
user-service/src/main/java/com/hp/user/service/impl/ElectricianGroupServiceImpl.java Vedi File

@@ -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<ServiceProviderArea> queryWrapper = new QueryWrapper<ServiceProviderArea>();
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<ServiceProviderArea> areaQueryWrapper = new QueryWrapper<ServiceProviderArea>();
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<ElectricianElectricianGroup> electricianElectricianGroupList = new ArrayList<>();


Caricamento…
Annulla
Salva