|
|
@@ -7,6 +7,7 @@ import javax.annotation.Resource;
|
|
|
import com.goafanti.admin.service.DepartmentService;
|
|
|
import com.goafanti.common.dao.*;
|
|
|
import com.goafanti.common.model.Department;
|
|
|
+import com.goafanti.common.utils.RedisUtil;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.cache.annotation.Cacheable;
|
|
|
@@ -17,7 +18,7 @@ import com.goafanti.admin.bo.AdminCustomerBo;
|
|
|
import com.goafanti.admin.bo.AdminCustomerDetailBo;
|
|
|
import com.goafanti.admin.bo.AdminDetail;
|
|
|
import com.goafanti.admin.bo.AdminListBo;
|
|
|
-import com.goafanti.admin.bo.depCountBo;
|
|
|
+import com.goafanti.admin.bo.DepCountBo;
|
|
|
import com.goafanti.admin.service.AdminService;
|
|
|
import com.goafanti.common.constant.AFTConstants;
|
|
|
import com.goafanti.common.model.Admin;
|
|
|
@@ -50,6 +51,8 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
|
|
|
@Resource(name = "passwordUtil")
|
|
|
private PasswordUtil passwordUtil;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RedisUtil redisUtil;
|
|
|
@Override
|
|
|
public List<Admin> selectAllAdmin() {
|
|
|
return adminMapper.selectAllAdmin(null);
|
|
|
@@ -360,13 +363,23 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
|
|
|
if (StringUtils.isNotBlank(endTime)) params.put("endTime", endTime+" 23:59:59");
|
|
|
return (Pagination<AdminCustomerBo>)findPage("selectAdminCustomerList", "selectAdminCustomerCount", params, pageNo, pageSize);
|
|
|
}
|
|
|
-
|
|
|
@Override
|
|
|
@Cacheable(cacheNames = "selectAllUser#500",key = "'selectAllUser:depId:'+#depId+'startTime:'+#startTime+" +"'endTime:'+#endTime+'aName:'+#aName")
|
|
|
- public depCountBo selectAllUser(String depId, String startTime, String endTime,String aName) {
|
|
|
- depCountBo acb=new depCountBo();
|
|
|
+ public DepCountBo selectAllUser(String depId, String startTime, String endTime,String aName) {
|
|
|
+ String str="selectAllUser"+depId+startTime+endTime+aName;
|
|
|
+ DepCountBo depCountBo=redisUtil.getJsonArray(str,DepCountBo.class);
|
|
|
+ if (depCountBo==null){
|
|
|
+ depCountBo=getselectAllUser(depId,startTime,endTime,aName);
|
|
|
+ redisUtil.saveJsonArray(depCountBo,str);
|
|
|
+ }
|
|
|
+ return depCountBo;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public DepCountBo getselectAllUser(String depId, String startTime, String endTime,String aName) {
|
|
|
+ DepCountBo acb=new DepCountBo();
|
|
|
if (endTime!=null)endTime=endTime+" 23:59:59";
|
|
|
- List<depCountBo >deps=new ArrayList<>();
|
|
|
+ List<DepCountBo >deps=new ArrayList<>();
|
|
|
List<Department> depIds=new ArrayList<>();
|
|
|
if (depId==null) {
|
|
|
acb.setName("科德集团");
|
|
|
@@ -387,7 +400,7 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
|
|
|
acb.getaList().add(ad);
|
|
|
}
|
|
|
}
|
|
|
- for (depCountBo dep : deps) {
|
|
|
+ for (DepCountBo dep : deps) {
|
|
|
dep.setList(iterationDeps(dep.getId(),list));
|
|
|
for (AdminCustomerBo ad : list) {
|
|
|
if (dep.getId().equals(ad.getDepId())){
|
|
|
@@ -402,9 +415,9 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
|
|
|
}
|
|
|
|
|
|
//迭代获取所有部门与部门员工并计算出部门数量
|
|
|
- private List<depCountBo> iterationDeps(String id,List<AdminCustomerBo> list) {
|
|
|
- List<depCountBo> deps =departmentMapper.selectBysuperId(id);
|
|
|
- for (depCountBo dep : deps) {
|
|
|
+ public List<DepCountBo> iterationDeps(String id,List<AdminCustomerBo> list) {
|
|
|
+ List<DepCountBo> deps =departmentMapper.selectBysuperId(id);
|
|
|
+ for (DepCountBo dep : deps) {
|
|
|
dep.setList(iterationDeps(dep.getId(),list));
|
|
|
for (AdminCustomerBo ad : list) {
|
|
|
if (dep.getId().equals(ad.getDepId())){
|
|
|
@@ -420,10 +433,10 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
|
|
|
*
|
|
|
* @param ab
|
|
|
*/
|
|
|
- private void sumCount(depCountBo ab) {
|
|
|
+ public void sumCount(DepCountBo ab) {
|
|
|
int completeCount=0,receiveCount=0,userCount=0,signCount=0,channelCount=0,newCount=0,channelNewCount=0,channelCompleteCount=0;
|
|
|
if (ab.getList()!=null&&!ab.getList().isEmpty()) {
|
|
|
- for (depCountBo a : ab.getList()) {
|
|
|
+ for (DepCountBo a : ab.getList()) {
|
|
|
if (a.getCompleteCount()!=null&& a.getCompleteCount()!=0) completeCount+=a.getCompleteCount();
|
|
|
if (a.getReceiveCount()!=null&& a.getReceiveCount()!=0) receiveCount+=a.getReceiveCount();
|
|
|
if (a.getUserCount()!=null&& a.getUserCount()!=0) userCount+=a.getUserCount();
|