Browse Source

营销日统计报表

anderx 7 years ago
parent
commit
3ad83d94e4

+ 2 - 0
src/main/java/com/goafanti/common/dao/DailySalesReportMapper.java

@@ -62,4 +62,6 @@ public interface DailySalesReportMapper {
 	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);
 }

+ 26 - 0
src/main/java/com/goafanti/common/mapper/DailySalesReportMapper.xml

@@ -326,4 +326,30 @@ select a.id,a.name,d.name as departmentName,role_name as roleName,ifnull(e.telNo
 	</if>
 	group by a.department_id
 	</select>
+	<select id="countsometimeMarketingStatistics" 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
+			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="depId != null">
+		and a.department_id= #{depId,jdbcType=VARCHAR}
+		</if>
+	</select>
 </mapper>

+ 3 - 7
src/main/java/com/goafanti/report/controller/ReportApiController.java

@@ -148,10 +148,7 @@ public class ReportApiController extends BaseApiController {
 			return res.data(reportService.countMarketingDepStatistics(depId));
 		}
 	}
-	public static void main(String[] args) {
-		int timeType = 0;
-		boolean a=(timeType==5);
-	}
+	
 	/**
 	 * 客户营销时段统计表
 	 * @param depId
@@ -200,12 +197,11 @@ public class ReportApiController extends BaseApiController {
 			 res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "日期类型参数参数错误", "日期类型参数"));
 	            return res;
 		}
-	   return res;
-		/*if (Integer.valueOf(type)==0) {
+	   if (Integer.valueOf(type)==0) {
 			return res.data(reportService.countSometimeMarketingStatistics(depId,timeType,startTime,endTime));
 		}else {
 			return res.data(reportService.countSometimeMarketingDepStatistics(depId,timeType,startTime,endTime));
-		}*/
+		}
 	}
 	
 	

+ 26 - 0
src/main/java/com/goafanti/report/service/SalesReportServiceImpl.java

@@ -437,6 +437,32 @@ public class SalesReportServiceImpl extends BaseMybatisDao<DailySalesReportMappe
 		}
 		return list;
 	}
+
+	public SomeTimeMarketingBo countSometimeMarketingStatistics(String depId, Integer timeType, String startTime, String endTime) {
+		ReportDate rd = new ReportDate(new Date());
+		if (TimeType.WEEKLY.getCode()==timeType) {
+			return salesReportMapper.countsometimeMarketingStatistics(depId,rd.getStringWeeklyStart(),rd.getStringWeeklyEnd());
+		}
+		if (TimeType.MONTH.getCode()==timeType) {
+			return salesReportMapper.countsometimeMarketingStatistics(depId,rd.getStringMonthStart(),rd.getStringMonthEnd());
+		}
+		if (TimeType.QTR.getCode()==timeType) {
+			return salesReportMapper.countsometimeMarketingStatistics(depId,rd.getStringQuarterStart(),rd.getStringQuarterEnd());
+		}
+		if (TimeType.YEAR.getCode()==timeType) {
+			return salesReportMapper.countsometimeMarketingStatistics(depId,rd.getStringYearStart(),rd.getStringYearEnd());
+		}
+		if (TimeType.ZS.getCode()==timeType) {
+			return salesReportMapper.countsometimeMarketingStatistics(depId,startTime,endTime);
+		}
+		return null;
+	}
+
+	public SomeTimeMarketingBo countSometimeMarketingDepStatistics(String depId, Integer timeType, String startTime,
+			String endTime) {
+		
+		return null;
+	}
 	
 
 }