|
@@ -16,7 +16,6 @@ import org.springframework.stereotype.Service;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
-import java.util.Arrays;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.UUID;
|
|
import java.util.UUID;
|
|
@@ -69,7 +68,7 @@ public class ManagerSaleValueServiceImpl extends ServiceImpl<ManagerSaleValueMap
|
|
//丁兆明特殊处理
|
|
//丁兆明特殊处理
|
|
if ("b161b7d9793942f980dbfe8c931cd1b0".equals(userId) || "228c45f913924639bf20c79ce5dadb16".equals(userId)) {
|
|
if ("b161b7d9793942f980dbfe8c931cd1b0".equals(userId) || "228c45f913924639bf20c79ce5dadb16".equals(userId)) {
|
|
//账户集合
|
|
//账户集合
|
|
- List<Long> accountIds = baseMapper.getCompanyAccountIds(companyId, mediaId);
|
|
|
|
|
|
+ List<Long> accountIds = baseMapper.querySalesDirectorAccountIds(companyId, mediaId, null);
|
|
if (Check.isNull(accountIds)) {
|
|
if (Check.isNull(accountIds)) {
|
|
return Result.error("未查询到账户!");
|
|
return Result.error("未查询到账户!");
|
|
}
|
|
}
|
|
@@ -80,9 +79,7 @@ public class ManagerSaleValueServiceImpl extends ServiceImpl<ManagerSaleValueMap
|
|
}
|
|
}
|
|
//查询销售总监及旗下的人员 集
|
|
//查询销售总监及旗下的人员 集
|
|
List<String> saleTeaMber = baseMapper.querySaleDirctorItsTeamMember(userId);
|
|
List<String> saleTeaMber = baseMapper.querySaleDirctorItsTeamMember(userId);
|
|
- if (Check.isNull(saleTeaMber)) {
|
|
|
|
- saleTeaMber = Arrays.asList(userId);
|
|
|
|
- }
|
|
|
|
|
|
+ saleTeaMber.add(userId);
|
|
//账户集合
|
|
//账户集合
|
|
List<Long> accountIds = baseMapper.querySalesDirectorAccountIds(companyId, mediaId, saleTeaMber);
|
|
List<Long> accountIds = baseMapper.querySalesDirectorAccountIds(companyId, mediaId, saleTeaMber);
|
|
if (Check.isNull(accountIds)) {
|
|
if (Check.isNull(accountIds)) {
|
|
@@ -95,7 +92,7 @@ public class ManagerSaleValueServiceImpl extends ServiceImpl<ManagerSaleValueMap
|
|
//分公司总经理
|
|
//分公司总经理
|
|
} else if ("CompanyManager".equals(roleCode) || "admin".equals(roleCode)) {
|
|
} else if ("CompanyManager".equals(roleCode) || "admin".equals(roleCode)) {
|
|
//账户集合
|
|
//账户集合
|
|
- List<Long> accountIds = baseMapper.getCompanyAccountIds(companyId, mediaId);
|
|
|
|
|
|
+ List<Long> accountIds = baseMapper.querySalesDirectorAccountIds(companyId, mediaId, null);
|
|
if (Check.isNull(accountIds)) {
|
|
if (Check.isNull(accountIds)) {
|
|
return Result.error("未查询到账户!");
|
|
return Result.error("未查询到账户!");
|
|
}
|
|
}
|
|
@@ -188,7 +185,7 @@ public class ManagerSaleValueServiceImpl extends ServiceImpl<ManagerSaleValueMap
|
|
public Result<Object> getHomeCharges(String userId, String mediaId, String companyId, String startTime, String endTime) throws ParseException {
|
|
public Result<Object> getHomeCharges(String userId, String mediaId, String companyId, String startTime, String endTime) throws ParseException {
|
|
String roleCode = baseMapper.getRoleCodeByUserId(userId);
|
|
String roleCode = baseMapper.getRoleCodeByUserId(userId);
|
|
|
|
|
|
- List<Long> compayAllAccountIds = baseMapper.getCompanyAccountIds(companyId, mediaId);
|
|
|
|
|
|
+ List<Long> compayAllAccountIds = baseMapper.querySalesDirectorAccountIds(companyId, mediaId, null);
|
|
if (Check.isNull(compayAllAccountIds)) {
|
|
if (Check.isNull(compayAllAccountIds)) {
|
|
return Result.error("未查询到账户!");
|
|
return Result.error("未查询到账户!");
|
|
}
|
|
}
|
|
@@ -207,9 +204,7 @@ public class ManagerSaleValueServiceImpl extends ServiceImpl<ManagerSaleValueMap
|
|
}
|
|
}
|
|
//查询销售总监及旗下的人员 集
|
|
//查询销售总监及旗下的人员 集
|
|
List<String> saleTeaMber = baseMapper.querySaleDirctorItsTeamMember(userId);
|
|
List<String> saleTeaMber = baseMapper.querySaleDirctorItsTeamMember(userId);
|
|
- if (Check.isNull(saleTeaMber)) {
|
|
|
|
- saleTeaMber = Arrays.asList(userId);
|
|
|
|
- }
|
|
|
|
|
|
+ saleTeaMber.add(userId);
|
|
//账户集合
|
|
//账户集合
|
|
List<Long> accountIds = baseMapper.querySalesDirectorAccountIds(companyId, mediaId, saleTeaMber);
|
|
List<Long> accountIds = baseMapper.querySalesDirectorAccountIds(companyId, mediaId, saleTeaMber);
|
|
if (Check.isNull(accountIds)) {
|
|
if (Check.isNull(accountIds)) {
|
|
@@ -325,48 +320,49 @@ public class ManagerSaleValueServiceImpl extends ServiceImpl<ManagerSaleValueMap
|
|
if ("saleDirector".equals(roleCode)) {
|
|
if ("saleDirector".equals(roleCode)) {
|
|
//丁兆明特殊处理
|
|
//丁兆明特殊处理
|
|
if ("b161b7d9793942f980dbfe8c931cd1b0".equals(userId) || "228c45f913924639bf20c79ce5dadb16".equals(userId)) {
|
|
if ("b161b7d9793942f980dbfe8c931cd1b0".equals(userId) || "228c45f913924639bf20c79ce5dadb16".equals(userId)) {
|
|
- List<Long> projectIds = baseMapper.querySalesDirectorProjectIds(companyId, mediaId, null);
|
|
|
|
- if(Check.isNull(projectIds)){
|
|
|
|
- throw new Exception("未查询到项目!");
|
|
|
|
|
|
+ //账户集合
|
|
|
|
+ List<Long> accountIds = baseMapper.querySalesDirectorAccountIds(companyId, mediaId, null);
|
|
|
|
+ if (Check.isNull(accountIds)) {
|
|
|
|
+ throw new Exception("未查询到账户!");
|
|
}
|
|
}
|
|
if (startTime.equals(endTime)) {
|
|
if (startTime.equals(endTime)) {
|
|
- return getProjectDailyCharges(projectIds, mediaId, startTime, null, pageNo, pageSize);
|
|
|
|
|
|
+ return getProjectDailyCharges(accountIds, mediaId, startTime, null, pageNo, pageSize);
|
|
} else {
|
|
} else {
|
|
- return getProjectDailyCharges(projectIds, mediaId, startTime, endTime, pageNo, pageSize);
|
|
|
|
|
|
+ return getProjectDailyCharges(accountIds, mediaId, startTime, endTime, pageNo, pageSize);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
//查询销售总监及旗下的人员 集
|
|
//查询销售总监及旗下的人员 集
|
|
List<String> saleTeaMber = baseMapper.querySaleDirctorItsTeamMember(userId);
|
|
List<String> saleTeaMber = baseMapper.querySaleDirctorItsTeamMember(userId);
|
|
- if (Check.isNull(saleTeaMber)) {
|
|
|
|
- saleTeaMber = Arrays.asList(userId);
|
|
|
|
- }
|
|
|
|
|
|
+ saleTeaMber.add(userId);
|
|
//账户集合
|
|
//账户集合
|
|
- List<Long> projectIds = baseMapper.querySalesDirectorProjectIds(companyId, mediaId, saleTeaMber);
|
|
|
|
- if (Check.isNull(projectIds)) {
|
|
|
|
- throw new Exception("未查询到项目!");
|
|
|
|
|
|
+ List<Long> accountIds = baseMapper.querySalesDirectorAccountIds(companyId, mediaId, saleTeaMber);
|
|
|
|
+ if (Check.isNull(accountIds)) {
|
|
|
|
+ throw new Exception("未查询到账户!");
|
|
}
|
|
}
|
|
if (startTime.equals(endTime)) {
|
|
if (startTime.equals(endTime)) {
|
|
- return getProjectDailyCharges(projectIds, mediaId, startTime, null, pageNo, pageSize);
|
|
|
|
|
|
+ return getProjectDailyCharges(accountIds, mediaId, startTime, null, pageNo, pageSize);
|
|
} else {
|
|
} else {
|
|
- return getProjectDailyCharges(projectIds, mediaId, startTime, endTime, pageNo, pageSize);
|
|
|
|
|
|
+ return getProjectDailyCharges(accountIds, mediaId, startTime, endTime, pageNo, pageSize);
|
|
}
|
|
}
|
|
//分公司总经理
|
|
//分公司总经理
|
|
} else if ("CompanyManager".equals(roleCode) || "admin".equals(roleCode)) {
|
|
} else if ("CompanyManager".equals(roleCode) || "admin".equals(roleCode)) {
|
|
- List<Long> projectIds = baseMapper.querySalesDirectorProjectIds(companyId, mediaId, null);
|
|
|
|
- if(Check.isNull(projectIds)){
|
|
|
|
- throw new Exception("未查询到项目!");
|
|
|
|
|
|
+ //账户集合
|
|
|
|
+ List<Long> accountIds = baseMapper.querySalesDirectorAccountIds(companyId, mediaId, null);
|
|
|
|
+ if (Check.isNull(accountIds)) {
|
|
|
|
+ throw new Exception("未查询到账户!");
|
|
}
|
|
}
|
|
if (startTime.equals(endTime)) {
|
|
if (startTime.equals(endTime)) {
|
|
- return getProjectDailyCharges(projectIds, mediaId, startTime, null, pageNo, pageSize);
|
|
|
|
|
|
+ return getProjectDailyCharges(accountIds, mediaId, startTime, null, pageNo, pageSize);
|
|
} else {
|
|
} else {
|
|
- return getProjectDailyCharges(projectIds, mediaId, startTime, endTime, pageNo, pageSize);
|
|
|
|
|
|
+ return getProjectDailyCharges(accountIds, mediaId, startTime, endTime, pageNo, pageSize);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
throw new Exception("该用户角色权限不足!");
|
|
throw new Exception("该用户角色权限不足!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private PageInfo getProjectDailyCharges(List<Long> projectIds, String mediaId, String startTime, String endTime, Integer pageNo, Integer pageSize) throws ParseException {
|
|
|
|
|
|
+ private PageInfo getProjectDailyCharges(List<Long> accountIds, String mediaId, String startTime, String endTime, Integer pageNo, Integer pageSize) throws ParseException {
|
|
Long days = 1L;
|
|
Long days = 1L;
|
|
Integer hour = DateUtils.getHour(DateUtils.formatDateTime());
|
|
Integer hour = DateUtils.getHour(DateUtils.formatDateTime());
|
|
if (endTime == null) {
|
|
if (endTime == null) {
|
|
@@ -377,16 +373,16 @@ public class ManagerSaleValueServiceImpl extends ServiceImpl<ManagerSaleValueMap
|
|
}
|
|
}
|
|
//1 头条
|
|
//1 头条
|
|
if ("1".equals(mediaId)) {
|
|
if ("1".equals(mediaId)) {
|
|
- Long total = baseMapper.queryTtHourProjectTopTotal(projectIds, startTime, endTime);
|
|
|
|
|
|
+ Long total = baseMapper.queryTtHourProjectTopTotal(accountIds, startTime, endTime);
|
|
PageHelper.startPage(pageNo, pageSize, false);
|
|
PageHelper.startPage(pageNo, pageSize, false);
|
|
- List<JSONObject> list = baseMapper.queryTtHourProjectTop(projectIds, startTime, endTime, days, hour);
|
|
|
|
|
|
+ List<JSONObject> list = baseMapper.queryTtHourProjectTop(accountIds, startTime, endTime, days, hour);
|
|
PageInfo pageInfo = new PageInfo(list);
|
|
PageInfo pageInfo = new PageInfo(list);
|
|
pageInfo.setTotal(total);
|
|
pageInfo.setTotal(total);
|
|
return pageInfo;
|
|
return pageInfo;
|
|
} else if ("2".equals(mediaId)) {
|
|
} else if ("2".equals(mediaId)) {
|
|
- Long total = baseMapper.queryKsHourProjectTopTotal(projectIds, startTime, endTime);
|
|
|
|
|
|
+ Long total = baseMapper.queryKsHourProjectTopTotal(accountIds, startTime, endTime);
|
|
PageHelper.startPage(pageNo, pageSize, false);
|
|
PageHelper.startPage(pageNo, pageSize, false);
|
|
- List<JSONObject> list = baseMapper.queryKsHourProjectTop(projectIds, startTime, endTime, days, hour);
|
|
|
|
|
|
+ List<JSONObject> list = baseMapper.queryKsHourProjectTop(accountIds, startTime, endTime, days, hour);
|
|
PageInfo pageInfo = new PageInfo(list);
|
|
PageInfo pageInfo = new PageInfo(list);
|
|
pageInfo.setTotal(total);
|
|
pageInfo.setTotal(total);
|
|
return pageInfo;
|
|
return pageInfo;
|