Przeglądaj źródła

盯盘运营经理-人均消耗保留3位

yangzian 3 lat temu
rodzic
commit
3c28a05e0c

+ 17 - 7
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/MaterialStareServiceImpl.java

@@ -439,17 +439,18 @@ public class MaterialStareServiceImpl implements MaterialStareService {
             }};
 
             //当天
-            if (startDate == entDate && entDate == now){
+            int effect = 0;
+            if (startDate == now || entDate == now){
                 //查询 当天有效 上新计划 上新组
                 JSONObject newEffect = materialStareMapper.getKuaiShouAccountNowBaseByUserId(ids,null,null,startDate,entDate);
-                operate.setNewUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum"));//组
-            }else {
+                effect = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
+            }
                 //查询 有效 上新计划 上新组
                 JSONObject newEffect = materialStareMapper.getKuaiShouAccountBaseByUserId(ids,null,null,startDate,entDate);
                 //operate.setNewEffectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newEffectNum"));//有效
                 operate.setNewCampaignNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newCampaignNum"));//计划
-                operate.setNewUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum"));//组
-            }
+                operate.setNewUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum")+effect);//组
+
 
 
             Set<String> userSet = new HashSet<String>(){{
@@ -493,6 +494,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
     @Override
     public Result getKuaiShouOperateProjectInfo(Integer pageNum, int pageSize, String startTime, String endTime, String userId) {
         DecimalFormat decimalFormat = new DecimalFormat("0.00%");
+        long now = Long.valueOf(DateUtils.getDateInteger(DateUtils.getDate("yyyy-MM-dd")));
         try {
             //查询当前人员所有下级
             Set<String> operatorUserIds = getAffiliateId(userId);
@@ -519,13 +521,21 @@ public class MaterialStareServiceImpl implements MaterialStareService {
             List<KuaiShouOperateProjectVo> listOperate = materialStareMapper.getKuaiShouOperateProjectInfo(startDate,entDate,null,operatorUserIds);
             for (KuaiShouOperateProjectVo projectInfo : listOperate) {
 
+                //当天
+                int newUnitNumNow = 0;
+                if (startDate == now || entDate == now){
+                    //查询 当天有效 上新计划 上新组
+                    JSONObject newEffect = materialStareMapper.getKuaiShouAccountNowBaseByUserId(operatorUserIds,null,null,now,now);
+                    newUnitNumNow = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
+                }
+
                 //查询 有效 上新视频 爆款视频
                 JSONObject newEffect = materialStareMapper.getKuaiShouAccountBaseByUserId(null,projectInfo.getProjectId(),null,startDate,entDate);
                 projectInfo.setNewEffectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newEffectNum"));//有效
                 projectInfo.setNewVideoNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newVideoNum"));//上新
                 projectInfo.setNewHotNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newHotNum"));//爆款
 
-                projectInfo.setNewUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum"));//基建数
+                projectInfo.setNewUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum")+newUnitNumNow);//基建数
                 projectInfo.setTrustUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum"));//智能托管
 
                 //查看 上传到助手、媒体的素材数量 分版位花费
@@ -1103,7 +1113,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                 groupVo.setAverageDayCost(new BigDecimal(aveDay).setScale(3,BigDecimal.ROUND_HALF_UP).doubleValue());
                 //人均消耗
                 Double avePeople = totalCost/operationNum;
-                groupVo.setAveragePeopleCost(avePeople);
+                groupVo.setAveragePeopleCost(new BigDecimal(avePeople).setScale(3,BigDecimal.ROUND_HALF_UP).doubleValue());
 
                 //项目数量
                 Double projectNum = Check.isNull(listOperate) ? 0 : listOperate.stream().mapToDouble(KuaiShouOperateVo::getProjectNum).sum();