Commit e4bf01699e0585389718229fbac8d822a998b9d7
1 parent
9c4d6326
Exists in
master
1
Showing
9 changed files
with
130 additions
and
36 deletions
Show diff stats
src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java
... | ... | @@ -63,6 +63,13 @@ public class ChannelController { |
63 | 63 | // private String domain="https://mytest.myjxt.com:51314"; |
64 | 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 | 74 | @RequestMapping(value = "copyChannel",method = RequestMethod.POST) |
68 | 75 | @ApiOperation(value = "内容下发") |
... | ... | @@ -245,6 +252,14 @@ public class ChannelController { |
245 | 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 | 263 | @RequestMapping(value = "UpdateChannelProduct",method = RequestMethod.POST) |
249 | 264 | @ApiOperation(value = "编辑代理商品") |
250 | 265 | public BaseDto UpdateChannelProduct(@RequestBody ChannelProduct channelProduct){ |
... | ... | @@ -613,6 +628,16 @@ public class ChannelController { |
613 | 628 | public BaseDto<List<Statistics>> GetStatistics(int channelId,int agentId,int type){ |
614 | 629 | BaseDto<List<Statistics>> result=new BaseDto(); |
615 | 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 | 641 | Statistics register=new Statistics(); |
617 | 642 | register.setCount(channelService.getRegisterCount(channelId,agentId,type)); |
618 | 643 | List<Users> registerList=new ArrayList<>(); |
... | ... | @@ -667,6 +692,11 @@ public class ChannelController { |
667 | 692 | public BaseDto<List<Statistics>> GetAgentStatistics(int channelId,int agentId,int type){ |
668 | 693 | BaseDto<List<Statistics>> result=new BaseDto<>(); |
669 | 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 | 700 | Statistics register=new Statistics(); |
671 | 701 | register.setCount(channelService.getRegisterCount(channelId,agentId,type)); |
672 | 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 | 8 | |
9 | 9 | public interface ChannelMapper { |
10 | 10 | |
11 | - List<Channel> get2List(); | |
11 | + List<Channel> getListByTemplate(int templateId); | |
12 | 12 | |
13 | 13 | List<Channel> getList(Channel channel); |
14 | 14 | |
... | ... | @@ -38,12 +38,18 @@ public interface ChannelMapper { |
38 | 38 | |
39 | 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 | 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 | 47 | List<Users> getAgentOrderList(@Param("channelId") int channelId,@Param("type") int type,@Param("state") int state); |
44 | 48 | |
45 | 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 | 53 | Users getChannelOrder(@Param("channelId") int channelId,@Param("type") int type,@Param("state") int state); |
48 | 54 | |
49 | 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
src/main/java/com/sincere/wechatbusiness/model/PageView.java
... | ... | @@ -11,8 +11,6 @@ public class PageView { |
11 | 11 | |
12 | 12 | private Integer channelProductId; |
13 | 13 | |
14 | - private Integer lookNumber; | |
15 | - | |
16 | 14 | private Date createTime; |
17 | 15 | |
18 | 16 | public Integer getId() { |
... | ... | @@ -47,14 +45,6 @@ public class PageView { |
47 | 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 | 48 | public Date getCreateTime() { |
59 | 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 | 8 | import java.util.List; |
9 | 9 | |
10 | 10 | public interface ChannelService { |
11 | + | |
12 | + List<Channel> getListByTemplate(int templateId); | |
13 | + | |
11 | 14 | Page<Channel> getList(Channel channel, int page, int pageSize); |
12 | 15 | |
13 | 16 | Channel getDetail(int id); |
... | ... | @@ -28,14 +31,20 @@ public interface ChannelService { |
28 | 31 | |
29 | 32 | int getRegisterCount(int channelId,int agentId,int type); |
30 | 33 | |
34 | + int getPageViewCount(int channelId,int agentId,int type); | |
35 | + | |
31 | 36 | int getOrderCount(int channelId,int agentId,int type); |
32 | 37 | |
33 | 38 | List<Users> getAgentRegisterList(int channelId,int type); |
34 | 39 | |
40 | + List<Users> getAgentPageViewList(int channelId,int agentId ,int type); | |
41 | + | |
35 | 42 | List<Users> getAgentOrderList(int channelId,int type); |
36 | 43 | |
37 | 44 | Users getChannelRegister(int channelId,int type); |
38 | 45 | |
46 | + Users getChannelPageView(int channelId,int type); | |
47 | + | |
39 | 48 | Users getChannelOrder(int channelId,int type); |
40 | 49 | |
41 | 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 | 16 | ChannelMapper channelMapper; |
17 | 17 | |
18 | 18 | @Override |
19 | + public List<Channel> getListByTemplate(int templateId) { | |
20 | + return channelMapper.getListByTemplate(templateId); | |
21 | + } | |
22 | + | |
23 | + @Override | |
19 | 24 | public Page<Channel> getList(Channel channel,int page, int pageSize){ |
20 | 25 | Page<Channel> result=new Page<>(page,pageSize); |
21 | 26 | PageHelper.startPage(page,pageSize); |
... | ... | @@ -68,18 +73,33 @@ public class ChannelServiceImpl implements ChannelService { |
68 | 73 | public int getRegisterCount(int channelId,int agentId,int type){return channelMapper.getRegisterCount(channelId,agentId,type);} |
69 | 74 | |
70 | 75 | @Override |
76 | + public int getPageViewCount(int channelId, int agentId, int type) { | |
77 | + return channelMapper.getPageViewCount(channelId,agentId,type); | |
78 | + } | |
79 | + | |
80 | + @Override | |
71 | 81 | public int getOrderCount(int channelId,int agentId,int type){return channelMapper.getOrderCount(channelId,agentId,type,1);} |
72 | 82 | |
73 | 83 | @Override |
74 | 84 | public List<Users> getAgentRegisterList(int channelId,int type){return channelMapper.getAgentRegisterList(channelId,type,1);} |
75 | 85 | |
76 | 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 | 92 | public List<Users> getAgentOrderList(int channelId,int type){return channelMapper.getAgentOrderList(channelId,type,1);} |
78 | 93 | |
79 | 94 | @Override |
80 | 95 | public Users getChannelRegister(int channelId,int type){return channelMapper.getChannelRegister(channelId,type,1);} |
81 | 96 | |
82 | 97 | @Override |
98 | + public Users getChannelPageView(int channelId, int type) { | |
99 | + return channelMapper.getChannelPageView(channelId,type,1); | |
100 | + } | |
101 | + | |
102 | + @Override | |
83 | 103 | public Users getChannelOrder(int channelId,int type){return channelMapper.getChannelOrder(channelId,type,1);} |
84 | 104 | |
85 | 105 | @Override | ... | ... |
src/main/java/com/sincere/wechatbusiness/service/impl/PageViewServiceImpl.java
... | ... | @@ -14,13 +14,6 @@ public class PageViewServiceImpl implements PageViewService { |
14 | 14 | |
15 | 15 | @Override |
16 | 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 | 65 | <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> |
66 | 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 | 70 | </select> |
71 | 71 | |
72 | + | |
72 | 73 | <select id="getList" parameterType="com.sincere.wechatbusiness.model.Channel" resultMap="ChannelMap"> |
73 | 74 | select *,(select count(0) from channel_product where channelId=c.id and state=1) as product_count, |
74 | 75 | (select title from template where id=c.templateId) as template_name from channel c |
... | ... | @@ -177,6 +178,24 @@ |
177 | 178 | </where> |
178 | 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 | 199 | <select id="getOrderCount" resultType="java.lang.Integer"> |
181 | 200 | select count(0) from (select distinct account from report_voluntary.dbo.orderpay |
182 | 201 | <where> |
... | ... | @@ -216,6 +235,28 @@ |
216 | 235 | from agent a where channelId=#{channelId} and state=1) b where count>0 |
217 | 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 | 260 | <select id="getChannelRegister" resultMap="UsersMap"> |
220 | 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 | 262 | <where> |
... | ... | @@ -233,6 +274,24 @@ |
233 | 274 | from channel c where id=#{channelId} and state=1) b where count>0 |
234 | 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 | 295 | <select id="getAgentOrderList" resultMap="UsersMap"> |
237 | 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 | 297 | distinct account from report_voluntary.dbo.orderpay | ... | ... |
src/main/resources/mapper/PageViewMapper.xml
... | ... | @@ -6,7 +6,6 @@ |
6 | 6 | <result column="channel_id" jdbcType="INTEGER" property="channelId" /> |
7 | 7 | <result column="agent_id" jdbcType="INTEGER" property="agentId" /> |
8 | 8 | <result column="channel_product_id" jdbcType="INTEGER" property="channelProductId" /> |
9 | - <result column="look_number" jdbcType="INTEGER" property="lookNumber" /> | |
10 | 9 | <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> |
11 | 10 | </resultMap> |
12 | 11 | <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> |
... | ... | @@ -17,20 +16,11 @@ |
17 | 16 | |
18 | 17 | <insert id="insert" parameterType="com.sincere.wechatbusiness.model.PageView"> |
19 | 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 | 21 | values ( #{channelId,jdbcType=INTEGER}, #{agentId,jdbcType=INTEGER}, |
23 | - #{channelProductId,jdbcType=INTEGER}, #{lookNumber,jdbcType=INTEGER}, getdate() | |
22 | + #{channelProductId,jdbcType=INTEGER}, getdate() | |
24 | 23 | ) |
25 | 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 | 26 | </mapper> |
37 | 27 | \ No newline at end of file | ... | ... |