|
|
|
@@ -25,6 +25,9 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.ByteArrayInputStream; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
@@ -197,5 +200,24 @@ public class WxCampaignServiceImpl implements WxCampaignService { |
|
|
|
return new ResultData(Result.SUCCESS,"操作成功"); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void printHtmlById(Long id, HttpServletResponse response) { |
|
|
|
try { |
|
|
|
response.setHeader("Content-type","text/html;charset=utf-8"); |
|
|
|
WxCampaign wxCampaign = wxCampaignMapper.selectByPrimaryKey(id); |
|
|
|
// 循环取出流中的数据 |
|
|
|
byte[] b = new byte[1024]; |
|
|
|
int len; |
|
|
|
InputStream inStream = new ByteArrayInputStream(wxCampaign.getHtml().getBytes()); |
|
|
|
while ((len = inStream.read(b)) > 0){ |
|
|
|
response.getOutputStream().write(b, 0, len); |
|
|
|
} |
|
|
|
inStream.close(); |
|
|
|
} catch (Exception e) { |
|
|
|
logger.info("输出富文本内容" + e.getMessage()); |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |