diff --git a/src/main/java/com/sincere/wechatbusiness/controller/ReportVoluntaryController.java b/src/main/java/com/sincere/wechatbusiness/controller/ReportVoluntaryController.java
index 13351eb..1e97227 100644
--- a/src/main/java/com/sincere/wechatbusiness/controller/ReportVoluntaryController.java
+++ b/src/main/java/com/sincere/wechatbusiness/controller/ReportVoluntaryController.java
@@ -17,9 +17,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.imageio.ImageIO;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import java.awt.image.BufferedImage;
 import java.io.*;
 import java.net.HttpURLConnection;
 import java.net.URL;
+import java.net.URLEncoder;
 
 @RestController
 @RequestMapping("reportVoluntary")
@@ -142,19 +147,28 @@ public class ReportVoluntaryController {
 
     @ApiOperation("获取小程序动态码")
     @RequestMapping(value = "/downloadSmallRoutine" , method = RequestMethod.GET)
-    public BaseDto downloadSmallRoutine(int channelId){
-        BaseDto result = new BaseDto();
+    public void downloadSmallRoutine(int channelId, HttpServletResponse response){
         Channel channel = channelService.getDetail(channelId);
         if(StringUtils.isBlank(channel.getReportRoutineUrl())){
             createRoutine(channelId);
-            String prefix = domain.replaceAll("51314","51315");
-            String url = prefix+"smallRoutine\\"+channelId+".png" ;
+            String url = "https://market.myjxt.com:51315/smallRoutine/"+channelId+".png" ;
             channel.setReportRoutineUrl(url);
             channelService.updateRoutine(channelId,url);
         }
-        result.setData(channel.getReportRoutineUrl());
-        return result ;
-
+        try{
+            String fileUrl = channel.getReportRoutineUrl().replace("https://market.myjxt.com:51315/smallRoutine/","c:\\report\\img\\smallRoutine\\");
+            response.setHeader("Content-Disposition", "attachment;filename="+ URLEncoder.encode(channel.getName()+"动态码.jpg", "utf-8"));
+            InputStream in = new FileInputStream(fileUrl);
+            OutputStream out = response.getOutputStream();
+            byte [] by = new byte[1024];
+            int i = 0;
+            while((i=in.read(by))!=-1) {
+                out.write(by,0,i);
+            }
+            in.close();
+        }catch (Exception e){
+            e.printStackTrace();
+        }
     }
 
     public void createRoutine(int channelId){
@@ -183,7 +197,7 @@ public class ReportVoluntaryController {
             printWriter.flush();
             //开始获取数据
             BufferedInputStream bis = new BufferedInputStream(httpURLConnection.getInputStream());
-            OutputStream os = new FileOutputStream(new File("D:\\report\\img\\smallRoutine\\"+channelId+".png"));
+            OutputStream os = new FileOutputStream(new File("C:\\report\\img\\smallRoutine\\"+channelId+".png"));
             int len;
             byte[] arr = new byte[1024];
             while ((len = bis.read(arr)) != -1)
@@ -192,13 +206,19 @@ public class ReportVoluntaryController {
                 os.flush();
             }
             os.close();
-        }
-        catch (Exception e)
-        {
+        }catch (Exception e) {
             e.printStackTrace();
         }
     }
 
+    @ApiOperation("获取渠道商列表")
+    @RequestMapping(value = "/getChannelList" , method = RequestMethod.GET)
+    public BaseDto getChannelList(String name , int page , int pageSize ){
+        BaseDto result = new BaseDto();
+        result.setData(channelService.getReportChannel(page,pageSize,name));
+        return result ;
+    }
+
     @ApiOperation("获取渠道商推广的用户")
     @RequestMapping(value = "/getUserList" , method = RequestMethod.GET)
     public JSONObject getUserList(int channelId , int page , int pageSize){
diff --git a/src/main/java/com/sincere/wechatbusiness/mapper/ChannelMapper.java b/src/main/java/com/sincere/wechatbusiness/mapper/ChannelMapper.java
index ac217dc..96aaa86 100644
--- a/src/main/java/com/sincere/wechatbusiness/mapper/ChannelMapper.java
+++ b/src/main/java/com/sincere/wechatbusiness/mapper/ChannelMapper.java
@@ -8,6 +8,9 @@ import java.util.List;
 
 public interface ChannelMapper {
 
+    List<Channel> getReportChannel(@Param("name") String name);
+    int getReportChannelCount(@Param("name") String name);
+
     Channel getByName(String name);
 
     List<Channel> getListByTemplate(int templateId);
diff --git a/src/main/java/com/sincere/wechatbusiness/service/ChannelService.java b/src/main/java/com/sincere/wechatbusiness/service/ChannelService.java
index 8b62045..2482494 100644
--- a/src/main/java/com/sincere/wechatbusiness/service/ChannelService.java
+++ b/src/main/java/com/sincere/wechatbusiness/service/ChannelService.java
@@ -7,6 +7,8 @@ import java.util.List;
 
 public interface ChannelService {
 
+    Page<Channel> getReportChannel(int page , int pageSize , String name);
+
     List<Channel> getListByTemplate(int templateId);
 
     Page<Channel> getList(Channel channel, int page, int pageSize);
diff --git a/src/main/java/com/sincere/wechatbusiness/service/impl/ChannelServiceImpl.java b/src/main/java/com/sincere/wechatbusiness/service/impl/ChannelServiceImpl.java
index a72f06c..c9b01e3 100644
--- a/src/main/java/com/sincere/wechatbusiness/service/impl/ChannelServiceImpl.java
+++ b/src/main/java/com/sincere/wechatbusiness/service/impl/ChannelServiceImpl.java
@@ -16,6 +16,15 @@ public class ChannelServiceImpl implements ChannelService {
     ChannelMapper channelMapper;
 
     @Override
+    public Page<Channel> getReportChannel(int page, int pageSize, String name) {
+        Page<Channel> result=new Page<>(page,pageSize);
+        PageHelper.startPage(page,pageSize);
+        result.setList(channelMapper.getReportChannel(name));
+        result.setCount(channelMapper.getReportChannelCount(name));
+        return result;
+    }
+
+    @Override
     public List<Channel> getListByTemplate(int templateId) {
         return channelMapper.getListByTemplate(templateId);
     }
diff --git a/src/main/resources/mapper/ChannelMapper.xml b/src/main/resources/mapper/ChannelMapper.xml
index 256a40c..c77b268 100644
--- a/src/main/resources/mapper/ChannelMapper.xml
+++ b/src/main/resources/mapper/ChannelMapper.xml
@@ -15,8 +15,25 @@
         <result column="province_code" jdbcType="VARCHAR" property="provinceCode" />
         <result column="city_code" jdbcType="VARCHAR" property="cityCode" />
         <result column="report_routine_url" jdbcType="VARCHAR" property="reportRoutineUrl" />
+        <result column="register" property="register" />
     </resultMap>
 
+    <select id="getReportChannel" resultMap="ChannelMap">
+        select * , (select count(*) from report_voluntary.dbo.users as users where users.channelId = channel.id) as register
+        from channel where state = 1
+        <if test="name != null and name != ''">
+         and name like '%${name}%'
+        </if>
+    </select>
+
+    <select id="getReportChannelCount" resultType="java.lang.Integer">
+        select count(*)
+        from channel where state = 1
+        <if test="name != null and name != ''">
+            and name like '%${name}%'
+        </if>
+    </select>
+
     <select id="getByName" parameterType="java.lang.String" resultMap="ChannelMap">
         select * from channel where name = #{name} and state = 1
     </select>
--
libgit2 0.21.0