Browse Source

营销报表时段统计接口开发

anderx 7 years ago
parent
commit
ab15d9d8d7

+ 15 - 4
src/main/java/com/goafanti/common/mapper/DailySalesReportMapper.xml

@@ -497,7 +497,7 @@ group by m.department_id
 
 
 <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">
 	,e.followNo/datediff(#{endTime,jdbcType=VARCHAR},#{startTime,jdbcType=VARCHAR}) as dayAVG
@@ -538,7 +538,12 @@ select a.id,a.name,d.name as departmentName,role_name as roleName,ifnull(e.telNo
  		<if test="startTime !=null and endTime !=null">
 			,x.followNo/datediff(#{endTime,jdbcType=VARCHAR},#{startTime,jdbcType=VARCHAR}) as dayAVG
 		</if>
-	 from (select b.department_id as departmentId,sum(a.followNo) as followNo,sum(a.visitNo)as visitNo,sum(a.telNo)as telNo
+	 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 ('营销员','营销经理','营销管理员')
+	  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,
@@ -564,7 +569,7 @@ select a.id,a.name,d.name as departmentName,role_name as roleName,ifnull(e.telNo
 	and b.department_id=#{depId,jdbcType=VARCHAR}
 	</if>
 	GROUP by b.department_id
-) x left join department_management z on x.departmentId=z.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">
@@ -579,7 +584,7 @@ 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 A
+			,count( 0 )/datediff(#{endTime,jdbcType=VARCHAR},#{startTime,jdbcType=VARCHAR}) as dayAVG
 			</if>
 		from
 			user_follow a left join admin b on
@@ -589,6 +594,12 @@ select a.id,a.name,d.name as departmentName,role_name as roleName,ifnull(e.telNo
 			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 a.department_id= #{depId,jdbcType=VARCHAR}
 		</if>

+ 3 - 0
src/main/java/com/goafanti/report/bo/SomeTimeMarketingBo.java

@@ -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) {

+ 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));
+		
 	}
 	
 	

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

@@ -123,4 +123,7 @@
 		<error-code>500</error-code>
 		<location>/WEB-INF/views/error.jsp</location>
 	</error-page>
+	<session-config>
+		<session-timeout>60</session-timeout>
+	</session-config>
 </web-app>