|
|
|
@ -693,7 +693,20 @@ public class BDPrizeServiceImpl implements BDPrizeService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<JSONObject> getBDTeamKpiCompletionDegree(String month) {
|
|
|
|
|
List<JSONObject> prizeAmountAndBdTypeList = financialBDPrizeLogMapper.findBdPrizeAmountAndBdType(getReportByMonth(month));
|
|
|
|
|
JSONObject report = financialBDPrizeRecordMapper.findByMonth(month);
|
|
|
|
|
List<JSONObject> prizeAmountAndBdTypeList = new ArrayList<>();
|
|
|
|
|
if (report == null) {
|
|
|
|
|
try {
|
|
|
|
|
Date start_date = DateUtils.parseDate(month+"-01","yyyy-MM-dd");
|
|
|
|
|
Date end_date = DateUtils.addMonths(start_date,1);
|
|
|
|
|
prizeAmountAndBdTypeList = financialBDPrizeLogMapper.findBdPrizeAmountRealTime(start_date,end_date);
|
|
|
|
|
} catch (ParseException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
prizeAmountAndBdTypeList = financialBDPrizeLogMapper.findBdPrizeAmountAndBdType(getReportByMonth(month));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (JSONObject prize : prizeAmountAndBdTypeList) {
|
|
|
|
|
BigDecimal kpi = financialBDCommissionConfigMapper.findCurrentCommissionMaxAmount(month, prize.getIntValue("bd_type"));
|
|
|
|
|
prize.put("kpi", kpi);
|
|
|
|
@ -707,12 +720,36 @@ public class BDPrizeServiceImpl implements BDPrizeService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<JSONObject> getBDProportionByTeamType(String month, String teamType) {
|
|
|
|
|
return financialBDConfigMapper.findManagerByTeamType(teamType, getReportByMonth(month));
|
|
|
|
|
JSONObject report = financialBDPrizeRecordMapper.findByMonth(month);
|
|
|
|
|
if (report == null) {
|
|
|
|
|
try {
|
|
|
|
|
Date start_date = DateUtils.parseDate(month+"-01","yyyy-MM-dd");
|
|
|
|
|
Date end_date = DateUtils.addMonths(start_date,1);
|
|
|
|
|
return financialBDConfigMapper.findManagerByTeamTypeRealTime(teamType,start_date,end_date);
|
|
|
|
|
} catch (ParseException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
throw new BadRequestException("Month is wrong");
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
return financialBDConfigMapper.findManagerByTeamType(teamType, getReportByMonth(month));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject getBDKpiByManagerId(String month, String manager_id) {
|
|
|
|
|
return financialBDPrizeLogMapper.findByReportAndBDTotal(getReportByMonth(month), manager_id);
|
|
|
|
|
JSONObject report = financialBDPrizeRecordMapper.findByMonth(month);
|
|
|
|
|
if (report == null) {
|
|
|
|
|
try {
|
|
|
|
|
Date start_date = DateUtils.parseDate(month+"-01","yyyy-MM-dd");
|
|
|
|
|
Date end_date = DateUtils.addMonths(start_date,1);
|
|
|
|
|
return financialBDPrizeLogMapper.findByReportAndBDTotalRealTime(manager_id,start_date,end_date);
|
|
|
|
|
} catch (ParseException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
throw new BadRequestException("Month is wrong");
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
return financialBDPrizeLogMapper.findByReportAndBDTotal(getReportByMonth(month), manager_id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getReportByMonth(String month) {
|
|
|
|
|