|
|
@ -32,10 +32,7 @@ import com.epmet.dao.*; |
|
|
|
import com.epmet.dto.*; |
|
|
|
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.entity.*; |
|
|
|
import com.epmet.enums.HouseChangeEnums; |
|
|
|
import com.epmet.enums.HousePurposeEnums; |
|
|
|
import com.epmet.enums.HouseRentFlagEnums; |
|
|
@ -152,7 +149,7 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { |
|
|
|
IcHouseEntity entity = new IcHouseEntity(); |
|
|
|
entity.setId(icHouseDTO.getId()); |
|
|
|
try { |
|
|
|
entity.setHouseQrcodeUrl(createHouseQrcodeUrl(icHouseDTO.getId())); |
|
|
|
entity.setHouseQrcodeUrl(createHouseQrcodeUrl(icHouseDTO.getId(),null)); |
|
|
|
} catch (Exception e) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"二维码生成失败","二维码生成失败"); |
|
|
|
} |
|
|
@ -834,14 +831,14 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { |
|
|
|
List<IcHouseListResultDTO> houseList = icHouseDao.searchHouseByPage(formDTO); |
|
|
|
|
|
|
|
//获取一户一码前缀地址
|
|
|
|
Result<List<SysDictDataDTO>> dict = epmetAdminOpenFeignClient.dictDataList("house_qrcode_pre"); |
|
|
|
if (!dict.success() || CollectionUtils.isEmpty(dict.getData())) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "一户一码前缀查询异常", "一户一码前缀查询异常"); |
|
|
|
CustomerOrgParameterEntity codePre = icHouseDao.selectByCustomerId(formDTO.getCustomerId(), HouseQrcodeEnum.PREFIX_KEY.getCode()); |
|
|
|
if(null == codePre){ |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "请先维护二维码前缀信息", "请先维护二维码前缀信息"); |
|
|
|
} |
|
|
|
for (IcHouseListResultDTO house : houseList) { |
|
|
|
|
|
|
|
BufferedImage image = HouseQRcodeUtils.drawHouseQRImage(house.getBuildingName() + house.getUnitNum() + house.getDoorName(), |
|
|
|
dict.getData().get(0).getDictValue() + house.getHouseCode()); |
|
|
|
codePre.getParameterValue() + house.getHouseCode()); |
|
|
|
|
|
|
|
try { |
|
|
|
byte[] buf = new byte[8192]; |
|
|
@ -920,7 +917,7 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public String createHouseQrcodeUrl(String houseId) throws Exception { |
|
|
|
public String createHouseQrcodeUrl(String houseId,String houseCode) throws Exception { |
|
|
|
if (StringUtils.isBlank(houseId)) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "房屋id不可为空", "房屋id不可为空"); |
|
|
|
} |
|
|
@ -929,11 +926,18 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "未查到房屋信息", "未查到房屋信息"); |
|
|
|
} |
|
|
|
//url组成:小程序地址?房屋编码
|
|
|
|
Result<List<SysDictDataDTO>> dict = epmetAdminOpenFeignClient.dictDataList("house_qrcode_pre"); |
|
|
|
if (!dict.success() || CollectionUtils.isEmpty(dict.getData())) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "一户一码前缀查询异常", "一户一码前缀查询异常"); |
|
|
|
CustomerOrgParameterEntity codePre = icHouseDao.selectByCustomerId(house.getCustomerId(), HouseQrcodeEnum.PREFIX_KEY.getCode()); |
|
|
|
if(null == codePre){ |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "请先维护二维码前缀信息", "请先维护二维码前缀信息"); |
|
|
|
} |
|
|
|
//默认使用传参的houseCode,如果没有则使用数据库查询到的houseCode
|
|
|
|
String url = ""; |
|
|
|
if(StringUtils.isBlank(houseCode)){ |
|
|
|
url = codePre.getParameterValue() + house.getHouseCode(); |
|
|
|
}else{ |
|
|
|
url = codePre.getParameterValue() + houseCode; |
|
|
|
} |
|
|
|
String url = dict.getData().get(0).getDictValue() + house.getHouseCode(); |
|
|
|
|
|
|
|
String fileName = house.getBuildingName() + house.getUnitNum() + house.getDoorName() + ".png"; |
|
|
|
BufferedImage image = HouseQRcodeUtils.drawHouseQRImage(house.getBuildingName() + house.getUnitNum() + house.getDoorName(), url); |
|
|
|
|
|
|
@ -990,13 +994,14 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { |
|
|
|
if(StringUtils.isNotBlank(house.getAreaCode())){ |
|
|
|
String areaCode = numberAfterFillZero(house.getAreaCode(), NumConstant.TWELVE); |
|
|
|
entity.setHouseCode(createHouseCode(house.getCustomerId(),house.getBuildingId(),areaCode)); |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
entity.setHouseQrcodeUrl(createHouseQrcodeUrl(house.getHouseId())); |
|
|
|
entity.setHouseQrcodeUrl(createHouseQrcodeUrl(house.getHouseId(),entity.getHouseCode())); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"二维码生成失败<houseId>:"+house.getHouseId(),"二维码生成失败<houseId>:"+house.getHouseId()); |
|
|
|
} |
|
|
|
} |
|
|
|
icHouseDao.updateById(entity); |
|
|
|
}); |
|
|
|
return new Result().ok("批量生成成功"); |
|
|
|