Browse Source

咨询统计开发

anderx 2 years ago
parent
commit
5b9125aa54

+ 76 - 0
src/main/java/com/goafanti/admin/bo/ConsultantUserCount.java

@@ -0,0 +1,76 @@
+package com.goafanti.admin.bo;
+
+public class ConsultantUserCount {
+    private String dates;
+    private Integer projectCount;
+    private  Integer inProgress;
+    private  Integer notStarted;
+    private  Integer complete;
+    private  Integer stop;
+    private  Integer countPublicRelease;
+    private  Integer countAssist;
+
+    public String getDates() {
+        return dates;
+    }
+
+    public void setDates(String dates) {
+        this.dates = dates;
+    }
+
+    public Integer getProjectCount() {
+        return projectCount;
+    }
+
+    public void setProjectCount(Integer projectCount) {
+        this.projectCount = projectCount;
+    }
+
+    public Integer getInProgress() {
+        return inProgress;
+    }
+
+    public void setInProgress(Integer inProgress) {
+        this.inProgress = inProgress;
+    }
+
+    public Integer getNotStarted() {
+        return notStarted;
+    }
+
+    public void setNotStarted(Integer notStarted) {
+        this.notStarted = notStarted;
+    }
+
+    public Integer getComplete() {
+        return complete;
+    }
+
+    public void setComplete(Integer complete) {
+        this.complete = complete;
+    }
+
+    public Integer getStop() {
+        return stop;
+    }
+
+    public void setStop(Integer stop) {
+        this.stop = stop;
+    }
+
+    public Integer getCountPublicRelease() {
+        return countPublicRelease;
+    }
+
+    public void setCountPublicRelease(Integer countPublicRelease) {
+        this.countPublicRelease = countPublicRelease;
+    }
+
+    public Integer getCountAssist() {
+        return countAssist;
+    }
+
+    public void setCountAssist(Integer countAssist) {
+        this.countAssist = countAssist;
+    }
+}

+ 1 - 1
src/main/java/com/goafanti/admin/controller/AdminStatisticsController.java

@@ -63,7 +63,7 @@ public class AdminStatisticsController extends CertifyApiController {
     @RequestMapping(value = "/consultant/lists", method = RequestMethod.GET)
     public Result consultantLists() {
         Result res =new Result();
-        res.data(adminStatisticsService.lists(TokenManager.getAdminId()));
+        res.data(adminStatisticsService.consultantLists(TokenManager.getAdminId()));
         return res;
     }
 

+ 2 - 0
src/main/java/com/goafanti/admin/service/AdminStatisticsService.java

@@ -6,4 +6,6 @@ public interface AdminStatisticsService {
     Object lists(String aid);
 
     Object consultantInfo(String startTime, String endTime);
+
+    Object consultantLists(String adminId);
 }

+ 11 - 2
src/main/java/com/goafanti/admin/service/impl/AdminStatisticsServiceImpl.java

@@ -2,6 +2,7 @@ package com.goafanti.admin.service.impl;
 
 import com.goafanti.admin.bo.AdminStatisticsBo;
 import com.goafanti.admin.bo.ConsultantStatisticsBo;
+import com.goafanti.admin.bo.ConsultantUserCount;
 import com.goafanti.admin.service.AdminStatisticsService;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.AdminMapper;
@@ -135,12 +136,20 @@ public class AdminStatisticsServiceImpl implements AdminStatisticsService {
         return res;
     }
 
+    @Override
+    public Object consultantLists(String aid) {
+        //获取当月的列表
+        Map<String,Object> map=new HashMap<>();
+        Days days = new Days();
+        List<String> thisMonth = getThisMonth(days);
+        List<ConsultantUserCount> list = adminMapper.consultantthisMonthUser(days.firstDay,days.endDay, aid);
+        return null;
+    }
 
 
     public  List<String> getThisMonth(Days days) {
-        //获取当月的第一天
+        //获取三十天前的日期
         Date date=new Date();
-
         Calendar ca=Calendar.getInstance();
         ca.setTime(date);
         ca.add(Calendar.DAY_OF_MONTH,-30);

+ 3 - 0
src/main/java/com/goafanti/common/dao/AdminMapper.java

@@ -194,4 +194,7 @@ public interface AdminMapper {
     ConsultantStatisticsBo consultantStatisticsInfo(String aid);
 
     ConsultantStatisticsBo consultantStatisticsInfoByTime(@Param("aid") String aid, @Param("startTime") String startTime, @Param("endTime") String endTime);
+
+    List<ConsultantUserCount> consultantthisMonthUser(@Param("firstDay")String firstDay, @Param("endDay")String endDay,
+                                                      @Param("aid")String aid);
 }

+ 24 - 0
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -1348,4 +1348,28 @@
         from public_release a left join public_release_details b on a.id=b.prid where aid=  #{aid}
         and a.release_start BETWEEN #{startTime} and #{endTime} group by a.aid)z on x.aid=z.aid
   </select>
+  <select id="consultantthisMonthUser" resultType="com.goafanti.admin.bo.ConsultantUserCount">
+    select x.dates,sum(projectCount)projectCount,sum(inProgress)inProgress,sum(notStarted)notStarted
+         ,0 complete,0 stop,0 countPublicRelease,0 countAssist
+    from (select commodity_quantity projectCount, if(a.project_status=1,commodity_quantity,0)inProgress,
+        if(a.project_status=0,commodity_quantity,0)notStarted,DATE_FORMAT(a.task_distribution_time,'%Y-%m-%d') dates
+        from t_order_task a  where a.split_status in (0,2) and a.task_receiver = #{aid}
+        and a.task_distribution_time BETWEEN #{firstDay} and #{endDay})x
+    group by x.dates
+    union
+    select x.dates,0 projectCount,0 inProgress,0 notStarted,sum(complete)complete,sum(stop)stop,0,0
+    from (SELECT if(a.project_status in (19,27) ,commodity_quantity,0) complete,
+        if(a.project_status in (2,3,29),commodity_quantity,0) stop ,DATE_FORMAT(b.date_time ,'%Y-%m-%d') dates
+        from t_order_task a left join task_time b on a.id=b.tid
+        where a.split_status in (0,2) and b.project_status =a.project_status
+        and a.task_receiver = #{aid} and b.date_time  BETWEEN #{firstDay} and #{endDay})x
+    group by x.dates
+    union
+    select x.dates,0,0,0,0,0,sum(countPublicRelease)countPublicRelease,sum(countAssist)countAssist
+    from ( select if(a.`type` in (0,1,2),1,0) countPublicRelease,if(a.`type` in (3),1,0) countAssist,
+        DATE_FORMAT(a.release_start ,'%Y-%m-%d') dates
+    from public_release a left join public_release_details b on a.id=b.prid where aid= #{aid}
+    and a.release_start  BETWEEN #{firstDay} and #{endDay})x
+    group by x.dates
+  </select>
 </mapper>