Browse Source

area code补0

feature/teamB_zz_wgh
zhaoqifeng 3 years ago
parent
commit
a7fb2d8862
  1. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java

12
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java

@ -142,6 +142,7 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
//获取所属组织地区码
String areaCode = icNeighborHoodDao.getAreaCode(formDTO.getNeighborHoodId());
if (StringUtils.isNotBlank(areaCode)) {
areaCode = numberAfterFillZero(areaCode, NumConstant.TWELVE);
icHouseDTO.setHouseCode(createHouseCode(customerId, formDTO.getBuildingId(), areaCode));
}
icHouseDao.insert(icHouseDTO);
@ -981,5 +982,16 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
return result;
}
private String numberAfterFillZero(String str, int length) {
StringBuilder buffer = new StringBuilder(str);
if (buffer.length() >= length) {
return buffer.toString();
} else {
while (buffer.length() < length) {
buffer.append("0");
}
}
return buffer.toString();
}
}

Loading…
Cancel
Save