|
|
|
@ -346,29 +346,6 @@ public class EpidemicBuildingUnitServiceImpl extends CrudServiceImpl<EpidemicBui |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public int getRoomMaxCode(Long buildingId, String unit) { |
|
|
|
Integer maxCode = baseDao.getRoomMaxCode(buildingId, null); |
|
|
|
if (maxCode == null) { |
|
|
|
maxCode = 0; |
|
|
|
} |
|
|
|
return maxCode; |
|
|
|
} |
|
|
|
|
|
|
|
// @Override
|
|
|
|
// public int getUnitNewCode(Long buildingId, String unit) {
|
|
|
|
// Integer code = baseDao.getUnitCode(buildingId, unit);
|
|
|
|
// if (code != null && code != NumConstant.ZERO) {
|
|
|
|
// return code;
|
|
|
|
// }
|
|
|
|
// Integer maxCode = baseDao.getUnitMaxCode(buildingId);
|
|
|
|
// if (maxCode == null || maxCode == NumConstant.ZERO) {
|
|
|
|
// maxCode = 0;
|
|
|
|
// }
|
|
|
|
// maxCode = maxCode + 1;
|
|
|
|
// return maxCode;
|
|
|
|
// }
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void updateErrorRoom() { |
|
|
|
List<EpidemicBuildingUnitEntity> list = baseDao.getErrorRoom(); |
|
|
|
@ -428,47 +405,6 @@ public class EpidemicBuildingUnitServiceImpl extends CrudServiceImpl<EpidemicBui |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// private void updateUnitMaCode(EpidemicBuildingUnitEntity entity) {
|
|
|
|
// String key = RedisKeys.getMaUnitCodeKey(entity.getBuildingId().toString(), entity.getUnit());
|
|
|
|
// String nextKey = RedisKeys.getMaUnitNextCodeKey(entity.getBuildingId().toString());
|
|
|
|
// Object obj = redisUtils.get(key);
|
|
|
|
// Object nextObj = redisUtils.get(nextKey);
|
|
|
|
// if (null != obj) {
|
|
|
|
// int maCodeCache = (int) obj;
|
|
|
|
// entity.setUnitMaCode(maCodeCache);
|
|
|
|
// redisUtils.set(key, maCodeCache, RedisUtils.HOUR_ONE_EXPIRE);
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// if (null != nextObj) {
|
|
|
|
// int maCodeCache = (int) nextObj;
|
|
|
|
// entity.setUnitMaCode(maCodeCache);
|
|
|
|
// redisUtils.set(key, maCodeCache, RedisUtils.HOUR_ONE_EXPIRE);
|
|
|
|
// redisUtils.set(nextKey, maCodeCache + 1, RedisUtils.HOUR_ONE_EXPIRE);
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// int maCode = getUnitNewCode(entity.getBuildingId(), entity.getUnit());
|
|
|
|
// entity.setUnitMaCode(maCode);
|
|
|
|
// redisUtils.set(key, maCode, RedisUtils.HOUR_ONE_EXPIRE);
|
|
|
|
// redisUtils.set(nextKey, maCode + 1, RedisUtils.HOUR_ONE_EXPIRE);
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// private void updateRoomMaCode(EpidemicBuildingUnitEntity entity) {
|
|
|
|
// String key = RedisKeys.getMaRoomCodeKey(entity.getBuildingId().toString(), entity.getUnit());
|
|
|
|
// Object obj = redisUtils.get(key);
|
|
|
|
// if (null != obj) {
|
|
|
|
// int maCodeCache = (int) obj;
|
|
|
|
// maCodeCache = maCodeCache + 1;
|
|
|
|
// entity.setRoomMaCode(maCodeCache);
|
|
|
|
// redisUtils.set(key, maCodeCache, RedisUtils.HOUR_ONE_EXPIRE);
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// int maCode = getRoomMaxCode(entity.getBuildingId(), entity.getUnit());
|
|
|
|
// maCode = maCode + 1;
|
|
|
|
// entity.setRoomMaCode(maCode);
|
|
|
|
// redisUtils.set(key, maCode, RedisUtils.HOUR_ONE_EXPIRE);
|
|
|
|
// }
|
|
|
|
|
|
|
|
@Override |
|
|
|
public Result createBatchHouseCodeAndUrl() { |
|
|
|
epidemicPlotBuildingService.updateMaCode(); |
|
|
|
@ -888,10 +824,10 @@ public class EpidemicBuildingUnitServiceImpl extends CrudServiceImpl<EpidemicBui |
|
|
|
} else { |
|
|
|
unitCode = unitNum.substring(unitNum.length() - 3); |
|
|
|
} |
|
|
|
if (roomNum.length() < 3) { |
|
|
|
roomCode = String.format("%03d", Integer.parseInt(roomNum)); |
|
|
|
if (roomNum.length() < 4) { |
|
|
|
roomCode = String.format("%04d", Integer.parseInt(roomNum)); |
|
|
|
} else { |
|
|
|
roomCode = roomNum.substring(roomNum.length() - 3); |
|
|
|
roomCode = roomNum.substring(roomNum.length() - 4); |
|
|
|
} |
|
|
|
return unitCode.concat(roomCode); |
|
|
|
} |
|
|
|
|