| @@ -2,12 +2,11 @@ package com.iformall.controller.mem; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.annotation.SystemControllerLog; | import com.iformall.annotation.SystemControllerLog; | ||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.WxCUserCar; | |||||
| import com.iformall.domain.po.WxCUserFrom; | import com.iformall.domain.po.WxCUserFrom; | ||||
| import com.iformall.service.WxCUserCarService; | |||||
| import com.iformall.domain.vo.WxCUserFromVo; | |||||
| import com.iformall.enums.EnumCUserFrom; | |||||
| import com.iformall.service.WxCUserFromService; | import com.iformall.service.WxCUserFromService; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| @@ -17,6 +16,9 @@ import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("wxCUserFrom") | @RequestMapping("wxCUserFrom") | ||||
| public class WxCUserFromController extends BaseController { | public class WxCUserFromController extends BaseController { | ||||
| @@ -30,7 +32,7 @@ public class WxCUserFromController extends BaseController { | |||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | ||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | ||||
| @SystemControllerLog(description = "停车-列表") | |||||
| @SystemControllerLog(description = "分享-列表") | |||||
| public ResultData list(@ModelAttribute WxCUserFrom wxCUserFrom, Integer pageNum, Integer pageSize) { | public ResultData list(@ModelAttribute WxCUserFrom wxCUserFrom, Integer pageNum, Integer pageSize) { | ||||
| logger.debug("[" + getIpAddr() + "] WxCUserCarController::list"); | logger.debug("[" + getIpAddr() + "] WxCUserCarController::list"); | ||||
| if (null == wxCUserFrom) wxCUserFrom = new WxCUserFrom(); | if (null == wxCUserFrom) wxCUserFrom = new WxCUserFrom(); | ||||
| @@ -42,13 +44,35 @@ public class WxCUserFromController extends BaseController { | |||||
| @ApiOperation("根据id查询接口") | @ApiOperation("根据id查询接口") | ||||
| @GetMapping("/visits") | @GetMapping("/visits") | ||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | ||||
| @SystemControllerLog(description = "停车-查询") | |||||
| public ResultData visits(@ModelAttribute WxCUserFrom wxCUserFrom,Integer pageNum, Integer pageSize) { | |||||
| @SystemControllerLog(description = "分享-列表") | |||||
| public ResultData visits(@ModelAttribute WxCUserFromVo wxCUserFromVo,Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] WxCUserCarController::findById"); | logger.debug("[" + getIpAddr() + "] WxCUserCarController::findById"); | ||||
| if (null == wxCUserFromVo) wxCUserFromVo = new WxCUserFromVo(); | |||||
| if(wxCUserFromVo.getFromType() == null){ | |||||
| wxCUserFromVo.setFromType(EnumCUserFrom.FROM_C_USER_BASIC_INFO.getCode()); | |||||
| } | |||||
| wxCUserFromVo.updateTenantInfo(getTenantInfo()); | |||||
| final PageInfo<WxCUserFromVo> page = wxCUserFromService.listAsVisitsPage(wxCUserFromVo, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @GetMapping("/exportData") | |||||
| @SystemControllerLog(description = "导出数据") | |||||
| public void exportData(@ModelAttribute WxCUserFrom wxCUserFrom, HttpServletRequest request, HttpServletResponse response) { | |||||
| if (null == wxCUserFrom) wxCUserFrom = new WxCUserFrom(); | if (null == wxCUserFrom) wxCUserFrom = new WxCUserFrom(); | ||||
| wxCUserFrom.updateTenantInfo(getTenantInfo()); | wxCUserFrom.updateTenantInfo(getTenantInfo()); | ||||
| final PageInfo<WxCUserFrom> page = wxCUserFromService.listAsVisitsPage(wxCUserFrom, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| wxCUserFromService.exportData(request, response, wxCUserFrom); | |||||
| } | |||||
| @GetMapping("/exportDataVisits") | |||||
| @SystemControllerLog(description = "导出数据") | |||||
| public void exportDataVisits(@ModelAttribute WxCUserFromVo wxCUserFromVo, HttpServletRequest request, HttpServletResponse response) { | |||||
| if (null == wxCUserFromVo) wxCUserFromVo = new WxCUserFromVo(); | |||||
| wxCUserFromVo.updateTenantInfo(getTenantInfo()); | |||||
| if(wxCUserFromVo.getFromType() == null){ | |||||
| wxCUserFromVo.setFromType(EnumCUserFrom.FROM_C_USER_BASIC_INFO.getCode()); | |||||
| } | |||||
| wxCUserFromService.exportDataVisits(request, response, wxCUserFromVo); | |||||
| } | } | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.domain.po; | package com.iformall.domain.po; | ||||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||||
| import com.baomidou.mybatisplus.annotation.TableField; | import com.baomidou.mybatisplus.annotation.TableField; | ||||
| import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||||
| @@ -24,9 +25,11 @@ public class WxCUserFrom extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="cUserId",name="cUserId") | @io.swagger.annotations.ApiModelProperty(value="cUserId",name="cUserId") | ||||
| protected Long cUserId; | protected Long cUserId; | ||||
| @Excel(name = "用户昵称", width = 20, orderNum = "2") | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| @io.swagger.annotations.ApiModelProperty(value="cUserNickName",name="cUserNickName") | @io.swagger.annotations.ApiModelProperty(value="cUserNickName",name="cUserNickName") | ||||
| protected String cUserNickName; | protected String cUserNickName; | ||||
| @Excel(name = "用户电话", width = 20, orderNum = "3") | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| @io.swagger.annotations.ApiModelProperty(value="cUserPhone",name="cUserPhone") | @io.swagger.annotations.ApiModelProperty(value="cUserPhone",name="cUserPhone") | ||||
| protected String cUserPhone; | protected String cUserPhone; | ||||
| @@ -37,11 +40,13 @@ public class WxCUserFrom extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="渠道,小程序",name="sceneAddress") | @io.swagger.annotations.ApiModelProperty(value="渠道,小程序",name="sceneAddress") | ||||
| private String sceneAddress; | private String sceneAddress; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| @Excel(name = "用户来源方式", width = 20, orderNum = "4") | |||||
| @io.swagger.annotations.ApiModelProperty(value="sceneAddress描述",name="sceneAddressDesc") | @io.swagger.annotations.ApiModelProperty(value="sceneAddress描述",name="sceneAddressDesc") | ||||
| private String sceneAddressDesc; | private String sceneAddressDesc; | ||||
| @io.swagger.annotations.ApiModelProperty(value="EnumCUserFrom",name="fromType") | @io.swagger.annotations.ApiModelProperty(value="EnumCUserFrom",name="fromType") | ||||
| private Integer fromType; | private Integer fromType; | ||||
| @Excel(name = "来源", width = 20, orderNum = "1") | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| @io.swagger.annotations.ApiModelProperty(value="fromType描述",name="fromTypeDesc") | @io.swagger.annotations.ApiModelProperty(value="fromType描述",name="fromTypeDesc") | ||||
| private String fromTypeDesc; | private String fromTypeDesc; | ||||
| @@ -67,11 +72,12 @@ public class WxCUserFrom extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="是否新用户(0:否1:是)EnumYesOrNo",name="isNewUser") | @io.swagger.annotations.ApiModelProperty(value="是否新用户(0:否1:是)EnumYesOrNo",name="isNewUser") | ||||
| private Integer isNewUser; | private Integer isNewUser; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| @Excel(name = "是否新用户", width = 20, orderNum = "5") | |||||
| @io.swagger.annotations.ApiModelProperty(value="是否新用户",name="isNewUserStr") | @io.swagger.annotations.ApiModelProperty(value="是否新用户",name="isNewUserStr") | ||||
| private String isNewUserStr; | private String isNewUserStr; | ||||
| public String getIsNewUserStr(){ | public String getIsNewUserStr(){ | ||||
| if(this.getIsNewUser() != null){ | if(this.getIsNewUser() != null){ | ||||
| EnumYesOrNo anEnum = EnumYesOrNo.getEnum(this.getFromType()); | |||||
| EnumYesOrNo anEnum = EnumYesOrNo.getEnum(this.getIsNewUser()); | |||||
| if(anEnum != null){ | if(anEnum != null){ | ||||
| isNewUserStr = anEnum.getMessage(); | isNewUserStr = anEnum.getMessage(); | ||||
| } | } | ||||
| @@ -86,7 +92,7 @@ public class WxCUserFrom extends TenantEntity { | |||||
| private String shareUserTypeDesc; | private String shareUserTypeDesc; | ||||
| public String getShareUserTypeDesc(){ | public String getShareUserTypeDesc(){ | ||||
| if(this.getShareUserType() != null){ | if(this.getShareUserType() != null){ | ||||
| EnumUserType anEnum = EnumUserType.getEnum(this.getFromType()); | |||||
| EnumUserType anEnum = EnumUserType.getEnum(this.getShareUserType()); | |||||
| if(anEnum != null){ | if(anEnum != null){ | ||||
| shareUserTypeDesc = anEnum.getMessage(); | shareUserTypeDesc = anEnum.getMessage(); | ||||
| } | } | ||||
| @@ -100,34 +106,21 @@ public class WxCUserFrom extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="分享者",name="shareUserName") | @io.swagger.annotations.ApiModelProperty(value="分享者",name="shareUserName") | ||||
| protected String shareUserName; | protected String shareUserName; | ||||
| @Excel(name = "进入时间", width = 20, format="yyyy-MM-dd HH:mm:ss", orderNum = "6") | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | ||||
| private Date createDate; | private Date createDate; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| @io.swagger.annotations.ApiModelProperty(value="推广人次",name="visits") | |||||
| private Integer visits; | |||||
| @TableField(exist = false) | |||||
| @io.swagger.annotations.ApiModelProperty(value="触达用户",name="reachUser") | |||||
| private Integer reachUser; | |||||
| @TableField(exist = false) | |||||
| @io.swagger.annotations.ApiModelProperty(value="触达新用户",name="newUser") | |||||
| private Integer newUser; | |||||
| @TableField(exist = false) | |||||
| @io.swagger.annotations.ApiModelProperty(value="触达老用户",name="oldUser") | |||||
| private Integer oldUser; | |||||
| public Integer getOldUser(){ | |||||
| if(this.getReachUser() != null && this.getNewUser() != null){ | |||||
| oldUser = this.getReachUser() - this.getNewUser(); | |||||
| } | |||||
| return oldUser; | |||||
| } | |||||
| protected Date startDate; | |||||
| @TableField(exist = false) | |||||
| protected Date endDate; | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| protected Date startDate; | |||||
| private Integer begin; | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| protected Date endDate; | |||||
| private Integer limit; | |||||
| } | } | ||||
| @@ -0,0 +1,81 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||||
| import com.baomidou.mybatisplus.annotation.TableField; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.enums.EnumCUserFrom; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| import java.util.Date; | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class WxCUserFromVo extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="EnumCUserFrom",name="fromType") | |||||
| private Integer fromType; | |||||
| @Excel(name = "来源", width = 20, orderNum = "1") | |||||
| @TableField(exist = false) | |||||
| @io.swagger.annotations.ApiModelProperty(value="fromType描述",name="fromTypeDesc") | |||||
| private String fromTypeDesc; | |||||
| public String getFromTypeDesc(){ | |||||
| if(this.getFromType() != null){ | |||||
| EnumCUserFrom anEnum = EnumCUserFrom.getEnum(this.getFromType()); | |||||
| if(anEnum != null){ | |||||
| fromTypeDesc = anEnum.getMessage(); | |||||
| } | |||||
| } | |||||
| return fromTypeDesc; | |||||
| } | |||||
| @io.swagger.annotations.ApiModelProperty(value="来源ID",name="fromId") | |||||
| protected Long fromId; | |||||
| @Excel(name = "用户昵称/店铺名称", width = 20, orderNum = "2") | |||||
| @TableField(exist = false) | |||||
| @io.swagger.annotations.ApiModelProperty(value="来源Name",name="fromName") | |||||
| protected String fromName; | |||||
| @Excel(name = "(用户/店铺)联系方式", width = 20, orderNum = "3") | |||||
| @TableField(exist = false) | |||||
| @io.swagger.annotations.ApiModelProperty(value="来源phone",name="fromPhone") | |||||
| protected String fromPhone; | |||||
| @Excel(name = "推广人次", width = 20, orderNum = "4") | |||||
| @TableField(exist = false) | |||||
| @io.swagger.annotations.ApiModelProperty(value="推广人次",name="visits") | |||||
| private Integer visits; | |||||
| @Excel(name = "触达用户", width = 20, orderNum = "5") | |||||
| @TableField(exist = false) | |||||
| @io.swagger.annotations.ApiModelProperty(value="触达用户",name="reachUser") | |||||
| private Integer reachUser; | |||||
| @Excel(name = "触达新用户", width = 20, orderNum = "6") | |||||
| @TableField(exist = false) | |||||
| @io.swagger.annotations.ApiModelProperty(value="触达新用户",name="newUser") | |||||
| private Integer newUser; | |||||
| @Excel(name = "触达老用户", width = 20, orderNum = "7") | |||||
| @TableField(exist = false) | |||||
| @io.swagger.annotations.ApiModelProperty(value="触达老用户",name="oldUser") | |||||
| private Integer oldUser; | |||||
| public Integer getOldUser(){ | |||||
| if(this.getReachUser() != null && this.getNewUser() != null){ | |||||
| oldUser = this.getReachUser() - this.getNewUser(); | |||||
| } | |||||
| return oldUser; | |||||
| } | |||||
| @TableField(exist = false) | |||||
| protected Date startDate; | |||||
| @TableField(exist = false) | |||||
| protected Date endDate; | |||||
| @TableField(exist = false) | |||||
| private Integer begin; | |||||
| @TableField(exist = false) | |||||
| private Integer limit; | |||||
| } | |||||
| @@ -2,6 +2,7 @@ package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.po.WxCUserFrom; | import com.iformall.domain.po.WxCUserFrom; | ||||
| import com.iformall.domain.vo.WxCUserFromVo; | |||||
| import java.util.List; | import java.util.List; | ||||
| @@ -9,5 +10,5 @@ public interface WxCUserFromMapper extends CommonMapper<WxCUserFrom, Long>{ | |||||
| List<WxCUserFrom> findList(WxCUserFrom record); | List<WxCUserFrom> findList(WxCUserFrom record); | ||||
| List<WxCUserFrom> visits(WxCUserFrom record); | |||||
| List<WxCUserFromVo> visits(WxCUserFromVo record); | |||||
| } | } | ||||
| @@ -2,6 +2,10 @@ package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.WxCUserFrom; | import com.iformall.domain.po.WxCUserFrom; | ||||
| import com.iformall.domain.vo.WxCUserFromVo; | |||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| public interface WxCUserFromService { | public interface WxCUserFromService { | ||||
| @@ -15,9 +19,12 @@ public interface WxCUserFromService { | |||||
| */ | */ | ||||
| PageInfo<WxCUserFrom> listAsPage(WxCUserFrom record, Integer pageIndex, Integer pageSize); | PageInfo<WxCUserFrom> listAsPage(WxCUserFrom record, Integer pageIndex, Integer pageSize); | ||||
| PageInfo<WxCUserFrom> listAsVisitsPage(WxCUserFrom record, Integer pageIndex, Integer pageSize); | |||||
| PageInfo<WxCUserFromVo> listAsVisitsPage(WxCUserFromVo record, Integer pageIndex, Integer pageSize); | |||||
| void save(WxCUserFrom wxCUserFrom); | void save(WxCUserFrom wxCUserFrom); | ||||
| void exportData(HttpServletRequest request, HttpServletResponse response, WxCUserFrom record); | |||||
| void exportDataVisits(HttpServletRequest request, HttpServletResponse response, WxCUserFromVo record); | |||||
| } | } | ||||
| @@ -1,10 +1,12 @@ | |||||
| package com.iformall.service.impl; | package com.iformall.service.impl; | ||||
| import cn.afterturn.easypoi.handler.inter.IExcelExportServer; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.WxCUserFromVo; | |||||
| import com.iformall.enums.EnumCUserFrom; | |||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
| @@ -13,24 +15,35 @@ import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import java.util.Date; | |||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| import java.util.*; | |||||
| @Service | @Service | ||||
| @Slf4j | @Slf4j | ||||
| public class WxCUserFromServiceImpl implements WxCUserFromService { | |||||
| public class WxCUserFromServiceImpl implements WxCUserFromService, IExcelExportServer { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| @Autowired | @Autowired | ||||
| WxCUserFromMapper wxCUserFromMapper; | WxCUserFromMapper wxCUserFromMapper; | ||||
| @Autowired | |||||
| WxCUserBasicInfoMapper wxCUserBasicInfoMapper; | |||||
| @Autowired | |||||
| WxMerchantMapper wxMerchantMapper; | |||||
| @Autowired | |||||
| ExcelService excelService; | |||||
| @Override | @Override | ||||
| public PageInfo<WxCUserFrom> listAsPage(WxCUserFrom record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxCUserFrom> listAsPage(WxCUserFrom record, Integer pageIndex, Integer pageSize) { | ||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserFromMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserFromMapper.findList(record)); | ||||
| } | } | ||||
| @Override | @Override | ||||
| public PageInfo<WxCUserFrom> listAsVisitsPage(WxCUserFrom record, Integer pageIndex, Integer pageSize) { | |||||
| public PageInfo<WxCUserFromVo> listAsVisitsPage(WxCUserFromVo record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserFromMapper.visits(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserFromMapper.visits(record)); | ||||
| } | } | ||||
| @@ -44,4 +57,59 @@ public class WxCUserFromServiceImpl implements WxCUserFromService { | |||||
| wxCUserFromMapper.insert(wxCUserFrom); | wxCUserFromMapper.insert(wxCUserFrom); | ||||
| } | } | ||||
| @Override | |||||
| public void exportData(HttpServletRequest request, HttpServletResponse response, WxCUserFrom record) { | |||||
| String sheetName = "门店/用户分享明细"; | |||||
| if(record.getFromType().equals(EnumCUserFrom.FROM_C_USER_BASIC_INFO.getCode())){ | |||||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(record.getFromId(), record.getFinalTenantId()); | |||||
| sheetName = "用户["+wxCUserBasicInfo.getPhone()+"]分享明细"; | |||||
| }else if(record.getFromType().equals(EnumCUserFrom.FROM_MERCHANT.getCode())){ | |||||
| WxMerchant wxMerchant = wxMerchantMapper.selectById(record.getFromId()); | |||||
| sheetName = "门店["+wxMerchant.getName()+"]分享明细"; | |||||
| } | |||||
| String fileName = sheetName + ".xlsx"; | |||||
| excelService.exportBigExcel(this,record, null, sheetName, WxCUserFrom.class, fileName, response, false); | |||||
| // List<WxCUserFrom> list = wxCUserFromMapper.findList(record); | |||||
| // excelService.exportExcel(list, null, "门店/用户分享记录", WxCUserFrom.class, "门店/用户分享记录.xlsx", response, false); | |||||
| } | |||||
| @Override | |||||
| public void exportDataVisits(HttpServletRequest request, HttpServletResponse response, WxCUserFromVo record) { | |||||
| String sheetName = "门店/用户分享报表"; | |||||
| if(record.getFromType().equals(EnumCUserFrom.FROM_C_USER_BASIC_INFO.getCode())){ | |||||
| sheetName = "用户分享报表"; | |||||
| }else if(record.getFromType().equals(EnumCUserFrom.FROM_MERCHANT.getCode())){ | |||||
| sheetName = "门店分享报表"; | |||||
| } | |||||
| String fileName = sheetName + ".xlsx"; | |||||
| excelService.exportBigExcel(this,record, null, sheetName, WxCUserFromVo.class, fileName, response, false); | |||||
| // List<WxCUserFromVo> visits = wxCUserFromMapper.visits(record); | |||||
| // excelService.exportExcel(visits, null, "门店/用户分享报表", WxCUserFromVo.class, "门店/用户分享报表.xlsx", response, false); | |||||
| } | |||||
| @Override | |||||
| public List<Object> selectListForExcelExport(Object queryParams, int page) { | |||||
| if(queryParams instanceof WxCUserFromVo){ | |||||
| WxCUserFromVo record = (WxCUserFromVo) queryParams; | |||||
| record.setBegin((page-1)*10000); | |||||
| record.setLimit(10000); | |||||
| List<WxCUserFromVo> visits = wxCUserFromMapper.visits(record); | |||||
| if (null != visits && visits.size() > 0 ) { | |||||
| List<Object> retList = new ArrayList<Object>(); | |||||
| retList.addAll(visits); | |||||
| return retList; | |||||
| } | |||||
| }else if(queryParams instanceof WxCUserFrom){ | |||||
| WxCUserFrom record = (WxCUserFrom) queryParams; | |||||
| record.setBegin((page-1)*10000); | |||||
| record.setLimit(10000); | |||||
| List<WxCUserFrom> list = wxCUserFromMapper.findList(record); | |||||
| if (null != list && list.size() > 0 ) { | |||||
| List<Object> retList = new ArrayList<Object>(); | |||||
| retList.addAll(list); | |||||
| return retList; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| } | } | ||||
| @@ -60,9 +60,9 @@ | |||||
| <if test=" null != fromId "> | <if test=" null != fromId "> | ||||
| and wcuf.`from_id` = #{fromId} | and wcuf.`from_id` = #{fromId} | ||||
| </if> | </if> | ||||
| <if test=" null != isNewUser "> | |||||
| <!--<if test=" null != isNewUser "> | |||||
| and wcuf.`is_new_user` = #{isNewUser} | and wcuf.`is_new_user` = #{isNewUser} | ||||
| </if> | |||||
| </if>--> | |||||
| <if test=" null != shareUserType "> | <if test=" null != shareUserType "> | ||||
| and wcuf.`share_user_type` = #{shareUserType} | and wcuf.`share_user_type` = #{shareUserType} | ||||
| </if> | </if> | ||||
| @@ -83,7 +83,7 @@ | |||||
| #{idItem} | #{idItem} | ||||
| </foreach> | </foreach> | ||||
| </if> | </if> | ||||
| order by wcuf.`create_date` desc | |||||
| </sql> | </sql> | ||||
| <select id="findList" parameterType="com.iformall.domain.po.WxCUserFrom" resultMap="BaseResultMap"> | <select id="findList" parameterType="com.iformall.domain.po.WxCUserFrom" resultMap="BaseResultMap"> | ||||
| @@ -95,6 +95,16 @@ | |||||
| left join wx_c_user wcu on wcu.id = wcuf.c_user_id | left join wx_c_user wcu on wcu.id = wcuf.c_user_id | ||||
| left join wx_user_channel wuc on wuc.scene_address = wcuf.scene_address | left join wx_user_channel wuc on wuc.scene_address = wcuf.scene_address | ||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| <if test=" null != isNewUser and isNewUser == 1"> | |||||
| and wcuf.`is_new_user` = 1 | |||||
| </if> | |||||
| <if test=" null != isNewUser and isNewUser == 0 "> | |||||
| and wcuf.c_user_id not in (select c_user_id from wx_c_user_from wcuf <include refid="dynamicWhereConditions" /> and wcuf.`is_new_user` = 1) | |||||
| </if> | |||||
| order by wcuf.`create_date` desc | |||||
| <if test=" null != begin "> | |||||
| limit #{begin}, #{limit} | |||||
| </if> | |||||
| <!-- select <include refid="allColumns" />--> | <!-- select <include refid="allColumns" />--> | ||||
| <!-- ,(select nick_name from wx_c_user where id = wcuf.c_user_id ) c_user_nick_name--> | <!-- ,(select nick_name from wx_c_user where id = wcuf.c_user_id ) c_user_nick_name--> | ||||
| @@ -116,9 +126,9 @@ | |||||
| <!-- <include refid="dynamicWhereConditions" />--> | <!-- <include refid="dynamicWhereConditions" />--> | ||||
| </select> | </select> | ||||
| <select id="visits" parameterType="com.iformall.domain.po.WxCUserFrom" resultType="com.iformall.domain.po.WxCUserFrom"> | |||||
| select a.from_id fromId,a.from_name fromName,a.from_phone fromPhone,IFNULL(a.visits,0) visits,IFNULL(b.reach_user,0) reachUser,IFNULL(c.new_user,0) newUser from ( | |||||
| select wcuf.from_id, | |||||
| <select id="visits" parameterType="com.iformall.domain.vo.WxCUserFromVo" resultType="com.iformall.domain.vo.WxCUserFromVo"> | |||||
| select a.from_id fromId,a.from_type fromType,a.from_name fromName,a.from_phone fromPhone,IFNULL(a.visits,0) visits,IFNULL(b.reach_user,0) reachUser,IFNULL(c.new_user,0) newUser from ( | |||||
| select wcuf.from_id,wcuf.from_type, | |||||
| <if test=" fromType == 2 ">wcubi.nick_name from_name,wcubi.phone from_phone,</if> | <if test=" fromType == 2 ">wcubi.nick_name from_name,wcubi.phone from_phone,</if> | ||||
| <if test=" fromType == 5 ">wm.name from_name,wm.link_phone from_phone,</if> | <if test=" fromType == 5 ">wm.name from_name,wm.link_phone from_phone,</if> | ||||
| count(*) visits | count(*) visits | ||||
| @@ -180,6 +190,9 @@ | |||||
| group by wcuf.from_id,wcuf.c_user_id | group by wcuf.from_id,wcuf.c_user_id | ||||
| ) c on c.from_id = a.from_id | ) c on c.from_id = a.from_id | ||||
| order by a.visits desc | order by a.visits desc | ||||
| <if test=" null != begin "> | |||||
| limit #{begin}, #{limit} | |||||
| </if> | |||||
| </select> | </select> | ||||
| </mapper> | </mapper> | ||||