Explorar el Código

运营绩效 离职人员 查询当季度和下个季度

zxa hace 2 años
padre
commit
5999b31ddb

+ 33 - 7
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouOperationReportServiceImpl.java

@@ -16,7 +16,6 @@ import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.system.entity.SysOperateRel;
 import org.jeecg.modules.system.mapper.SysOperateRelMapper;
 import org.jeecg.modules.system.service.ISysRoleService;
-import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -53,6 +52,12 @@ public class KuaishouOperationReportServiceImpl extends ServiceImpl<KuaishouOper
     public Result<Object> queryToutiaoMonthlyData(Integer time, String role, String userId, Integer pageNo, Integer pageSize) {
         List<Integer> monthInt = getMonthInt(time);
         Map<String, String> quarterMap = DateUtils.getCurrQuarter(time);
+        String nextMonthEndDate = null;
+        if (time != 4) {
+            nextMonthEndDate = DateUtils.getCurrQuarter(time + 1).get("endDate");
+        } else {
+            nextMonthEndDate = quarterMap.get("endDate");
+        }
         String startDate = quarterMap.get("startDate");
         String endDate = quarterMap.get("endDate");
         List<String> roleCode = new ArrayList<>();
@@ -75,7 +80,7 @@ public class KuaishouOperationReportServiceImpl extends ServiceImpl<KuaishouOper
         //查询在职人员 1-在职
         List<JSONObject> onJobUserIds = sysUserService.getQuarterlyOnJobOperators(roleCode, userId, 1, changeRoleUserIds, "1");
         //查询离职人员 2-离职
-        List<JSONObject> offJobUserIds = sysUserService.getQuarterlyOffJobOperators(roleCode, userId, 2, startDate, endDate, "1");
+        List<JSONObject> offJobUserIds = sysUserService.getQuarterlyOffJobOperators(roleCode, userId, 2, startDate, nextMonthEndDate, "1");
         JSONObject dates = new JSONObject();
         int count = 1;
         for (Integer month : monthInt) {
@@ -99,6 +104,12 @@ public class KuaishouOperationReportServiceImpl extends ServiceImpl<KuaishouOper
     @Override
     public Result<Object> queryToutiaoQuarterlyCharge(Integer time, String role, String userId, Integer pageNo, Integer pageSize) throws Exception {
         Map<String, String> quarterMap = DateUtils.getCurrQuarter(time);
+        String nextMonthEndDate = null;
+        if (time != 4) {
+            nextMonthEndDate = DateUtils.getCurrQuarter(time + 1).get("endDate");
+        } else {
+            nextMonthEndDate = quarterMap.get("endDate");
+        }
         String startDate = quarterMap.get("startDate");
         String endDate = quarterMap.get("endDate");
         List<String> roleCode = new ArrayList<>();
@@ -122,7 +133,7 @@ public class KuaishouOperationReportServiceImpl extends ServiceImpl<KuaishouOper
         //查询在职人员 1-在职
         List<JSONObject> onJobUserIds = sysUserService.getQuarterlyOnJobOperators(roleCode, userId, 1, changeRoleUserIds, "1");
         //查询离职人员 2-离职
-        List<JSONObject> offJobUserIds = sysUserService.getQuarterlyOffJobOperators(roleCode, userId, 2, startDate, endDate, "1");
+        List<JSONObject> offJobUserIds = sysUserService.getQuarterlyOffJobOperators(roleCode, userId, 2, startDate, nextMonthEndDate, "1");
         JSONObject dates = new JSONObject();
 
         List<JSONObject> dataList = new ArrayList<>();
@@ -440,7 +451,8 @@ public class KuaishouOperationReportServiceImpl extends ServiceImpl<KuaishouOper
             if (!Check.isNull(quitTime)) {
                 Integer startMonth = Integer.valueOf(DateUtils.getMonth("yyyy-MM-dd", dateMap.get("startDate")));
                 Integer endMonth = Integer.valueOf(DateUtils.getMonth("yyyy-MM-dd", quitTime));
-                user.put("monthCount", endMonth - startMonth + 1);
+                Integer num = endMonth - startMonth + 1;
+                user.put("monthCount", num > 3 ? 3 : num);
             }
         }
         List<Integer> monthInt = getMonthInt(time);
@@ -640,6 +652,12 @@ public class KuaishouOperationReportServiceImpl extends ServiceImpl<KuaishouOper
     public Result<Object> queryKuaishouMonthlyData(Integer time, String role, String userId, Integer pageNo, Integer pageSize) {
         List<Integer> monthInt = getMonthInt(time);
         Map<String, String> quarterMap = DateUtils.getCurrQuarter(time);
+        String nextMonthEndDate = null;
+        if (time != 4) {
+            nextMonthEndDate = DateUtils.getCurrQuarter(time + 1).get("endDate");
+        } else {
+            nextMonthEndDate = quarterMap.get("endDate");
+        }
         String startDate = quarterMap.get("startDate");
         String endDate = quarterMap.get("endDate");
         List<String> roleCode = new ArrayList<>();
@@ -663,7 +681,7 @@ public class KuaishouOperationReportServiceImpl extends ServiceImpl<KuaishouOper
         //查询在职人员 1-在职
         List<JSONObject> onJobUserIds = sysUserService.getQuarterlyOnJobOperators(roleCode, userId, 1, changeRoleUserIds, "2");
         //查询离职人员 2-离职
-        List<JSONObject> offJobUserIds = sysUserService.getQuarterlyOffJobOperators(roleCode, userId, 2, startDate, endDate, "2");
+        List<JSONObject> offJobUserIds = sysUserService.getQuarterlyOffJobOperators(roleCode, userId, 2, startDate, nextMonthEndDate, "2");
         JSONObject dates = new JSONObject();
         int count = 1;
         for (Integer month : monthInt) {
@@ -690,6 +708,13 @@ public class KuaishouOperationReportServiceImpl extends ServiceImpl<KuaishouOper
     @Override
     public Result<Object> queryKuaishouQuarterlyCharge(Integer time, String role, String userId, Integer pageNo, Integer pageSize) throws Exception {
         Map<String, String> quarterMap = DateUtils.getCurrQuarter(time);
+        String nextMonthEndDate = null;
+        if (time != 4) {
+            nextMonthEndDate = DateUtils.getCurrQuarter(time + 1).get("endDate");
+        } else {
+            nextMonthEndDate = quarterMap.get("endDate");
+        }
+        Map<String, String> nextQuarterMap = DateUtils.getCurrQuarter(time);
         String startDate = quarterMap.get("startDate");
         String endDate = quarterMap.get("endDate");
         List<String> roleCode = new ArrayList<>();
@@ -713,7 +738,7 @@ public class KuaishouOperationReportServiceImpl extends ServiceImpl<KuaishouOper
         //查询在职人员 1-在职
         List<JSONObject> onJobUserIds = sysUserService.getQuarterlyOnJobOperators(roleCode, userId, 1, changeRoleUserIds, "2");
         //查询离职人员 2-离职
-        List<JSONObject> offJobUserIds = sysUserService.getQuarterlyOffJobOperators(roleCode, userId, 2, startDate, endDate, "2");
+        List<JSONObject> offJobUserIds = sysUserService.getQuarterlyOffJobOperators(roleCode, userId, 2, startDate, nextMonthEndDate, "2");
         JSONObject dates = new JSONObject();
 
         List<JSONObject> dataList = new ArrayList<>();
@@ -1032,7 +1057,8 @@ public class KuaishouOperationReportServiceImpl extends ServiceImpl<KuaishouOper
             if (!Check.isNull(quitTime)) {
                 Integer startMonth = Integer.valueOf(DateUtils.getMonth("yyyy-MM-dd", dateMap.get("startDate")));
                 Integer endMonth = Integer.valueOf(DateUtils.getMonth("yyyy-MM-dd", quitTime));
-                user.put("monthCount", endMonth - startMonth + 1);
+                Integer num = endMonth - startMonth + 1;
+                user.put("monthCount", num > 3 ? 3 : num);
             }
         }
         List<Integer> monthInt = getMonthInt(time);