|
@@ -66,7 +66,7 @@ public class ManagerSaleValueServiceImpl extends ServiceImpl<ManagerSaleValueMap
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Result<Object> getDayAndMonthlyCharges(String userId, String mediaId, String companyId, String operate) throws ParseException {
|
|
|
+ public Result<Object> getDayAndMonthlyCharges(String userId, String mediaId, String companyId, String startTime, String endTime, String operate) throws ParseException {
|
|
|
Result<Object> result = new Result<>();
|
|
|
String roleCode = baseMapper.getRoleCodeByUserId(userId);
|
|
|
Boolean bjCompany = false;
|
|
@@ -84,7 +84,7 @@ public class ManagerSaleValueServiceImpl extends ServiceImpl<ManagerSaleValueMap
|
|
|
if (Check.isNull(accountIds)) {
|
|
|
return Result.error("未查询到账户!");
|
|
|
}
|
|
|
- JSONObject data = getManagerData(accountIds, userId, mediaId, companyId, bjCompany, null);
|
|
|
+ JSONObject data = getManagerData(accountIds, userId, mediaId, companyId, bjCompany, null, startTime, endTime);
|
|
|
return Result.ok(data);
|
|
|
}
|
|
|
//查询销售总监及旗下的人员 集
|
|
@@ -95,7 +95,7 @@ public class ManagerSaleValueServiceImpl extends ServiceImpl<ManagerSaleValueMap
|
|
|
if (Check.isNull(accountIds)) {
|
|
|
return Result.error("未查询到账户!");
|
|
|
}
|
|
|
- JSONObject data = getManagerData(accountIds, userId, mediaId, companyId, bjCompany, saleTeaMber);
|
|
|
+ JSONObject data = getManagerData(accountIds, userId, mediaId, companyId, bjCompany, saleTeaMber, startTime, endTime);
|
|
|
result = Result.ok(data);
|
|
|
//分公司总经理
|
|
|
} else if ("CompanyManager".equals(roleCode) || "admin".equals(roleCode)) {
|
|
@@ -104,7 +104,7 @@ public class ManagerSaleValueServiceImpl extends ServiceImpl<ManagerSaleValueMap
|
|
|
if (Check.isNull(accountIds)) {
|
|
|
return Result.error("未查询到账户!");
|
|
|
}
|
|
|
- JSONObject data = getManagerData(accountIds, userId, mediaId, companyId, bjCompany, null);
|
|
|
+ JSONObject data = getManagerData(accountIds, userId, mediaId, companyId, bjCompany, null, startTime, endTime);
|
|
|
result = Result.ok(data);
|
|
|
} else {
|
|
|
result = Result.error("该用户角色权限不足!");
|
|
@@ -113,7 +113,7 @@ public class ManagerSaleValueServiceImpl extends ServiceImpl<ManagerSaleValueMap
|
|
|
}
|
|
|
|
|
|
|
|
|
- private JSONObject getManagerData(List<Long> accountIds, String userId, String mediaId, String companyId, boolean bjCompany, List<String> saleTeaMber) throws ParseException {
|
|
|
+ private JSONObject getManagerData(List<Long> accountIds, String userId, String mediaId, String companyId, boolean bjCompany, List<String> saleTeaMber, String startTime, String endTime) throws ParseException {
|
|
|
//当天日期
|
|
|
String statDay = DateUtils.date2Str();
|
|
|
//当前小时数
|
|
@@ -148,15 +148,19 @@ public class ManagerSaleValueServiceImpl extends ServiceImpl<ManagerSaleValueMap
|
|
|
result.put("realCharged", realCharged.getBigDecimal("realCharged"));
|
|
|
result.put("realChargedRoi", realCharged.getString("realChargedRoi"));
|
|
|
if (bjCompany) {
|
|
|
+ long days = DateUtils.getDiscrepantDays(startTime, endTime) + 1;
|
|
|
+ if (!startTime.equals(endTime)) {
|
|
|
+ hour = 23;
|
|
|
+ }
|
|
|
//运营一部:李超及其下级 李超 id:f6a6843879c949618e4a859140c8a127
|
|
|
oneAccountIds = baseMapper.querySalesDirectorAccountIds(companyId, mediaId, saleTeaMber, lichaoId);
|
|
|
- JSONObject oneResult = baseMapper.queryTtTodayCharge(statDay, hour, oneAccountIds, companyId);
|
|
|
+ JSONObject oneResult = baseMapper.queryTtTodayCharge2(startTime, endTime, hour, oneAccountIds, companyId, days);
|
|
|
result.put("oneCharge", oneResult.getBigDecimal("totalCharge"));
|
|
|
result.put("oneChargeRoi", oneResult.getString("chargeRoi"));
|
|
|
|
|
|
//运营二部:兰兰及其下级 兰兰id:461857c245f54ba5813bcb5900a23092
|
|
|
twoAccountIds = baseMapper.querySalesDirectorAccountIds(companyId, mediaId, saleTeaMber, lanlanId);
|
|
|
- JSONObject twoResult = baseMapper.queryTtTodayCharge(statDay, hour, twoAccountIds, companyId);
|
|
|
+ JSONObject twoResult = baseMapper.queryTtTodayCharge2(startTime, endTime, hour, twoAccountIds, companyId, days);
|
|
|
result.put("twoCharge", twoResult.getBigDecimal("totalCharge"));
|
|
|
result.put("twoChargeRoi", twoResult.getString("chargeRoi"));
|
|
|
}
|
|
@@ -173,15 +177,19 @@ public class ManagerSaleValueServiceImpl extends ServiceImpl<ManagerSaleValueMap
|
|
|
result.put("realCharged", realCharged.getBigDecimal("realCharged"));
|
|
|
result.put("realChargedRoi", realCharged.getString("realChargedRoi"));
|
|
|
if (bjCompany) {
|
|
|
+ long days = DateUtils.getDiscrepantDays(startTime, endTime) + 1;
|
|
|
+ if (!startTime.equals(endTime)) {
|
|
|
+ hour = 23;
|
|
|
+ }
|
|
|
//运营一部:李超及其下级 李超 id:f6a6843879c949618e4a859140c8a127
|
|
|
oneAccountIds = baseMapper.querySalesDirectorAccountIds(companyId, mediaId, saleTeaMber, lichaoId);
|
|
|
- JSONObject oneResult = baseMapper.queryKsTodayCharge(statDay, hour, oneAccountIds, companyId);
|
|
|
+ JSONObject oneResult = baseMapper.queryKsTodayCharge2(startTime, endTime, hour, oneAccountIds, companyId, days);
|
|
|
result.put("oneCharge", oneResult.getBigDecimal("totalCharge"));
|
|
|
result.put("oneChargeRoi", oneResult.getString("chargeRoi"));
|
|
|
|
|
|
//运营二部:兰兰及其下级 兰兰id:461857c245f54ba5813bcb5900a23092
|
|
|
twoAccountIds = baseMapper.querySalesDirectorAccountIds(companyId, mediaId, saleTeaMber, lanlanId);
|
|
|
- JSONObject twoResult = baseMapper.queryKsTodayCharge(statDay, hour, twoAccountIds, companyId);
|
|
|
+ JSONObject twoResult = baseMapper.queryKsTodayCharge2(startTime, endTime, hour, twoAccountIds, companyId, days);
|
|
|
result.put("twoCharge", twoResult.getBigDecimal("totalCharge"));
|
|
|
result.put("twoChargeRoi", twoResult.getString("chargeRoi"));
|
|
|
}
|