|
|
@ -30,6 +30,7 @@ import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.entity.IcHouseChangeDetailEntity; |
|
|
|
import com.epmet.entity.IcHouseChangeRecordEntity; |
|
|
|
import com.epmet.entity.IcHouseCodeInfoEntity; |
|
|
|
import com.epmet.entity.IcHouseEntity; |
|
|
|
import com.epmet.enums.HouseChangeEnums; |
|
|
|
import com.epmet.enums.HousePurposeEnums; |
|
|
@ -111,6 +112,8 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { |
|
|
|
private IcHouseChangeDetailService changeDetailService; |
|
|
|
@Autowired |
|
|
|
private HouseService houseService; |
|
|
|
@Autowired |
|
|
|
private IcHouseCodeInfoDao icHouseCodeInfoDao; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@ -839,5 +842,52 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { |
|
|
|
return house.getNeighborHoodName() + File.separator +house.getBuildingName() + File.separator +house.getUnitNum() + File.separator + house.getDoorName() + HouseQrcodeEnum.SUFFIX.getCode(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public String createHouseCode(String customerId, String buildingId, String areaCode) { |
|
|
|
String result = ""; |
|
|
|
IcHouseCodeInfoEntity codeEntity = icHouseCodeInfoDao.selectByCuIdAndBuilId(customerId, buildingId); |
|
|
|
if (null == codeEntity) { |
|
|
|
//查询数据库里最大的楼栋编号
|
|
|
|
IcHouseCodeInfoEntity maxCodeEntity = icHouseCodeInfoDao.selectMaxHouseMaxNum(); |
|
|
|
//新增楼栋信息
|
|
|
|
IcHouseCodeInfoEntity newEntity = new IcHouseCodeInfoEntity(); |
|
|
|
if (null != maxCodeEntity) { |
|
|
|
Integer buildingMaxNum = Integer.valueOf(maxCodeEntity.getBuildingMaxNum()) + 1; |
|
|
|
result = areaCode + getNewMaxIndex(buildingMaxNum) + "00001"; |
|
|
|
} else { |
|
|
|
//数据库里面的第一条数据
|
|
|
|
result = areaCode + "00001" + "00001"; |
|
|
|
newEntity.setBuildingMaxNum("00001"); |
|
|
|
newEntity.setHouseMaxNum("00001"); |
|
|
|
} |
|
|
|
newEntity.setCustomerId(customerId); |
|
|
|
newEntity.setBuildingId(buildingId); |
|
|
|
icHouseCodeInfoDao.insert(newEntity); |
|
|
|
} else { |
|
|
|
Integer houseMaxNum = Integer.valueOf(codeEntity.getHouseMaxNum()) + 1; |
|
|
|
result = areaCode + codeEntity.getBuildingMaxNum() + getNewMaxIndex(houseMaxNum); |
|
|
|
//更新该楼栋下最大的房间编号
|
|
|
|
codeEntity.setHouseMaxNum(getNewMaxIndex(houseMaxNum)); |
|
|
|
icHouseCodeInfoDao.updateById(codeEntity); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @return java.lang.String |
|
|
|
* @describe: 把数字转换成5位的字符串,不够的前面补0 |
|
|
|
* @author wangtong |
|
|
|
* @date 2022/6/1 14:27 |
|
|
|
* @params [maxIndex] |
|
|
|
*/ |
|
|
|
private String getNewMaxIndex(Integer maxIndex) { |
|
|
|
String result = maxIndex.toString(); |
|
|
|
while (result.length() < 5) { |
|
|
|
result = "0" + result; |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|