|
@@ -6,7 +6,6 @@ import com.zd.common.core.annotation.DataScope;
|
|
|
import com.zd.common.core.exception.NoRollException;
|
|
import com.zd.common.core.exception.NoRollException;
|
|
|
import com.zd.common.core.exception.ServiceException;
|
|
import com.zd.common.core.exception.ServiceException;
|
|
|
import com.zd.common.core.redis.RedisService;
|
|
import com.zd.common.core.redis.RedisService;
|
|
|
-import com.zd.common.core.security.TokenService;
|
|
|
|
|
import com.zd.common.core.utils.DateUtils;
|
|
import com.zd.common.core.utils.DateUtils;
|
|
|
import com.zd.common.core.utils.SaveUtil;
|
|
import com.zd.common.core.utils.SaveUtil;
|
|
|
import com.zd.common.core.utils.StringUtils;
|
|
import com.zd.common.core.utils.StringUtils;
|
|
@@ -78,9 +77,6 @@ public class LabHardwareServiceImpl implements ILabHardwareService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private RemoteCabinetService remoteCabinetService;
|
|
private RemoteCabinetService remoteCabinetService;
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private TokenService tokenService;
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 查询硬件
|
|
* 查询硬件
|
|
|
*
|
|
*
|
|
@@ -162,15 +158,6 @@ public class LabHardwareServiceImpl implements ILabHardwareService {
|
|
|
@DataScope(deptAlias = "xx" , userAlias = "xx", permi = PerPrefix.LABORATORY_HARDWARE)
|
|
@DataScope(deptAlias = "xx" , userAlias = "xx", permi = PerPrefix.LABORATORY_HARDWARE)
|
|
|
public List<LabHardwareVO> selectLabHardwareList(LabHardware labHardware) {
|
|
public List<LabHardwareVO> selectLabHardwareList(LabHardware labHardware) {
|
|
|
List<LabHardwareVO> list = labHardwareMapper.selectLabHardwareList(labHardware);
|
|
List<LabHardwareVO> list = labHardwareMapper.selectLabHardwareList(labHardware);
|
|
|
-
|
|
|
|
|
- /*Map<String, Object> map;
|
|
|
|
|
- for (LabHardwareVO labHardwareVO : list) {
|
|
|
|
|
- map = socketService.getRelayData(labHardwareVO.getRelayCode());
|
|
|
|
|
- if(map != null && labHardwareVO.getBit() != null){
|
|
|
|
|
- int status = Integer.parseInt(map.get("reverseBit").toString().substring(labHardwareVO.getBit() -1, labHardwareVO.getBit()));
|
|
|
|
|
- labHardwareVO.setStatus(status);
|
|
|
|
|
- }
|
|
|
|
|
- }*/
|
|
|
|
|
for (LabHardwareVO labHardwareVO : list) {
|
|
for (LabHardwareVO labHardwareVO : list) {
|
|
|
if(labHardwareVO.getHardwareType()==2){
|
|
if(labHardwareVO.getHardwareType()==2){
|
|
|
Integer code=redisService.getCacheObject(CacheConstants.RELAY_STATUS_KEY+labHardwareVO.getId());
|
|
Integer code=redisService.getCacheObject(CacheConstants.RELAY_STATUS_KEY+labHardwareVO.getId());
|
|
@@ -241,20 +228,16 @@ public class LabHardwareServiceImpl implements ILabHardwareService {
|
|
|
LabHardware labHardware2 = new LabHardware();
|
|
LabHardware labHardware2 = new LabHardware();
|
|
|
labHardware2.setHardwareNum(labHardware.getHardwareNum());
|
|
labHardware2.setHardwareNum(labHardware.getHardwareNum());
|
|
|
Predicate<List<LabHardwareVO>> p = x->x.size()>0;
|
|
Predicate<List<LabHardwareVO>> p = x->x.size()>0;
|
|
|
- if(StringUtils.isNotBlank(labHardware2.getHardwareNum())){
|
|
|
|
|
- if(p.test(labHardwareMapper.selectLabHardwareList(labHardware2))){
|
|
|
|
|
- throw new ServiceException("设备编号重复,请重新输入。");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if(StringUtils.isNotBlank(labHardware2.getHardwareNum())
|
|
|
|
|
+ && p.test(labHardwareMapper.selectLabHardwareList(labHardware2))){
|
|
|
|
|
+ throw new ServiceException("设备编号重复,请重新输入。");
|
|
|
}
|
|
}
|
|
|
int id;
|
|
int id;
|
|
|
try{
|
|
try{
|
|
|
id = labHardwareMapper.insertLabHardware(labHardware);
|
|
id = labHardwareMapper.insertLabHardware(labHardware);
|
|
|
-
|
|
|
|
|
- if(HardwareTypeEnum.HK_DOOR.equals(labHardware.getType())){
|
|
|
|
|
- if(labHardwareMapper.selectCountByType(labHardware) > 3){
|
|
|
|
|
- throw new ServiceException("添加失败:同一实验室最多添加3台门禁设备");
|
|
|
|
|
- }
|
|
|
|
|
- //haiKangDoorService.addUserAuthorizeDoor(true, labHardware, tokenService.getLoginUser());
|
|
|
|
|
|
|
+ if(HardwareTypeEnum.HK_DOOR.equals(labHardware.getType())
|
|
|
|
|
+ && labHardwareMapper.selectCountByType(labHardware) > 3){
|
|
|
|
|
+ throw new ServiceException("添加失败:同一实验室最多添加3台门禁设备");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}catch (DuplicateKeyException e){
|
|
}catch (DuplicateKeyException e){
|
|
@@ -347,11 +330,6 @@ public class LabHardwareServiceImpl implements ILabHardwareService {
|
|
|
}
|
|
}
|
|
|
try{
|
|
try{
|
|
|
id=labHardwareMapper.updateLabHardware(labHardware);
|
|
id=labHardwareMapper.updateLabHardware(labHardware);
|
|
|
-
|
|
|
|
|
- /*if(HardwareTypeEnum.HK_DOOR.equals(old.getType()) && !old.getControlScope().equals(labHardware.getControlScope())){
|
|
|
|
|
- haiKangDoorService.updateUserAuthorizeDoor(old, labHardware);
|
|
|
|
|
- }*/
|
|
|
|
|
-
|
|
|
|
|
}catch (DuplicateKeyException e){
|
|
}catch (DuplicateKeyException e){
|
|
|
throw new ServiceException("继电器编号位置重复,请重新输入。");
|
|
throw new ServiceException("继电器编号位置重复,请重新输入。");
|
|
|
}
|
|
}
|
|
@@ -453,7 +431,6 @@ public class LabHardwareServiceImpl implements ILabHardwareService {
|
|
|
}catch (DuplicateKeyException e){
|
|
}catch (DuplicateKeyException e){
|
|
|
throw new ServiceException("该硬件绑定的传感器位置已被使用,绑定失败");
|
|
throw new ServiceException("该硬件绑定的传感器位置已被使用,绑定失败");
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
return id;
|
|
return id;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -466,8 +443,7 @@ public class LabHardwareServiceImpl implements ILabHardwareService {
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public int setLock(LabHardwareVO labHardwareVO) {
|
|
public int setLock(LabHardwareVO labHardwareVO) {
|
|
|
- int flag = labHardwareMapper.setLock(labHardwareVO);
|
|
|
|
|
- return flag;
|
|
|
|
|
|
|
+ return labHardwareMapper.setLock(labHardwareVO);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -479,15 +455,8 @@ public class LabHardwareServiceImpl implements ILabHardwareService {
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(noRollbackFor = {NoRollException.class})
|
|
@Transactional(noRollbackFor = {NoRollException.class})
|
|
|
public int deleteLabHardwareByIds(Long[] ids) {
|
|
public int deleteLabHardwareByIds(Long[] ids) {
|
|
|
- LabHardwareVO labHardware = labHardwareMapper.selectLabHardwareById(ids[0]);
|
|
|
|
|
-
|
|
|
|
|
labSubjectHardwarePostionMapper.deleteLabSubjectHardwarePositionByHardId(ids[0]);
|
|
labSubjectHardwarePostionMapper.deleteLabSubjectHardwarePositionByHardId(ids[0]);
|
|
|
- int flag = labHardwareMapper.deleteLabHardwareByIds(ids);
|
|
|
|
|
-
|
|
|
|
|
- /*if(HardwareTypeEnum.HK_DOOR.equals(labHardware.getType())){
|
|
|
|
|
- haiKangDoorService.deleteUserAuthorizeDoor(labHardware);
|
|
|
|
|
- }*/
|
|
|
|
|
- return flag;
|
|
|
|
|
|
|
+ return labHardwareMapper.deleteLabHardwareByIds(ids);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|