Commit e4bf01699e0585389718229fbac8d822a998b9d7

Authored by 陈杰
1 parent 9c4d6326
Exists in master

1

src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java
@@ -63,6 +63,13 @@ public class ChannelController { @@ -63,6 +63,13 @@ public class ChannelController {
63 // private String domain="https://mytest.myjxt.com:51314"; 63 // private String domain="https://mytest.myjxt.com:51314";
64 private String domain="https://proxy.shunzhi.net:51314"; 64 private String domain="https://proxy.shunzhi.net:51314";
65 65
  66 + @RequestMapping(value = "getByTemplate",method = RequestMethod.GET)
  67 + @ApiOperation(value = "获取统一模板下 渠道商")
  68 + public BaseDto<List<Channel>> getByTemplate(int templateId){
  69 + BaseDto<List<Channel>> result = new BaseDto<>();
  70 + result.setData(channelService.getListByTemplate(templateId));
  71 + return result ;
  72 + }
66 73
67 @RequestMapping(value = "copyChannel",method = RequestMethod.POST) 74 @RequestMapping(value = "copyChannel",method = RequestMethod.POST)
68 @ApiOperation(value = "内容下发") 75 @ApiOperation(value = "内容下发")
@@ -245,6 +252,14 @@ public class ChannelController { @@ -245,6 +252,14 @@ public class ChannelController {
245 return new BaseDto(); 252 return new BaseDto();
246 } 253 }
247 254
  255 + @RequestMapping(value = "getChannelProduct",method = RequestMethod.GET)
  256 + @ApiOperation(value = "渠道商商品详情")
  257 + public BaseDto<ChannelProduct> getChannelProduct(int id){
  258 + BaseDto<ChannelProduct> result = new BaseDto<>();
  259 + result.setData(channelProductService.getDetail(id));
  260 + return result;
  261 + }
  262 +
248 @RequestMapping(value = "UpdateChannelProduct",method = RequestMethod.POST) 263 @RequestMapping(value = "UpdateChannelProduct",method = RequestMethod.POST)
249 @ApiOperation(value = "编辑代理商品") 264 @ApiOperation(value = "编辑代理商品")
250 public BaseDto UpdateChannelProduct(@RequestBody ChannelProduct channelProduct){ 265 public BaseDto UpdateChannelProduct(@RequestBody ChannelProduct channelProduct){
@@ -613,6 +628,16 @@ public class ChannelController { @@ -613,6 +628,16 @@ public class ChannelController {
613 public BaseDto<List<Statistics>> GetStatistics(int channelId,int agentId,int type){ 628 public BaseDto<List<Statistics>> GetStatistics(int channelId,int agentId,int type){
614 BaseDto<List<Statistics>> result=new BaseDto(); 629 BaseDto<List<Statistics>> result=new BaseDto();
615 List<Statistics> list=new ArrayList<>(); 630 List<Statistics> list=new ArrayList<>();
  631 + Statistics pageView=new Statistics();
  632 + pageView.setCount(channelService.getPageViewCount(channelId,agentId,type));
  633 + List<Users> pageViewList=new ArrayList<>();
  634 + Users channelPageView =channelService.getChannelPageView(channelId,type) ;
  635 + if(channelPageView != null){
  636 + pageViewList.add(channelPageView);
  637 + }
  638 + pageViewList.addAll(channelService.getAgentPageViewList(channelId,0,type));
  639 + pageView.setUsersList(pageViewList);
  640 + list.add(pageView);
616 Statistics register=new Statistics(); 641 Statistics register=new Statistics();
617 register.setCount(channelService.getRegisterCount(channelId,agentId,type)); 642 register.setCount(channelService.getRegisterCount(channelId,agentId,type));
618 List<Users> registerList=new ArrayList<>(); 643 List<Users> registerList=new ArrayList<>();
@@ -667,6 +692,11 @@ public class ChannelController { @@ -667,6 +692,11 @@ public class ChannelController {
667 public BaseDto<List<Statistics>> GetAgentStatistics(int channelId,int agentId,int type){ 692 public BaseDto<List<Statistics>> GetAgentStatistics(int channelId,int agentId,int type){
668 BaseDto<List<Statistics>> result=new BaseDto<>(); 693 BaseDto<List<Statistics>> result=new BaseDto<>();
669 List<Statistics> list=new ArrayList<>(); 694 List<Statistics> list=new ArrayList<>();
  695 + Statistics pageView=new Statistics();
  696 + pageView.setCount(channelService.getPageViewCount(channelId,agentId,type));
  697 + pageView.setUsersList(channelService.getAgentPageViewList(channelId,agentId,type));
  698 + list.add(pageView);
  699 +
670 Statistics register=new Statistics(); 700 Statistics register=new Statistics();
671 register.setCount(channelService.getRegisterCount(channelId,agentId,type)); 701 register.setCount(channelService.getRegisterCount(channelId,agentId,type));
672 register.setUsersList(channelService.getRegisterDetailList(channelId,agentId,type)); 702 register.setUsersList(channelService.getRegisterDetailList(channelId,agentId,type));
src/main/java/com/sincere/wechatbusiness/mapper/ChannelMapper.java
@@ -8,7 +8,7 @@ import java.util.List; @@ -8,7 +8,7 @@ import java.util.List;
8 8
9 public interface ChannelMapper { 9 public interface ChannelMapper {
10 10
11 - List<Channel> get2List(); 11 + List<Channel> getListByTemplate(int templateId);
12 12
13 List<Channel> getList(Channel channel); 13 List<Channel> getList(Channel channel);
14 14
@@ -38,12 +38,18 @@ public interface ChannelMapper { @@ -38,12 +38,18 @@ public interface ChannelMapper {
38 38
39 int getOrderCount(@Param("channelId") int channelId, @Param("agentId") int agentId, @Param("type") int type,@Param("state") int state); 39 int getOrderCount(@Param("channelId") int channelId, @Param("agentId") int agentId, @Param("type") int type,@Param("state") int state);
40 40
  41 + int getPageViewCount(@Param("channelId") int channelId, @Param("agentId") int agentId, @Param("type") int type);
  42 +
41 List<Users> getAgentRegisterList(@Param("channelId") int channelId,@Param("type") int type,@Param("state") int state); 43 List<Users> getAgentRegisterList(@Param("channelId") int channelId,@Param("type") int type,@Param("state") int state);
42 44
  45 + List<Users> getAgentPageViewList(@Param("channelId") int channelId,@Param("agentId") int agentId,@Param("type") int type,@Param("state") int state);
  46 +
43 List<Users> getAgentOrderList(@Param("channelId") int channelId,@Param("type") int type,@Param("state") int state); 47 List<Users> getAgentOrderList(@Param("channelId") int channelId,@Param("type") int type,@Param("state") int state);
44 48
45 Users getChannelRegister(@Param("channelId") int channelId,@Param("type") int type,@Param("state") int state); 49 Users getChannelRegister(@Param("channelId") int channelId,@Param("type") int type,@Param("state") int state);
46 50
  51 + Users getChannelPageView(@Param("channelId") int channelId,@Param("type") int type,@Param("state") int state);
  52 +
47 Users getChannelOrder(@Param("channelId") int channelId,@Param("type") int type,@Param("state") int state); 53 Users getChannelOrder(@Param("channelId") int channelId,@Param("type") int type,@Param("state") int state);
48 54
49 List<DiscountPackage> getOrderList(@Param("channelId") int channelId,@Param("agentId") int agentId,@Param("type") int type,@Param("state") int state); 55 List<DiscountPackage> getOrderList(@Param("channelId") int channelId,@Param("agentId") int agentId,@Param("type") int type,@Param("state") int state);
src/main/java/com/sincere/wechatbusiness/mapper/PageViewMapper.java
@@ -6,7 +6,4 @@ public interface PageViewMapper { @@ -6,7 +6,4 @@ public interface PageViewMapper {
6 6
7 int insert(PageView record); 7 int insert(PageView record);
8 8
9 - PageView getDetail(PageView pageView);  
10 -  
11 - int updateLook(PageView pageView);  
12 } 9 }
13 \ No newline at end of file 10 \ No newline at end of file
src/main/java/com/sincere/wechatbusiness/model/PageView.java
@@ -11,8 +11,6 @@ public class PageView { @@ -11,8 +11,6 @@ public class PageView {
11 11
12 private Integer channelProductId; 12 private Integer channelProductId;
13 13
14 - private Integer lookNumber;  
15 -  
16 private Date createTime; 14 private Date createTime;
17 15
18 public Integer getId() { 16 public Integer getId() {
@@ -47,14 +45,6 @@ public class PageView { @@ -47,14 +45,6 @@ public class PageView {
47 this.channelProductId = channelProductId; 45 this.channelProductId = channelProductId;
48 } 46 }
49 47
50 - public Integer getLookNumber() {  
51 - return lookNumber;  
52 - }  
53 -  
54 - public void setLookNumber(Integer lookNumber) {  
55 - this.lookNumber = lookNumber;  
56 - }  
57 -  
58 public Date getCreateTime() { 48 public Date getCreateTime() {
59 return createTime; 49 return createTime;
60 } 50 }
src/main/java/com/sincere/wechatbusiness/service/ChannelService.java
@@ -8,6 +8,9 @@ import org.springframework.web.bind.annotation.RequestParam; @@ -8,6 +8,9 @@ import org.springframework.web.bind.annotation.RequestParam;
8 import java.util.List; 8 import java.util.List;
9 9
10 public interface ChannelService { 10 public interface ChannelService {
  11 +
  12 + List<Channel> getListByTemplate(int templateId);
  13 +
11 Page<Channel> getList(Channel channel, int page, int pageSize); 14 Page<Channel> getList(Channel channel, int page, int pageSize);
12 15
13 Channel getDetail(int id); 16 Channel getDetail(int id);
@@ -28,14 +31,20 @@ public interface ChannelService { @@ -28,14 +31,20 @@ public interface ChannelService {
28 31
29 int getRegisterCount(int channelId,int agentId,int type); 32 int getRegisterCount(int channelId,int agentId,int type);
30 33
  34 + int getPageViewCount(int channelId,int agentId,int type);
  35 +
31 int getOrderCount(int channelId,int agentId,int type); 36 int getOrderCount(int channelId,int agentId,int type);
32 37
33 List<Users> getAgentRegisterList(int channelId,int type); 38 List<Users> getAgentRegisterList(int channelId,int type);
34 39
  40 + List<Users> getAgentPageViewList(int channelId,int agentId ,int type);
  41 +
35 List<Users> getAgentOrderList(int channelId,int type); 42 List<Users> getAgentOrderList(int channelId,int type);
36 43
37 Users getChannelRegister(int channelId,int type); 44 Users getChannelRegister(int channelId,int type);
38 45
  46 + Users getChannelPageView(int channelId,int type);
  47 +
39 Users getChannelOrder(int channelId,int type); 48 Users getChannelOrder(int channelId,int type);
40 49
41 List<DiscountPackage> getOrderList(int channelId,int agentId,int type); 50 List<DiscountPackage> getOrderList(int channelId,int agentId,int type);
src/main/java/com/sincere/wechatbusiness/service/impl/ChannelServiceImpl.java
@@ -16,6 +16,11 @@ public class ChannelServiceImpl implements ChannelService { @@ -16,6 +16,11 @@ public class ChannelServiceImpl implements ChannelService {
16 ChannelMapper channelMapper; 16 ChannelMapper channelMapper;
17 17
18 @Override 18 @Override
  19 + public List<Channel> getListByTemplate(int templateId) {
  20 + return channelMapper.getListByTemplate(templateId);
  21 + }
  22 +
  23 + @Override
19 public Page<Channel> getList(Channel channel,int page, int pageSize){ 24 public Page<Channel> getList(Channel channel,int page, int pageSize){
20 Page<Channel> result=new Page<>(page,pageSize); 25 Page<Channel> result=new Page<>(page,pageSize);
21 PageHelper.startPage(page,pageSize); 26 PageHelper.startPage(page,pageSize);
@@ -68,18 +73,33 @@ public class ChannelServiceImpl implements ChannelService { @@ -68,18 +73,33 @@ public class ChannelServiceImpl implements ChannelService {
68 public int getRegisterCount(int channelId,int agentId,int type){return channelMapper.getRegisterCount(channelId,agentId,type);} 73 public int getRegisterCount(int channelId,int agentId,int type){return channelMapper.getRegisterCount(channelId,agentId,type);}
69 74
70 @Override 75 @Override
  76 + public int getPageViewCount(int channelId, int agentId, int type) {
  77 + return channelMapper.getPageViewCount(channelId,agentId,type);
  78 + }
  79 +
  80 + @Override
71 public int getOrderCount(int channelId,int agentId,int type){return channelMapper.getOrderCount(channelId,agentId,type,1);} 81 public int getOrderCount(int channelId,int agentId,int type){return channelMapper.getOrderCount(channelId,agentId,type,1);}
72 82
73 @Override 83 @Override
74 public List<Users> getAgentRegisterList(int channelId,int type){return channelMapper.getAgentRegisterList(channelId,type,1);} 84 public List<Users> getAgentRegisterList(int channelId,int type){return channelMapper.getAgentRegisterList(channelId,type,1);}
75 85
76 @Override 86 @Override
  87 + public List<Users> getAgentPageViewList(int channelId,int agentId , int type) {
  88 + return channelMapper.getAgentPageViewList(channelId,agentId,type,1);
  89 + }
  90 +
  91 + @Override
77 public List<Users> getAgentOrderList(int channelId,int type){return channelMapper.getAgentOrderList(channelId,type,1);} 92 public List<Users> getAgentOrderList(int channelId,int type){return channelMapper.getAgentOrderList(channelId,type,1);}
78 93
79 @Override 94 @Override
80 public Users getChannelRegister(int channelId,int type){return channelMapper.getChannelRegister(channelId,type,1);} 95 public Users getChannelRegister(int channelId,int type){return channelMapper.getChannelRegister(channelId,type,1);}
81 96
82 @Override 97 @Override
  98 + public Users getChannelPageView(int channelId, int type) {
  99 + return channelMapper.getChannelPageView(channelId,type,1);
  100 + }
  101 +
  102 + @Override
83 public Users getChannelOrder(int channelId,int type){return channelMapper.getChannelOrder(channelId,type,1);} 103 public Users getChannelOrder(int channelId,int type){return channelMapper.getChannelOrder(channelId,type,1);}
84 104
85 @Override 105 @Override
src/main/java/com/sincere/wechatbusiness/service/impl/PageViewServiceImpl.java
@@ -14,13 +14,6 @@ public class PageViewServiceImpl implements PageViewService { @@ -14,13 +14,6 @@ public class PageViewServiceImpl implements PageViewService {
14 14
15 @Override 15 @Override
16 public int updateLook(PageView pageView) { 16 public int updateLook(PageView pageView) {
17 - PageView temp = pageViewMapper.getDetail(pageView);  
18 - if(temp != null){  
19 - pageViewMapper.updateLook(pageView);  
20 - }else {  
21 - pageView.setLookNumber(1);  
22 - pageViewMapper.insert(pageView);  
23 - }  
24 - return 1; 17 + return pageViewMapper.insert(pageView);
25 } 18 }
26 } 19 }
src/main/resources/mapper/ChannelMapper.xml
@@ -65,10 +65,11 @@ @@ -65,10 +65,11 @@
65 <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> 65 <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
66 </resultMap> 66 </resultMap>
67 67
68 - <select id="get2List" resultMap="ChannelMap">  
69 - select * from channel where templateId = 2 68 + <select id="getListByTemplate" parameterType="java.lang.Integer" resultMap="ChannelMap">
  69 + select * from channel where templateId = #{templateId}
70 </select> 70 </select>
71 71
  72 +
72 <select id="getList" parameterType="com.sincere.wechatbusiness.model.Channel" resultMap="ChannelMap"> 73 <select id="getList" parameterType="com.sincere.wechatbusiness.model.Channel" resultMap="ChannelMap">
73 select *,(select count(0) from channel_product where channelId=c.id and state=1) as product_count, 74 select *,(select count(0) from channel_product where channelId=c.id and state=1) as product_count,
74 (select title from template where id=c.templateId) as template_name from channel c 75 (select title from template where id=c.templateId) as template_name from channel c
@@ -177,6 +178,24 @@ @@ -177,6 +178,24 @@
177 </where> 178 </where>
178 </select> 179 </select>
179 180
  181 + <select id="getPageViewCount" resultType="java.lang.Integer">
  182 + select count(0) from page_view
  183 + <where>
  184 + <if test="channelId > 0">
  185 + and channel_id=#{channelId}
  186 + </if>
  187 + <if test="agentId>0">
  188 + and agent_id=#{agentId}
  189 + </if>
  190 + <if test="type==1">
  191 + and DateDiff(dd,create_time,getdate())=0
  192 + </if>
  193 + <if test="type==2">
  194 + and DateDiff(mm,create_time,getdate())=0
  195 + </if>
  196 + </where>
  197 + </select>
  198 +
180 <select id="getOrderCount" resultType="java.lang.Integer"> 199 <select id="getOrderCount" resultType="java.lang.Integer">
181 select count(0) from (select distinct account from report_voluntary.dbo.orderpay 200 select count(0) from (select distinct account from report_voluntary.dbo.orderpay
182 <where> 201 <where>
@@ -216,6 +235,28 @@ @@ -216,6 +235,28 @@
216 from agent a where channelId=#{channelId} and state=1) b where count>0 235 from agent a where channelId=#{channelId} and state=1) b where count>0
217 </select> 236 </select>
218 237
  238 + <select id="getAgentPageViewList" resultMap="UsersMap">
  239 + select * from (select a.id as agentId,0 as channelId,RIGHT(mobile,4) as account,name as userName,(select count(0) from page_view
  240 + <where>
  241 + <if test="state==1">
  242 + and agent_id=a.id
  243 + </if>
  244 + <if test="type==1">
  245 + and DateDiff(dd,create_time,getdate())=0
  246 + </if>
  247 + <if test="type==2">
  248 + and DateDiff(mm,create_time,getdate())=0
  249 + </if>
  250 + </where>
  251 + ) as count
  252 + from agent a where channelId=#{channelId} and state=1
  253 + <if test="agentId != 0">
  254 + and id = #{agentId}
  255 + </if>
  256 + ) b where count>0
  257 + </select>
  258 +
  259 +
219 <select id="getChannelRegister" resultMap="UsersMap"> 260 <select id="getChannelRegister" resultMap="UsersMap">
220 select * from (select c.id as channelId,0 as agentId,RIGHT(mobile,4) as account,name+'(本人)' as userName,(select count(0) from report_voluntary.dbo.users 261 select * from (select c.id as channelId,0 as agentId,RIGHT(mobile,4) as account,name+'(本人)' as userName,(select count(0) from report_voluntary.dbo.users
221 <where> 262 <where>
@@ -233,6 +274,24 @@ @@ -233,6 +274,24 @@
233 from channel c where id=#{channelId} and state=1) b where count>0 274 from channel c where id=#{channelId} and state=1) b where count>0
234 </select> 275 </select>
235 276
  277 +
  278 + <select id="getChannelPageView" resultMap="UsersMap">
  279 + select * from (select c.id as channelId,0 as agentId,RIGHT(mobile,4) as account,name+'(本人)' as userName,(select count(0) from page_view
  280 + <where>
  281 + <if test="state==1">
  282 + and channel_id=c.id and (agent_id=0 or agent_id=null)
  283 + </if>
  284 + <if test="type==1">
  285 + and DateDiff(dd,create_time,getdate())=0
  286 + </if>
  287 + <if test="type==2">
  288 + and DateDiff(mm,create_time,getdate())=0
  289 + </if>
  290 + </where>
  291 + ) as count
  292 + from channel c where id=#{channelId} and state=1) b where count>0
  293 + </select>
  294 +
236 <select id="getAgentOrderList" resultMap="UsersMap"> 295 <select id="getAgentOrderList" resultMap="UsersMap">
237 select * from (select a.id as agentId,0 as channelId,RIGHT(mobile,4) as account,name as userName,(select count(0) from (select 296 select * from (select a.id as agentId,0 as channelId,RIGHT(mobile,4) as account,name as userName,(select count(0) from (select
238 distinct account from report_voluntary.dbo.orderpay 297 distinct account from report_voluntary.dbo.orderpay
src/main/resources/mapper/PageViewMapper.xml
@@ -6,7 +6,6 @@ @@ -6,7 +6,6 @@
6 <result column="channel_id" jdbcType="INTEGER" property="channelId" /> 6 <result column="channel_id" jdbcType="INTEGER" property="channelId" />
7 <result column="agent_id" jdbcType="INTEGER" property="agentId" /> 7 <result column="agent_id" jdbcType="INTEGER" property="agentId" />
8 <result column="channel_product_id" jdbcType="INTEGER" property="channelProductId" /> 8 <result column="channel_product_id" jdbcType="INTEGER" property="channelProductId" />
9 - <result column="look_number" jdbcType="INTEGER" property="lookNumber" />  
10 <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> 9 <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
11 </resultMap> 10 </resultMap>
12 <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> 11 <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
@@ -17,20 +16,11 @@ @@ -17,20 +16,11 @@
17 16
18 <insert id="insert" parameterType="com.sincere.wechatbusiness.model.PageView"> 17 <insert id="insert" parameterType="com.sincere.wechatbusiness.model.PageView">
19 insert into page_view (channel_id, agent_id, 18 insert into page_view (channel_id, agent_id,
20 - channel_product_id, look_number, create_time 19 + channel_product_id, create_time
21 ) 20 )
22 values ( #{channelId,jdbcType=INTEGER}, #{agentId,jdbcType=INTEGER}, 21 values ( #{channelId,jdbcType=INTEGER}, #{agentId,jdbcType=INTEGER},
23 - #{channelProductId,jdbcType=INTEGER}, #{lookNumber,jdbcType=INTEGER}, getdate() 22 + #{channelProductId,jdbcType=INTEGER}, getdate()
24 ) 23 )
25 </insert> 24 </insert>
26 25
27 - <select id="getDetail" parameterType="com.sincere.wechatbusiness.model.PageView" resultMap="BaseResultMap">  
28 - select * from page_view  
29 - where channel_id = #{channelId} and agent_id = #{agentId} and channel_product_id = #{channelProductId}  
30 - </select>  
31 -  
32 - <update id="updateLook" parameterType="com.sincere.wechatbusiness.model.PageView">  
33 - update page_view set look_number = look_number + 1  
34 - where channel_id = #{channelId} and agent_id = #{agentId} and channel_product_id = #{channelProductId}  
35 - </update>  
36 </mapper> 26 </mapper>
37 \ No newline at end of file 27 \ No newline at end of file