|
|
@ -23,10 +23,7 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; |
|
|
|
import com.epmet.commons.tools.security.user.LoginUserUtil; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.commons.tools.utils.FileUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.utils.*; |
|
|
|
import com.epmet.constant.SmsTemplateConstant; |
|
|
|
import com.epmet.constants.ImportTaskConstants; |
|
|
|
import com.epmet.dao.*; |
|
|
@ -60,12 +57,22 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.web.multipart.commons.CommonsMultipartFile; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.awt.image.BufferedImage; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.io.OutputStream; |
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.nio.file.Files; |
|
|
|
import java.nio.file.Path; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.zip.ZipEntry; |
|
|
|
import java.util.zip.ZipOutputStream; |
|
|
|
|
|
|
|
import static com.epmet.constant.CustomerAgencyConstant.JUMP_URL; |
|
|
|
import static com.epmet.service.impl.HouseServiceImpl.bufferedImageToInputStream; |
|
|
|
|
|
|
|
/** |
|
|
|
* 企事业单位表 |
|
|
@ -303,8 +310,13 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic |
|
|
|
} |
|
|
|
//本组织及下级
|
|
|
|
formDTO.setStaffAgencyId(staffInfo.getAgencyId()); |
|
|
|
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getPageFlag()); |
|
|
|
List<EnterpriseDetailDTO> list = baseDao.selectList(formDTO); |
|
|
|
List<EnterpriseDetailDTO> list = new ArrayList<>(); |
|
|
|
if (formDTO.getPageFlag()){ |
|
|
|
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getPageFlag()); |
|
|
|
list = baseDao.selectList(formDTO); |
|
|
|
}else { |
|
|
|
list = baseDao.selectList(formDTO); |
|
|
|
} |
|
|
|
PageInfo<EnterpriseDetailDTO> pageInfo = new PageInfo<>(list); |
|
|
|
if (!org.springframework.util.CollectionUtils.isEmpty(list)) { |
|
|
|
//规模名称
|
|
|
@ -562,4 +574,51 @@ public class IcEnterpriseServiceImpl extends BaseServiceImpl<IcEnterpriseDao, Ic |
|
|
|
record.setType(type); |
|
|
|
icEnterpriseChangeRecordService.insert(record); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 登记码导出 |
|
|
|
* @param formDTO |
|
|
|
* @Author zxc |
|
|
|
* @Date 2022/10/26 15:55 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void qrCodeExport(EnterprisePageFormDTO formDTO, HttpServletResponse response) throws IOException { |
|
|
|
List<EnterpriseDetailDTO> list = list(formDTO).getList(); |
|
|
|
if (CollectionUtils.isEmpty(list)){ |
|
|
|
return; |
|
|
|
} |
|
|
|
response.reset(); |
|
|
|
//文件的名称
|
|
|
|
String downloadFilename = "登记码压缩包.zip"; |
|
|
|
//转换中文否则可能会产生乱码
|
|
|
|
downloadFilename = URLEncoder.encode(downloadFilename, "UTF-8"); |
|
|
|
// 指明response的返回对象是文件流
|
|
|
|
response.setContentType("application/octet-stream; charset=UTF-8"); |
|
|
|
//设置下载格式和名称
|
|
|
|
response.setHeader("Content-Disposition", "attachment;filename=" + downloadFilename); |
|
|
|
ZipOutputStream zip = new ZipOutputStream(response.getOutputStream()); |
|
|
|
for (EnterpriseDetailDTO l : list) { |
|
|
|
try { |
|
|
|
String content = JUMP_URL + "enterpriseId=" + l.getEnterpriseId() + "&customerId=" + formDTO.getCustomerId() + "&placeOrgName=" + l.getPlaceOrgName(); |
|
|
|
BufferedImage image = HouseQRcodeUtils.drawHouseQRImage(l.getPlaceOrgName(), content); |
|
|
|
byte[] buf = new byte[8192]; |
|
|
|
int len; |
|
|
|
//添加到zip
|
|
|
|
zip.putNextEntry(new ZipEntry(l.getPlaceOrgName()+l.getEnterpriseId()+".png")); |
|
|
|
InputStream inputStream = bufferedImageToInputStream(image); |
|
|
|
//输出压缩包
|
|
|
|
while ((len = inputStream.read(buf)) > 0) { |
|
|
|
zip.write(buf, 0, len); |
|
|
|
} |
|
|
|
inputStream.close(); |
|
|
|
} catch (IOException e) { |
|
|
|
log.error(e.getMessage()); |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "组装zip信息有误", "组装zip信息有误"); |
|
|
|
} catch (Exception e) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
|
} |
|
|
|
zip.close(); |
|
|
|
} |
|
|
|
|
|
|
|
} |