use of com.netsteadfast.greenstep.po.hbm.BbMeasureData in project bamboobsc by billchen198318.
the class MeasureDataLogicServiceImpl method delete.
private void delete(KpiVO kpi, String date, String frequency, String organizationId, String employeeId) throws ServiceException, Exception {
Map<String, Object> params = new HashMap<String, Object>();
Map<String, String> likeParams = new HashMap<String, String>();
params.put("kpiId", kpi.getId());
params.put("frequency", frequency);
params.put("orgId", organizationId);
params.put("empId", employeeId);
likeParams.put("date", date + "%");
List<BbMeasureData> searchList = this.measureDataService.findListByParams(params, likeParams);
if (searchList == null || searchList.size() < 1) {
return;
}
for (BbMeasureData measureData : searchList) {
this.measureDataService.delete(measureData);
}
}
use of com.netsteadfast.greenstep.po.hbm.BbMeasureData in project bamboobsc by billchen198318.
the class PersonalAndOrganizationReportDateRangeScoreCommand method setDateRangeScore.
private void setDateRangeScore(KpiVO kpi, String dateType, String year) throws Exception {
float score = 0.0f;
// year
String date = year + "0101";
if ("2".equals(dateType)) {
// second helf-year
date = year + "0701";
}
for (BbMeasureData measureData : kpi.getMeasureDatas()) {
if (date.equals(measureData.getDate())) {
BscMeasureData data = new BscMeasureData();
data.setActual(measureData.getActual());
data.setTarget(measureData.getTarget());
Object value = BscFormulaUtils.parse(kpi.getFormula(), data);
// 2016-07-01
if (NumberUtils.isNumber(String.valueOf(value))) {
score = NumberUtils.toFloat(String.valueOf(value), 0.0f);
}
}
}
DateRangeScoreVO dateRangeScore = new DateRangeScoreVO();
dateRangeScore.setDate(date);
dateRangeScore.setBgColor(BscScoreColorUtils.getBackgroundColor(score));
dateRangeScore.setFontColor(BscScoreColorUtils.getFontColor(score));
dateRangeScore.setTarget(kpi.getTarget());
dateRangeScore.setMin(kpi.getMin());
dateRangeScore.setScore(score);
dateRangeScore.setImgIcon("");
kpi.getDateRangeScores().add(dateRangeScore);
}
use of com.netsteadfast.greenstep.po.hbm.BbMeasureData in project bamboobsc by billchen198318.
the class AggregationMethod method sumDateRange.
public void sumDateRange(KpiVO kpi, String frequency) throws Exception {
BscReportSupportUtils.loadExpression();
for (DateRangeScoreVO dateScore : kpi.getDateRangeScores()) {
float score = 0.0f;
//int size = 0;
for (BbMeasureData measureData : kpi.getMeasureDatas()) {
String date = dateScore.getDate().replaceAll("/", "");
if (!this.isDateRange(date, frequency, measureData)) {
continue;
}
BscMeasureData data = new BscMeasureData();
data.setActual(measureData.getActual());
data.setTarget(measureData.getTarget());
try {
Object value = BscFormulaUtils.parse(kpi.getFormula(), data);
if (value == null) {
continue;
}
if (!NumberUtils.isNumber(String.valueOf(value))) {
continue;
}
score += NumberUtils.toFloat(String.valueOf(value), 0.0f);
//size++;
} catch (Exception e) {
e.printStackTrace();
}
}
dateScore.setScore(score);
dateScore.setFontColor(BscScoreColorUtils.getFontColor(score));
dateScore.setBgColor(BscScoreColorUtils.getBackgroundColor(score));
dateScore.setImgIcon(BscReportSupportUtils.getHtmlIcon(kpi, score));
}
}
use of com.netsteadfast.greenstep.po.hbm.BbMeasureData in project bamboobsc by billchen198318.
the class AggregationMethod method countDistinctDateRange.
public void countDistinctDateRange(KpiVO kpi, String frequency) throws Exception {
BscReportSupportUtils.loadExpression();
for (DateRangeScoreVO dateScore : kpi.getDateRangeScores()) {
List<Float> scores = new ArrayList<Float>();
float score = 0.0f;
//int size = 0;
for (BbMeasureData measureData : kpi.getMeasureDatas()) {
String date = dateScore.getDate().replaceAll("/", "");
if (!this.isDateRange(date, frequency, measureData)) {
continue;
}
BscMeasureData data = new BscMeasureData();
data.setActual(measureData.getActual());
data.setTarget(measureData.getTarget());
try {
Object value = BscFormulaUtils.parse(kpi.getFormula(), data);
if (value == null) {
continue;
}
if (!NumberUtils.isNumber(String.valueOf(value))) {
continue;
}
float nowScore = NumberUtils.toFloat(String.valueOf(value), 0.0f);
if (!scores.contains(nowScore)) {
scores.add(nowScore);
}
} catch (Exception e) {
e.printStackTrace();
}
}
score = Float.valueOf(scores.size());
dateScore.setScore(score);
dateScore.setFontColor(BscScoreColorUtils.getFontColor(score));
dateScore.setBgColor(BscScoreColorUtils.getBackgroundColor(score));
dateScore.setImgIcon(BscReportSupportUtils.getHtmlIcon(kpi, score));
}
}
use of com.netsteadfast.greenstep.po.hbm.BbMeasureData in project bamboobsc by billchen198318.
the class AggregationMethod method max.
public float max(KpiVO kpi) throws Exception {
List<BbMeasureData> measureDatas = kpi.getMeasureDatas();
// init
float score = 0.0f;
int size = 0;
float nowScore = 0.0f;
for (BbMeasureData measureData : measureDatas) {
BscMeasureData data = new BscMeasureData();
data.setActual(measureData.getActual());
data.setTarget(measureData.getTarget());
try {
Object value = BscFormulaUtils.parse(kpi.getFormula(), data);
if (value == null) {
continue;
}
if (!NumberUtils.isNumber(String.valueOf(value))) {
continue;
}
nowScore = NumberUtils.toFloat(String.valueOf(value), 0.0f);
if (size < 1) {
score = nowScore;
} else {
// Max
if (score < nowScore) {
score = nowScore;
}
}
size++;
} catch (Exception e) {
e.printStackTrace();
}
}
return score;
}
Aggregations