|
@@ -1313,7 +1313,14 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
//下级员工
|
|
//下级员工
|
|
Set<String> operatorUserIds = getAffiliateId(groupVo.getUserId());
|
|
Set<String> operatorUserIds = getAffiliateId(groupVo.getUserId());
|
|
//有消耗的账户
|
|
//有消耗的账户
|
|
- operatorUserIds = materialStareMapper.getKuaiShouAllOperators(null,DateUtils.getDateInteger(startTime).longValue(),DateUtils.getDateInteger(endTime).longValue(),operatorUserIds);
|
|
|
|
|
|
+
|
|
|
|
+ if (mediaType.equals("1")){
|
|
|
|
+ operatorUserIds = materialStareMapper.getBytedanceAllOperators(null,DateUtils.getDateInteger(startTime).longValue(),DateUtils.getDateInteger(endTime).longValue(),operatorUserIds);
|
|
|
|
+
|
|
|
|
+ }else {
|
|
|
|
+ operatorUserIds = materialStareMapper.getKuaiShouAllOperators(null,DateUtils.getDateInteger(startTime).longValue(),DateUtils.getDateInteger(endTime).longValue(),operatorUserIds);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
if (Check.isNull(operatorUserIds) || operatorUserIds.size() < 1){
|
|
if (Check.isNull(operatorUserIds) || operatorUserIds.size() < 1){
|
|
continue;
|
|
continue;
|
|
@@ -1326,15 +1333,26 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
//查询账户数据
|
|
//查询账户数据
|
|
List<KuaiShouOperateVo> listOperate= new ArrayList<>();
|
|
List<KuaiShouOperateVo> listOperate= new ArrayList<>();
|
|
|
|
|
|
- if (daysBetween <= 1){
|
|
|
|
|
|
+ if (mediaType.equals("1")){
|
|
|
|
+ if (daysBetween <= 1){
|
|
|
|
+ //时报
|
|
|
|
+ listOperate= materialStareMapper.getBytedanceOperateInfoHourly(startDate,entDate,operatorUserIds);
|
|
|
|
+ }else {
|
|
|
|
|
|
- //时报
|
|
|
|
- listOperate= materialStareMapper.getKuaiShouOperateInfoHourly(startDate,entDate,operatorUserIds);
|
|
|
|
|
|
+ listOperate = materialStareMapper.getBytedanceOperateInfo(startDate,entDate,operatorUserIds);
|
|
|
|
+ }
|
|
}else {
|
|
}else {
|
|
|
|
+ if (daysBetween <= 1){
|
|
|
|
+ //时报
|
|
|
|
+ listOperate= materialStareMapper.getKuaiShouOperateInfoHourly(startDate,entDate,operatorUserIds);
|
|
|
|
+ }else {
|
|
|
|
|
|
- listOperate = materialStareMapper.getKuaiShouOperateInfo(startDate,entDate,operatorUserIds);
|
|
|
|
|
|
+ listOperate = materialStareMapper.getKuaiShouOperateInfo(startDate,entDate,operatorUserIds);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
//总花费
|
|
//总花费
|
|
Double totalCost = Check.isNull(listOperate) ? 0 : listOperate.stream().mapToDouble(KuaiShouOperateVo::getTotalCost).sum();
|
|
Double totalCost = Check.isNull(listOperate) ? 0 : listOperate.stream().mapToDouble(KuaiShouOperateVo::getTotalCost).sum();
|
|
groupVo.setTotalCost(new BigDecimal(totalCost).setScale(3,BigDecimal.ROUND_HALF_UP).doubleValue());
|
|
groupVo.setTotalCost(new BigDecimal(totalCost).setScale(3,BigDecimal.ROUND_HALF_UP).doubleValue());
|
|
@@ -1355,8 +1373,14 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
//平均账户消耗 总花费/账户数量
|
|
//平均账户消耗 总花费/账户数量
|
|
Double aveAccount = accountNum.intValue() == 0 ? 0 : totalCost/accountNum;
|
|
Double aveAccount = accountNum.intValue() == 0 ? 0 : totalCost/accountNum;
|
|
groupVo.setAverageAccountCost(new BigDecimal(aveAccount).setScale(3,BigDecimal.ROUND_HALF_UP).doubleValue());
|
|
groupVo.setAverageAccountCost(new BigDecimal(aveAccount).setScale(3,BigDecimal.ROUND_HALF_UP).doubleValue());
|
|
|
|
+
|
|
//环比 = (当前 - 上阶段 ) / 上阶段
|
|
//环比 = (当前 - 上阶段 ) / 上阶段
|
|
- List<KuaiShouOperateVo> yearOnYearInfo = materialStareMapper.getKuaiShouOperateInfo(lastTimeStart,lastTimeEnd,operatorUserIds);
|
|
|
|
|
|
+ List<KuaiShouOperateVo> yearOnYearInfo = new ArrayList<>();
|
|
|
|
+ if (mediaType.equals("1")){
|
|
|
|
+ yearOnYearInfo = materialStareMapper.getBytedanceOperateInfo(lastTimeStart,lastTimeEnd,operatorUserIds);
|
|
|
|
+ }else {
|
|
|
|
+ yearOnYearInfo = materialStareMapper.getKuaiShouOperateInfo(lastTimeStart,lastTimeEnd,operatorUserIds);
|
|
|
|
+ }
|
|
String yearOnYear = "0";
|
|
String yearOnYear = "0";
|
|
if (!Check.isNull(yearOnYearInfo)){
|
|
if (!Check.isNull(yearOnYearInfo)){
|
|
Double lastTotalCost = Check.isNull(yearOnYearInfo) ? 0 : yearOnYearInfo.stream().mapToDouble(KuaiShouOperateVo::getTotalCost).sum();
|
|
Double lastTotalCost = Check.isNull(yearOnYearInfo) ? 0 : yearOnYearInfo.stream().mapToDouble(KuaiShouOperateVo::getTotalCost).sum();
|
|
@@ -1369,15 +1393,26 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
//当天
|
|
//当天
|
|
int newUnitNumNow = 0;
|
|
int newUnitNumNow = 0;
|
|
if (startDate == nowDate || entDate == nowDate){
|
|
if (startDate == nowDate || entDate == nowDate){
|
|
- //查询 当天有效 上新计划 上新组
|
|
|
|
- JSONObject newEffect = materialStareMapper.getKuaiShouAccountNowBaseByUserId(operatorUserIds,null,null,nowDate,nowDate);
|
|
|
|
|
|
+ JSONObject newEffect = new JSONObject();
|
|
|
|
+ if (mediaType.equals("1")){
|
|
|
|
+ //查询 当天有效 上新计划 上新组
|
|
|
|
+ newEffect = materialStareMapper.getBytedanceAccountBaseByUserId(operatorUserIds,null,null,nowDate,nowDate);
|
|
|
|
+ }else {
|
|
|
|
+ //查询 当天有效 上新计划 上新组
|
|
|
|
+ newEffect = materialStareMapper.getKuaiShouAccountNowBaseByUserId(operatorUserIds,null,null,nowDate,nowDate);
|
|
|
|
+ }
|
|
newUnitNumNow = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
|
|
newUnitNumNow = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
|
|
}
|
|
}
|
|
|
|
|
|
- //查询 历史上新组
|
|
|
|
- JSONObject newEffect = materialStareMapper.getKuaiShouAccountBaseByUserId(operatorUserIds,null,null,startDate,entDate);
|
|
|
|
|
|
+ if (mediaType.equals("1")){
|
|
|
|
+ }else {
|
|
|
|
+ //查询 历史上新组
|
|
|
|
+ JSONObject newEffect = materialStareMapper.getKuaiShouAccountBaseByUserId(operatorUserIds,null,null,startDate,entDate);
|
|
|
|
+ newUnitNumNow = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum")+newUnitNumNow;
|
|
|
|
+ }
|
|
|
|
+
|
|
//基建数量
|
|
//基建数量
|
|
- groupVo.setUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum")+newUnitNumNow);//组
|
|
|
|
|
|
+ groupVo.setUnitNum(newUnitNumNow);//组
|
|
}
|
|
}
|
|
PageInfo<KuaiShouOperateGroupVo> pageInfo = new PageInfo<>(operationList);
|
|
PageInfo<KuaiShouOperateGroupVo> pageInfo = new PageInfo<>(operationList);
|
|
pageInfo.setTotal(operationManagerList.size());
|
|
pageInfo.setTotal(operationManagerList.size());
|