Przeglądaj źródła

客户统计新增导出

anderx 1 rok temu
rodzic
commit
108f2d909f

+ 16 - 0
src/main/java/com/goafanti/admin/bo/AdminCustomerBo.java

@@ -1,34 +1,50 @@
 package com.goafanti.admin.bo;
 
 
+import com.goafanti.common.utils.excel.Excel;
+
 public class AdminCustomerBo {
 	private String aid;
+	@Excel( name = "名称")
 	private String aName;
 	private String depId;
+	@Excel( name = "部门")
 	private String depName;
 	/** 私有数 */
+	@Excel( name = "私有数")
 	private Integer userCount;
 	/** 渠道数 */
+	@Excel( name = "渠道数")
 	private Integer channelCount;
 	/** 签单数 */
+	@Excel( name = "签单数")
 	private Integer signCount;
 	/** 私有新增数 */
+	@Excel( name = "私有新增数")
 	private Integer newCount;
 	/** 渠道新增数 */
+	@Excel( name = "渠道新增数")
 	private Integer channelNewCount;
 	/** 私有面谈数 */
+	@Excel( name = "私有面谈数")
 	private Integer completeCount;
 	/** 渠道面谈数 */
+	@Excel( name = "渠道面谈数")
 	private Integer channelCompleteCount;
 	/** 私有领取数 */
+	@Excel( name = "私有领取数")
 	private Integer receiveCount;
 	/** 私有转交数 */
+	@Excel( name = "私有转交数")
 	private Integer transferCount;
 	/** 一般客戶 */
+	@Excel( name = "一般客户")
 	private Integer generalCount;
 	/** 私有客戶 */
+	@Excel( name = "私有客户")
 	private Integer intentionCount;
 	/** 重点客户 */
+	@Excel( name = "重点客户")
 	private Integer keynoteCount;
 
 	public Integer getGeneralCount() {

+ 3 - 0
src/main/java/com/goafanti/admin/service/AdminService.java

@@ -1,6 +1,7 @@
 package com.goafanti.admin.service;
 
 import com.goafanti.admin.bo.*;
+import com.goafanti.common.bo.Result;
 import com.goafanti.common.model.Admin;
 import com.goafanti.core.mybatis.page.Pagination;
 
@@ -86,4 +87,6 @@ public interface AdminService {
 
 
     Object pushStatistics() ;
+
+	Result selectAllUserExport(String depId, String startTime, String endTime, String aName);
 }

+ 33 - 0
src/main/java/com/goafanti/admin/service/impl/AdminServiceImpl.java

@@ -4,6 +4,7 @@ import com.goafanti.admin.bo.*;
 import com.goafanti.admin.service.AdminService;
 import com.goafanti.admin.service.DepartmentService;
 import com.goafanti.admin.service.NewAdminService;
+import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.*;
 import com.goafanti.common.error.BusinessException;
@@ -11,6 +12,7 @@ import com.goafanti.common.model.*;
 import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.common.utils.PasswordUtil;
 import com.goafanti.common.utils.StringUtils;
+import com.goafanti.common.utils.excel.NewExcelUtil;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
@@ -18,6 +20,7 @@ import com.goafanti.customer.bo.BusinessListBo;
 import com.goafanti.organization.bo.OrganizationListOut;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -60,6 +63,9 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 	@Autowired
 	private FinanceCountMapper financeCountMapper;
 
+	@Value(value = "${upload.path}")
+	private String uploadPath = null;
+
 
 
 
@@ -707,6 +713,33 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 		return 1;
 	}
 
+	@Override
+	public Result selectAllUserExport(String depId, String startTime, String endTime, String aName) {
+		if (endTime!=null)endTime=endTime+" 23:59:59";
+		List<Department> depIds=new ArrayList<>();
+		//总裁助力不查看老员工
+		Integer seniorstaff = null;
+		if (TokenManager.hasRole(AFTConstants.CED_ASSISTANT)){
+			seniorstaff=0;
+		}
+		OrganizationListOut oo=departmentMapper.selectAllById(depId);
+		if(TokenManager.hasRole(AFTConstants.OPERATION_MANAGER)){
+			List<String> myShiroDep = departmentService.selectMyDeps();
+			if (!myShiroDep.contains(depId))throw new BusinessException("无权查看此部门信息");
+		}
+		depIds =departmentService.selectSubordinateDeps(depId);
+		Department department = new Department();
+		department.setId(depId);
+		depIds.add(department);
+		List<AdminCustomerBo> list =null;
+		//原sql计算
+//		list=departmentMapper.AlldepCount(depIds,startTime,  endTime);
+		//新java计算
+		list=AllDepCount(depIds,startTime,endTime,seniorstaff);
+		NewExcelUtil excel=new NewExcelUtil(AdminCustomerBo.class);
+		return excel.exportExcel(list,"部门统计表",uploadPath);
+	}
+
 	/**
 	 *
 	 * @param list

+ 14 - 0
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -1391,6 +1391,20 @@ public class AdminCustomerApiController extends BaseApiController{
 		res.data(adminService.selectAllUser( depId,  startTime, endTime, aName));
 		return res;
 	}
+
+
+	/**
+	 * 查看客户统计导出
+	 * @param depId 部门编号
+	 * @param startTime 开始时间
+	 * @param endTime	结束时间
+	 * @return
+	 */
+	@RequestMapping(value = "/selectAllUser/export", method = RequestMethod.GET)
+	public Result selectAllUserExport(String depId, String startTime,String endTime,String aName ) {
+
+		return adminService.selectAllUserExport( depId,  startTime, endTime, aName);
+	}
 	/**
 	 * 查看客户日期内新增客户
 	 * @param type 0私有 1渠道 2签单 3私有新增 4渠道新增 5私有面谈 6渠道面谈 7私有领取 8 私有转交