|
|
@ -47,9 +47,11 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
import java.io.ByteArrayOutputStream; |
|
|
|
import java.io.File; |
|
|
|
import java.io.FileInputStream; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.*; |
|
|
|
import java.net.MalformedURLException; |
|
|
|
import java.net.URL; |
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
@ -147,6 +149,39 @@ public class EpidemicSentryPostServiceImpl extends BaseServiceImpl<EpidemicSentr |
|
|
|
return ConvertUtils.sourceToTarget(baseDao.selectOne(wrapper), EpidemicSentryPostDTO.class); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void downloadQRCode(String postId, HttpServletResponse response) { |
|
|
|
EpidemicSentryPostDTO dto = selectOneByThirdSentryPostid(postId); |
|
|
|
URL url; |
|
|
|
try { |
|
|
|
String fileUrl = dto.getMaCodeUrl(); |
|
|
|
url = new URL(fileUrl); |
|
|
|
|
|
|
|
DataInputStream dataInputStream = new DataInputStream(url.openStream()); |
|
|
|
if (null != dataInputStream) { |
|
|
|
response.setHeader("Cache-Control", "No-Cache"); |
|
|
|
response.setContentType("image/jpeg"); |
|
|
|
|
|
|
|
byte[] buf = new byte[1024]; |
|
|
|
int L; |
|
|
|
|
|
|
|
OutputStream toClient = new BufferedOutputStream(response.getOutputStream()); |
|
|
|
while ((L = dataInputStream.read(buf)) != NumConstant.ONE_NEG) { |
|
|
|
toClient.write(buf, NumConstant.ZERO, L); |
|
|
|
} |
|
|
|
dataInputStream.close(); |
|
|
|
toClient.flush(); |
|
|
|
toClient.close(); |
|
|
|
} |
|
|
|
} catch (MalformedURLException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} catch (UnsupportedEncodingException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} catch (IOException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<Map<String, String>> listSentryPostName() { |
|
|
|
return baseDao.selectListSentryPostName(); |
|
|
|