Explorar o código

Merge branch 'test' of jishutao/aft into prod

gitadmin %!s(int64=8) %!d(string=hai) anos
pai
achega
0adffa55c3

+ 19 - 7
src/main/java/com/goafanti/common/dao/DailySalesReportMapper.java

@@ -51,17 +51,29 @@ public interface DailySalesReportMapper {
 	List<ModelMap> selectSalesDepartmentExtraReports(@Param("startTime") Date startTime,
 			@Param("endTime") Date endTime);
 
-	List<marketingESBo> findmarketingStatisticsList(@Param("depId")String depId);
-
-	List<marketingESBo> marketingDepStatisticsList(@Param("depId")String depId);
-
-	CountMarketingStatisticsBo privateCustomersCount(@Param("depId")String depId);
-
-	CountDepMarketingStatisticsBo privateCustomersDepCount(@Param("depId")String depId);
+	List<marketingESBo> findmarketingStatisticsList(@Param("depId")String depId, @Param("dayStart")String dayStart, @Param("dayEnd")String dayEnd,
+			@Param("weeklyStart")String weeklyStart, @Param("weeklyEnd")String weeklyEnd, @Param("monthStart")String monthStart, @Param("monthEnd")String monthEnd,
+			@Param("yearStart")String yearStart, @Param("yearEnd")String yearEnd);
+	
+	List<marketingESBo> marketingDepStatisticsList(@Param("depId")String depId, @Param("dayStart")String dayStart, @Param("dayEnd")String dayEnd,
+			@Param("weeklyStart")String weeklyStart, @Param("weeklyEnd")String weeklyEnd, @Param("monthStart")String monthStart, @Param("monthEnd")String monthEnd,
+			@Param("yearStart")String yearStart, @Param("yearEnd")String yearEnd);
+
+	CountMarketingStatisticsBo privateCustomersCount(@Param("depId")String depId, @Param("dayStart")String dayStart, @Param("dayEnd")String dayEnd,
+			@Param("weeklyStart")String weeklyStart, @Param("weeklyEnd")String weeklyEnd, @Param("monthStart")String monthStart, @Param("monthEnd")String monthEnd,
+			@Param("yearStart")String yearStart, @Param("yearEnd")String yearEnd);
+
+	CountMarketingStatisticsBo privateCustomersDepCount(@Param("depId")String depId, @Param("dayStart")String dayStart, @Param("dayEnd")String dayEnd,
+			@Param("weeklyStart")String weeklyStart, @Param("weeklyEnd")String weeklyEnd, @Param("monthStart")String monthStart, @Param("monthEnd")String monthEnd,
+			@Param("yearStart")String yearStart, @Param("yearEnd")String yearEnd);
 
 	List<SomeTimeMarketingBo> sometimeMarketingStatistics(@Param("depId")String depId, @Param("startTime")String startTime, @Param("endTime")String endTime);
 
 	List<SomeTimeMarketingBo> sometimeMarketingDepStatistics(@Param("depId")String depId, @Param("startTime")String startTime, @Param("endTime")String endTime);
 
 	SomeTimeMarketingBo countsometimeMarketingStatistics(@Param("depId")String depId, @Param("startTime")String startTime, @Param("endTime")String endTime);
+
+	SomeTimeMarketingBo countsometimeMarketingDepStatistics(@Param("depId")String depId, @Param("startTime")String startTime, @Param("endTime")String endTime);
+
+
 }

+ 3 - 1
src/main/java/com/goafanti/common/mapper/ContractTaskMapper.xml

@@ -570,6 +570,7 @@
 			h.contract_no as contractNo,
 			d.uid,
 			i.name as salesmanName,
+			j.name as departmentName,
 			h.order_remarks as orderRemarks
 		from
 			contract_task a 
@@ -581,7 +582,8 @@
 			left join user g on d.uid = g.id
 			left join t_order h on h.order_no=d.order_no
 			left join admin i on h.salesman_id = i.id
-			where 1=1 
+			left join department_management j on i.department_id=j.id
+			where 1=1
 			and a.id = #{taskId,jdbcType=VARCHAR}
   </select>
 </mapper>

+ 346 - 99
src/main/java/com/goafanti/common/mapper/DailySalesReportMapper.xml

@@ -167,112 +167,341 @@
   </select>
   
    <select id="findmarketingStatisticsList" parameterType="String" resultType="com.goafanti.report.bo.marketingESBo">
-		select a.id ,a.name,a.department_id as departmentId,d.name as departmentName,d.manager_id,f.name as departmentManagerName,
+		select t1.id,t1.name,t1.departmentId,t1.departmentName,t1.manager_id,t1.departmentManagerName,
+		t1.roleName,t1.privateCustomersCount,t1.entryTime,
+		 t2.yearFollowNo,t2.yearVisitNo,t2.yearTelNo,
+			 t2.monthFollowNo,t2.monthVisitNo,t2.monthTelNo,
+			 t2.weeklyFollowNo,t2.weeklyVisitNo,t2.weeklyTelNo,
+			 t2.dayFollowNo,t2.dayVisitNo,t2.dayTelNo 
+		from(
+		select a.id as id,a.name as name,a.department_id as departmentId,d.name as departmentName,d.manager_id,f.name as departmentManagerName,
 				c.role_name as roleName,ifnull(e.privateCustomersCount,0)as privateCustomersCount,a.create_time as entryTime
 		from admin a left join user_role b
 		on a.id=b.uid left join role c
 		on b.rid=c.id left join department_management d
-		on a.department_id=d.id left join (select aid,count(0) as privateCustomersCount from user group by aid)e
+		on a.department_id=d.id left join (select aid,count(0) as privateCustomersCount from user where aid is not null and aid != '' group by aid)e
 		on a.id=e.aid left join admin f
 		on d.manager_id=f.id
-		where 1=1
-		and (c.role_name='营销员' or c.role_name='营销经理'or c.role_name='营销管理员')
-	<if test="depId != null">
+		where c.role_name in ('营销员' ,'营销经理','营销管理员')
+		<if test="depId != null">
 		and a.department_id = #{depId,jdbcType=VARCHAR}
 	</if>
-	order by a.name desc
+)t1
+left join (
+select x.aid,x.yearFollowNo,x.yearVisitNo,x.yearTelNo,
+			 y.monthFollowNo,y.monthVisitNo,y.monthTelNo,
+			 z.weeklyFollowNo,z.weeklyVisitNo,z.weeklyTelNo,
+			 w.dayFollowNo,w.dayVisitNo,dayTelNo
+			 from (
+select
+			aid,
+			count(0) as yearFollowNo,
+			ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as yearVisitNo, 
+			ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as yearTelNo
+			from user_follow where 1=1
+			and create_time &gt; #{yearStart,jdbcType=VARCHAR}
+			and create_time &lt; #{yearEnd,jdbcType=VARCHAR}
+			group by aid
+)x  left join (
+select
+			aid,
+			count(0) as monthFollowNo,
+			ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as monthVisitNo, 
+			ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as monthTelNo
+			from user_follow where 1=1
+			and create_time &gt; #{monthStart,jdbcType=VARCHAR}
+			and create_time &lt; #{monthEnd,jdbcType=VARCHAR}
+			group by aid
+)y on x.aid = y.aid
+left join (
+select
+			aid,
+			count(0) as weeklyFollowNo,
+			ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as weeklyVisitNo, 
+			ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as weeklyTelNo
+			from user_follow where 1=1
+			and create_time &gt; #{weeklyStart,jdbcType=VARCHAR}
+			and create_time &lt; #{weeklyEnd,jdbcType=VARCHAR}
+			group by aid
+)z on y.aid = z.aid
+left join (
+select
+			aid,
+			count(0) as dayFollowNo,
+			ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as dayVisitNo, 
+			ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as dayTelNo
+			from user_follow where 1=1
+			and create_time &gt; #{dayStart,jdbcType=VARCHAR}
+			and create_time &lt; #{dayEnd,jdbcType=VARCHAR}
+			group by aid
+)w on y.aid = w.aid
+)t2 on t1.id = t2.aid
  </select>
   
   <select id="marketingDepStatisticsList" parameterType="String" resultType="com.goafanti.report.bo.marketingESBo">
-	select
+	select t1.departmentId,t1.departmentName,t1.departmentManagerName,t1.privateCustomersCount,t1.departmentNumber,
+			t2.yearFollowNo,t2.yearVisitNo,t2.yearTelNo,
+			 t2.monthFollowNo,t2.monthVisitNo,t2.monthTelNo,
+			 t2.weeklyFollowNo,t2.weeklyVisitNo,t2.weeklyTelNo,
+			 t2.dayFollowNo,t2.dayVisitNo,t2.dayTelNo ,
+			 t2.dayFollowNo/t1.departmentNumber as dayAVG
+		from(select
 	a.department_id as departmentId,
 	b.name as departmentName,
-	b.manager_id,
 	c.name as departmentManagerName,
 	a.count2 as privateCustomersCount,
 	d.count3 as departmentNumber
-from
-	(
-		select
+from ( select
 			z.department_id,
-			sum( y.count1 ) as count2
-		from
-			(
-				select
-					a.id,
-					count( a.id ) as count1
-				from
-					admin a left join user b on
-					a.id = b.aid 
-				group by
-					a.id
+			sum( y.count1 ) as count2 from
+			( select aid, count( aid ) as count1
+				from user 
+				where aid is not null and aid !=''
+				group by aid
 			) y left join admin z on
-			y.id = z.id
+			y.aid = z.id
 		group by
 			z.department_id
 	) a left join department_management b 
 	on a.department_id = b.id left join admin c
 	on b.manager_id=c.id left join (select department_id,count(0) as count3 from admin   	group by department_id)d
 	on a.department_id = d.department_id
-	where 1=1
+	where a.department_id is not null
 	<if test="depId != null">
 		and a.department_id = #{depId,jdbcType=VARCHAR}
 	</if>
-	order by b.name desc
-		
+)t1
+left join (
+select m.department_id as departmentId,sum(n.dayFollowNo)as dayFollowNo,sum(n.dayVisitNo)as dayVisitNo,sum(n.dayTelNo) as dayTelNo
+					,sum(n.weeklyFollowNo)as weeklyFollowNo,sum(n.weeklyVisitNo)as weeklyVisitNo,sum(n.weeklyTelNo) as weeklyTelNo
+					,sum(n.monthFollowNo)as monthFollowNo,sum(n.monthVisitNo)as monthVisitNo,sum(n.monthTelNo) as monthTelNo
+					,sum(n.yearFollowNo)as yearFollowNo,sum(n.yearVisitNo)as yearVisitNo,sum(n.yearTelNo) as yearTelNo
+from admin m left join 
+(select x.aid,x.yearFollowNo,x.yearVisitNo,x.yearTelNo,
+			 y.monthFollowNo,y.monthVisitNo,y.monthTelNo,
+			 z.weeklyFollowNo,z.weeklyVisitNo,z.weeklyTelNo,
+			 w.dayFollowNo,w.dayVisitNo,dayTelNo
+			 from (
+select
+			aid,
+			count(0) as yearFollowNo,
+			ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as yearVisitNo, 
+			ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as yearTelNo
+			from user_follow where 1=1
+			and create_time &gt; #{yearStart,jdbcType=VARCHAR}
+			and create_time &lt; #{yearEnd,jdbcType=VARCHAR}
+			group by aid
+)x  left join (
+select
+			aid,
+			count(0) as monthFollowNo,
+			ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as monthVisitNo, 
+			ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as monthTelNo
+			from user_follow where 1=1
+			and create_time &gt; #{monthStart,jdbcType=VARCHAR}
+			and create_time &lt; #{monthEnd,jdbcType=VARCHAR}
+			group by aid
+)y on x.aid = y.aid
+left join (
+select
+			aid,
+			count(0) as weeklyFollowNo,
+			ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as weeklyVisitNo, 
+			ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as weeklyTelNo
+			from user_follow where 1=1
+			and create_time &gt; #{weeklyStart,jdbcType=VARCHAR}
+			and create_time &lt; #{weeklyEnd,jdbcType=VARCHAR}
+			group by aid
+)z on y.aid = z.aid
+left join (
+select
+			aid,
+			count(0) as dayFollowNo,
+			ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as dayVisitNo, 
+			ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as dayTelNo
+			from user_follow where 1=1
+			and create_time &gt; #{dayStart,jdbcType=VARCHAR}
+			and create_time &lt; #{dayEnd,jdbcType=VARCHAR}
+			group by aid
+)w on y.aid = w.aid) n on m.id=n.aid
+where m.department_id is not null and m.department_id !=''
+group by m.department_id
+)t2 on t1.departmentId = t2.departmentId
+ORDER by t1.departmentName
 	</select>
   <select id="privateCustomersCount" parameterType="string" resultType="com.goafanti.report.bo.CountMarketingStatisticsBo">
-	select sum(e.privateCustomersCount) as privateCustomersCount
+	select SUM( n.privateCustomersCount )as privateCustomersCount,
+	SUM( m.dayFollowNo )as dayFollowNo,
+	SUM( m.dayVisitNo )as dayVisitNo,
+	SUM( m.dayTelNo )as dayTelNo,
+	SUM( m.weeklyFollowNo )as weeklyFollowNo,
+	SUM( m.weeklyVisitNo )as weeklyVisitNo,
+	SUM( m.weeklyTelNo )as weeklyTelNo,
+	SUM( m.monthFollowNo )as monthFollowNo,
+	SUM( m.monthVisitNo )as monthVisitNo,
+	SUM( m.monthTelNo )as monthTelNo,
+	SUM( m.yearFollowNo )as yearFollowNo,
+	SUM( m.yearVisitNo )as yearVisitNo,
+	SUM( m.yearTelNo )as yearTelNo
+	
+from( 
+select a.id,sum(e.privateCustomersCount) as privateCustomersCount
 	from admin a left join user_role b
 	on a.id=b.uid left join role c
-	on b.rid=c.id left join department_management d
-	on a.department_id=d.id left join (select aid,count(0) as privateCustomersCount from user group by aid)e
-	on a.id=e.aid  where 1=1
+	on b.rid=c.id left join (select aid,count(0) as privateCustomersCount from user group by aid)e
+	on a.id=e.aid  where c.role_name in ('营销员','营销经理','营销管理员')
 	<if test="depId != null">
-		and a.department_id = #{depId,jdbcType=VARCHAR}
+	and a.department_id = #{depId,jdbcType=VARCHAR}
 	</if>
-	and (c.role_name='营销员' or c.role_name='营销经理'or c.role_name='营销管理员')
+	GROUP by a.id
+) n left join (
+select x.aid,x.yearFollowNo,x.yearVisitNo,x.yearTelNo,
+			 y.monthFollowNo,y.monthVisitNo,y.monthTelNo,
+			 z.weeklyFollowNo,z.weeklyVisitNo,z.weeklyTelNo,
+			 w.dayFollowNo,w.dayVisitNo,w.dayTelNo
+			 from (
+select
+			aid,
+			count(0) as yearFollowNo,
+			ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as yearVisitNo, 
+			ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as yearTelNo
+			from user_follow where 1=1
+			and create_time &gt;  #{yearStart,jdbcType=VARCHAR}
+			and create_time &lt;  #{yearEnd,jdbcType=VARCHAR}
+			group by aid
+)x  left join (
+select
+			aid,
+			count(0) as monthFollowNo,
+			ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as monthVisitNo, 
+			ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as monthTelNo
+			from user_follow where 1=1
+			and create_time &gt;  #{monthStart,jdbcType=VARCHAR}
+			and create_time &lt;  #{monthEnd,jdbcType=VARCHAR}
+			group by aid
+)y on x.aid = y.aid
+left join (
+select
+			aid,
+			count(0) as weeklyFollowNo,
+			ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as weeklyVisitNo, 
+			ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as weeklyTelNo
+			from user_follow where 1=1
+			and create_time &gt;  #{weeklyStart,jdbcType=VARCHAR}
+			and create_time &lt;  #{weeklyEnd,jdbcType=VARCHAR}
+			group by aid
+)z on y.aid = z.aid
+left join (
+select
+			aid,
+			count(0) as dayFollowNo,
+			ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as dayVisitNo, 
+			ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as dayTelNo
+			from user_follow where 1=1
+			and create_time &gt;  #{dayStart,jdbcType=VARCHAR}
+			and create_time &lt;  #{dayEnd,jdbcType=VARCHAR}
+			group by aid
+)w on y.aid = w.aid
+)m on n.id=m.aid	
 	</select>
   
-  <select id="privateCustomersDepCount" parameterType="String" resultType="com.goafanti.report.bo.CountDepMarketingStatisticsBo">
-	select
-	sum(a.count2) as privateCustomersCount,
-	sum(d.count3) as departmentNumber
-from
-	(
-		select
+  <select id="privateCustomersDepCount" parameterType="String" resultType="com.goafanti.report.bo.CountMarketingStatisticsBo">
+	select sum(t1.privateCustomersCount) as privateCustomersCount,sum(t1.departmentNumber) as departmentNumber,
+			sum(t2.yearFollowNo) as yearFollowNo,sum(t2.yearVisitNo) as yearVisitNo,sum(t2.yearTelNo) as yearTelNo,
+			 sum(t2.monthFollowNo) as monthFollowNo,sum(t2.monthVisitNo) as monthVisitNo,sum(t2.monthTelNo) as monthTelNo,
+			 sum(t2.weeklyFollowNo) as weeklyFollowNo,sum(t2.weeklyVisitNo) as weeklyVisitNo,sum(t2.weeklyTelNo) as weeklyTelNo,
+			 sum(t2.dayFollowNo) as dayFollowNo,sum(t2.dayVisitNo) as dayVisitNo,sum(t2.dayTelNo) as dayTelNo
+			,sum(t2.dayFollowNo)/sum(t1.departmentNumber) as dayAVG
+		from(select
+	a.department_id as departmentId,
+	b.name as departmentName,
+	c.name as departmentManagerName,
+	a.count2 as privateCustomersCount,
+	d.count3 as departmentNumber
+from ( select
 			z.department_id,
-			sum( y.count1 ) as count2
-		from
-			(
-				select
-					a.id,
-					count( a.id ) as count1
-				from
-					admin a left join user b on
-					a.id = b.aid 
-				group by
-					a.id
+			sum( y.count1 ) as count2 from
+			( select aid, count( aid ) as count1
+				from user 
+				where aid is not null and aid !=''
+				group by aid
 			) y left join admin z on
-			y.id = z.id
+			y.aid = z.id
 		group by
 			z.department_id
 	) a left join department_management b 
 	on a.department_id = b.id left join admin c
 	on b.manager_id=c.id left join (select department_id,count(0) as count3 from admin   	group by department_id)d
 	on a.department_id = d.department_id
-	where 1=1
-<if test="depId != null">
-and a.department_id = #{depId,jdbcType=VARCHAR}
-</if>
+	where a.department_id is not null
+	<if test="depId != null">
+	and a.department_id = #{depId,jdbcType=VARCHAR}
+	</if>
+)t1
+left join (
+select m.department_id as departmentId,sum(n.dayFollowNo)as dayFollowNo,sum(n.dayVisitNo)as dayVisitNo,sum(n.dayTelNo) as dayTelNo
+					,sum(n.weeklyFollowNo)as weeklyFollowNo,sum(n.weeklyVisitNo)as weeklyVisitNo,sum(n.weeklyTelNo) as weeklyTelNo
+					,sum(n.monthFollowNo)as monthFollowNo,sum(n.monthVisitNo)as monthVisitNo,sum(n.monthTelNo) as monthTelNo
+					,sum(n.yearFollowNo)as yearFollowNo,sum(n.yearVisitNo)as yearVisitNo,sum(n.yearTelNo) as yearTelNo
+from admin m left join 
+(select x.aid,x.yearFollowNo,x.yearVisitNo,x.yearTelNo,
+			 y.monthFollowNo,y.monthVisitNo,y.monthTelNo,
+			 z.weeklyFollowNo,z.weeklyVisitNo,z.weeklyTelNo,
+			 w.dayFollowNo,w.dayVisitNo,w.dayTelNo
+			 from (
+select
+			aid,
+			count(0) as yearFollowNo,
+			ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as yearVisitNo, 
+			ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as yearTelNo
+			from user_follow where 1=1
+			and create_time &gt; #{yearStart,jdbcType=VARCHAR}
+			and create_time &lt; #{yearEnd,jdbcType=VARCHAR}
+			group by aid
+)x  left join (
+select
+			aid,
+			count(0) as monthFollowNo,
+			ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as monthVisitNo, 
+			ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as monthTelNo
+			from user_follow where 1=1
+			and create_time &gt; #{monthStart,jdbcType=VARCHAR}
+			and create_time &lt; #{monthEnd,jdbcType=VARCHAR}
+			group by aid
+)y on x.aid = y.aid
+left join (
+select
+			aid,
+			count(0) as weeklyFollowNo,
+			ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as weeklyVisitNo, 
+			ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as weeklyTelNo
+			from user_follow where 1=1
+			and create_time &gt; #{weeklyStart,jdbcType=VARCHAR}
+			and create_time &lt; #{weeklyEnd,jdbcType=VARCHAR}
+			group by aid
+)z on y.aid = z.aid
+left join (
+select
+			aid,
+			count(0) as dayFollowNo,
+			ifnull(sum(case when contact_type = 0 then 1 else 0 end) ,0)as dayVisitNo, 
+			ifnull(sum(case when contact_type = 1 then 1 else 0 end) ,0)as dayTelNo
+			from user_follow where 1=1
+			and create_time &gt; #{dayStart,jdbcType=VARCHAR}
+			and create_time &lt; #{dayEnd,jdbcType=VARCHAR}
+			group by aid
+)w on y.aid = w.aid) n on m.id=n.aid
+where m.department_id is not null and m.department_id !=''
+group by m.department_id
+)t2 on t1.departmentId = t2.departmentId
 </select>
 
 
 <select id="sometimeMarketingStatistics" parameterType="String" resultType="com.goafanti.report.bo.SomeTimeMarketingBo">
-select a.id,a.name,d.name as departmentName,role_name as roleName,ifnull(e.telNo,0)as countTelNo,
+select a.id,a.name,d.id as departmentId,d.name as departmentName,role_name as roleName,ifnull(e.telNo,0)as countTelNo,
 	ifnull(e.visitNo,0)as countVisitNo,ifnull(e.followNo,0)as countFollowNo
 	<if test="startTime !=null and endTime !=null">
-	,countFollowNo/datediff(#{endTime,jdbcType=VARCHAR},#{startTime,jdbcType=VARCHAR}) as AVG
+	,e.followNo/datediff(#{endTime,jdbcType=VARCHAR},#{startTime,jdbcType=VARCHAR}) as dayAVG
 	</if>
 	from admin a left join user_role b on
 	a.id = b.uid left join role c on
@@ -298,66 +527,51 @@ select a.id,a.name,d.name as departmentName,role_name as roleName,ifnull(e.telNo
 	and a.create_time &lt;  #{endTime,jdbcType=VARCHAR}
 	</if>
 		GROUP BY a.aid)e on a.id=e.aid
-	where
-	1 = 1
-	and(
-		c.role_name = '营销员'
-		or c.role_name = '营销经理'
-		or c.role_name = '营销管理员'
-	)
+	where c.role_name in ('营销员','营销经理','营销管理员')
 	<if test="depId != null">
 	and a.department_id= #{depId,jdbcType=VARCHAR}
 	</if>
+	order by a.name 
 </select>
 <select id="sometimeMarketingDepStatistics" parameterType="String" resultType="com.goafanti.report.bo.SomeTimeMarketingBo">
-	select
-	a.department_id as departmentId,
-	d.name as  departmentName,
-	f.name as departmentManagerName,
-	d.manager_id,
-	ifnull(e.telNo,0) as countTelNo,
-	ifnull(e.visitNo,0) as countVisitNo,
-	ifnull(e.followNo,0) as countFollowNo
-	<if test="startTime !=null and endTime !=null">
-			,e.followNo/datediff(#{endTime,jdbcType=VARCHAR},#{startTime,jdbcType=VARCHAR}) as AVG
-			</if>
-	from admin a left join user_role b on
-	a.id = b.uid left join role c on
-	b.rid = c.id left join department_management d on
-	a.department_id = d.id left join admin f on 
-	d.manager_id=f.id left join (select
-		b.department_id,
+	select z.id,z.name as departmentName,y.name as departmentManagerName,
+ 		x.followNo as countFollowNo,x.visitNo as countVisitNo,x.telNo as countTelNo
+ 		<if test="startTime !=null and endTime !=null">
+			,x.followNo/datediff(#{endTime,jdbcType=VARCHAR},#{startTime,jdbcType=VARCHAR}) as dayAVG
+		</if>
+	 from (select a.id, a.name,a.manager_id
+	from department_management a left join admin b on a.id=b.department_id
+	left join user_role c on b.id = c.uid
+	 left join role d on c.rid = d.id
+	  where d.role_name in ('营销员','营销经理','营销管理员')
+	  	<if test="depId != null">
+	and a.id=#{depId,jdbcType=VARCHAR}
+		</if>
+	  group by a.id) z  left join (select b.department_id as departmentId,sum(a.followNo) as followNo,sum(a.visitNo)as visitNo,sum(a.telNo)as telNo
+			from (select
+		aid,
 		count( 0 ) as followNo,
 		ifnull(
-			sum( case when a.contact_type = 0 then 1 else 0 end ),
+			sum( case when contact_type = 0 then 1 else 0 end ),
 			0
 		) as visitNo,
 		ifnull(
-			sum( case when a.contact_type = 1 then 1 else 0 end ),
+			sum( case when contact_type = 1 then 1 else 0 end ),
 			0
 			) as telNo
-	from user_follow a left join admin b on a.aid=b.id
-	left join department_management c on b.department_id=c.id
-	where
-		1 = 1
+	from user_follow a where 1 = 1
 	<if test="startTime !=null">
 	and a.create_time &gt;  #{startTime,jdbcType=VARCHAR}
 	</if>
 	<if test="endTime !=null">
 	and a.create_time &lt;  #{endTime,jdbcType=VARCHAR}
 	</if>
-		GROUP BY b.department_id)e on a.department_id=e.department_id
-	where
-	1 = 1
-	and(
-		c.role_name = '营销员'
-		or c.role_name = '营销经理'
-		or c.role_name = '营销管理员'
-	)
-	<if test="depId != null">
-	and a.department_id= #{depId,jdbcType=VARCHAR}
-	</if>
-	group by a.department_id
+	GROUP BY aid)a left join admin b on a.aid=b.id
+	left join department_management c on b.department_id=c.id
+	where b.department_id is not null  and b.department_id !=''
+	GROUP by b.department_id
+) x  on x.departmentId=z.id
+	left join admin y on z.manager_id=y.id
 	</select>
 	<select id="countsometimeMarketingStatistics" parameterType="String" resultType="com.goafanti.report.bo.SomeTimeMarketingBo">
 		select
@@ -371,6 +585,39 @@ select a.id,a.name,d.name as departmentName,role_name as roleName,ifnull(e.telNo
 				0
 			) as countTelNo
 			<if test="startTime !=null and endTime !=null">
+			,count( 0 )/datediff(#{endTime,jdbcType=VARCHAR},#{startTime,jdbcType=VARCHAR}) as dayAVG
+			</if>
+		from
+			user_follow a left join admin b on
+			a.aid = b.id left join department_management c on
+			b.department_id = c.id left join user_role d on
+			b.id = d.uid left join role e on
+			d.rid = e.id
+		where 1 = 1
+		and( e.role_name = '营销员' or e.role_name = '营销经理' or e.role_name = '营销管理员')
+		<if test="startTime !=null">
+		and a.create_time &gt;  #{startTime,jdbcType=VARCHAR}
+		</if>
+		<if test="endTime !=null">
+		and a.create_time &lt;  #{endTime,jdbcType=VARCHAR}
+		</if>
+		<if test="depId != null">
+		and b.department_id= #{depId,jdbcType=VARCHAR}
+		</if>
+	</select>
+	
+	<select id="countsometimeMarketingDepStatistics" parameterType="String" resultType="com.goafanti.report.bo.SomeTimeMarketingBo">
+		select
+			count( 0 ) as countFollowNo,
+			ifnull(
+				sum( case when a.contact_type = 0 then 1 else 0 end ),
+				0
+			) as countVisitNo,
+			ifnull(
+				sum( case when a.contact_type = 1 then 1 else 0 end ),
+				0
+			) as countTelNo
+			<if test="startTime !=null and endTime !=null">
 			,count( 0 )/datediff(#{endTime,jdbcType=VARCHAR},#{startTime,jdbcType=VARCHAR}) as A
 			</if>
 		from

+ 8 - 3
src/main/java/com/goafanti/common/mapper/TOrderMapper.xml

@@ -1091,9 +1091,12 @@
 		<if test="orderChannel != null">
 			and a.order_channel = #{orderChannel,jdbcType=INTEGER}
 		</if>
-		<if test="approval != null">
+		<if test="approval != null and approval !=4">
 			and a.approval = #{approval,jdbcType=INTEGER}
 		</if>
+		<if test="approval ==4">
+			and a.approval != 0
+		</if>
 		<if test="buyerName != null and buyerName != ''">
 			and b.nickname like concat('%', #{buyerName},'%')
 		</if>
@@ -1222,8 +1225,9 @@
 			b.type as buyerType,
 			b.nickname as buyerName,
 			c.name as salesmanName,
+			x.name as departmentName,
 			a.finance_id as financeId,
-			d.name as financeName,
+			c.name as financeName,
 			a.technician_id as technicianId,
 			e.name as technicianName,
 			a.delete_sign as deleteSign,
@@ -1234,7 +1238,8 @@
 			t_order a left join user b on
 			a.buyer_id = b.id left join admin c on
 			a.salesman_id = c.id left join admin d on
-			a.finance_id = d.id left join admin e on
+			a.finance_id = d.id left join department_management x on 
+			c.department_id=x.id left join admin e on
 			a.technician_id = e.id left join business_varieties f on
 			a.contract_type = f.id
 		where a.order_no = #{orderNo,jdbcType=VARCHAR}

+ 2 - 1
src/main/java/com/goafanti/common/mapper/TechProjectMapper.xml

@@ -757,7 +757,8 @@ from
 		a.deleted_sign as deletedSign,
 		a.task_comment as taskComment,
 		a.publish_status as publishStatus,
-		b.name as technicianName
+		b.name as technicianName,
+		b.mobile as technicianMobile
 	from
 		contract_task a left join admin b on
 		a.task_receiver = b.id

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

@@ -1653,6 +1653,5 @@
 		</if>
 		and a.create_time &gt; #{dailyStart,jdbcType=VARCHAR}
 		and a.create_time &lt; #{dailyEnd,jdbcType=VARCHAR}
-		
 	</select>
 </mapper>

+ 9 - 0
src/main/java/com/goafanti/order/bo/ServiceOrderDetailBo.java

@@ -21,6 +21,9 @@ public class ServiceOrderDetailBo extends OrderListBo{
 	private int buyerType;
 	/** 订单负责人 **/
 	private String salesmanId;
+	/** 订单部门 **/
+	private String departmentName;
+	
 	/** 财务负责人 **/
 	private String financeId;
 	/** 技术人员 **/
@@ -105,4 +108,10 @@ public class ServiceOrderDetailBo extends OrderListBo{
 	public void setContractNo(String contractNo) {
 		this.contractNo = contractNo;
 	}
+	public String getDepartmentName() {
+		return departmentName;
+	}
+	public void setDepartmentName(String departmentName) {
+		this.departmentName = departmentName;
+	}
 }

+ 1 - 0
src/main/java/com/goafanti/order/service/impl/OrderServiceImpl.java

@@ -865,6 +865,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 	private Map<String,Object> disposeParams(OrderListBo bo,String startDate,String endDate){
 		Map<String,Object> params = new HashMap<>();
 		if(StringUtils.isNotBlank(bo.getBuyerName())) params.put("buyerName", bo.getBuyerName());
+		if(null!=bo.getApproval()) params.put("approval", bo.getApproval());
 		if(StringUtils.isNotBlank(bo.getSalesmanName())) params.put("salesmanName", bo.getSalesmanName());
 		if(StringUtils.isNotBlank(startDate)) params.put("startDate", startDate +" 00:00:00");
 		if(StringUtils.isNotBlank(endDate)) params.put("endDate", endDate + "23:59:59");

+ 34 - 18
src/main/java/com/goafanti/report/bo/CountMarketingStatisticsBo.java

@@ -2,9 +2,11 @@ package com.goafanti.report.bo;
 
 public class CountMarketingStatisticsBo {
 	private String privateCustomersCount;
-	private String dailyVisitNo;
-	private String dailyTelNo;
-	private String dailyFollowNo;
+	private String departmentNumber;
+	private String dayVisitNo;
+	private String dayTelNo;
+	private String dayFollowNo;
+	private String dayAVG;
 	private String weeklyVisitNo;
 	private String weeklyTelNo;
 	private String weeklyFollowNo;
@@ -23,32 +25,32 @@ public class CountMarketingStatisticsBo {
 	public void setPrivateCustomersCount(String privateCustomersCount) {
 		this.privateCustomersCount = privateCustomersCount;
 	}
-	public String getDailyVisitNo() {
-		if (null==dailyVisitNo) {
+	public String getDayVisitNo() {
+		if (null==dayVisitNo) {
 			return "0";
 		}
-		return dailyVisitNo;
+		return dayVisitNo;
 	}
-	public void setDailyVisitNo(String dailyVisitNo) {
-		this.dailyVisitNo = dailyVisitNo;
+	public void setDayVisitNo(String dayVisitNo) {
+		this.dayVisitNo = dayVisitNo;
 	}
-	public String getDailyTelNo() {
-		if (null==dailyTelNo) {
+	public String getDayTelNo() {
+		if (null==dayTelNo) {
 			return "0";
 		}
-		return dailyTelNo;
+		return dayTelNo;
 	}
-	public void setDailyTelNo(String dailyTelNo) {
-		this.dailyTelNo = dailyTelNo;
+	public void setDayTelNo(String dayTelNo) {
+		this.dayTelNo = dayTelNo;
 	}
-	public String getDailyFollowNo() {
-		if (null==dailyFollowNo) {
+	public String getDayFollowNo() {
+		if (null==dayFollowNo) {
 			return "0";
 		}
-		return dailyFollowNo;
+		return dayFollowNo;
 	}
-	public void setDailyFollowNo(String dailyFollowNo) {
-		this.dailyFollowNo = dailyFollowNo;
+	public void setDayFollowNo(String dayFollowNo) {
+		this.dayFollowNo = dayFollowNo;
 	}
 	public String getWeeklyVisitNo() {
 		if (null==weeklyVisitNo) {
@@ -131,5 +133,19 @@ public class CountMarketingStatisticsBo {
 	public void setYearFollowNo(String yearFollowNo) {
 		this.yearFollowNo = yearFollowNo;
 	}
+	public String getDayAVG() {
+		if (null==dayAVG)return "0";
+		return dayAVG;
+	}
+	public void setDayAVG(String dayAVG) {
+		this.dayAVG = dayAVG;
+	}
+	public String getDepartmentNumber() {
+		if (null==departmentNumber)return "0";
+		return departmentNumber;
+	}
+	public void setDepartmentNumber(String departmentNumber) {
+		this.departmentNumber = departmentNumber;
+	}
 
 }

+ 9 - 5
src/main/java/com/goafanti/report/bo/SomeTimeMarketingBo.java

@@ -10,7 +10,7 @@ public class SomeTimeMarketingBo {
 		private String countVisitNo;
 		private String countTelNo;
 		private String countFollowNo;
-		private String AVG;
+		private String dayAVG;
 		public String getId() {
 			return id;
 		}
@@ -36,18 +36,21 @@ public class SomeTimeMarketingBo {
 			this.roleName = roleName;
 		}
 		public String getCountVisitNo() {
+			if(null==countVisitNo)return "0";
 			return countVisitNo;
 		}
 		public void setCountVisitNo(String countVisitNo) {
 			this.countVisitNo = countVisitNo;
 		}
 		public String getCountTelNo() {
+			if(null==countTelNo)return "0";
 			return countTelNo;
 		}
 		public void setCountTelNo(String countTelNo) {
 			this.countTelNo = countTelNo;
 		}
 		public String getCountFollowNo() {
+			if(null==countFollowNo)return "0";
 			return countFollowNo;
 		}
 		public void setCountFollowNo(String countFollowNo) {
@@ -65,11 +68,12 @@ public class SomeTimeMarketingBo {
 		public void setDepartmentManagerName(String departmentManagerName) {
 			this.departmentManagerName = departmentManagerName;
 		}
-		public String getAVG() {
-			return AVG;
+		public String getDayAVG() {
+			if (null==dayAVG)return "0";
+			return dayAVG;
 		}
-		public void setAVG(String aVG) {
-			AVG = aVG;
+		public void setDayAVG(String dayAVG) {
+			this.dayAVG = dayAVG;
 		}
 		
 }

+ 84 - 6
src/main/java/com/goafanti/report/bo/marketingESBo.java

@@ -1,6 +1,6 @@
 package com.goafanti.report.bo;
 
-import java.util.Map;
+
 
 public class marketingESBo {
 		private String id;
@@ -12,11 +12,85 @@ public class marketingESBo {
 		private String roleName;
 		private String entryTime;
 		private String privateCustomersCount;
-		private Map<String,Object> values;
+		private String dayVisitNo;
+		private String dayTelNo;
+		private String dayFollowNo;
+		private String dayAVG;
+		private String weeklyVisitNo;
+		private String weeklyTelNo;
+		private String weeklyFollowNo;
+		private String monthVisitNo;
+		private String monthTelNo;
+		private String monthFollowNo;
 		private String yearVisitNo;
 		private String yearTelNo;
 		private String yearFollowNo;
+		
+		public String getDayVisitNo() {
+			if (null==dayVisitNo)	return "0";
+			return dayVisitNo;
+		}
+		public void setDayVisitNo(String dayVisitNo) {
+			this.dayVisitNo = dayVisitNo;
+		}
+		public String getDayTelNo() {
+			if (null==dayTelNo)	return "0";
+			return dayTelNo;
+		}
+		public void setDayTelNo(String dayTelNo) {
+			this.dayTelNo = dayTelNo;
+		}
+		public String getDayFollowNo() {
+			if (null==dayFollowNo)	return "0";
+			return dayFollowNo;
+		}
+		public void setDayFollowNo(String dayFollowNo) {
+			this.dayFollowNo = dayFollowNo;
+		}
+		public String getWeeklyVisitNo() {
+			if (null==weeklyVisitNo)	return "0";
+			return weeklyVisitNo;
+		}
+		public void setWeeklyVisitNo(String weeklyVisitNo) {
+			this.weeklyVisitNo = weeklyVisitNo;
+		}
+		public String getWeeklyTelNo() {
+			if (null==weeklyTelNo)	return "0";
+			return weeklyTelNo;
+		}
+		public void setWeeklyTelNo(String weeklyTelNo) {
+			this.weeklyTelNo = weeklyTelNo;
+		}
+		public String getWeeklyFollowNo() {
+			if (null==weeklyFollowNo)	return "0";
+			return weeklyFollowNo;
+		}
+		public void setWeeklyFollowNo(String weeklyFollowNo) {
+			this.weeklyFollowNo = weeklyFollowNo;
+		}
+		public String getMonthVisitNo() {
+			if (null==monthVisitNo)	return "0";
+			return monthVisitNo;
+		}
+		public void setMonthVisitNo(String monthVisitNo) {
+			this.monthVisitNo = monthVisitNo;
+		}
+		public String getMonthTelNo() {
+			if (null==monthTelNo)	return "0";
+			return monthTelNo;
+		}
+		public void setMonthTelNo(String monthTelNo) {
+			this.monthTelNo = monthTelNo;
+		}
+		public String getMonthFollowNo() {
+			if (null==monthFollowNo)	return "0";
+			return monthFollowNo;
+		}
+		public void setMonthFollowNo(String monthFollowNo) {
+			this.monthFollowNo = monthFollowNo;
+		}
 		public String getName() {
+
 			return name;
 		}
 		public void setName(String name) {
@@ -91,10 +165,14 @@ public class marketingESBo {
 		public void setDepartmentNumber(String departmentNumber) {
 			this.departmentNumber = departmentNumber;
 		}
-		public Map<String,Object> getValues() {
-			return values;
+		public String getDayAVG() {
+			if (null==dayAVG) {
+				return "0";
+			}
+			return dayAVG;
 		}
-		public void setValues(Map<String,Object> values) {
-			this.values = values;
+		public void setDayAVG(String dayAVG) {
+			this.dayAVG = dayAVG;
 		}
+		
 }

+ 2 - 5
src/main/java/com/goafanti/report/controller/ReportApiController.java

@@ -197,11 +197,8 @@ public class ReportApiController extends BaseApiController {
 			 res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "日期类型参数参数错误", "日期类型参数"));
 	            return res;
 		}
-	   if (Integer.valueOf(type)==0) {
-			return res.data(reportService.countSometimeMarketingStatistics(depId,timeType,startTime,endTime));
-		}else {
-			return res.data(reportService.countSometimeMarketingDepStatistics(depId,timeType,startTime,endTime));
-		}
+	  return res.data(reportService.countSometimeMarketingStatistics(depId,timeType,startTime,endTime));
+		
 	}
 	
 	

+ 29 - 138
src/main/java/com/goafanti/report/service/SalesReportServiceImpl.java

@@ -1,7 +1,6 @@
 package com.goafanti.report.service;
 
 import java.math.BigDecimal;
-import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.Date;
 import java.util.HashMap;
@@ -9,21 +8,16 @@ import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.stream.Collectors;
-
 import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.time.DateFormatUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.ui.ModelMap;
-
-import com.alibaba.druid.sql.visitor.functions.If;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.DailySalesReportMapper;
 import com.goafanti.common.dao.UserMapper;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.DailySalesReport;
 import com.goafanti.core.mybatis.BaseMybatisDao;
-import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.report.bo.CountDepMarketingStatisticsBo;
 import com.goafanti.report.bo.CountMarketingStatisticsBo;
 import com.goafanti.report.bo.DepartmentSalesReportBO;
@@ -257,156 +251,37 @@ public class SalesReportServiceImpl extends BaseMybatisDao<DailySalesReportMappe
 
 	
 	public List<marketingESBo> marketingStatistics(String depId) {
-		List<marketingESBo> list=salesReportMapper.findmarketingStatisticsList(depId);
 		ReportDate rd = new ReportDate(new Date());
-		for (marketingESBo m : list) {
-				Map<String,Object> map=new HashMap<>();
-				marketingESBo day=userMapper.marketingStatistics(m.getId(),DateFormatUtils.format(rd.getDailyStart(), AFTConstants.YYYYMMDDHHMMSS),DateFormatUtils.format(rd.getDailyEnd(), AFTConstants.YYYYMMDDHHMMSS));
-				Map<String,String> daily =valuesloading(day);
-				map.put("daily", daily);
-				marketingESBo weekly=userMapper.marketingStatistics(m.getId(),DateFormatUtils.format(rd.getWeeklyStart(), AFTConstants.YYYYMMDDHHMMSS),DateFormatUtils.format(rd.getWeeklyEnd(), AFTConstants.YYYYMMDDHHMMSS));
-					Map<String,String> week =valuesloading(weekly);
-					map.put("week", week);
-				marketingESBo month=userMapper.marketingStatistics(m.getId(),DateFormatUtils.format(rd.getMonthStart(), AFTConstants.YYYYMMDDHHMMSS),DateFormatUtils.format(rd.getMonthEnd(), AFTConstants.YYYYMMDDHHMMSS));
-					Map<String,String> months =valuesloading(month);
-					map.put("months", months);
-				marketingESBo year=userMapper.marketingStatistics(m.getId(),DateFormatUtils.format(rd.getYearStart(), AFTConstants.YYYYMMDDHHMMSS),DateFormatUtils.format(rd.getYearEnd(), AFTConstants.YYYYMMDDHHMMSS));
-					Map<String,String> annual =valuesloading(year);
-					map.put("annual", annual);
-				m.setValues(map);
-			}
+		List<marketingESBo> list=salesReportMapper.findmarketingStatisticsList(depId,rd.getStringDailyStart(),rd.getStringDailyEnd(),rd.getStringWeeklyStart(),rd.getStringWeeklyEnd(),
+														rd.getStringMonthStart(),rd.getStringMonthEnd(),rd.getStringYearStart(),rd.getStringYearEnd());
+		
 			return list;
 	}
 
-	
-	private Map<String, String> valuesloading(marketingESBo day) {
-		Map<String, String> map=new HashMap<>();
-		if (null!=day) {
-			map.put("VisitNo", day.getYearVisitNo());
-			map.put("TelNo", day.getYearTelNo());
-			map.put("FollowNo", day.getYearFollowNo());
-		}else {
-			map.put("VisitNo", "0");
-			map.put("TelNo", "0");
-			map.put("FollowNo", "0");
-		}
-		
-		return map;
-	}
 
 	public List<marketingESBo> marketingDepStatistics(String depId) {
-		List<marketingESBo> list=salesReportMapper.marketingDepStatisticsList(depId);
 		ReportDate rd = new ReportDate(new Date());
-			for (marketingESBo m : list) {
-				Map<String,Object> map=new HashMap<>();
-				marketingESBo day=null;
-				if(null!=m.getDepartmentId())day=userMapper.marketingDepStatistics(m.getDepartmentId(),DateFormatUtils.format(rd.getDailyStart(), AFTConstants.YYYYMMDDHHMMSS),DateFormatUtils.format(rd.getDailyEnd(), AFTConstants.YYYYMMDDHHMMSS));
-					Map<String,String> daily =valuesloading(day);
-					if (null==day||null==day.getYearFollowNo()||null==m.getDepartmentNumber()) {
-					daily.put("AVG", "0");
-					}else {
-						daily.put("AVG", calculateAVG(day.getYearFollowNo(),m.getDepartmentNumber()));
-					}
-					map.put("daily", daily);
-				marketingESBo weekly=null;
-				if(null!=m.getDepartmentId())weekly=userMapper.marketingDepStatistics(m.getDepartmentId(),DateFormatUtils.format(rd.getWeeklyStart(), AFTConstants.YYYYMMDDHHMMSS),DateFormatUtils.format(rd.getWeeklyEnd(), AFTConstants.YYYYMMDDHHMMSS));
-					Map<String,String> week =valuesloading(weekly);
-					map.put("week", week);
-				marketingESBo month=null;
-				if(null!=m.getDepartmentId())month=userMapper.marketingDepStatistics(m.getDepartmentId(),DateFormatUtils.format(rd.getMonthStart(), AFTConstants.YYYYMMDDHHMMSS),DateFormatUtils.format(rd.getMonthEnd(), AFTConstants.YYYYMMDDHHMMSS));
-					Map<String,String> months =valuesloading(month);
-					map.put("months", months);
-				marketingESBo year=null;
-				if(null!=m.getDepartmentId())year=userMapper.marketingDepStatistics(m.getDepartmentId(),DateFormatUtils.format(rd.getYearStart(), AFTConstants.YYYYMMDDHHMMSS),DateFormatUtils.format(rd.getYearEnd(), AFTConstants.YYYYMMDDHHMMSS));
-					Map<String,String> annual =valuesloading(year);
-					map.put("annual", annual);
-				m.setValues(map);
-			}
-				
+		List<marketingESBo> list=salesReportMapper.marketingDepStatisticsList(depId,rd.getStringDailyStart(),rd.getStringDailyEnd(),rd.getStringWeeklyStart(),rd.getStringWeeklyEnd(),
+				rd.getStringMonthStart(),rd.getStringMonthEnd(),rd.getStringYearStart(),rd.getStringYearEnd());
+			
 		return list;
 	}
 
 	public CountMarketingStatisticsBo countMarketingStatistics(String depId) {
-		CountMarketingStatisticsBo count=salesReportMapper.privateCustomersCount(depId);
-		if (null==count) {
-			count=new CountMarketingStatisticsBo();
-		}
 		ReportDate rd = new ReportDate(new Date());
-		CountMarketingStatisticsBo d=userMapper.countmarketingDepStatistics(depId,rd.getStringDailyStart(),rd.getStringDailyEnd());
-		if (null!=d.getYearFollowNo()) {
-			count.setDailyFollowNo(d.getYearFollowNo());
-			count.setDailyTelNo(d.getYearTelNo());
-			count.setDailyVisitNo(d.getYearVisitNo());	
-		}
-		CountMarketingStatisticsBo w=userMapper.countmarketingDepStatistics(depId,rd.getStringWeeklyStart(),rd.getStringWeeklyEnd());
-		if (null!=w) {
-		count.setWeeklyFollowNo(w.getYearFollowNo());
-		count.setWeeklyTelNo(w.getYearTelNo());
-		count.setWeeklyVisitNo(w.getYearVisitNo());
-		}
-		CountMarketingStatisticsBo m=userMapper.countmarketingDepStatistics(depId,rd.getStringMonthStart(),rd.getStringMonthEnd());
-		if (null!=d) {
-		count.setMonthFollowNo(m.getYearFollowNo());
-		count.setMonthTelNo(m.getYearTelNo());
-		count.setMonthVisitNo(m.getYearVisitNo());
-		}
-		CountMarketingStatisticsBo y=userMapper.countmarketingDepStatistics(depId,rd.getStringYearStart(),rd.getStringYearEnd());
-		if (null!=d) {
-		count.setYearFollowNo(y.getYearFollowNo());
-		count.setYearTelNo(y.getYearTelNo());
-		count.setYearVisitNo(y.getYearVisitNo());
-		}
+		CountMarketingStatisticsBo count=salesReportMapper.privateCustomersCount(depId,rd.getStringDailyStart(),rd.getStringDailyEnd(),rd.getStringWeeklyStart(),rd.getStringWeeklyEnd(),
+				rd.getStringMonthStart(),rd.getStringMonthEnd(),rd.getStringYearStart(),rd.getStringYearEnd());
 		return count;
 	}
 
 	public CountMarketingStatisticsBo countMarketingDepStatistics(String depId) {
-		
-		CountDepMarketingStatisticsBo count=salesReportMapper.privateCustomersDepCount(depId);
-		if (null==count) {
-			return new CountDepMarketingStatisticsBo();
-		}
 		ReportDate rd = new ReportDate(new Date());
-		CountMarketingStatisticsBo d=userMapper.countmarketingDepStatistics(depId,rd.getStringDailyStart(),rd.getStringDailyEnd());
-		if (null!=d) {
-		count.setDailyFollowNo(d.getYearFollowNo());
-		count.setDailyTelNo(d.getYearTelNo());
-		count.setDailyVisitNo(d.getYearVisitNo());
-		count.setDailyAVG(calculateAVG(count.getDailyFollowNo(),count.getDepartmentNumber()));
-		}
-		CountMarketingStatisticsBo w=userMapper.countmarketingDepStatistics(depId,rd.getStringWeeklyStart(),rd.getStringWeeklyEnd());
-		if (null!=w) {
-		count.setWeeklyFollowNo(w.getYearFollowNo());
-		count.setWeeklyTelNo(w.getYearTelNo());
-		count.setWeeklyVisitNo(w.getYearVisitNo());
-		count.setWeeklyAVG(calculateAVG(count.getWeeklyFollowNo(),count.getDepartmentNumber()));
-		}
-		CountMarketingStatisticsBo m=userMapper.countmarketingDepStatistics(depId,rd.getStringMonthStart(),rd.getStringMonthEnd());
-		if (null!=m) {
-		count.setMonthFollowNo(m.getYearFollowNo());
-		count.setMonthTelNo(m.getYearTelNo());
-		count.setMonthVisitNo(m.getYearVisitNo());
-		count.setMonthAVG(calculateAVG(count.getMonthFollowNo(),count.getDepartmentNumber()));
-		}
-		CountMarketingStatisticsBo y=userMapper.countmarketingDepStatistics(depId,rd.getStringYearStart(),rd.getStringYearEnd());
-		if (null!=y) {
-		count.setYearFollowNo(y.getYearFollowNo());
-		count.setYearTelNo(y.getYearTelNo());
-		count.setYearVisitNo(y.getYearVisitNo());
-		count.setYearAVG(calculateAVG(count.getYearFollowNo(),count.getDepartmentNumber()));
-		}
+		CountMarketingStatisticsBo count=salesReportMapper.privateCustomersDepCount(depId,rd.getStringDailyStart(),rd.getStringDailyEnd(),rd.getStringWeeklyStart(),rd.getStringWeeklyEnd(),
+				rd.getStringMonthStart(),rd.getStringMonthEnd(),rd.getStringYearStart(),rd.getStringYearEnd());
+		
 		return count;
 	}
 
-	public String calculateAVG(String a, String b) {
-		if (StringUtils.isNumeric(a)&&StringUtils.isNumeric(b)) {
-			if ((float)Integer.valueOf(a)==0||(float)Integer.valueOf(b)==0)return "0"; 
-			float f=(float)Integer.valueOf(a)/(float)Integer.valueOf(b);
-			return String.valueOf(f);	
-		}else {
-			return"0";
-		}
-	}
-
 	public List<SomeTimeMarketingBo> sometimeMarketingStatistics(String depId, Integer timeType, String startTime, String endTime) {
 		List<SomeTimeMarketingBo> list = null;
 		ReportDate rd = new ReportDate(new Date());
@@ -471,8 +346,24 @@ public class SalesReportServiceImpl extends BaseMybatisDao<DailySalesReportMappe
 
 	public SomeTimeMarketingBo countSometimeMarketingDepStatistics(String depId, Integer timeType, String startTime,
 			String endTime) {
-		
-		return null;
+
+		ReportDate rd = new ReportDate(new Date());
+		if (TimeType.WEEKLY.getCode()==timeType) {
+			return salesReportMapper.countsometimeMarketingDepStatistics(depId,rd.getStringWeeklyStart(),rd.getStringWeeklyEnd());
+		}
+		if (TimeType.MONTH.getCode()==timeType) {
+			return salesReportMapper.countsometimeMarketingDepStatistics(depId,rd.getStringMonthStart(),rd.getStringMonthEnd());
+		}
+		if (TimeType.QTR.getCode()==timeType) {
+			return salesReportMapper.countsometimeMarketingDepStatistics(depId,rd.getStringQuarterStart(),rd.getStringQuarterEnd());
+		}
+		if (TimeType.YEAR.getCode()==timeType) {
+			return salesReportMapper.countsometimeMarketingDepStatistics(depId,rd.getStringYearStart(),rd.getStringYearEnd());
+		}
+		if (TimeType.ZS.getCode()==timeType) {
+			return salesReportMapper.countsometimeMarketingDepStatistics(depId,startTime,endTime);
+		}
+			return null;
 	}
 	
 

+ 8 - 0
src/main/java/com/goafanti/techproject/bo/TaskDetailBo.java

@@ -39,6 +39,8 @@ public class TaskDetailBo{
 	private String salesmanName;
 	/** 订单留言 **/
 	private String orderRemarks;
+	/** 订单部门 **/
+	private String departmentName;
 	
 	private Integer publishStatus;
 	
@@ -162,4 +164,10 @@ public class TaskDetailBo{
 	public void setPublishStatus(Integer publishStatus) {
 		this.publishStatus = publishStatus;
 	}
+	public String getDepartmentName() {
+		return departmentName;
+	}
+	public void setDepartmentName(String departmentName) {
+		this.departmentName = departmentName;
+	}
 }

+ 7 - 0
src/main/java/com/goafanti/techproject/bo/TaskListBo.java

@@ -4,6 +4,7 @@ package com.goafanti.techproject.bo;
 public class TaskListBo{
 	private String taskId;
 	private String technicianName;
+	private String technicianMobile;
 	private String taskDistributionTimes;
 	private String taskNo;
 	private Integer taskStatus;
@@ -128,4 +129,10 @@ public class TaskListBo{
 	public void setSalesmanName(String salesmanName) {
 		this.salesmanName = salesmanName;
 	}
+	public String getTechnicianMobile() {
+		return technicianMobile;
+	}
+	public void setTechnicianMobile(String technicianMobile) {
+		this.technicianMobile = technicianMobile;
+	}
 }

+ 1 - 1
src/main/resources/props/config_local.properties

@@ -40,7 +40,7 @@ jdbc.filters=stat
 
 logging.level.com.goafanti=DEBUG
 
-jedis.host=192.168.1.213
+jedis.host=127.0.0.1
 jedis.port=6379
 jedis.timeout=5000
 jedis.password=aft123456

+ 1 - 1
src/main/resources/props/config_test.properties

@@ -1,7 +1,7 @@
 #Driver
 jdbc.driverClassName=com.mysql.jdbc.Driver
 #\u6570\u636e\u5e93\u94fe\u63a5\uff0c
-jdbc.url=jdbc:mysql://127.0.0.1:3306/aft?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
+jdbc.url=jdbc:mysql://127.0.0.1:3306/aft20180522?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
 #\u5e10\u53f7
 jdbc.username=root
 #\u5bc6\u7801

+ 2 - 2
src/main/resources/spring/spring-shiro.xml

@@ -116,9 +116,9 @@
 		<!-- class="org.apache.shiro.web.session.mgt.DefaultWebSessionManager"> -->
 		<property name="sessionIdUrlRewritingEnabled" value="false" />
 		<!-- -->
-		<property name="sessionValidationInterval" value="1800000" />
+		<property name="sessionValidationInterval" value="3600000" />
 		<!-- -->
-		<property name="globalSessionTimeout" value="1800000" />
+		<property name="globalSessionTimeout" value="3600000" />
 		<property name="sessionDAO" ref="enterpriseCacheSessionDAO" />
 		<property name="cacheManager" ref="shrioRedisCacheManager" />
 		<!-- session -->

+ 1 - 0
src/main/webapp/WEB-INF/web.xml

@@ -123,4 +123,5 @@
 		<error-code>500</error-code>
 		<location>/WEB-INF/views/error.jsp</location>
 	</error-page>
+	
 </web-app>