|
@@ -1,5 +1,6 @@
|
|
package cn.com.ctop.toutiao.modules.report.service.impl;
|
|
package cn.com.ctop.toutiao.modules.report.service.impl;
|
|
|
|
|
|
|
|
+import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
|
|
import cn.com.ctop.toutiao.modules.report.DTO.AccountVideoDTO;
|
|
import cn.com.ctop.toutiao.modules.report.DTO.AccountVideoDTO;
|
|
import cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily;
|
|
import cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily;
|
|
import cn.com.ctop.toutiao.modules.report.mapper.ByteDanceVideoReportDailyMapper;
|
|
import cn.com.ctop.toutiao.modules.report.mapper.ByteDanceVideoReportDailyMapper;
|
|
@@ -8,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
@@ -16,7 +18,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
-import java.text.ParseException;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -28,11 +29,13 @@ import java.util.List;
|
|
* @version V1.0
|
|
* @version V1.0
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
|
|
+@Slf4j
|
|
public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceVideoReportDailyMapper, ByteDanceVideoReportDaily> implements IByteDanceVideoReportDailyService {
|
|
public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceVideoReportDailyMapper, ByteDanceVideoReportDaily> implements IByteDanceVideoReportDailyService {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private ByteDanceVideoReportDailyMapper byteDanceVideoReportDailyMapper;
|
|
private ByteDanceVideoReportDailyMapper byteDanceVideoReportDailyMapper;
|
|
|
|
|
|
|
|
+ @Override
|
|
public void videoInfoList(String startDate, String endDate){
|
|
public void videoInfoList(String startDate, String endDate){
|
|
//华南
|
|
//华南
|
|
videoInfoListByCompanyId(startDate, endDate, "6608ed13c0dd42de93c790dbdf124234");
|
|
videoInfoListByCompanyId(startDate, endDate, "6608ed13c0dd42de93c790dbdf124234");
|
|
@@ -49,30 +52,32 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
|
|
wrapper.eq("company_id", companyId);
|
|
wrapper.eq("company_id", companyId);
|
|
byteDanceVideoReportDailyMapper.delete(wrapper);
|
|
byteDanceVideoReportDailyMapper.delete(wrapper);
|
|
|
|
|
|
- List<ByteDanceVideoReportDaily> mList = byteDanceVideoReportDailyMapper.videoInfoList(startDate, endDate, companyId);
|
|
|
|
|
|
+ List<ByteDanceVideoReportDaily> mList = byteDanceVideoReportDailyMapper.videoInfoList(startDate, endDate, companyId, null);
|
|
for (ByteDanceVideoReportDaily m:mList){
|
|
for (ByteDanceVideoReportDaily m:mList){
|
|
byteDanceVideoReportDailyMapper.insert(m);
|
|
byteDanceVideoReportDailyMapper.insert(m);
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //根据accountId和时间清洗头条素材为头条视频报表数据
|
|
|
|
+ @Override
|
|
|
|
+ public void videoInfoListByAccountId(String startDate, String endDate, Long accountId){
|
|
|
|
+ QueryWrapper<ByteDanceVideoReportDaily> wrapper = new QueryWrapper<>();
|
|
|
|
+ wrapper.ge("stat_datetime",startDate);
|
|
|
|
+ wrapper.le("stat_datetime",endDate);
|
|
|
|
+ wrapper.eq("account_id", accountId);
|
|
|
|
+ byteDanceVideoReportDailyMapper.delete(wrapper);
|
|
|
|
|
|
- //QueryWrapper<ByteDanceVideoReportDaily> queryWrapper = new QueryWrapper<>();
|
|
|
|
-
|
|
|
|
- //List<ByteDanceVideoReportDaily> mList2 = byteDanceVideoReportDailyMapper.selectList(wrapper);
|
|
|
|
- //
|
|
|
|
- //for(ByteDanceVideoReportDaily m:mList2){
|
|
|
|
- // String statDate = DateUtils.formatDate(DateUtils.addDay(m.getStatDatetime(),-1));
|
|
|
|
- // BigDecimal cost = byteDanceVideoReportDailyMapper.getVideoReportDailyByDateAndSignature(statDate,statDate,m.getSignature(),companyId);
|
|
|
|
- //
|
|
|
|
- // BigDecimal huanbi =BigDecimal.ZERO;
|
|
|
|
- // if(cost != null && cost.compareTo(BigDecimal.ZERO)>0){
|
|
|
|
- // huanbi = m.getCost().subtract(cost).divide(cost,7, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- // }
|
|
|
|
- //
|
|
|
|
- // m.setHuanbi(huanbi);
|
|
|
|
- // byteDanceVideoReportDailyMapper.updateById(m);
|
|
|
|
- //}
|
|
|
|
|
|
+ String companyId = byteDanceVideoReportDailyMapper.getCompanyIdByAccountId(accountId);
|
|
|
|
+
|
|
|
|
+ List<ByteDanceVideoReportDaily> mList = byteDanceVideoReportDailyMapper.videoInfoList(startDate, endDate, companyId, accountId);
|
|
|
|
+ for (ByteDanceVideoReportDaily m:mList){
|
|
|
|
+ byteDanceVideoReportDailyMapper.insert(m);
|
|
|
|
+ }
|
|
|
|
+ log.info("根据accountId和时间清洗头条素材为头条视频报表数据结束,开始时间:{},结束时间:{},accountId:{}",startDate,endDate,accountId );
|
|
}
|
|
}
|
|
|
|
|
|
//视频按天列表
|
|
//视频按天列表
|
|
|
|
+ @Override
|
|
public PageInfo<ByteDanceVideoReportDaily> videoInfoListDaily(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds, String sort){
|
|
public PageInfo<ByteDanceVideoReportDaily> videoInfoListDaily(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds, String sort){
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
String userId = sysUser.getId();
|
|
String userId = sysUser.getId();
|
|
@@ -91,11 +96,11 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
|
|
accountIdsList = Arrays.asList(accountIds);
|
|
accountIdsList = Arrays.asList(accountIds);
|
|
}
|
|
}
|
|
//admin能看所有视频
|
|
//admin能看所有视频
|
|
- if(roleCode.equals("admin")){
|
|
|
|
|
|
+ if(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN)){
|
|
PageHelper.startPage(pageNo,pageSize,sort);
|
|
PageHelper.startPage(pageNo,pageSize,sort);
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
|
|
}else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
|
|
}else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
|
|
- if (accountIdsList != null && accountIdsList.size() != 0){
|
|
|
|
|
|
+ if (accountIdsList != null && !accountIdsList.isEmpty()){
|
|
PageHelper.startPage(pageNo,pageSize,sort);
|
|
PageHelper.startPage(pageNo,pageSize,sort);
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
|
|
}else{
|
|
}else{
|
|
@@ -136,12 +141,12 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
|
|
m.setHuanbi(huanbi);
|
|
m.setHuanbi(huanbi);
|
|
}
|
|
}
|
|
|
|
|
|
- PageInfo<ByteDanceVideoReportDaily> pageInfo = new PageInfo<>(mList);
|
|
|
|
- return pageInfo;
|
|
|
|
|
|
+ return new PageInfo<>(mList);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
//视频报表月列表
|
|
//视频报表月列表
|
|
|
|
+ @Override
|
|
public PageInfo<ByteDanceVideoReportDaily> videoInfoListMonth(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds, String sort){
|
|
public PageInfo<ByteDanceVideoReportDaily> videoInfoListMonth(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds, String sort){
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
String userId = sysUser.getId();
|
|
String userId = sysUser.getId();
|
|
@@ -160,11 +165,11 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
|
|
accountIdsList = Arrays.asList(accountIds);
|
|
accountIdsList = Arrays.asList(accountIds);
|
|
}
|
|
}
|
|
//admin能看所有视频
|
|
//admin能看所有视频
|
|
- if(roleCode.equals("admin")){
|
|
|
|
|
|
+ if(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN)){
|
|
PageHelper.startPage(pageNo,pageSize,sort);
|
|
PageHelper.startPage(pageNo,pageSize,sort);
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
|
|
}else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
|
|
}else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
|
|
- if (accountIdsList != null && accountIdsList.size() != 0){
|
|
|
|
|
|
+ if (accountIdsList != null && !accountIdsList.isEmpty()){
|
|
PageHelper.startPage(pageNo,pageSize,sort);
|
|
PageHelper.startPage(pageNo,pageSize,sort);
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
|
|
}else{
|
|
}else{
|
|
@@ -201,16 +206,15 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
|
|
if(costBefore != null && costBefore.compareTo(BigDecimal.ZERO)>0){
|
|
if(costBefore != null && costBefore.compareTo(BigDecimal.ZERO)>0){
|
|
huanbi = m.getCost().subtract(costBefore).divide(costBefore,7, BigDecimal.ROUND_HALF_UP);
|
|
huanbi = m.getCost().subtract(costBefore).divide(costBefore,7, BigDecimal.ROUND_HALF_UP);
|
|
}
|
|
}
|
|
-
|
|
|
|
m.setHuanbi(huanbi);
|
|
m.setHuanbi(huanbi);
|
|
}
|
|
}
|
|
|
|
|
|
- PageInfo<ByteDanceVideoReportDaily> pageInfo = new PageInfo<>(mList);
|
|
|
|
- return pageInfo;
|
|
|
|
|
|
+ return new PageInfo<>(mList);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
//视频总报表列表
|
|
//视频总报表列表
|
|
|
|
+ @Override
|
|
public PageInfo<ByteDanceVideoReportDaily> videoInfoListTotal(String startDate, String endDate, String signature, BigDecimal cost , Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds, String sort){
|
|
public PageInfo<ByteDanceVideoReportDaily> videoInfoListTotal(String startDate, String endDate, String signature, BigDecimal cost , Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds, String sort){
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
String userId = sysUser.getId();
|
|
String userId = sysUser.getId();
|
|
@@ -229,11 +233,11 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
|
|
accountIdsList = Arrays.asList(accountIds);
|
|
accountIdsList = Arrays.asList(accountIds);
|
|
}
|
|
}
|
|
//admin能看所有视频
|
|
//admin能看所有视频
|
|
- if(roleCode.equals("admin")){
|
|
|
|
|
|
+ if(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN)){
|
|
PageHelper.startPage(pageNo,pageSize,sort);
|
|
PageHelper.startPage(pageNo,pageSize,sort);
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
|
|
}else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
|
|
}else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
|
|
- if (accountIdsList != null && accountIdsList.size() != 0){
|
|
|
|
|
|
+ if (accountIdsList != null && !accountIdsList.isEmpty()){
|
|
PageHelper.startPage(pageNo,pageSize,sort);
|
|
PageHelper.startPage(pageNo,pageSize,sort);
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
|
|
}else{
|
|
}else{
|
|
@@ -273,30 +277,16 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
|
|
|
|
|
|
m.setHuanbi(huanbi);
|
|
m.setHuanbi(huanbi);
|
|
}
|
|
}
|
|
-
|
|
|
|
- PageInfo<ByteDanceVideoReportDaily> pageInfo = new PageInfo<>(mList);
|
|
|
|
- return pageInfo;
|
|
|
|
|
|
+ return new PageInfo<>(mList);
|
|
}
|
|
}
|
|
|
|
|
|
//视频总报表列表导出excel
|
|
//视频总报表列表导出excel
|
|
|
|
+ @Override
|
|
public List<ByteDanceVideoReportDaily> videoInfoListTotalExcel(String startDate, String endDate, String signature, BigDecimal cost , Long[] accountIds, String sort){
|
|
public List<ByteDanceVideoReportDaily> videoInfoListTotalExcel(String startDate, String endDate, String signature, BigDecimal cost , Long[] accountIds, String sort){
|
|
- //LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
- //String userId = sysUser.getId();
|
|
|
|
- //String roleCode = byteDanceVideoReportDailyMapper.getRoleCodeByUserId(userId);
|
|
|
|
- //String companyId = byteDanceVideoReportDailyMapper.getCompanyIdByUserId(userId);
|
|
|
|
- //
|
|
|
|
- //List<ByteDanceVideoReportDaily> mList = byteDanceVideoReportDailyMapper.videoInfoListWeek(startDate, endDate, roleCode, userId, signature, companyId, cost);
|
|
|
|
-
|
|
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
String userId = sysUser.getId();
|
|
String userId = sysUser.getId();
|
|
String roleCode = byteDanceVideoReportDailyMapper.getRoleCodeByUserId(userId);
|
|
String roleCode = byteDanceVideoReportDailyMapper.getRoleCodeByUserId(userId);
|
|
String companyId = byteDanceVideoReportDailyMapper.getCompanyIdByUserId(userId);
|
|
String companyId = byteDanceVideoReportDailyMapper.getCompanyIdByUserId(userId);
|
|
-
|
|
|
|
- if(StringUtils.isBlank(sort)){
|
|
|
|
- sort = "cost-";
|
|
|
|
- }
|
|
|
|
- sort = sort.replace("-", " desc,").replace("+", " asc,"); //sort=id-name+age+
|
|
|
|
- sort = sort.substring(0, sort.length() - 1);
|
|
|
|
List<ByteDanceVideoReportDaily> mList = new ArrayList<>();
|
|
List<ByteDanceVideoReportDaily> mList = new ArrayList<>();
|
|
|
|
|
|
List<Long> accountIdsList = null;
|
|
List<Long> accountIdsList = null;
|
|
@@ -304,10 +294,10 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
|
|
accountIdsList = Arrays.asList(accountIds);
|
|
accountIdsList = Arrays.asList(accountIds);
|
|
}
|
|
}
|
|
//admin能看所有视频
|
|
//admin能看所有视频
|
|
- if(roleCode.equals("admin")){
|
|
|
|
|
|
+ if(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN)){
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
|
|
}else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
|
|
}else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
|
|
- if (accountIdsList != null && accountIdsList.size() != 0){
|
|
|
|
|
|
+ if (accountIdsList != null && !accountIdsList.isEmpty()){
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
|
|
}else{
|
|
}else{
|
|
List<Long> accoutnIds= byteDanceVideoReportDailyMapper.getAccountIdsByOperatorIdAndMediaId(1,userId);
|
|
List<Long> accoutnIds= byteDanceVideoReportDailyMapper.getAccountIdsByOperatorIdAndMediaId(1,userId);
|
|
@@ -324,26 +314,11 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
|
|
}else if(roleCode.equals("designTeamLeader")){
|
|
}else if(roleCode.equals("designTeamLeader")){
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListGroupdesignTeamLeader(startDate, endDate, companyId, accountIdsList, signature, cost);
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListGroupdesignTeamLeader(startDate, endDate, companyId, accountIdsList, signature, cost);
|
|
}
|
|
}
|
|
-
|
|
|
|
- //计算环比
|
|
|
|
- //for(ByteDanceVideoReportDaily m:mList){
|
|
|
|
- // Integer datediff = DateUtils.dateDiff(startDate, endDate);
|
|
|
|
- // String startMonthDate = DateUtils.formatDate(DateUtils.addDay(startDate,-(datediff + 1) ) );
|
|
|
|
- // String endMonthDate = DateUtils.formatDate(DateUtils.addDay(startDate,-1));
|
|
|
|
- //
|
|
|
|
- // BigDecimal costBefore = byteDanceVideoReportDailyMapper.getVideoReportDailyByDateAndSignature(startMonthDate,endMonthDate,m.getSignature(),accountIdsList);
|
|
|
|
- //
|
|
|
|
- // BigDecimal huanbi =BigDecimal.ZERO;
|
|
|
|
- // if(costBefore != null && costBefore.compareTo(BigDecimal.ZERO)>0){
|
|
|
|
- // huanbi = m.getCost().subtract(costBefore).divide(costBefore,7, BigDecimal.ROUND_HALF_UP);
|
|
|
|
- // }
|
|
|
|
- //
|
|
|
|
- // m.setHuanbi(huanbi);
|
|
|
|
- //}
|
|
|
|
return mList;
|
|
return mList;
|
|
}
|
|
}
|
|
|
|
|
|
//视频报表周列表
|
|
//视频报表周列表
|
|
|
|
+ @Override
|
|
public PageInfo<ByteDanceVideoReportDaily> videoInfoListWeek(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds, String sort){
|
|
public PageInfo<ByteDanceVideoReportDaily> videoInfoListWeek(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds, String sort){
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
String userId = sysUser.getId();
|
|
String userId = sysUser.getId();
|
|
@@ -362,11 +337,11 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
|
|
accountIdsList = Arrays.asList(accountIds);
|
|
accountIdsList = Arrays.asList(accountIds);
|
|
}
|
|
}
|
|
//admin能看所有视频
|
|
//admin能看所有视频
|
|
- if(roleCode.equals("admin")){
|
|
|
|
|
|
+ if(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN)){
|
|
PageHelper.startPage(pageNo,pageSize,sort);
|
|
PageHelper.startPage(pageNo,pageSize,sort);
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
|
|
}else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
|
|
}else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
|
|
- if (accountIdsList != null && accountIdsList.size() != 0){
|
|
|
|
|
|
+ if (accountIdsList != null && !accountIdsList.isEmpty()){
|
|
PageHelper.startPage(pageNo,pageSize,sort);
|
|
PageHelper.startPage(pageNo,pageSize,sort);
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
|
|
}else{
|
|
}else{
|
|
@@ -407,18 +382,16 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
|
|
m.setHuanbi(huanbi);
|
|
m.setHuanbi(huanbi);
|
|
}
|
|
}
|
|
|
|
|
|
- PageInfo<ByteDanceVideoReportDaily> pageInfo = new PageInfo<>(mList);
|
|
|
|
-
|
|
|
|
- return pageInfo;
|
|
|
|
|
|
+ return new PageInfo<>(mList);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
public List<ByteDanceVideoReportDaily> videoInfoListDetail(String startDate, String endDate, String signature, Long[] accountIds){
|
|
public List<ByteDanceVideoReportDaily> videoInfoListDetail(String startDate, String endDate, String signature, Long[] accountIds){
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
String userId = sysUser.getId();
|
|
String userId = sysUser.getId();
|
|
String roleCode = byteDanceVideoReportDailyMapper.getRoleCodeByUserId(userId);
|
|
String roleCode = byteDanceVideoReportDailyMapper.getRoleCodeByUserId(userId);
|
|
String companyId = byteDanceVideoReportDailyMapper.getCompanyIdByUserId(userId);
|
|
String companyId = byteDanceVideoReportDailyMapper.getCompanyIdByUserId(userId);
|
|
|
|
|
|
- //List<ByteDanceVideoReportDaily> mList = byteDanceVideoReportDailyMapper.videoInfoListDetail(companyId, startDate, endDate, signature, roleCode);
|
|
|
|
List<ByteDanceVideoReportDaily> mList =new ArrayList<>();
|
|
List<ByteDanceVideoReportDaily> mList =new ArrayList<>();
|
|
|
|
|
|
List<Long> accountIdsList = null;
|
|
List<Long> accountIdsList = null;
|
|
@@ -426,10 +399,10 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
|
|
accountIdsList = Arrays.asList(accountIds);
|
|
accountIdsList = Arrays.asList(accountIds);
|
|
}
|
|
}
|
|
//admin能看所有视频
|
|
//admin能看所有视频
|
|
- if(roleCode.equals("admin")){
|
|
|
|
|
|
+ if(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN)){
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListDetail(companyId, startDate, endDate, signature, accountIdsList);
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListDetail(companyId, startDate, endDate, signature, accountIdsList);
|
|
}else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
|
|
}else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
|
|
- if (accountIdsList != null && accountIdsList.size() != 0){
|
|
|
|
|
|
+ if (accountIdsList != null && !accountIdsList.isEmpty()){
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListDetailOperator(companyId, startDate,endDate,signature, accountIdsList);
|
|
mList = byteDanceVideoReportDailyMapper.videoInfoListDetailOperator(companyId, startDate,endDate,signature, accountIdsList);
|
|
}else{
|
|
}else{
|
|
accountIdsList= byteDanceVideoReportDailyMapper.getAccountIdsByOperatorIdAndMediaId(1,userId);
|
|
accountIdsList= byteDanceVideoReportDailyMapper.getAccountIdsByOperatorIdAndMediaId(1,userId);
|
|
@@ -454,11 +427,7 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
|
|
|
|
|
|
//计算环比
|
|
//计算环比
|
|
for(ByteDanceVideoReportDaily m:mList){
|
|
for(ByteDanceVideoReportDaily m:mList){
|
|
- //Integer datediff = DateUtils.dateDiff(startDate, endDate);
|
|
|
|
- //String startMonthDate = DateUtils.formatDate(DateUtils.addDay(startDate,-(datediff + 1) ) );
|
|
|
|
String beforeDate = DateUtils.formatDate(DateUtils.addDay(m.getStatDatetime(),-1));
|
|
String beforeDate = DateUtils.formatDate(DateUtils.addDay(m.getStatDatetime(),-1));
|
|
- //List<Long> accountIdsList = new ArrayList<>();
|
|
|
|
- //accountIdsList.add(m.getAccountId());
|
|
|
|
BigDecimal costBefore = byteDanceVideoReportDailyMapper.getVideoReportDailyByDateAndSignature(beforeDate,beforeDate,m.getSignature(),accountIdsList);
|
|
BigDecimal costBefore = byteDanceVideoReportDailyMapper.getVideoReportDailyByDateAndSignature(beforeDate,beforeDate,m.getSignature(),accountIdsList);
|
|
|
|
|
|
BigDecimal huanbi =BigDecimal.ZERO;
|
|
BigDecimal huanbi =BigDecimal.ZERO;
|
|
@@ -472,12 +441,14 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
|
|
return mList;
|
|
return mList;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
public String getColumnJson(Integer columnType){
|
|
public String getColumnJson(Integer columnType){
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
String userId = sysUser.getId();
|
|
String userId = sysUser.getId();
|
|
return byteDanceVideoReportDailyMapper.getJsonByUserIdAndColumnType(columnType, userId);
|
|
return byteDanceVideoReportDailyMapper.getJsonByUserIdAndColumnType(columnType, userId);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
public void saveOrUpdateColumnJson(Integer columnType, String json){
|
|
public void saveOrUpdateColumnJson(Integer columnType, String json){
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
String userId = sysUser.getId();
|
|
String userId = sysUser.getId();
|
|
@@ -490,21 +461,23 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
public int videoInfoListTotalExportExcelPermission(){
|
|
public int videoInfoListTotalExportExcelPermission(){
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
String userId = sysUser.getId();
|
|
String userId = sysUser.getId();
|
|
String roleCode = byteDanceVideoReportDailyMapper.getRoleCodeByUserId(userId);
|
|
String roleCode = byteDanceVideoReportDailyMapper.getRoleCodeByUserId(userId);
|
|
|
|
|
|
- if(roleCode.equals("admin") || roleCode.equals("designTeamLeader") ){
|
|
|
|
|
|
+ if(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN) || roleCode.equals("designTeamLeader") ){
|
|
return 1;
|
|
return 1;
|
|
}else{
|
|
}else{
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
public void accountVideoMap(){
|
|
public void accountVideoMap(){
|
|
- List<AccountVideoDTO> accountVideoDTOList = byteDanceVideoReportDailyMapper.accountVideoMap();
|
|
|
|
- byteDanceVideoReportDailyMapper.replaceIntoAccountVideoMapBatch(accountVideoDTOList);
|
|
|
|
|
|
+ List<AccountVideoDTO> accountVideos = byteDanceVideoReportDailyMapper.accountVideoMap();
|
|
|
|
+ byteDanceVideoReportDailyMapper.replaceIntoAccountVideoMapBatch(accountVideos);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|