|
@ -30,13 +30,16 @@ import com.epmet.commons.tools.annotation.MaskResponse; |
|
|
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
|
|
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.constant.ServiceConstant; |
|
|
import com.epmet.commons.tools.constant.ServiceConstant; |
|
|
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
import com.epmet.commons.tools.dto.form.IcHouseFormDTO; |
|
|
import com.epmet.commons.tools.dto.form.IcHouseFormDTO; |
|
|
|
|
|
import com.epmet.commons.tools.enums.HouseQrcodeEnum; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
import com.epmet.commons.tools.feign.ResultDataResolver; |
|
|
import com.epmet.commons.tools.feign.ResultDataResolver; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.redis.common.bean.HouseInfoCache; |
|
|
import com.epmet.commons.tools.redis.common.bean.HouseInfoCache; |
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
|
|
import com.epmet.commons.tools.utils.BarcodeUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ExcelUtils; |
|
|
import com.epmet.commons.tools.utils.ExcelUtils; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
@ -44,6 +47,7 @@ import com.epmet.commons.tools.utils.poi.excel.handler.ExcelFillRowMergeStrategy |
|
|
import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; |
|
|
import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; |
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
import com.epmet.constants.ImportTaskConstants; |
|
|
import com.epmet.constants.ImportTaskConstants; |
|
|
|
|
|
import com.epmet.dao.IcHouseDao; |
|
|
import com.epmet.dto.form.*; |
|
|
import com.epmet.dto.form.*; |
|
|
import com.epmet.dto.result.*; |
|
|
import com.epmet.dto.result.*; |
|
|
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
|
|
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
|
@ -61,9 +65,12 @@ import org.springframework.util.CollectionUtils; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
|
|
|
|
import javax.imageio.ImageIO; |
|
|
|
|
|
import javax.imageio.stream.ImageOutputStream; |
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
import java.io.InputStream; |
|
|
import java.awt.image.BufferedImage; |
|
|
import java.io.PrintWriter; |
|
|
import java.io.*; |
|
|
|
|
|
import java.net.URLEncoder; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.HashMap; |
|
|
import java.util.HashMap; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
@ -90,6 +97,9 @@ public class HouseController implements ResultDataResolver { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient; |
|
|
private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IcHouseDao icHouseDao; |
|
|
|
|
|
|
|
|
@PostMapping("houselist") |
|
|
@PostMapping("houselist") |
|
|
@MaskResponse(fieldNames = {"ownerIdCard", "ownerPhone"}, |
|
|
@MaskResponse(fieldNames = {"ownerIdCard", "ownerPhone"}, |
|
|
fieldsMaskType = { MaskResponse.MASK_TYPE_ID_CARD, MaskResponse.MASK_TYPE_MOBILE }) |
|
|
fieldsMaskType = { MaskResponse.MASK_TYPE_ID_CARD, MaskResponse.MASK_TYPE_MOBILE }) |
|
@ -415,4 +425,62 @@ public class HouseController implements ResultDataResolver { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Desc: 生成某类型下的二维码 |
|
|
|
|
|
* @param formDTO |
|
|
|
|
|
* @author zxc |
|
|
|
|
|
* @date 2022/3/2 10:32 上午 |
|
|
|
|
|
*/ |
|
|
|
|
|
@PostMapping("createHouseQrcode") |
|
|
|
|
|
public void createQrCode(@RequestBody HouseQrcodeFormDTO formDTO, HttpServletResponse response){ |
|
|
|
|
|
ValidatorUtils.validateEntity(formDTO); |
|
|
|
|
|
try { |
|
|
|
|
|
IcHouseListResultDTO house = icHouseDao.selectHouseQrcodeById(formDTO.getId()); |
|
|
|
|
|
if(null == house){ |
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "未查到房屋信息","未查到房屋信息"); |
|
|
|
|
|
} |
|
|
|
|
|
//url组成:小程序地址?房屋编码
|
|
|
|
|
|
String url = HouseQrcodeEnum.PREFIX.getCode()+"?houseCode="+house.getHouseCode(); |
|
|
|
|
|
BufferedImage image = BarcodeUtils.drawQRImage(house.getNeighborHoodName() + house.getBuildingName() +house.getUnitNum()+ house.getDoorName(), url); |
|
|
|
|
|
//BufferedImage 转 InputStream
|
|
|
|
|
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); |
|
|
|
|
|
ImageOutputStream imageOutput = ImageIO.createImageOutputStream(byteArrayOutputStream); |
|
|
|
|
|
ImageIO.write(image, "png", imageOutput); |
|
|
|
|
|
InputStream inputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray()); |
|
|
|
|
|
long length = imageOutput.length(); |
|
|
|
|
|
String fileName = house.getNeighborHoodName() + house.getBuildingName() +house.getUnitNum()+ house.getDoorName()+".png"; |
|
|
|
|
|
response.setContentType("application/octet-stream"); |
|
|
|
|
|
response.setContentLength((int)length); |
|
|
|
|
|
response.setHeader("Content-Disposition","attachment;filename="+ URLEncoder.encode(fileName, StrConstant.UTF_8)); |
|
|
|
|
|
|
|
|
|
|
|
//输出流
|
|
|
|
|
|
byte[] bytes = new byte[1024]; |
|
|
|
|
|
OutputStream outputStream = response.getOutputStream(); |
|
|
|
|
|
long count = 0; |
|
|
|
|
|
while(count < length){ |
|
|
|
|
|
int len = inputStream.read(bytes, 0, 1024); |
|
|
|
|
|
count +=len; |
|
|
|
|
|
outputStream.write(bytes, 0, len); |
|
|
|
|
|
} |
|
|
|
|
|
outputStream.flush(); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
log.error("method exception", e); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @describe: 批量下载一户一档的二维码 |
|
|
|
|
|
* @author wangtong |
|
|
|
|
|
* @date 2022/5/31 17:58 |
|
|
|
|
|
* @params [loginUser, formDTO, response] |
|
|
|
|
|
* @return void |
|
|
|
|
|
*/ |
|
|
|
|
|
@PostMapping(value = "/downloadZip") |
|
|
|
|
|
public void downloadZip(@LoginUser TokenDto loginUser, @RequestBody IcHouseListFormDTO formDTO, HttpServletResponse response) throws Exception { |
|
|
|
|
|
//效验数据
|
|
|
|
|
|
LoginUserDetailsResultDTO loginUserDetail = getLoginUserDetailsResultDTO(loginUser, "【查询房屋】查询当前staff所在组织信息失败"); |
|
|
|
|
|
formDTO.setAgencyId(loginUserDetail.getAgencyId()); |
|
|
|
|
|
ValidatorUtils.validateEntity(formDTO); |
|
|
|
|
|
houseService.downloadZip(response,formDTO); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|