Browse Source

客户管理添加部门

wanghui 8 years ago
parent
commit
294934735f

+ 23 - 1
src/main/java/com/goafanti/admin/bo/AdminListBo.java

@@ -53,7 +53,13 @@ public class AdminListBo {
 	 * 上级管理用户ID
 	 */
 	private String	superiorId;
-
+	
+	/** 部门ID **/
+	private String departmentId;
+	
+	/** 部门名称 **/
+	private String departmentName;
+	
 	public String getSuperiorId() {
 		return superiorId;
 	}
@@ -133,6 +139,22 @@ public class AdminListBo {
 	public void setSuperior(String superior) {
 		this.superior = superior;
 	}
+	
+	public String getDepartmentId() {
+		return departmentId;
+	}
+
+	public void setDepartmentId(String departmentId) {
+		this.departmentId = departmentId;
+	}
+
+	public String getDepartmentName() {
+		return departmentName;
+	}
+
+	public void setDepartmentName(String departmentName) {
+		this.departmentName = departmentName;
+	}
 
 	// 创建时间
 	public String getCreateTimeFormattedDate() {

+ 4 - 1
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -347,10 +347,13 @@
    		 a.position, a.email, a.id,
    		 a.create_time as createTime,
    		 aa.name as superior, GROUP_CONCAT(DISTINCT(al.province)) AS province,
-   		 a.superior_id as superiorId
+   		 a.superior_id as superiorId,
+   		 dm.id as departmentId,
+   		 dm.name as departmentName
     from admin a 
     left join admin_location al on a.id = al.admin_id
     left join admin aa on aa.id = a.superior_id
+    left join department_management dm on a.department_id = dm.id
     where 1 =1
     <if test = "mobile != null"> 
     	and a.mobile = #{mobile,jdbcType=VARCHAR}

+ 1 - 0
src/main/java/com/goafanti/common/mapper/UserBusinessMapper.xml

@@ -354,6 +354,7 @@
 		b.identify_name as identifyName,
 		a.id as businessId,
 		a.create_time as createTime,
+		a.update_time as updateTime,
 		a.follow_situation as followSituation,
 		a.customer_status as customerStatus,
 		d.name as adminName

+ 21 - 14
src/main/java/com/goafanti/common/mapper/UserMapperExt.xml

@@ -22,10 +22,12 @@
 			dg1.name as province,
 			dg2.name as city, 
 			dg3.name as area,
-			c.name as industry
+			c.name as industry,
+			d.name as adminName
 		from
 		(select
 			id,
+			aid,
 			type,
 			status,
 			create_time,
@@ -76,6 +78,7 @@
 		left join district_glossory dg2 on b.city = dg2.id
 		left join district_glossory dg3 on b.area = dg3.id
 		left join industry_category c on b.industry = c.id
+		left join admin d on a.aid = d.id 
 		where 1=1
 		<if test="province != null">
 			and b.province = #{province,jdbcType=INTEGER}
@@ -196,10 +199,12 @@
 			dg1.name as province,
 			dg2.name as city, 
 			dg3.name as area,
-			c.name as industry
+			c.name as industry,
+			d.name as adminName
 		from
 		(select
 			id,
+			aid,
 			type,
 			status,
 			create_time,
@@ -249,6 +254,7 @@
 		left join district_glossory dg2 on b.location_city = dg2.id
 		left join district_glossory dg3 on b.location_area = dg3.id
 		left join industry_category c on b.industry = c.id
+		left join admin d on a.aid = d.id 
 		where 1=1
 		<if test="province != null">
 			and b.location_province = #{province,jdbcType=INTEGER}
@@ -587,8 +593,8 @@
 			)a 
 		left join admin b on a.aid = b.id 
 		left join department_management c on b.department_id = c.id
-		<if test="departmentId !=null">
-			where b.department_id = #{departmentId,jdbcType=VARCHAR}
+		<if test="depNo != null">
+			where c.dep_no like concat(#{depNo,jdbcType=VARCHAR},'%')
 		</if>
 		<if test="page_sql != null">
     		${page_sql}
@@ -613,8 +619,8 @@
 		)a
 		left join admin b on a.aid = b.id 
 		left join department_management c on b.department_id = c.id
-		<if test="departmentId !=null">
-			where b.department_id = #{departmentId,jdbcType=VARCHAR}
+		<if test="depNo !=null">
+			where c.dep_no like concat(#{depNo,jdbcType=VARCHAR},'%')
 		</if>
 	</select>
 	
@@ -644,8 +650,8 @@
 			)a
 			left join admin b on a.aid = b.id 
 			left join department_management c on b.department_id = c.id
-		<if test="departmentId !=null">
-			where b.department_id = #{departmentId,jdbcType=VARCHAR}
+		<if test="depNo !=null">
+			where c.dep_no like concat(#{depNo,jdbcType=VARCHAR},'%')
 		</if>
 		<if test="page_sql != null">
     		${page_sql}
@@ -670,8 +676,8 @@
 			)a
 			left join admin b on a.aid = b.id 
 			left join department_management c on b.department_id = c.id
-		<if test="departmentId !=null">
-			where b.department_id = #{departmentId,jdbcType=VARCHAR}
+		<if test="depNo !=null">
+			where c.dep_no like concat(#{depNo,jdbcType=VARCHAR},'%')
 		</if>
 	</select>
 	
@@ -717,8 +723,8 @@
 				group by
 					aid
 		)y on x.aid = y.aid
-		<if test="departmentId !=null">
-			where b.department_id = #{departmentId,jdbcType=VARCHAR}
+		<if test="depNo !=null">
+			where c.dep_no like concat(#{depNo,jdbcType=VARCHAR},'%')
 		</if>
 	</select>
 	
@@ -736,8 +742,9 @@
 			group by aid
 		)x
 		left join admin b on x.aid = b.id 
-		<if test="departmentId !=null">
-			where b.department_id = #{departmentId,jdbcType=VARCHAR}
+		left join department_management c on b.department_id = c.id
+		<if test="depNo !=null">
+			where c.dep_no like concat(#{depNo,jdbcType=VARCHAR},'%')
 		</if>
 	</select>
 	

+ 8 - 0
src/main/java/com/goafanti/customer/bo/BusinessListBo.java

@@ -23,6 +23,8 @@ public class BusinessListBo {
 	private String endDate;
 	/** 业务创建时间 **/
 	private String createTime;
+	/** 更新时间 **/
+	private String updateTime;
 	/** 业务字典ID **/
 	private String businessGlossoryId;
 	
@@ -92,6 +94,12 @@ public class BusinessListBo {
 	public void setCreateTime(String createTime) {
 		this.createTime = createTime;
 	}
+	public String getUpdateTime() {
+		return updateTime;
+	}
+	public void setUpdateTime(String updateTime) {
+		this.updateTime = updateTime;
+	}
 	public String getBusinessGlossoryId() {
 		return businessGlossoryId;
 	}

+ 12 - 2
src/main/java/com/goafanti/customer/bo/CustomerListOut.java

@@ -12,7 +12,10 @@ public class CustomerListOut extends CustomerListIn{
 	
 	/** 创建时间 **/
 	private String createTime;
-
+	
+	/** 营销员姓名 **/
+	private String adminName;
+	
 	public String getUid() {
 		return uid;
 	}
@@ -44,6 +47,13 @@ public class CustomerListOut extends CustomerListIn{
 	public void setCreateTime(String createTime) {
 		this.createTime = createTime;
 	}
-	
+
+	public String getAdminName() {
+		return adminName;
+	}
+
+	public void setAdminName(String adminName) {
+		this.adminName = adminName;
+	}
 	
 }

+ 6 - 6
src/main/java/com/goafanti/customer/controller/CustomerApiController.java

@@ -486,7 +486,7 @@ public class CustomerApiController extends BaseApiController{
 	 * @throws ParseException
 	 */
 	@RequestMapping(value = "/customerStatistics",method = RequestMethod.GET)
-	public Result customerStatistics(String startDate,String endDate,String timeSpan,String depId,String businessGlossoryId,Integer pageNo, Integer pageSize) throws ParseException{
+	public Result customerStatistics(String startDate,String endDate,String timeSpan,String depNo,String businessGlossoryId,Integer pageNo, Integer pageSize) throws ParseException{
 		Result res = new Result();
 		Date sDate = null;
 		Date eDate = null;
@@ -507,7 +507,7 @@ public class CustomerApiController extends BaseApiController{
 				sDate = DateUtils.getLastDayOfLastYear(date);
 			}		
 		}
-		res.setData(customerService.customerStatistics(sDate,eDate,depId,businessGlossoryId,pageNo,pageSize));
+		res.setData(customerService.customerStatistics(sDate,eDate,depNo,businessGlossoryId,pageNo,pageSize));
 		return res;
 	}
 	
@@ -524,7 +524,7 @@ public class CustomerApiController extends BaseApiController{
 	 * @throws ParseException 
 	 */
 	@RequestMapping(value = "/businessStatistic", method = RequestMethod.GET)
-	public Result businessStatistic(String startDate,String endDate,String timeSpan,String depId,String businessGlossoryId,Integer pageNo, Integer pageSize) throws ParseException{
+	public Result businessStatistic(String startDate,String endDate,String timeSpan,String depNo,String businessGlossoryId,Integer pageNo, Integer pageSize) throws ParseException{
 		Result res = new Result();
 		Date sDate = null;
 		Date eDate = null;
@@ -545,7 +545,7 @@ public class CustomerApiController extends BaseApiController{
 				sDate = DateUtils.getLastDayOfLastYear(date);
 			}		
 		}
-		res.setData(customerService.businessStatistic(sDate,eDate,depId,businessGlossoryId,pageNo,pageSize));
+		res.setData(customerService.businessStatistic(sDate,eDate,depNo,businessGlossoryId,pageNo,pageSize));
 		return res;
 	}
 	
@@ -563,7 +563,7 @@ public class CustomerApiController extends BaseApiController{
 	 */
 
 	@RequestMapping(value = "/followStatistic",method = RequestMethod.GET)
-	public Result followStatistic(String startDate,String endDate,String timeSpan,String depId,Integer pageNo, Integer pageSize) throws ParseException{
+	public Result followStatistic(String startDate,String endDate,String timeSpan,String depNo,Integer pageNo, Integer pageSize) throws ParseException{
 		Result res = new Result();
 		Date sDate = null;
 		Date eDate = null;
@@ -584,7 +584,7 @@ public class CustomerApiController extends BaseApiController{
 				sDate = DateUtils.getLastDayOfLastYear(date);
 			}		
 		}
-		res.setData(customerService.followStatistic(sDate, eDate, depId, pageNo, pageSize));
+		res.setData(customerService.followStatistic(sDate, eDate, depNo, pageNo, pageSize));
 		return res;
 	}
 	

+ 3 - 3
src/main/java/com/goafanti/customer/service/CustomerService.java

@@ -234,7 +234,7 @@ public interface CustomerService {
 	 * @param depId
 	 * @return
 	 */
-	Pagination<StatisticBo> customerStatistics(Date sDate, Date eDate, String depId, String businessGlossoryId, Integer pageNo, Integer pageSize);
+	Pagination<StatisticBo> customerStatistics(Date sDate, Date eDate, String depNo, String businessGlossoryId, Integer pageNo, Integer pageSize);
 	
 	/**
 	 * 业务进度统计
@@ -242,7 +242,7 @@ public interface CustomerService {
 	 * @param eDate
 	 * @return
 	 */
-	Pagination<StatisticBo> businessStatistic(Date sDate, Date eDate, String depId, String businessGlossoryId,Integer pageNo, Integer pageSize);
+	Pagination<StatisticBo> businessStatistic(Date sDate, Date eDate, String depNo, String businessGlossoryId,Integer pageNo, Integer pageSize);
 	
 	/**
 	 * 拜访统计
@@ -250,5 +250,5 @@ public interface CustomerService {
 	 * @param eDate
 	 * @return
 	 */
-	Pagination<StatisticBo> followStatistic(Date sDate, Date eDate, String depId, Integer pageNo, Integer pageSize);
+	Pagination<StatisticBo> followStatistic(Date sDate, Date eDate, String depNo, Integer pageNo, Integer pageSize);
 }

+ 6 - 6
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -689,11 +689,11 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 
 	@SuppressWarnings("unchecked")
 	@Override
-	public Pagination<StatisticBo> customerStatistics(Date sDate, Date eDate, String depId, String businessGlossoryId, Integer pageNo, Integer pageSize) {
+	public Pagination<StatisticBo> customerStatistics(Date sDate, Date eDate, String depNo, String businessGlossoryId, Integer pageNo, Integer pageSize) {
 		Map<String,Object> params = new HashMap<String,Object>();
 		if(null != sDate) params.put("sDate", sDate);
 		if(null != eDate) params.put("eDate", eDate);
-		if(StringUtils.isNotBlank(depId)) params.put("departmentId", depId);
+		if(StringUtils.isNotBlank(depNo)) params.put("depNo", depNo);
 		if(StringUtils.isNotBlank(businessGlossoryId)) params.put("businessGlossoryId", businessGlossoryId);
 		Pagination<StatisticBo> page = (Pagination<StatisticBo>)findPage("customerStatisticsList", "customerStatisticsCount", params, pageNo, pageSize);
 		return page;
@@ -701,11 +701,11 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 
 	@SuppressWarnings("unchecked")
 	@Override
-	public Pagination<StatisticBo> businessStatistic(Date sDate, Date eDate,String depId, String businessGlossoryId,Integer pageNo, Integer pageSize) {
+	public Pagination<StatisticBo> businessStatistic(Date sDate, Date eDate,String depNo, String businessGlossoryId,Integer pageNo, Integer pageSize) {
 		Map<String,Object> params = new HashMap<String,Object>();
 		if(null != sDate) params.put("sDate", sDate);
 		if(null != eDate) params.put("eDate", eDate);
-		if(StringUtils.isNotBlank(depId)) params.put("departmentId", depId);
+		if(StringUtils.isNotBlank(depNo)) params.put("depNo", depNo);
 		if(StringUtils.isNotBlank(businessGlossoryId)) params.put("businessGlossoryId", businessGlossoryId);
 		Pagination<StatisticBo> page = (Pagination<StatisticBo>)findPage("businessStatisticList", "businessStatisticCount", params, pageNo, pageSize);
 		return page;
@@ -713,11 +713,11 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 
 	@SuppressWarnings("unchecked")
 	@Override
-	public Pagination<StatisticBo> followStatistic(Date sDate, Date eDate, String depId, Integer pageNo, Integer pageSize) {
+	public Pagination<StatisticBo> followStatistic(Date sDate, Date eDate, String depNo, Integer pageNo, Integer pageSize) {
 		Map<String,Object> params = new HashMap<String,Object>();
 		if(null != sDate) params.put("sDate", sDate);
 		if(null != eDate) params.put("eDate", eDate);
-		if(StringUtils.isNotBlank(depId)) params.put("departmentId", depId);
+		if(StringUtils.isNotBlank(depNo)) params.put("depNo", depNo);
 		Pagination<StatisticBo> page = (Pagination<StatisticBo>)findPage("followStatisticList", "followStatisticCount", params, pageNo, pageSize);
 		return page;
 	}