From e4bf01699e0585389718229fbac8d822a998b9d7 Mon Sep 17 00:00:00 2001 From: 陈杰 <504987307@qq.com> Date: Tue, 16 Jun 2020 15:13:06 +0800 Subject: [PATCH] 1 --- src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java | 30 ++++++++++++++++++++++++++++++ src/main/java/com/sincere/wechatbusiness/mapper/ChannelMapper.java | 8 +++++++- src/main/java/com/sincere/wechatbusiness/mapper/PageViewMapper.java | 3 --- src/main/java/com/sincere/wechatbusiness/model/PageView.java | 10 ---------- src/main/java/com/sincere/wechatbusiness/service/ChannelService.java | 9 +++++++++ src/main/java/com/sincere/wechatbusiness/service/impl/ChannelServiceImpl.java | 20 ++++++++++++++++++++ src/main/java/com/sincere/wechatbusiness/service/impl/PageViewServiceImpl.java | 9 +-------- src/main/resources/mapper/ChannelMapper.xml | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- src/main/resources/mapper/PageViewMapper.xml | 14 ++------------ 9 files changed, 130 insertions(+), 36 deletions(-) diff --git a/src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java b/src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java index c5f97a7..08c117c 100644 --- a/src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java +++ b/src/main/java/com/sincere/wechatbusiness/controller/ChannelController.java @@ -63,6 +63,13 @@ public class ChannelController { // private String domain="https://mytest.myjxt.com:51314"; private String domain="https://proxy.shunzhi.net:51314"; + @RequestMapping(value = "getByTemplate",method = RequestMethod.GET) + @ApiOperation(value = "获取统一模板下 渠道商") + public BaseDto> getByTemplate(int templateId){ + BaseDto> result = new BaseDto<>(); + result.setData(channelService.getListByTemplate(templateId)); + return result ; + } @RequestMapping(value = "copyChannel",method = RequestMethod.POST) @ApiOperation(value = "内容下发") @@ -245,6 +252,14 @@ public class ChannelController { return new BaseDto(); } + @RequestMapping(value = "getChannelProduct",method = RequestMethod.GET) + @ApiOperation(value = "渠道商商品详情") + public BaseDto getChannelProduct(int id){ + BaseDto result = new BaseDto<>(); + result.setData(channelProductService.getDetail(id)); + return result; + } + @RequestMapping(value = "UpdateChannelProduct",method = RequestMethod.POST) @ApiOperation(value = "编辑代理商品") public BaseDto UpdateChannelProduct(@RequestBody ChannelProduct channelProduct){ @@ -613,6 +628,16 @@ public class ChannelController { public BaseDto> GetStatistics(int channelId,int agentId,int type){ BaseDto> result=new BaseDto(); List list=new ArrayList<>(); + Statistics pageView=new Statistics(); + pageView.setCount(channelService.getPageViewCount(channelId,agentId,type)); + List pageViewList=new ArrayList<>(); + Users channelPageView =channelService.getChannelPageView(channelId,type) ; + if(channelPageView != null){ + pageViewList.add(channelPageView); + } + pageViewList.addAll(channelService.getAgentPageViewList(channelId,0,type)); + pageView.setUsersList(pageViewList); + list.add(pageView); Statistics register=new Statistics(); register.setCount(channelService.getRegisterCount(channelId,agentId,type)); List registerList=new ArrayList<>(); @@ -667,6 +692,11 @@ public class ChannelController { public BaseDto> GetAgentStatistics(int channelId,int agentId,int type){ BaseDto> result=new BaseDto<>(); List list=new ArrayList<>(); + Statistics pageView=new Statistics(); + pageView.setCount(channelService.getPageViewCount(channelId,agentId,type)); + pageView.setUsersList(channelService.getAgentPageViewList(channelId,agentId,type)); + list.add(pageView); + Statistics register=new Statistics(); register.setCount(channelService.getRegisterCount(channelId,agentId,type)); register.setUsersList(channelService.getRegisterDetailList(channelId,agentId,type)); diff --git a/src/main/java/com/sincere/wechatbusiness/mapper/ChannelMapper.java b/src/main/java/com/sincere/wechatbusiness/mapper/ChannelMapper.java index 73a57fa..37154e9 100644 --- a/src/main/java/com/sincere/wechatbusiness/mapper/ChannelMapper.java +++ b/src/main/java/com/sincere/wechatbusiness/mapper/ChannelMapper.java @@ -8,7 +8,7 @@ import java.util.List; public interface ChannelMapper { - List get2List(); + List getListByTemplate(int templateId); List getList(Channel channel); @@ -38,12 +38,18 @@ public interface ChannelMapper { int getOrderCount(@Param("channelId") int channelId, @Param("agentId") int agentId, @Param("type") int type,@Param("state") int state); + int getPageViewCount(@Param("channelId") int channelId, @Param("agentId") int agentId, @Param("type") int type); + List getAgentRegisterList(@Param("channelId") int channelId,@Param("type") int type,@Param("state") int state); + List getAgentPageViewList(@Param("channelId") int channelId,@Param("agentId") int agentId,@Param("type") int type,@Param("state") int state); + List getAgentOrderList(@Param("channelId") int channelId,@Param("type") int type,@Param("state") int state); Users getChannelRegister(@Param("channelId") int channelId,@Param("type") int type,@Param("state") int state); + Users getChannelPageView(@Param("channelId") int channelId,@Param("type") int type,@Param("state") int state); + Users getChannelOrder(@Param("channelId") int channelId,@Param("type") int type,@Param("state") int state); List getOrderList(@Param("channelId") int channelId,@Param("agentId") int agentId,@Param("type") int type,@Param("state") int state); diff --git a/src/main/java/com/sincere/wechatbusiness/mapper/PageViewMapper.java b/src/main/java/com/sincere/wechatbusiness/mapper/PageViewMapper.java index fa88625..3250f72 100644 --- a/src/main/java/com/sincere/wechatbusiness/mapper/PageViewMapper.java +++ b/src/main/java/com/sincere/wechatbusiness/mapper/PageViewMapper.java @@ -6,7 +6,4 @@ public interface PageViewMapper { int insert(PageView record); - PageView getDetail(PageView pageView); - - int updateLook(PageView pageView); } \ No newline at end of file diff --git a/src/main/java/com/sincere/wechatbusiness/model/PageView.java b/src/main/java/com/sincere/wechatbusiness/model/PageView.java index 97612e8..c39674d 100644 --- a/src/main/java/com/sincere/wechatbusiness/model/PageView.java +++ b/src/main/java/com/sincere/wechatbusiness/model/PageView.java @@ -11,8 +11,6 @@ public class PageView { private Integer channelProductId; - private Integer lookNumber; - private Date createTime; public Integer getId() { @@ -47,14 +45,6 @@ public class PageView { this.channelProductId = channelProductId; } - public Integer getLookNumber() { - return lookNumber; - } - - public void setLookNumber(Integer lookNumber) { - this.lookNumber = lookNumber; - } - public Date getCreateTime() { return createTime; } diff --git a/src/main/java/com/sincere/wechatbusiness/service/ChannelService.java b/src/main/java/com/sincere/wechatbusiness/service/ChannelService.java index cabf853..9ccb0df 100644 --- a/src/main/java/com/sincere/wechatbusiness/service/ChannelService.java +++ b/src/main/java/com/sincere/wechatbusiness/service/ChannelService.java @@ -8,6 +8,9 @@ import org.springframework.web.bind.annotation.RequestParam; import java.util.List; public interface ChannelService { + + List getListByTemplate(int templateId); + Page getList(Channel channel, int page, int pageSize); Channel getDetail(int id); @@ -28,14 +31,20 @@ public interface ChannelService { int getRegisterCount(int channelId,int agentId,int type); + int getPageViewCount(int channelId,int agentId,int type); + int getOrderCount(int channelId,int agentId,int type); List getAgentRegisterList(int channelId,int type); + List getAgentPageViewList(int channelId,int agentId ,int type); + List getAgentOrderList(int channelId,int type); Users getChannelRegister(int channelId,int type); + Users getChannelPageView(int channelId,int type); + Users getChannelOrder(int channelId,int type); List getOrderList(int channelId,int agentId,int type); 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 1104fe8..8805ac3 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,11 @@ public class ChannelServiceImpl implements ChannelService { ChannelMapper channelMapper; @Override + public List getListByTemplate(int templateId) { + return channelMapper.getListByTemplate(templateId); + } + + @Override public Page getList(Channel channel,int page, int pageSize){ Page result=new Page<>(page,pageSize); PageHelper.startPage(page,pageSize); @@ -68,18 +73,33 @@ public class ChannelServiceImpl implements ChannelService { public int getRegisterCount(int channelId,int agentId,int type){return channelMapper.getRegisterCount(channelId,agentId,type);} @Override + public int getPageViewCount(int channelId, int agentId, int type) { + return channelMapper.getPageViewCount(channelId,agentId,type); + } + + @Override public int getOrderCount(int channelId,int agentId,int type){return channelMapper.getOrderCount(channelId,agentId,type,1);} @Override public List getAgentRegisterList(int channelId,int type){return channelMapper.getAgentRegisterList(channelId,type,1);} @Override + public List getAgentPageViewList(int channelId,int agentId , int type) { + return channelMapper.getAgentPageViewList(channelId,agentId,type,1); + } + + @Override public List getAgentOrderList(int channelId,int type){return channelMapper.getAgentOrderList(channelId,type,1);} @Override public Users getChannelRegister(int channelId,int type){return channelMapper.getChannelRegister(channelId,type,1);} @Override + public Users getChannelPageView(int channelId, int type) { + return channelMapper.getChannelPageView(channelId,type,1); + } + + @Override public Users getChannelOrder(int channelId,int type){return channelMapper.getChannelOrder(channelId,type,1);} @Override diff --git a/src/main/java/com/sincere/wechatbusiness/service/impl/PageViewServiceImpl.java b/src/main/java/com/sincere/wechatbusiness/service/impl/PageViewServiceImpl.java index f095679..5450397 100644 --- a/src/main/java/com/sincere/wechatbusiness/service/impl/PageViewServiceImpl.java +++ b/src/main/java/com/sincere/wechatbusiness/service/impl/PageViewServiceImpl.java @@ -14,13 +14,6 @@ public class PageViewServiceImpl implements PageViewService { @Override public int updateLook(PageView pageView) { - PageView temp = pageViewMapper.getDetail(pageView); - if(temp != null){ - pageViewMapper.updateLook(pageView); - }else { - pageView.setLookNumber(1); - pageViewMapper.insert(pageView); - } - return 1; + return pageViewMapper.insert(pageView); } } diff --git a/src/main/resources/mapper/ChannelMapper.xml b/src/main/resources/mapper/ChannelMapper.xml index 49f0bf1..0f3006d 100644 --- a/src/main/resources/mapper/ChannelMapper.xml +++ b/src/main/resources/mapper/ChannelMapper.xml @@ -65,10 +65,11 @@ - + select * from channel where templateId = #{templateId} + + + + + + + + + @@ -17,20 +16,11 @@ insert into page_view (channel_id, agent_id, - channel_product_id, look_number, create_time + channel_product_id, create_time ) values ( #{channelId,jdbcType=INTEGER}, #{agentId,jdbcType=INTEGER}, - #{channelProductId,jdbcType=INTEGER}, #{lookNumber,jdbcType=INTEGER}, getdate() + #{channelProductId,jdbcType=INTEGER}, getdate() ) - - - - update page_view set look_number = look_number + 1 - where channel_id = #{channelId} and agent_id = #{agentId} and channel_product_id = #{channelProductId} - \ No newline at end of file -- libgit2 0.21.0