Browse Source

统计修改

anderx 3 years ago
parent
commit
c9d5fbd2e7

+ 10 - 3
src/main/java/com/goafanti/admin/service/impl/AdminServiceImpl.java

@@ -9,11 +9,9 @@ import com.goafanti.admin.service.NewAdminService;
 import com.goafanti.common.dao.*;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.Department;
-import com.goafanti.common.model.Role;
 import com.goafanti.common.utils.RedisUtil;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
 import com.goafanti.admin.bo.AdminContacts;
@@ -393,7 +391,11 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 			depIds.add(department);
 			deps=departmentMapper.selectBysuperId(oo.getId());
 		}
-		List<AdminCustomerBo> list =departmentMapper.AlldepCount(depIds,startTime,  endTime);
+		List<AdminCustomerBo> list =null;
+		//原sql计算
+		list=departmentMapper.AlldepCount(depIds,startTime,  endTime);
+		//新java计算
+		list=AllDepCount(depIds,startTime,endTime);
 		for (AdminCustomerBo ad : list) {
 			if (acb.getId().equals(ad.getDepId())){
 				acb.getaList().add(ad);
@@ -413,6 +415,11 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 		return acb;
 	}
 
+	private List<AdminCustomerBo> AllDepCount(List<Department> depIds, String startTime, String endTime) {
+
+		return null;
+	}
+
 	//迭代获取所有部门与部门员工并计算出部门数量
 	public List<DepCountBo> iterationDeps(String id,List<AdminCustomerBo> list) {
 		List<DepCountBo>  deps =departmentMapper.selectBysuperId(id);

+ 5 - 4
src/main/java/com/goafanti/common/mapper/DepartmentMapper.xml

@@ -526,11 +526,12 @@
       and  transfer_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
     </if>
     group by aid)b on a.id=b.aid
-    left join (select a.aid,sum(if(b.channel=0,1,0))completeCount,
-    sum(if(b.channel=1,1,0))channelCompleteCount from public_release a left join `user` b on a.uid =b.id
-    where a.clock_in =1
+    left join (select a.aid,sum(if(c.channel=0,1,0))completeCount,
+    sum(if(c.channel=1,1,0))channelCompleteCount
+    from public_release a left join public_release_details b on a.id=b.prid left join `user` c on b.uid=c.id
+    where b.clock_in =1
     <if test="startTime != null and endTime != null">
-      and clock_in_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
+      and b.clock_in_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
     </if>
     group by a.aid ) y on a.id=y.aid
     left join department c on a.department_id =c.id