处理网格编码问题
This commit is contained in:
parent
9501db8495
commit
260a7c7aeb
@ -577,7 +577,11 @@ public class GridServiceImpl extends BaseService implements IGridService {
|
|||||||
*/
|
*/
|
||||||
private String getSaveGridCode(String areaCode) {
|
private String getSaveGridCode(String areaCode) {
|
||||||
GridPO areaLastPO = getAreaLastPO(areaCode);
|
GridPO areaLastPO = getAreaLastPO(areaCode);
|
||||||
return areaLastPO == null ? String.format("%s001", areaCode.substring(0, 12)) : String.valueOf(Long.valueOf(areaLastPO.getGridCode()) + 1);
|
if (areaLastPO == null) {
|
||||||
|
return String.format("%s001", areaCode);
|
||||||
|
}
|
||||||
|
String gridCode = areaLastPO.getGridCode().substring(areaLastPO.getGridCode().length() - 3);
|
||||||
|
return areaCode + String.format("%03d", (Integer.parseInt(gridCode) + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -594,7 +598,7 @@ public class GridServiceImpl extends BaseService implements IGridService {
|
|||||||
}
|
}
|
||||||
// 网格为空,递增
|
// 网格为空,递增
|
||||||
if (StringUtils.isBlank(gridCode)) {
|
if (StringUtils.isBlank(gridCode)) {
|
||||||
return areaCode + String.format("%03d", Integer.parseInt(areaLastPO.getGridCode().substring(areaLastPO.getGridCode().length() - 4)) + 1);
|
return areaCode + String.format("%03d", Integer.parseInt(areaLastPO.getGridCode().substring(areaLastPO.getGridCode().length() - 3)) + 1);
|
||||||
}
|
}
|
||||||
// 网格编码存在不更改
|
// 网格编码存在不更改
|
||||||
return areaCode + String.format("%03d", Integer.parseInt(gridCode.substring(gridCode.length() - 3)));
|
return areaCode + String.format("%03d", Integer.parseInt(gridCode.substring(gridCode.length() - 3)));
|
||||||
|
Loading…
Reference in New Issue
Block a user