Commit 9d8faaf1 by Water Wang

add dashboard sales all

parent 10b70a35
...@@ -106,4 +106,5 @@ public class AgmsController { ...@@ -106,4 +106,5 @@ public class AgmsController {
result.setData(responseVO); result.setData(responseVO);
return result; return result;
} }
} }
...@@ -14,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -14,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Service("agmsDashboardService") @Service("agmsDashboardService")
...@@ -93,20 +95,56 @@ public class AgmsDashboardServiceImpl implements AgmsDashboardService { ...@@ -93,20 +95,56 @@ public class AgmsDashboardServiceImpl implements AgmsDashboardService {
String category = requestVO.getCategory(); String category = requestVO.getCategory();
String time = requestVO.getTime(); String time = requestVO.getTime();
String type = requestVO.getType(); String type = requestVO.getType();
category = Strings.isNullOrEmpty(category) ? "PC" : category; category = Strings.isNullOrEmpty(category) ? "all" : category;
time = Strings.isNullOrEmpty(time) ? "m" : time; time = Strings.isNullOrEmpty(time) ? "m" : time;
type = Strings.isNullOrEmpty(type) ? "b" : type; type = Strings.isNullOrEmpty(type) ? "b" : type;
List<StatisticsSalesInfo> statisticsSalesInfos; List<StatisticsSalesInfo> statisticsSalesInfos;
if("life".equals(category)){//寿险 if("life".equals(category)){//寿险
statisticsSalesInfos = agmsDashboardDALService.statisticsSalesEG(type,time); statisticsSalesInfos = agmsDashboardDALService.statisticsSalesEG(type,time);
}else{//产险 }else if("pc".equals(category)){//产险
statisticsSalesInfos = agmsDashboardDALService.statisticsSalesYD(type,time); statisticsSalesInfos = agmsDashboardDALService.statisticsSalesYD(type,time);
}else{
statisticsSalesInfos = getAll(type,time);
} }
responseVO.setStatisticsSalesInfos(statisticsSalesInfos); responseVO.setStatisticsSalesInfos(statisticsSalesInfos);
responseVO.setCommonResult(new CommonResult(true,ZHBErrorConfig.getErrorInfo("800000"))); responseVO.setCommonResult(new CommonResult(true,ZHBErrorConfig.getErrorInfo("800000")));
return responseVO; return responseVO;
} }
/**
* dashBoard -- 寿险+产险销售统计
* @param type 类型
* @param time 时间
* @return 数据
*/
private List<StatisticsSalesInfo> getAll(String type, String time) {
StatisticsSalesInfo statisticsSalesInfo = new StatisticsSalesInfo();
List<StatisticsSalesInfo> statisticsSalesInfos = new ArrayList<>();
String unitPremium = "0";
double fyp = 0D,fyc = 0D;
Integer pieces = 0;
List<StatisticsSalesInfo> statisticsSalesInfosLife = agmsDashboardDALService.statisticsSalesEG(type,time);
List<StatisticsSalesInfo> statisticsSalesInfosPC = agmsDashboardDALService.statisticsSalesYD(type,time);
statisticsSalesInfosLife.addAll(statisticsSalesInfosPC);
if(statisticsSalesInfosLife.size() > 0){
for(StatisticsSalesInfo item : statisticsSalesInfosLife){
fyp += Double.parseDouble(item.getFyp());
fyc += Double.parseDouble(item.getFyc());
pieces += item.getPieces();
}
if(pieces != 0){
unitPremium = BigDecimal.valueOf(fyp / pieces).setScale(2,BigDecimal.ROUND_HALF_UP).toString();
}
}
statisticsSalesInfo.setFyc(new DecimalFormat("0.00").format(fyc));
statisticsSalesInfo.setFyp(new DecimalFormat("0.00").format(fyp));
statisticsSalesInfo.setPieces(pieces);
statisticsSalesInfo.setUnitPremium(unitPremium);
statisticsSalesInfo.setTypeName("寿险+财险");
statisticsSalesInfos.add(statisticsSalesInfo);
return statisticsSalesInfos;
}
@Override @Override
public StatisticsPractitionerResponseVO statisticsPractitioner(StatisticsPractitionerRequestVO requestVO) { public StatisticsPractitionerResponseVO statisticsPractitioner(StatisticsPractitionerRequestVO requestVO) {
StatisticsPractitionerResponseVO responseVO = new StatisticsPractitionerResponseVO(); StatisticsPractitionerResponseVO responseVO = new StatisticsPractitionerResponseVO();
......
...@@ -3,7 +3,7 @@ package com.yd.api.agms.vo.dashboard; ...@@ -3,7 +3,7 @@ package com.yd.api.agms.vo.dashboard;
public class StatisticsSalesRequestVO { public class StatisticsSalesRequestVO {
private String type;// d:整体,t:团体 private String type;// d:整体,t:团体
private String time;//d:天,w:周,m:月,q:季,y:年 private String time;//d:天,w:周,m:月,q:季,y:年
private String category;//life:寿险,pc:财险 private String category;//life:寿险,pc:财险,all:全部
public String getType() { public String getType() {
return type; return type;
......
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