| | |
| | | import com.moral.common.bean.PageResult;
|
| | | import com.moral.common.util.ExampleUtil;
|
| | | import com.moral.common.util.RedisUtils;
|
| | | import com.moral.mapper.MonitorPointMapper;
|
| | | import org.apache.commons.collections.MapUtils;
|
| | | import org.apache.commons.lang3.BooleanUtils;
|
| | | import org.apache.commons.lang3.StringUtils;
|
| | |
| | |
|
| | | @Resource
|
| | | private DeviceMapper deviceMapper;
|
| | |
|
| | | @Resource
|
| | | private MonitorPointMapper monitorPointMapper;
|
| | | @Resource
|
| | | private AccountService accountService;
|
| | | private Class ENTITY_CLASS = Device.class;
|
| | |
| | | /*
|
| | | 刷新 redis 设备的信息
|
| | | */
|
| | | private void refreshDeviceInRedis(String mac){
|
| | | getDeviceWithOrgIdsByMac(mac);
|
| | | private void refreshDeviceInRedis(Device device){
|
| | | if(!StringUtils.isBlank(device.getMac())){
|
| | | Device simpleDevice = new Device();
|
| | | simpleDevice.setId(device.getId());
|
| | | simpleDevice.setDeviceVersion(device.getDeviceVersion());
|
| | | simpleDevice.setMac(device.getMac());
|
| | | simpleDevice.setMonitorPointId(device.getMonitorPointId());
|
| | | if(device.getMonitorPointId()!=null){
|
| | | List<Integer> orgIds = monitorPointMapper.selectOrganizationIds(device.getMonitorPointId());
|
| | | simpleDevice.setOrganizationIds(orgIds);
|
| | | }
|
| | | String key = "device_"+device.getMac();
|
| | | redisUtils.set(key,simpleDevice);
|
| | | }
|
| | | }
|
| | | @Override
|
| | | public PageBean queryByPageBean(PageBean pageBean) {
|
| | |
| | | }else{
|
| | | deviceMapper.updateByPrimaryKeySelective(device);
|
| | | //刷新redis里设备信息
|
| | | refreshDeviceInRedis(device.getMac());
|
| | | refreshDeviceInRedis(device);
|
| | | }
|
| | | }
|
| | | catch (Exception ex){
|