risk control: chargeback

master
yixian 4 years ago
parent f837766573
commit 78aa62f892

@ -1,10 +1,10 @@
package au.com.royalpay.payment.manage.analysis.core.impls;
import au.com.royalpay.payment.manage.analysis.core.OrgAnalysisService;
import au.com.royalpay.payment.manage.analysis.mappers.CustomerAndOrdersStatisticsMapper;
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
import au.com.royalpay.payment.manage.mappers.log.StatisticsBDSalesReportMapper;
import au.com.royalpay.payment.manage.organizations.core.OrgManager;
import au.com.royalpay.payment.tools.utils.JsonHelper;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.stereotype.Service;
@ -30,30 +30,26 @@ public class OrgAnalysisServiceImp implements OrgAnalysisService {
@Resource
private OrgManager orgManager;
@Resource
private CustomerAndOrdersStatisticsMapper customerAndOrdersStatisticsMapper;
@Override
public List<JSONObject> getSalesAnalysis(JSONObject params,JSONObject manager) {
orgManager.checkOrgIds(manager,params);
params.put("org_type",0);
List<JSONObject> OrgTransaction = statisticsBDSalesReportMapper.getPartnerAmountList(params);
List<JSONObject> newOrgTransaction = new ArrayList<>();
OrgTransaction.forEach(item->{
newOrgTransaction.add(new JSONObject(){{
put("org_id",item.getString("org_id"));
put("org_name",item.getString("org_name"));
put("amount",item.getString("clearing_amount"));
}}
);
});
public List<JSONObject> getSalesAnalysis(JSONObject params, JSONObject manager) {
orgManager.checkOrgIds(manager, params);
params.put("org_type", 0);
List<JSONObject> orgTransactions = statisticsBDSalesReportMapper.getPartnerAmountList(params);
List<JSONObject> newOrgTransaction = new ArrayList<>();
orgTransactions.forEach(item -> newOrgTransaction.add(JsonHelper.newJson(json -> {
json.put("org_id", item.getString("org_id"));
json.put("org_name", item.getString("org_name"));
json.put("amount", item.getString("clearing_amount"));
})
));
//判断查询的最后一天是否是当日,若是当日,将当日数据添加至结果集内
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
if (sd.format(params.getDate("end")).equals(sd.format(DateUtils.addDays(new Date(), 1)))) {
params.put("begin", DateUtils.addDays(params.getDate("end"), -1));
params.put("end",params.getDate("end"));
params.put("end", params.getDate("end"));
List<JSONObject> todayOrgTransaction = transactionAnalysisMapper.getOneDayOrgMerchantSaleList(params);
if(todayOrgTransaction.size()!=0){
if (!todayOrgTransaction.isEmpty()) {
for (JSONObject todayOrgTransactionItem : todayOrgTransaction) {
boolean flag = false;
for (JSONObject orgTransaction : newOrgTransaction) {
@ -64,7 +60,7 @@ public class OrgAnalysisServiceImp implements OrgAnalysisService {
}
}
if (!flag) {
todayOrgTransactionItem.put("amount",todayOrgTransactionItem.getString("clearing_amount"));
todayOrgTransactionItem.put("amount", todayOrgTransactionItem.getString("clearing_amount"));
newOrgTransaction.add(todayOrgTransactionItem);
}
}

Loading…
Cancel
Save