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