Commit 75833914 by yao.xiao

增加-AGMS预测总量

parent 1bccbaf3
...@@ -2,10 +2,7 @@ package com.yd.api.agms; ...@@ -2,10 +2,7 @@ package com.yd.api.agms;
import com.yd.api.agms.service.AgmsDashboardService; import com.yd.api.agms.service.AgmsDashboardService;
import com.yd.api.agms.service.AgmsStatementService; import com.yd.api.agms.service.AgmsStatementService;
import com.yd.api.agms.vo.dashboard.StatisticsOpportunityRequestVO; import com.yd.api.agms.vo.dashboard.*;
import com.yd.api.agms.vo.dashboard.StatisticsOpportunityResponseVO;
import com.yd.api.agms.vo.dashboard.StatisticsPEPRequestVO;
import com.yd.api.agms.vo.dashboard.StatisticsPEPResponseVO;
import com.yd.api.agms.vo.statement.FinancialStatementRequestVO; import com.yd.api.agms.vo.statement.FinancialStatementRequestVO;
import com.yd.api.agms.vo.statement.FinancialStatementResponseVO; import com.yd.api.agms.vo.statement.FinancialStatementResponseVO;
import com.yd.api.result.JsonResult; import com.yd.api.result.JsonResult;
...@@ -41,7 +38,7 @@ public class AgmsController { ...@@ -41,7 +38,7 @@ public class AgmsController {
} }
/** /**
* AGMS -- Dashboard查询 寿险整体运营->PEP活动管理(根据公司) * AGMS -- Dashboard查询 PEP活动管理
* @param requestVO 请求数据 * @param requestVO 请求数据
* @return 响应数据 * @return 响应数据
*/ */
...@@ -55,7 +52,7 @@ public class AgmsController { ...@@ -55,7 +52,7 @@ public class AgmsController {
} }
/** /**
* AGMS -- Dashboard查询 寿险整体运营->商机预测(根据公司) * AGMS -- Dashboard查询 商机预测
* @param requestVO 请求数据 * @param requestVO 请求数据
* @return 响应数据 * @return 响应数据
*/ */
...@@ -67,4 +64,18 @@ public class AgmsController { ...@@ -67,4 +64,18 @@ public class AgmsController {
result.setData(responseVO); result.setData(responseVO);
return result; return result;
} }
/**
* AGMS -- Dashboard查询 预测统计查询
* @param requestVO 请求数据
* @return 响应数据
*/
@RequestMapping("/statisticsForecastTotal")
public Object statisticsForecastTotal(@RequestBody StatisticsForecastTotalRequestVO requestVO){
JsonResult result = new JsonResult();
StatisticsForecastTotalResponseVO responseVO = agmsDashboardService.statisticsForecastTotal(requestVO);
result.addResult(responseVO);
result.setData(responseVO);
return result;
}
} }
package com.yd.api.agms.service; package com.yd.api.agms.service;
import com.yd.api.agms.vo.dashboard.StatisticsOpportunityRequestVO; import com.yd.api.agms.vo.dashboard.*;
import com.yd.api.agms.vo.dashboard.StatisticsOpportunityResponseVO;
import com.yd.api.agms.vo.dashboard.StatisticsPEPRequestVO;
import com.yd.api.agms.vo.dashboard.StatisticsPEPResponseVO;
public interface AgmsDashboardService { public interface AgmsDashboardService {
/** /**
* AGMS -- Dashboard查询 寿险整体运营->PEP活动管理(根据公司) * AGMS -- Dashboard查询 PEP活动管理
* @param requestVO 请求数据 * @param requestVO 请求数据
* @return 响应数据 * @return 响应数据
*/ */
StatisticsPEPResponseVO statisticsPEP(StatisticsPEPRequestVO requestVO); StatisticsPEPResponseVO statisticsPEP(StatisticsPEPRequestVO requestVO);
/** /**
* AGMS -- Dashboard查询 寿险整体运营->商机预测(根据公司) * AGMS -- Dashboard查询 商机预测
* @param requestVO 请求数据 * @param requestVO 请求数据
* @return 响应数据 * @return 响应数据
*/ */
StatisticsOpportunityResponseVO statisticsOpportunity(StatisticsOpportunityRequestVO requestVO); StatisticsOpportunityResponseVO statisticsOpportunity(StatisticsOpportunityRequestVO requestVO);
/**
* AGMS -- Dashboard查询 预测统计查询
* @param requestVO 请求数据
* @return 响应数据
*/
StatisticsForecastTotalResponseVO statisticsForecastTotal(StatisticsForecastTotalRequestVO requestVO);
} }
package com.yd.api.agms.service.impl; package com.yd.api.agms.service.impl;
import com.yd.api.agms.service.AgmsDashboardService; import com.yd.api.agms.service.AgmsDashboardService;
import com.yd.api.agms.vo.dashboard.StatisticsOpportunityRequestVO; import com.yd.api.agms.vo.dashboard.*;
import com.yd.api.agms.vo.dashboard.StatisticsOpportunityResponseVO;
import com.yd.api.agms.vo.dashboard.StatisticsPEPRequestVO;
import com.yd.api.agms.vo.dashboard.StatisticsPEPResponseVO;
import com.yd.api.result.CommonResult; import com.yd.api.result.CommonResult;
import com.yd.dal.entity.agms.dashboard.StatisticsOpportunityInfo; import com.yd.dal.entity.agms.dashboard.StatisticsOpportunityInfo;
import com.yd.dal.entity.agms.dashboard.StatisticsPEPInfo; import com.yd.dal.entity.agms.dashboard.StatisticsPEPInfo;
...@@ -27,7 +24,7 @@ public class AgmsDashboardServiceImpl implements AgmsDashboardService { ...@@ -27,7 +24,7 @@ public class AgmsDashboardServiceImpl implements AgmsDashboardService {
@Override @Override
public StatisticsPEPResponseVO statisticsPEP(StatisticsPEPRequestVO requestVO) { public StatisticsPEPResponseVO statisticsPEP(StatisticsPEPRequestVO requestVO) {
//AGMS -- Dashboard查询 寿险整体运营->PEP活动管理(根据公司) //AGMS -- Dashboard查询 PEP活动管理
StatisticsPEPResponseVO responseVO = new StatisticsPEPResponseVO(); StatisticsPEPResponseVO responseVO = new StatisticsPEPResponseVO();
MdDropOptions mdDropOptions = mdDropOptionsDALService.selectByMasterCodeAndOptionsCode("bizchance_promotion_action","refused"); MdDropOptions mdDropOptions = mdDropOptionsDALService.selectByMasterCodeAndOptionsCode("bizchance_promotion_action","refused");
List<StatisticsPEPInfo> statisticsPEPInfos = agmsDashboardDALService.statisticsPEP(requestVO.getType(),mdDropOptions.getId()); List<StatisticsPEPInfo> statisticsPEPInfos = agmsDashboardDALService.statisticsPEP(requestVO.getType(),mdDropOptions.getId());
...@@ -38,6 +35,7 @@ public class AgmsDashboardServiceImpl implements AgmsDashboardService { ...@@ -38,6 +35,7 @@ public class AgmsDashboardServiceImpl implements AgmsDashboardService {
@Override @Override
public StatisticsOpportunityResponseVO statisticsOpportunity(StatisticsOpportunityRequestVO requestVO) { public StatisticsOpportunityResponseVO statisticsOpportunity(StatisticsOpportunityRequestVO requestVO) {
//AGMS -- Dashboard查询 商机预测
StatisticsOpportunityResponseVO responseVO = new StatisticsOpportunityResponseVO(); StatisticsOpportunityResponseVO responseVO = new StatisticsOpportunityResponseVO();
MdDropOptions mdDropOptions = mdDropOptionsDALService.selectByMasterCodeAndOptionsCode("bizchance_promotion_action","refused"); MdDropOptions mdDropOptions = mdDropOptionsDALService.selectByMasterCodeAndOptionsCode("bizchance_promotion_action","refused");
List<StatisticsOpportunityInfo> statisticsOpportunityInfos = agmsDashboardDALService.statisticsOpportunity(requestVO.getType(),requestVO.getTime(),mdDropOptions.getId()); List<StatisticsOpportunityInfo> statisticsOpportunityInfos = agmsDashboardDALService.statisticsOpportunity(requestVO.getType(),requestVO.getTime(),mdDropOptions.getId());
...@@ -45,4 +43,45 @@ public class AgmsDashboardServiceImpl implements AgmsDashboardService { ...@@ -45,4 +43,45 @@ public class AgmsDashboardServiceImpl implements AgmsDashboardService {
responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000"))); responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
return responseVO; return responseVO;
} }
@Override
public StatisticsForecastTotalResponseVO statisticsForecastTotal(StatisticsForecastTotalRequestVO requestVO) {
//AGMS -- Dashboard查询 预测统计查询
StatisticsForecastTotalResponseVO responseVO = new StatisticsForecastTotalResponseVO();
MdDropOptions mdDropOptions = mdDropOptionsDALService.selectByMasterCodeAndOptionsCode("bizchance_promotion_action","refused");
List<StatisticsOpportunityInfo> statisticsOpportunityInfos = agmsDashboardDALService.statisticsOpportunity("total",requestVO.getTime(),mdDropOptions.getId());
List<StatisticsPEPInfo> statisticsPEPInfos = agmsDashboardDALService.statisticsPEP("total",mdDropOptions.getId());
if (!statisticsOpportunityInfos.isEmpty()){
StatisticsOpportunityInfo statisticsOpportunityInfo = statisticsOpportunityInfos.get(0);
responseVO.setOpportunityNum(statisticsOpportunityInfo.getOpportunityNum());
responseVO.setPredictFYC(statisticsOpportunityInfo.getPredictFYC());
responseVO.setPredictFYP(statisticsOpportunityInfo.getPredictFYP());
responseVO.setPieces(statisticsOpportunityInfo.getOpportunityNum());
}
if (!statisticsPEPInfos.isEmpty()){
StatisticsPEPInfo statisticsPEPInfo = statisticsPEPInfos.get(0);
String time = requestVO.getTime();
switch (time.toLowerCase()){
case ("d"):
responseVO.setScore(statisticsPEPInfo.getScoreDay());
break;
case ("w"):
responseVO.setScore(statisticsPEPInfo.getScoreWeek());
break;
case ("m"):
responseVO.setScore(statisticsPEPInfo.getScoreMonth());
break;
case ("q"):
responseVO.setScore(statisticsPEPInfo.getScoreQuarter());
break;
case ("y"):
responseVO.setScore(statisticsPEPInfo.getScoreYear());
break;
}
}
responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
return responseVO;
}
} }
package com.yd.api.agms.vo.dashboard;
import lombok.Data;
@Data
public class StatisticsForecastTotalRequestVO {
private String time;//D:今天 W:周 M:月 Q:季度 Y:年
}
package com.yd.api.agms.vo.dashboard;
import com.yd.api.result.CommonResult;
import lombok.Data;
@Data
public class StatisticsForecastTotalResponseVO {
private Long opportunityNum;
private Double predictFYC;
private Double predictFYP;
private Long pieces;
private Double score;
private CommonResult commonResult;
}
...@@ -10,5 +10,7 @@ public class StatisticsPEPInfo { ...@@ -10,5 +10,7 @@ public class StatisticsPEPInfo {
private Double scoreDay; private Double scoreDay;
private Double scoreWeek; private Double scoreWeek;
private Double scoreMonth; private Double scoreMonth;
private Double scoreQuarter;
private Double scoreYear;
private Double scoreTotal; private Double scoreTotal;
} }
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
sum(case when to_days(t.track_time)=to_days(now()) then t.track_score else 0 end)/count(p.id) scoreDay, sum(case when to_days(t.track_time)=to_days(now()) then t.track_score else 0 end)/count(p.id) scoreDay,
sum(case when YEARWEEK(date_format(t.track_time,'%Y-%m-%d')) = YEARWEEK(now()) then t.track_score else 0 end)/count(p.id) scoreWeek, sum(case when YEARWEEK(date_format(t.track_time,'%Y-%m-%d')) = YEARWEEK(now()) then t.track_score else 0 end)/count(p.id) scoreWeek,
sum(case when date_format(t.track_time,'%Y-%m')=date_format(now(),'%Y-%m') then t.track_score else 0 end)/count(p.id) scoreMonth, sum(case when date_format(t.track_time,'%Y-%m')=date_format(now(),'%Y-%m') then t.track_score else 0 end)/count(p.id) scoreMonth,
sum(case when QUARTER(t.track_time)=QUARTER(now()) then t.track_score else 0 end)/count(p.id) scoreQuarter,
sum(case when YEAR(t.track_time)=YEAR(now()) then t.track_score else 0 end)/count(p.id) scoreYear,
sum(case when t.track_score is not null then t.track_score else 0 end)/count(p.id) scoreTotal sum(case when t.track_score is not null then t.track_score else 0 end)/count(p.id) scoreTotal
from ag_acl_practitioner p from ag_acl_practitioner p
left join ag_mkt_leads_assigneds a on p.id = a.assigned_practitioner_id left join ag_mkt_leads_assigneds a on p.id = a.assigned_practitioner_id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment