Commit abe44b0f by yao.xiao

增加-经纪人完成率

parent 51d92659
...@@ -62,6 +62,8 @@ import java.net.URLEncoder; ...@@ -62,6 +62,8 @@ import java.net.URLEncoder;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.List; import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@Service("practitionerService") @Service("practitionerService")
public class PractitionerServiceImpl implements com.yd.api.practitioner.service.PractitionerService { public class PractitionerServiceImpl implements com.yd.api.practitioner.service.PractitionerService {
...@@ -1327,7 +1329,38 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -1327,7 +1329,38 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
} }
//计算新增商机个数 //计算新增商机个数
List<MktLeadsAssigneds> mktLeadsAssigneds = mktLeadsAssignedsDALService.findByPractitionerIdAndThisWeek(requestVO.getPractitionerId()); List<MktLeadsAssigneds> mktLeadsAssigneds = mktLeadsAssignedsDALService.findByPractitionerIdAndThisWeek(requestVO.getPractitionerId());
//计算经纪人目标得分
MktLeadsGoalsActions mktLeadsGoalsActions = new MktLeadsGoalsActions();
mktLeadsGoalsActions.setPractitionerId(requestVO.getPractitionerId());
//当前年份
Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR);
mktLeadsGoalsActions.setCurrentYear(year);
mktLeadsGoalsActions.setIsActive(1);
List<MktLeadsGoalsActions> leadsGoalsActions = mktLeadsGoalsActionsDALService.findByMktLeadsGoalsActions(mktLeadsGoalsActions);
if (!leadsGoalsActions.isEmpty()){
List<MdDropOptions> mdDropOptionsList = mdDropOptionsDALService.findByDropMasterCode("bizchance_promotion_action");
ConcurrentMap<Long,Integer> optionScoreMap = new ConcurrentHashMap<>();
for (MdDropOptions info : mdDropOptionsList){
optionScoreMap.put(info.getId(),info.getDropOptionScore());
}
Integer targetScoreMonth = 0;
for (MktLeadsGoalsActions info : leadsGoalsActions){
Long leadsActionId = info.getLeadsActionId();
Integer singleScore = optionScoreMap.get(leadsActionId);
targetScoreMonth += singleScore * info.getActionStandards();
}
Double achievementRateMonth = BigDecimal.valueOf(scoreMonth)
.divide(BigDecimal.valueOf(targetScoreMonth),1,BigDecimal.ROUND_HALF_UP)
.doubleValue();
Double achievementRateWeek = BigDecimal.valueOf(scoreWeek)
.divide(BigDecimal.valueOf(targetScoreMonth),1,BigDecimal.ROUND_HALF_UP)
.multiply(BigDecimal.valueOf(12))
.divide(BigDecimal.valueOf(52),1,BigDecimal.ROUND_HALF_UP)
.doubleValue();
resp.setAchievementRateMonth(achievementRateMonth);
resp.setAchievementRateWeek(achievementRateWeek);
}
resp.setScoreDay(scoreDay); resp.setScoreDay(scoreDay);
resp.setScoreWeek(scoreWeek); resp.setScoreWeek(scoreWeek);
resp.setScoreMonth(scoreMonth); resp.setScoreMonth(scoreMonth);
......
...@@ -8,7 +8,8 @@ public class OpportunityStatisticsResponseVO { ...@@ -8,7 +8,8 @@ public class OpportunityStatisticsResponseVO {
private Integer scoreDay; private Integer scoreDay;
private Integer scoreWeek; private Integer scoreWeek;
private Integer scoreMonth; private Integer scoreMonth;
private Double achievementRate; private Double achievementRateMonth;
private Double achievementRateWeek;
private Integer addOpportunityNum; private Integer addOpportunityNum;
private CommonResult commonResult; private CommonResult commonResult;
} }
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