use of com.netsteadfast.greenstep.vo.MeasureDataVO in project bamboobsc by billchen198318.
the class MeasureDataCalendarUtils method findMeasureData.
/**
* 這個 method 主要給 Expression 使用, 避免近入LogicService 處理時影響到 Transaction
*
* @param kpiId
* @param date
* @param frequency
* @param orgaId
* @param emplId
* @return
* @throws ServiceException
* @throws Exception
*/
@SuppressWarnings("rawtypes")
public static MeasureDataVO findMeasureData(String kpiId, String date, String frequency, String orgaId, String emplId) throws ServiceException, Exception {
transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
transactionTemplate.setIsolationLevel(TransactionDefinition.ISOLATION_DEFAULT);
transactionTemplate.setReadOnly(true);
MeasureDataVO measureData = null;
try {
measureData = (MeasureDataVO) transactionTemplate.execute(new TransactionCallback() {
@Override
public Object doInTransaction(TransactionStatus status) {
MeasureDataVO value = new MeasureDataVO();
value.setKpiId(kpiId);
value.setDate(date);
value.setFrequency(frequency);
value.setOrgId(orgaId);
value.setEmpId(emplId);
try {
DefaultResult<MeasureDataVO> mdResult = measureDataService.findByUK(value);
if (mdResult.getValue() != null) {
value = mdResult.getValue();
} else {
value = null;
}
} catch (Exception e) {
e.printStackTrace();
value = null;
}
return value;
}
});
} catch (Exception e) {
throw e;
}
return measureData;
}
Aggregations