| @@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.ModelAttribute; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | import org.springframework.web.bind.annotation.RestController; | ||||
| import javax.servlet.http.HttpServletResponse; | |||||
| import java.util.List; | import java.util.List; | ||||
| import static com.iformall.domain.po.WxCampaign.Field.SortNum_ASC; | import static com.iformall.domain.po.WxCampaign.Field.SortNum_ASC; | ||||
| @@ -91,5 +92,11 @@ public class WxCampaignController extends BaseController { | |||||
| return new ResultData(Result.SUCCESS, "调整顺序成功", null); | return new ResultData(Result.SUCCESS, "调整顺序成功", null); | ||||
| } | } | ||||
| @ApiOperation("输出富文本内容") | |||||
| @GetMapping("/printHtmlById") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public void printHtmlById(Long id,HttpServletResponse response){ | |||||
| wxCampaignService.printHtmlById(id,response); | |||||
| } | |||||
| } | } | ||||
| @@ -4,6 +4,8 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxCampaign; | import com.iformall.domain.po.WxCampaign; | ||||
| import javax.servlet.http.HttpServletResponse; | |||||
| public interface WxCampaignService { | public interface WxCampaignService { | ||||
| /** | /** | ||||
| @@ -41,4 +43,7 @@ public interface WxCampaignService { | |||||
| ResultData updateStatus(WxCampaign wxCampaign); | ResultData updateStatus(WxCampaign wxCampaign); | ||||
| void printHtmlById(Long id, HttpServletResponse response); | |||||
| } | } | ||||
| @@ -25,6 +25,9 @@ import org.springframework.stereotype.Service; | |||||
| import org.springframework.transaction.annotation.Propagation; | import org.springframework.transaction.annotation.Propagation; | ||||
| import org.springframework.transaction.annotation.Transactional; | 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.Date; | ||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.List; | import java.util.List; | ||||
| @@ -197,5 +200,24 @@ public class WxCampaignServiceImpl implements WxCampaignService { | |||||
| return new ResultData(Result.SUCCESS,"操作成功"); | 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(); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -161,6 +161,7 @@ | |||||
| left join wx_mall_building b on s.building=b.id | left join wx_mall_building b on s.building=b.id | ||||
| left join wx_mall_floor f on s.floor=f.id | left join wx_mall_floor f on s.floor=f.id | ||||
| where rc.status not in(1,5,6,7) and rc.tenant_id=#{tenantId} | where rc.status not in(1,5,6,7) and rc.tenant_id=#{tenantId} | ||||
| order by id desc | |||||
| </select> | </select> | ||||
| </mapper> | </mapper> | ||||