|
|
|
@ -101,10 +101,10 @@ public class EstimateAnalysisServiceImpl implements EstimateAnalysisService {
|
|
|
|
|
calendar.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
|
|
|
|
|
|
|
|
|
|
//如果是周一,显示周五的数据
|
|
|
|
|
Calendar cal=Calendar.getInstance();
|
|
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
|
|
cal.setTime(new Date());
|
|
|
|
|
int week=cal.get(Calendar.DAY_OF_WEEK);
|
|
|
|
|
if (week ==2) {
|
|
|
|
|
int week = cal.get(Calendar.DAY_OF_WEEK);
|
|
|
|
|
if (week == 2) {
|
|
|
|
|
cal.add(Calendar.DATE, -3);
|
|
|
|
|
}
|
|
|
|
|
Date todayDate = new Date();
|
|
|
|
@ -228,13 +228,13 @@ public class EstimateAnalysisServiceImpl implements EstimateAnalysisService {
|
|
|
|
|
//预计到账金额
|
|
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
|
|
cal.setTime(date);
|
|
|
|
|
cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH)-1, 0, 0, 0);
|
|
|
|
|
cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH) - 1, 0, 0, 0);
|
|
|
|
|
Date datefrom = cal.getTime();
|
|
|
|
|
|
|
|
|
|
if (new Date().getDate() == datefrom.getDate()) {
|
|
|
|
|
if (DateUtils.isSameDay(new Date(), datefrom)) {
|
|
|
|
|
JSONObject params = new JSONObject();
|
|
|
|
|
params.put("datefrom", DateFormatUtils.format(datefrom, "yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
params.put("dateto", DateFormatUtils.format(DateUtils.addDays(datefrom, 1),"yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
params.put("dateto", DateFormatUtils.format(DateUtils.addDays(datefrom, 1), "yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
|
|
|
|
|
List<JSONObject> lastDayClearingAmount = transactionMapper.getLastDaytransAmount(params);
|
|
|
|
|
BigDecimal total_clearing = BigDecimal.ZERO;
|
|
|
|
@ -258,7 +258,7 @@ public class EstimateAnalysisServiceImpl implements EstimateAnalysisService {
|
|
|
|
|
String end_date = maxDays.getString("date_str");
|
|
|
|
|
JSONObject cleanDays = estimateAnalysisMapper.findLastCleanDays(endStr, 1);
|
|
|
|
|
List<JSONObject> tencentSettle = platformSettlementMapper.findBySettleDate(new Date(maxDays.getDate("date_str").getTime() - 86400000L), "Wechat");
|
|
|
|
|
if (tencentSettle != null && tencentSettle.size()>0) {
|
|
|
|
|
if (tencentSettle != null && tencentSettle.size() > 0) {
|
|
|
|
|
for (JSONObject logs : tencentSettle) {
|
|
|
|
|
dayInfo.put("settlementFee_" + logs.getString("merchants"), logs.getBigDecimal("settlement_fee"));
|
|
|
|
|
if (!dayInfo.containsKey("platformGetSettleFee")) {
|
|
|
|
@ -273,7 +273,7 @@ public class EstimateAnalysisServiceImpl implements EstimateAnalysisService {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
tencentSettleList = mpPaymentApi.settlementLogs(new Date(maxDays.getDate("date_str").getTime() - 86400000L), new Date(maxDays.getDate("date_str").getTime() - 86400000L), mch.getMerchantId());
|
|
|
|
|
if (tencentSettle == null || tencentSettleList.size()<=0) {
|
|
|
|
|
if (tencentSettle == null || tencentSettleList.size() <= 0) {
|
|
|
|
|
logger.info("EstimateAnalysisServiceImpl.getDaySettleInfo ======>【" + mch.getMerchantId() + "】下没有清算记录");
|
|
|
|
|
} else {
|
|
|
|
|
for (SettlementLog settle : tencentSettleList) {
|
|
|
|
@ -294,19 +294,19 @@ public class EstimateAnalysisServiceImpl implements EstimateAnalysisService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<JSONObject> hfSettle = platformSettlementMapper.findBySettleDate(new Date(estimateAnalysisMapper.findLastCleanDays(end_date, 1).getDate("date_str").getTime()), "hf");
|
|
|
|
|
if (hfSettle !=null && hfSettle.size()>0) {
|
|
|
|
|
if (hfSettle != null && hfSettle.size() > 0) {
|
|
|
|
|
for (JSONObject logs : hfSettle) {
|
|
|
|
|
dayInfo.put("hfSettleFee_" + logs.getString("merchants"), logs.getBigDecimal("settlement_fee"));
|
|
|
|
|
dayInfo.put("platformGetSettleFee",dayInfo.getBigDecimal("hfSettleFee_" + logs.getString("merchants")));
|
|
|
|
|
dayInfo.put("platformGetSettleFee", dayInfo.getBigDecimal("hfSettleFee_" + logs.getString("merchants")));
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
dayInfo.put("platformGetSettleFee",BigDecimal.ZERO);
|
|
|
|
|
} else {
|
|
|
|
|
dayInfo.put("platformGetSettleFee", BigDecimal.ZERO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<JSONObject> alipaySettleLogs = platformSettlementMapper.findBySettleDate(new Date(estimateAnalysisMapper.findLastCleanDays(end_date, 1).getDate("date_str").getTime()), "Alipay");
|
|
|
|
|
for (JSONObject logs : alipaySettleLogs) {
|
|
|
|
|
dayInfo.put("aliSettleFee_" + logs.getString("merchants"), logs.getBigDecimal("settlement_fee"));
|
|
|
|
|
dayInfo.put("platformGetSettleFee",dayInfo.getBigDecimal("platformGetSettleFee").add(dayInfo.getBigDecimal("aliSettleFee_" + logs.getString("merchants"))));
|
|
|
|
|
dayInfo.put("platformGetSettleFee", dayInfo.getBigDecimal("platformGetSettleFee").add(dayInfo.getBigDecimal("aliSettleFee_" + logs.getString("merchants"))));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<JSONObject> alipayOnlineSettleLogs = platformSettlementMapper.findBySettleDate(new Date(estimateAnalysisMapper.findLastCleanDays(end_date, 1).getDate("date_str").getTime()), "AlipayOnline");
|
|
|
|
@ -322,7 +322,7 @@ public class EstimateAnalysisServiceImpl implements EstimateAnalysisService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void generateSettleAmount() {
|
|
|
|
|
String report_date = DateFormatUtils.format(DateUtils.addDays(new Date(),-1), "yyyy/MM/dd");
|
|
|
|
|
String report_date = DateFormatUtils.format(DateUtils.addDays(new Date(), -1), "yyyy/MM/dd");
|
|
|
|
|
logger.info("系统开始生成[ " + report_date + " ]清算总额");
|
|
|
|
|
|
|
|
|
|
JSONObject isClearDay = estimateAnalysisMapper.checkIsClearDay(report_date);
|
|
|
|
@ -343,7 +343,8 @@ public class EstimateAnalysisServiceImpl implements EstimateAnalysisService {
|
|
|
|
|
estimateAnalysisMapper.save(estimate);
|
|
|
|
|
|
|
|
|
|
logger.info("系统自动生成[ " + report_date + " ]清算总额更新完毕");
|
|
|
|
|
}}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -358,7 +359,7 @@ public class EstimateAnalysisServiceImpl implements EstimateAnalysisService {
|
|
|
|
|
estimate.put("log_type", 2);
|
|
|
|
|
estimate.put("last_update_by", "System Auto Generat Transaction Logs");
|
|
|
|
|
|
|
|
|
|
JSONObject estimateExit = estimateAnalysisMapper.findByLogDate(start_date,2);
|
|
|
|
|
JSONObject estimateExit = estimateAnalysisMapper.findByLogDate(start_date, 2);
|
|
|
|
|
if (estimateExit != null) {
|
|
|
|
|
estimate.put("estimate_id", estimateExit.getString("estimate_id"));
|
|
|
|
|
estimateAnalysisMapper.update(estimate);
|
|
|
|
@ -375,7 +376,7 @@ public class EstimateAnalysisServiceImpl implements EstimateAnalysisService {
|
|
|
|
|
public List<JSONObject> listEstimateLog(int logType, String date) {
|
|
|
|
|
Date monthDate;
|
|
|
|
|
try {
|
|
|
|
|
monthDate = DateUtils.parseDate(date, new String[] { "yyyy-MM" });
|
|
|
|
|
monthDate = DateUtils.parseDate(date, new String[]{"yyyy-MM"});
|
|
|
|
|
} catch (ParseException e) {
|
|
|
|
|
throw new BadRequestException("Invalid month format");
|
|
|
|
|
}
|
|
|
|
@ -398,7 +399,7 @@ public class EstimateAnalysisServiceImpl implements EstimateAnalysisService {
|
|
|
|
|
estimate.put("last_update_date", new Date());
|
|
|
|
|
estimate.put("last_update_by", "developer import");
|
|
|
|
|
estimate.put("log_type", 1);
|
|
|
|
|
JSONObject estimateExit = estimateAnalysisMapper.findByLogDate(report_date,1);
|
|
|
|
|
JSONObject estimateExit = estimateAnalysisMapper.findByLogDate(report_date, 1);
|
|
|
|
|
|
|
|
|
|
if (estimateExit != null) {
|
|
|
|
|
estimate.put("estimate_id", estimateExit.getString("estimate_id"));
|
|
|
|
@ -417,7 +418,7 @@ public class EstimateAnalysisServiceImpl implements EstimateAnalysisService {
|
|
|
|
|
JSONObject estimate = getTransactionAmountDaily(start_date, end_date);
|
|
|
|
|
estimate.put("last_update_date", new Date());
|
|
|
|
|
estimate.put("last_update_by", "developer import");
|
|
|
|
|
JSONObject estimateExit = estimateAnalysisMapper.findByLogDate(start_date,2);
|
|
|
|
|
JSONObject estimateExit = estimateAnalysisMapper.findByLogDate(start_date, 2);
|
|
|
|
|
estimate.put("log_type", 2);
|
|
|
|
|
if (estimateExit != null) {
|
|
|
|
|
estimate.put("estimate_id", estimateExit.getString("estimate_id"));
|
|
|
|
|