|
|
@ -1051,10 +1051,25 @@ public class RetailAppServiceImp implements RetailAppService {
|
|
|
|
throw new BadRequestException("No Transactions in date " + dateStr + " at " + timezone);
|
|
|
|
throw new BadRequestException("No Transactions in date " + dateStr + " at " + timezone);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TimeZoneUtils.switchTimeZoneToString(transactions, timezone, "HH:mm:ss", Collections.singletonList("transaction_time"));
|
|
|
|
TimeZoneUtils.switchTimeZoneToString(transactions, timezone, "HH:mm:ss", Collections.singletonList("transaction_time"));
|
|
|
|
|
|
|
|
BigDecimal display_amount = BigDecimal.ZERO;
|
|
|
|
|
|
|
|
BigDecimal cny_display_amount = BigDecimal.ZERO;
|
|
|
|
|
|
|
|
for (JSONObject transaction:transactions){
|
|
|
|
|
|
|
|
if (PlatformEnvironment.getEnv().getForeignCurrency().equals(transaction.getString("currency"))){
|
|
|
|
|
|
|
|
if ("Credit".equals(transaction.getString("transaction_type"))){
|
|
|
|
|
|
|
|
display_amount = display_amount.add(transaction.getBigDecimal("display_amount"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
if ("Credit".equals(transaction.getString("transaction_type"))){
|
|
|
|
|
|
|
|
cny_display_amount = cny_display_amount.add(transaction.getBigDecimal("cny_display_amount"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
JSONObject res = new JSONObject();
|
|
|
|
JSONObject res = new JSONObject();
|
|
|
|
res.put("transactions", transactions);
|
|
|
|
res.put("transactions", transactions);
|
|
|
|
JSONObject analysis = transactionMapper.analysisRetailDailyReport(date, to, devId, device.getIntValue("client_id"));
|
|
|
|
JSONObject analysis = transactionMapper.analysisRetailDailyReport(date, to, devId, device.getIntValue("client_id"));
|
|
|
|
analysis.put("date", TimeZoneUtils.formatTime(date, "dd/MMM/yyyy", timezone));
|
|
|
|
analysis.put("date", TimeZoneUtils.formatTime(date, "dd/MMM/yyyy", timezone));
|
|
|
|
|
|
|
|
analysis.put("display_amount",display_amount);
|
|
|
|
|
|
|
|
analysis.put("cny_display_amount",cny_display_amount);
|
|
|
|
res.put("analysis", analysis);
|
|
|
|
res.put("analysis", analysis);
|
|
|
|
return res;
|
|
|
|
return res;
|
|
|
|
} catch (ParseException e) {
|
|
|
|
} catch (ParseException e) {
|
|
|
|