|
|
@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.analysis.core.impls;
|
|
|
|
import au.com.royalpay.payment.manage.analysis.beans.AnalysisBean;
|
|
|
|
import au.com.royalpay.payment.manage.analysis.beans.AnalysisBean;
|
|
|
|
import au.com.royalpay.payment.manage.analysis.core.BDAnalysisService;
|
|
|
|
import au.com.royalpay.payment.manage.analysis.core.BDAnalysisService;
|
|
|
|
import au.com.royalpay.payment.manage.analysis.mappers.BDAnalysisMapper;
|
|
|
|
import au.com.royalpay.payment.manage.analysis.mappers.BDAnalysisMapper;
|
|
|
|
|
|
|
|
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.tools.permission.enums.ManagerRole;
|
|
|
|
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
@ -14,6 +15,7 @@ import org.apache.poi.hssf.usermodel.*;
|
|
|
|
import org.apache.poi.hssf.util.HSSFColor;
|
|
|
|
import org.apache.poi.hssf.util.HSSFColor;
|
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
|
import org.apache.poi.ss.util.CellRangeAddress;
|
|
|
|
import org.apache.poi.ss.util.CellRangeAddress;
|
|
|
|
|
|
|
|
import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
@ -40,6 +42,9 @@ public class BDAnalysisServiceImpl implements BDAnalysisService {
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private StatisticsBDSalesReportMapper bdSalesReportMapper;
|
|
|
|
private StatisticsBDSalesReportMapper bdSalesReportMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private TransactionAnalysisMapper transactionAnalysisMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<JSONObject> getSalesAnalysis(JSONObject jsonObject) {
|
|
|
|
public List<JSONObject> getSalesAnalysis(JSONObject jsonObject) {
|
|
|
@ -59,7 +64,6 @@ public class BDAnalysisServiceImpl implements BDAnalysisService {
|
|
|
|
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
if (sd.format(jsonObject.getDate("end")).equals(sd.format(DateUtils.addDays(new Date(), 1)))) {
|
|
|
|
if (sd.format(jsonObject.getDate("end")).equals(sd.format(DateUtils.addDays(new Date(), 1)))) {
|
|
|
|
jsonObject.put("begin", DateUtils.addDays(jsonObject.getDate("end"), -1));
|
|
|
|
jsonObject.put("begin", DateUtils.addDays(jsonObject.getDate("end"), -1));
|
|
|
|
// jsonObject.put("end", DateUtils.addDays(jsonObject.getDate("end"), -2));
|
|
|
|
|
|
|
|
jsonObject.put("end",jsonObject.getDate("end"));
|
|
|
|
jsonObject.put("end",jsonObject.getDate("end"));
|
|
|
|
List<JSONObject> todaySaleList = bdAnalysisMapper.getBDSaleList(jsonObject);
|
|
|
|
List<JSONObject> todaySaleList = bdAnalysisMapper.getBDSaleList(jsonObject);
|
|
|
|
for (JSONObject todayBDSaleItem : todaySaleList) {
|
|
|
|
for (JSONObject todayBDSaleItem : todaySaleList) {
|
|
|
@ -194,7 +198,7 @@ public class BDAnalysisServiceImpl implements BDAnalysisService {
|
|
|
|
List<JSONObject> bdSaleList = bdAnalysisMapper.getOneDayBDSaleList(params);
|
|
|
|
List<JSONObject> bdSaleList = bdAnalysisMapper.getOneDayBDSaleList(params);
|
|
|
|
if (bdSaleList.size() != 0) {
|
|
|
|
if (bdSaleList.size() != 0) {
|
|
|
|
for (JSONObject item : bdSaleList) {
|
|
|
|
for (JSONObject item : bdSaleList) {
|
|
|
|
JSONObject existBDSalesReport = bdSalesReportMapper.findByBDIdAndLogDate(item.getString("bd_id"),beginTime);
|
|
|
|
JSONObject existBDSalesReport = bdSalesReportMapper.findByBDIdAndLogDate(item.getString("bd_id"),beginTime,0);
|
|
|
|
if(existBDSalesReport==null){
|
|
|
|
if(existBDSalesReport==null){
|
|
|
|
JSONObject object = new JSONObject(item);
|
|
|
|
JSONObject object = new JSONObject(item);
|
|
|
|
object.put("log_id", UUID.randomUUID().toString());
|
|
|
|
object.put("log_id", UUID.randomUUID().toString());
|
|
|
@ -207,6 +211,24 @@ public class BDAnalysisServiceImpl implements BDAnalysisService {
|
|
|
|
existBDSalesReport.put("net_amount",item.getString("net_amount"));
|
|
|
|
existBDSalesReport.put("net_amount",item.getString("net_amount"));
|
|
|
|
bdSalesReportMapper.update(existBDSalesReport);
|
|
|
|
bdSalesReportMapper.update(existBDSalesReport);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
List<JSONObject> orgSaleList= transactionAnalysisMapper.getOneDayOrgMerchantSaleList(params);
|
|
|
|
|
|
|
|
if (orgSaleList.size() != 0) {
|
|
|
|
|
|
|
|
for (JSONObject item : orgSaleList) {
|
|
|
|
|
|
|
|
JSONObject existOrgSalesReport = bdSalesReportMapper.findByBDIdAndLogDate(item.getString("bd_id"),beginTime,1);
|
|
|
|
|
|
|
|
if(existOrgSalesReport==null){
|
|
|
|
|
|
|
|
JSONObject object = new JSONObject(item);
|
|
|
|
|
|
|
|
object.put("log_id", UUID.randomUUID().toString());
|
|
|
|
|
|
|
|
object.put("log_date", beginTime);
|
|
|
|
|
|
|
|
object.put("create_time", new Date());
|
|
|
|
|
|
|
|
bdSalesReportMapper.save(object);
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
existOrgSalesReport.put("pay_amount",item.getString("pay_amount"));
|
|
|
|
|
|
|
|
existOrgSalesReport.put("refund_amount",item.getString("refund_amount"));
|
|
|
|
|
|
|
|
existOrgSalesReport.put("net_amount",item.getString("net_amount"));
|
|
|
|
|
|
|
|
bdSalesReportMapper.update(existOrgSalesReport);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|