|
@@ -1,5 +1,6 @@
|
|
|
package org.jeecg.modules.bytedance.advertise.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -9,7 +10,9 @@ import org.jeecg.modules.bytedance.advertise.entity.ByteDanceGeneralCopywriter;
|
|
|
import org.jeecg.modules.bytedance.advertise.mapper.ByteDanceGeneralCopywriterMapper;
|
|
|
import org.jeecg.modules.bytedance.advertise.mapper.BytedanceVideoSlogenInfoMapper;
|
|
|
import org.jeecg.modules.bytedance.advertise.service.IByteDanceGeneralCopywriterService;
|
|
|
+import org.jeecg.modules.bytedance.common.service.IUserAllocationService;
|
|
|
import org.jeecg.modules.bytedance.common.utils.Check;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -17,6 +20,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.DecimalFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -30,12 +34,33 @@ import java.util.Map;
|
|
|
public class ByteDanceGeneralCopywriterServiceImpl extends ServiceImpl<ByteDanceGeneralCopywriterMapper, ByteDanceGeneralCopywriter> implements IByteDanceGeneralCopywriterService {
|
|
|
@Resource
|
|
|
ByteDanceGeneralCopywriterMapper byteDanceGeneralCopywriterMapper;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ IUserAllocationService IUserAllocationService;
|
|
|
|
|
|
@Override
|
|
|
public Result getGeneralCopywriterReport(String userId, String accountId, String keyWord, String startTime, String endTime, Integer pageNum, Integer pageSize){
|
|
|
PageHelper.startPage(pageNum,pageSize);
|
|
|
- List<Map<String, Object>> generalCopywriteReportList = byteDanceGeneralCopywriterMapper.selectGeneralCopywriterReport(userId, accountId,keyWord, startTime, endTime);
|
|
|
+
|
|
|
+ List<String> accountIds = new ArrayList<>();
|
|
|
+ //查询普通用户的全量查询,当前用户所有项目
|
|
|
+ if(Check.isNull(accountId)){
|
|
|
+ List<JSONObject> jsonObjectList = IUserAllocationService.getAccountIdsByUserId(userId);
|
|
|
+ if(!Check.isNull(jsonObjectList)){
|
|
|
+ for (JSONObject jsonObject:jsonObjectList) {
|
|
|
+ accountIds.add((String) jsonObject.get("account_id"));
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ return Result.successMsg("当前登录人未绑定账户","");
|
|
|
+ }
|
|
|
+
|
|
|
+ }else if(accountId == "admin"){//管理员的全量查询
|
|
|
+ accountIds = null;
|
|
|
+ }else { //不论什么权限的用户的单独搜索一个项目
|
|
|
+ accountIds.add(accountId);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<Map<String, Object>> generalCopywriteReportList = byteDanceGeneralCopywriterMapper.selectGeneralCopywriterReport(accountIds,keyWord, startTime, endTime);
|
|
|
if(Check.isNull(generalCopywriteReportList)){
|
|
|
return Result.successMsg("还没有此文案报表数据,请将此文案投放跑量!",generalCopywriteReportList);
|
|
|
}
|