Commit e9e43340 by daixing

1000884编辑端首页、收益管理,加上微信群相关

parent 2af562d2
...@@ -129,7 +129,7 @@ public class BookConsr { ...@@ -129,7 +129,7 @@ public class BookConsr {
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("批量获取社群码下资源的总收益.[getRescourceTotalIncome]:" + e.getMessage(), e); LOGGER.error("批量获取社群码下资源的总收益.[getRescourceTotalIncome]:" + e.getMessage(), e);
} }
return rescourceTotalIncome; return rescourceTotalIncome == null?BigDecimal.ZERO:rescourceTotalIncome;
} }
@ParamLog(value = "批量获取社群码分类的收益", isBefore = false, isAfterReturn = false) @ParamLog(value = "批量获取社群码分类的收益", isBefore = false, isAfterReturn = false)
......
...@@ -5,6 +5,9 @@ import com.pcloud.common.dto.ResponseDto; ...@@ -5,6 +5,9 @@ import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil; import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.settlementcenter.record.dto.ProductStaticUnderAppMapDTO;
import com.pcloud.settlementcenter.record.dto.ResourcesStatisticVO;
import com.pcloud.settlementcenter.record.service.BookService;
import com.pcloud.settlementcenter.record.service.SettlementService; import com.pcloud.settlementcenter.record.service.SettlementService;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -26,6 +29,8 @@ public class SettlementConsr { ...@@ -26,6 +29,8 @@ public class SettlementConsr {
@Autowired @Autowired
private SettlementService settlementService; private SettlementService settlementService;
@Autowired
private BookService bookService;
@ParamLog(value = "获取收益", isBefore = false, isAfterReturn = false) @ParamLog(value = "获取收益", isBefore = false, isAfterReturn = false)
public Map<Long, BigDecimal> getWXGroupQrcodeIncomeByAdviser(List<Long> groupQrcodeIds, Long adviserId) throws BizException { public Map<Long, BigDecimal> getWXGroupQrcodeIncomeByAdviser(List<Long> groupQrcodeIds, Long adviserId) throws BizException {
...@@ -66,4 +71,16 @@ public class SettlementConsr { ...@@ -66,4 +71,16 @@ public class SettlementConsr {
} }
return dateList; return dateList;
} }
@ParamLog(value = "社群码应用下商品的收益", isBefore = false, isAfterReturn = false)
public Map<Long,List<ResourcesStatisticVO>> getProductStaticUnderApp(ProductStaticUnderAppMapDTO productStaticUnderAppMapDTO) throws BizException {
Map<Long,List<ResourcesStatisticVO>> resourcesStatisticVOS = new HashMap<>();
try {
ResponseEntity<ResponseDto<Map<Long,List<ResourcesStatisticVO>>>> responseEntityP = bookService.getProductStaticUnderAppMap(productStaticUnderAppMapDTO);
resourcesStatisticVOS = ResponseHandleUtil.parseMapList(responseEntityP, Long.class, ResourcesStatisticVO.class);
} catch (Exception e) {
LOGGER.error("社群码应用下商品的收益.[getProductStaticUnderApp]:" + e.getMessage(), e);
}
return resourcesStatisticVOS;
}
} }
...@@ -280,7 +280,7 @@ public interface BookGroupBiz { ...@@ -280,7 +280,7 @@ public interface BookGroupBiz {
/** /**
* 资源数据导出 * 资源数据导出
*/ */
void exportRescourceIncomeData(Long bookGroupId,Long adviserId, Long classifyId, Long qrcodeId, String type); Map<String, String> exportRescourceIncomeData(Long bookGroupId,Long adviserId);
/** /**
* 获取资源浏览数据 * 获取资源浏览数据
......
...@@ -51,6 +51,7 @@ import com.pcloud.common.utils.DateUtils; ...@@ -51,6 +51,7 @@ import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.QrcodeUtils; import com.pcloud.common.utils.QrcodeUtils;
import com.pcloud.common.utils.ResponseHandleUtil; import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.common.utils.export.excel.ExcelExportor;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.common.utils.zip.CompressUtils; import com.pcloud.common.utils.zip.CompressUtils;
import com.pcloud.facade.tradecenter.dto.*; import com.pcloud.facade.tradecenter.dto.*;
...@@ -65,6 +66,7 @@ import com.pcloud.resourcecenter.product.dto.UpdateAppProductParamDTO; ...@@ -65,6 +66,7 @@ import com.pcloud.resourcecenter.product.dto.UpdateAppProductParamDTO;
import com.pcloud.resourcecenter.product.entity.Product; import com.pcloud.resourcecenter.product.entity.Product;
import com.pcloud.resourcecenter.product.service.ProductService; import com.pcloud.resourcecenter.product.service.ProductService;
import com.pcloud.settlementcenter.record.dto.GroupRescourceIncomeParamDTO; import com.pcloud.settlementcenter.record.dto.GroupRescourceIncomeParamDTO;
import com.pcloud.settlementcenter.record.dto.ProductStaticUnderAppMapDTO;
import com.pcloud.settlementcenter.record.service.SettlementService; import com.pcloud.settlementcenter.record.service.SettlementService;
import com.pcloud.videolesson.schedule.service.ScheduleService; import com.pcloud.videolesson.schedule.service.ScheduleService;
import com.pcloud.wechatgroup.group.dto.GroupMemberStatisDTO; import com.pcloud.wechatgroup.group.dto.GroupMemberStatisDTO;
...@@ -88,6 +90,8 @@ import java.util.List; ...@@ -88,6 +90,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.sun.tools.doclets.formats.html.markup.HtmlStyle.title;
/** /**
* Description 社群书群二维码业务逻辑层接口实现类 * Description 社群书群二维码业务逻辑层接口实现类
* Created by PENG on 2019/4/17. * Created by PENG on 2019/4/17.
...@@ -1293,7 +1297,7 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -1293,7 +1297,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
TotalRescourceDataVO totalRescourceDataVO = new TotalRescourceDataVO(); TotalRescourceDataVO totalRescourceDataVO = new TotalRescourceDataVO();
List<Long> rescourceIds = appClickRecordDao.getRescourceIds(bookGroupId, classifyId, qrcodeId, type); List<Long> rescourceIds = appClickRecordDao.getRescourceIds(bookGroupId, classifyId, qrcodeId, type);
Long rescourceTotalClick = appClickRecordDao.getRescourceTotalClick(bookGroupId, classifyId, qrcodeId, type); Long rescourceTotalClick = appClickRecordDao.getRescourceTotalClick(bookGroupId, classifyId, qrcodeId, type);
totalRescourceDataVO.setClickCount(rescourceTotalClick); totalRescourceDataVO.setClickCount(rescourceTotalClick == null?0L:rescourceTotalClick);
GroupRescourceIncomeParamDTO groupRescourceIncomeParamDTO = new GroupRescourceIncomeParamDTO(); GroupRescourceIncomeParamDTO groupRescourceIncomeParamDTO = new GroupRescourceIncomeParamDTO();
groupRescourceIncomeParamDTO.setBookGroupId(bookGroupId); groupRescourceIncomeParamDTO.setBookGroupId(bookGroupId);
groupRescourceIncomeParamDTO.setClassifyId(classifyId); groupRescourceIncomeParamDTO.setClassifyId(classifyId);
...@@ -1308,11 +1312,116 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -1308,11 +1312,116 @@ public class BookGroupBizImpl implements BookGroupBiz {
} }
@Override @Override
public void exportRescourceIncomeData(Long bookGroupId, Long adviserId, Long classifyId, Long qrcodeId, String type) { public Map<String, String> exportRescourceIncomeData(Long bookGroupId, Long adviserId) {
List<ResourcesStatisticVO> clickStatistics = appClickRecordDao.getClickStatistics(bookGroupId, classifyId, qrcodeId, type); List<StatisticsIncomeDto> appStatisticsIncomeDtos = new ArrayList<>();
setInfo(clickStatistics,bookGroupId,classifyId,qrcodeId,type); List<StatisticsIncomeDto> productStatisticsIncomeDtos = new ArrayList<>();
List<ResourcesStatisticVO> appClickStatistics = appClickRecordDao.getClickStatistics(bookGroupId, null, null, "APP");
List<ResourcesStatisticVO> productClickStatistics = appClickRecordDao.getClickStatistics(bookGroupId, null, null, "PRODUCT");
if (!ListUtils.isEmpty(appClickStatistics)){
setInfo(appClickStatistics, bookGroupId, null, null, "APP");
//获取挂在应用下的商品信息
ProductStaticUnderAppMapDTO productStaticUnderAppMapDTO = new ProductStaticUnderAppMapDTO();
productStaticUnderAppMapDTO.setBookGroupId(bookGroupId);
productStaticUnderAppMapDTO.setAppIds(appClickStatistics.stream().map(ResourcesStatisticVO::getRescourceId).collect(Collectors.toList()));
Map<Long, List<com.pcloud.settlementcenter.record.dto.ResourcesStatisticVO>> productStaticUnderApp = settlementConsr.getProductStaticUnderApp(productStaticUnderAppMapDTO);
Map<Long, List<StatisticsIncomeDto>> productStaticUnderAppMap = copy(productStaticUnderApp,bookGroupId);
appClickStatistics.forEach(e ->{
StatisticsIncomeDto statisticsIncomeDto = new StatisticsIncomeDto();
statisticsIncomeDto.setAppId(e.getRescourceId());
statisticsIncomeDto.setBookGroupId(bookGroupId);
statisticsIncomeDto.setIncome(e.getTotalIncome());
statisticsIncomeDto.setAppName(e.getRescourceName());
statisticsIncomeDto.setSaleCounts(e.getSaleCount().intValue());
statisticsIncomeDto.setSaleMoney(e.getTotalSale());
statisticsIncomeDto.setScanCounts(e.getBrowseCount().intValue());
statisticsIncomeDto.setItemList(productStaticUnderAppMap.get(e.getRescourceId()));
appStatisticsIncomeDtos.add(statisticsIncomeDto);
});
}
if (!ListUtils.isEmpty(productClickStatistics)){
setInfo(productClickStatistics, bookGroupId, null, null, "PRODUCT");
productClickStatistics.forEach(e ->{
StatisticsIncomeDto statisticsIncomeDto = new StatisticsIncomeDto();
statisticsIncomeDto.setProductId(e.getRescourceId());
statisticsIncomeDto.setBookGroupId(bookGroupId);
statisticsIncomeDto.setIncome(e.getTotalIncome());
statisticsIncomeDto.setProductName(e.getRescourceName());
statisticsIncomeDto.setSaleCounts(e.getSaleCount().intValue());
statisticsIncomeDto.setSaleMoney(e.getTotalSale());
statisticsIncomeDto.setScanCounts(e.getBrowseCount().intValue());
productStatisticsIncomeDtos.add(statisticsIncomeDto);
});
}
TotalRescourceDataVO appTotalRescourceData = getTotalRescourceData(bookGroupId, null, null, null, "APP");
StatisticsIncomeDto appSumStatistics = setResourceSumStatistics(appTotalRescourceData);
TotalRescourceDataVO productTotalRescourceData = getTotalRescourceData(bookGroupId, null, null, null, "PRODUCT");
StatisticsIncomeDto productSumStatistics = setResourceSumStatistics(productTotalRescourceData);
Map<String, Object> dataMap = new HashMap<>();
BookGroupDTO bookGroupDTO = bookGroupDao.getDTOById(bookGroupId);
if (bookGroupDTO == null){
bookGroupDTO = new BookGroupDTO();
}
String groupQrcodeName = bookGroupDTO.getGroupQrcodeName()== null?" ":bookGroupDTO.getGroupQrcodeName();
String title = "社群码" + groupQrcodeName + "的收益列表";
dataMap.put("appIncomeList", appStatisticsIncomeDtos);
dataMap.put("productIncomeList", productStatisticsIncomeDtos);
dataMap.put("title", title);
dataMap.put("appSumStatistics", appSumStatistics);
dataMap.put("productSumStatistics", productSumStatistics);
String today = DateUtils.formatDate(DateUtils.nowTimeStamp(), DateUtils.DATE_FORMAT_DATEONLY);
String fileName = title+ "-" + today;
String filePath = "";
try {
LOGGER.info("生成Excel【START】");
filePath = ExcelExportor.uploadExcel(this.getClass(), dataMap, "template_bookGroupStatistics.ftl");
LOGGER.info("生成Excel【END】" + filePath);
} catch (Exception e) {
LOGGER.error("生成Excel异常+++" + e.getMessage(), e);
throw new BookBizException(BookBizException.ERROR, "导出失败,请联系管理员");
}
Map<String, String> resultMap = new HashMap<>();
resultMap.put("fileName", fileName);
resultMap.put("fileUrl", filePath);
return resultMap;
}
private StatisticsIncomeDto setResourceSumStatistics(TotalRescourceDataVO totalRescourceDataVO){
if (totalRescourceDataVO == null){
return new StatisticsIncomeDto();
}
Long clickCount = totalRescourceDataVO.getClickCount();
BigDecimal totalIncome = totalRescourceDataVO.getTotalIncome();
BigDecimal totalSale = totalRescourceDataVO.getTotalSale();
StatisticsIncomeDto statisticsIncomeDto = new StatisticsIncomeDto();
statisticsIncomeDto.setScanCounts(clickCount.intValue());
statisticsIncomeDto.setIncome(totalIncome);
statisticsIncomeDto.setSaleMoney(totalSale);
return statisticsIncomeDto;
}
private Map<Long, List<StatisticsIncomeDto>> copy(Map<Long, List<com.pcloud.settlementcenter.record.dto.ResourcesStatisticVO>> productStaticUnderApp,Long bookGroupId){
Map<Long, List<StatisticsIncomeDto>> productStaticUnderAppMap = new HashMap<>();
if (MapUtils.isEmpty(productStaticUnderApp)){
return productStaticUnderAppMap;
}
List<StatisticsIncomeDto> productStatisticsIncomeDtos = new ArrayList<>();
productStaticUnderApp.forEach((k,v) ->{
v.forEach(e ->{
StatisticsIncomeDto statisticsIncomeDto = new StatisticsIncomeDto();
statisticsIncomeDto.setProductId(e.getRescourceId());
statisticsIncomeDto.setIncome(e.getTotalIncome());
statisticsIncomeDto.setProductName(e.getRescourceName());
statisticsIncomeDto.setSaleCounts(e.getSaleCount().intValue());
statisticsIncomeDto.setSaleMoney(e.getTotalSale());
statisticsIncomeDto.setScanCounts(e.getBrowseCount().intValue());
productStatisticsIncomeDtos.add(statisticsIncomeDto);
});
productStaticUnderAppMap.put(k,productStatisticsIncomeDtos);
});
return productStaticUnderAppMap;
} }
@Override @Override
......
...@@ -47,7 +47,7 @@ public class AppClickRecordDaoImpl extends BaseDaoImpl<AppClickRecord> implement ...@@ -47,7 +47,7 @@ public class AppClickRecordDaoImpl extends BaseDaoImpl<AppClickRecord> implement
@Override @Override
public Map<Long, ResourceClickVO> getResourceClick(Map<String, Object> map) { public Map<Long, ResourceClickVO> getResourceClick(Map<String, Object> map) {
return this.getSqlSession().selectMap(this.getStatement("getResourceClick"), map,"resourceId"); return this.getSqlSession().selectMap(this.getStatement("getResourceClick"), map,"rescourceId");
} }
@Override @Override
......
package com.pcloud.book.group.dto;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* @author 戴兴
* @description TODO
* @date 2019/8/8 21:39
*/
public class StatisticsIncomeDto implements Serializable {
/**
*
*/
private static final long serialVersionUID = 4695716936925368521L;
/**
* 应用标识
*/
private Long appId;
/**
* 书刊标识
*/
private Long bookGroupId;
/**
* 应用名称
*/
private String appName;
/**
* 浏览量
*/
private Integer scanCounts;
/**
* 销售量
*/
private Integer saleCounts;
/**
* 销售额
*/
private BigDecimal saleMoney;
/**
* 收益额
*/
private BigDecimal income;
/**
* 商品标识
*/
private Long productId;
/**
* 商品名称
*/
private String productName;
/**
* 收益时间
*/
private String dateTime;
/**
* 子项
*/
private List<StatisticsIncomeDto> itemList;
public Long getAppId() {
return appId;
}
public void setAppId(Long appId) {
this.appId = appId;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public Integer getScanCounts() {
return scanCounts;
}
public void setScanCounts(Integer scanCounts) {
this.scanCounts = scanCounts;
}
public Integer getSaleCounts() {
return saleCounts;
}
public void setSaleCounts(Integer saleCounts) {
this.saleCounts = saleCounts;
}
public BigDecimal getSaleMoney() {
return saleMoney;
}
public void setSaleMoney(BigDecimal saleMoney) {
this.saleMoney = saleMoney;
}
public BigDecimal getIncome() {
return income;
}
public void setIncome(BigDecimal income) {
this.income = income;
}
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getDateTime() {
return dateTime;
}
public void setDateTime(String dateTime) {
this.dateTime = dateTime;
}
public List<StatisticsIncomeDto> getItemList() {
return itemList;
}
public void setItemList(List<StatisticsIncomeDto> itemList) {
this.itemList = itemList;
}
@Override
public String toString() {
return "StatisticsIncomeDto{" +
"appId=" + appId +
", bookGroupId=" + bookGroupId +
", appName='" + appName + '\'' +
", scanCounts=" + scanCounts +
", saleCounts=" + saleCounts +
", saleMoney=" + saleMoney +
", income=" + income +
", productId=" + productId +
", productName='" + productName + '\'' +
", dateTime='" + dateTime + '\'' +
", itemList=" + itemList +
'}';
}
}
\ No newline at end of file
...@@ -314,10 +314,8 @@ public interface BookGroupFacade { ...@@ -314,10 +314,8 @@ public interface BookGroupFacade {
@ApiImplicitParam(name = "type",value = "type",required = true,dataType = "String",paramType = "query") @ApiImplicitParam(name = "type",value = "type",required = true,dataType = "String",paramType = "query")
}) })
@RequestMapping(value ="exportRescourceIncomeData",method = RequestMethod.GET) @RequestMapping(value ="exportRescourceIncomeData",method = RequestMethod.GET)
public ResponseDto<?> exportRescourceIncomeData(@RequestHeader("token") String token, @RequestParam(value = "bookGroupId",required = true) Long bookGroupId, public ResponseDto<?> exportRescourceIncomeData(@RequestHeader("token") String token,
@RequestParam(value = "classifyId",required = false) Long classifyId, @RequestParam(value = "qrcodeId",required = false) Long qrcodeId, @RequestParam(value = "bookGroupId",required = true) Long bookGroupId) throws BizException, PermissionException;
@RequestParam("type") String type) throws BizException, PermissionException;
} }
...@@ -433,12 +433,12 @@ public class BookGroupFacadeImpl implements BookGroupFacade { ...@@ -433,12 +433,12 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@Override @Override
@RequestMapping(value ="exportRescourceIncomeData",method = RequestMethod.GET) @RequestMapping(value ="exportRescourceIncomeData",method = RequestMethod.GET)
public ResponseDto<?> exportRescourceIncomeData(@RequestHeader("token") String token, @RequestParam(value = "bookGroupId",required = true) Long bookGroupId, public ResponseDto<?> exportRescourceIncomeData(@RequestHeader("token") String token,
@RequestParam(value = "classifyId",required = false) Long classifyId, @RequestParam(value = "qrcodeId",required = false) Long qrcodeId, @RequestParam(value = "bookGroupId",required = true) Long bookGroupId) throws BizException, PermissionException {
@RequestParam("type") String type) throws BizException, PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token); Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long adviserId = (Long) map.get(SessionUtil.PARTY_ID); Long adviserId = (Long) map.get(SessionUtil.PARTY_ID);
bookGroupBiz.exportRescourceIncomeData(bookGroupId, adviserId, classifyId, qrcodeId, type); bookGroupBiz.exportRescourceIncomeData(bookGroupId, adviserId);
return new ResponseDto<>(); return new ResponseDto<>();
} }
} }
...@@ -50,6 +50,10 @@ ...@@ -50,6 +50,10 @@
<pcloud-common-core.version>2.1.0-SNAPSHOT</pcloud-common-core.version> <pcloud-common-core.version>2.1.0-SNAPSHOT</pcloud-common-core.version>
<wxgroup-sdk.version>1.0.0-SNAPSHOT</wxgroup-sdk.version> <wxgroup-sdk.version>1.0.0-SNAPSHOT</wxgroup-sdk.version>
</properties> </properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile> </profile>
<!-- UAT --> <!-- UAT -->
...@@ -64,9 +68,7 @@ ...@@ -64,9 +68,7 @@
<wxgroup-sdk.version>1.0.0-RELEASE</wxgroup-sdk.version> <wxgroup-sdk.version>1.0.0-RELEASE</wxgroup-sdk.version>
</properties> </properties>
<!-- 设置默认环境 --> <!-- 设置默认环境 -->
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile> </profile>
<!-- 压测环境 --> <!-- 压测环境 -->
...@@ -113,7 +115,7 @@ ...@@ -113,7 +115,7 @@
<pcloud-facade-analysisengine.version>2.1.0-RELEASE</pcloud-facade-analysisengine.version> <pcloud-facade-analysisengine.version>2.1.0-RELEASE</pcloud-facade-analysisengine.version>
<pcloud-facade-quartz.version>2.1.0-RELEASE</pcloud-facade-quartz.version> <pcloud-facade-quartz.version>2.1.0-RELEASE</pcloud-facade-quartz.version>
<pcloud-facade-appcenter.version>2.1.0-RELEASE</pcloud-facade-appcenter.version> <pcloud-facade-appcenter.version>2.1.0-RELEASE</pcloud-facade-appcenter.version>
<pcloud-facade-settlement.version>2.0.0-SNAPSHOT</pcloud-facade-settlement.version> <pcloud-facade-settlement.version>2.1.0-SNAPSHOT</pcloud-facade-settlement.version>
<pcloud-facade-message.version>2.1.0-RELEASE</pcloud-facade-message.version> <pcloud-facade-message.version>2.1.0-RELEASE</pcloud-facade-message.version>
<pcloud-facade-commoncenter.version>2.1.0-RELEASE</pcloud-facade-commoncenter.version> <pcloud-facade-commoncenter.version>2.1.0-RELEASE</pcloud-facade-commoncenter.version>
<pcloud-facade-comment.version>2.1.0-RELEASE</pcloud-facade-comment.version> <pcloud-facade-comment.version>2.1.0-RELEASE</pcloud-facade-comment.version>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment