diff --git a/pom.xml b/pom.xml index f169dc9b0..ded40941b 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ 4.0.0 manage - 1.1.16 + 1.1.19 UTF-8 diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/BDAnalysisService.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/BDAnalysisService.java index ae814453e..7f9360453 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/BDAnalysisService.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/BDAnalysisService.java @@ -30,4 +30,10 @@ public interface BDAnalysisService { * @return bd_id, bd_name, num */ List approvedAnalysis(JSONObject params); + + /** + * BD销售每日数据统计 + * @param format + */ + void generateReport(String format); } diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/BDAnalysisServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/BDAnalysisServiceImpl.java index 579561871..96f113b02 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/BDAnalysisServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/BDAnalysisServiceImpl.java @@ -3,10 +3,13 @@ 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.core.BDAnalysisService; import au.com.royalpay.payment.manage.analysis.mappers.BDAnalysisMapper; +import au.com.royalpay.payment.manage.mappers.log.StatisticsBDSalesReportMapper; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.time.DateFormatUtils; +import org.apache.commons.lang3.time.DateUtils; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.*; @@ -18,8 +21,12 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.OutputStream; import java.math.BigDecimal; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Date; import java.util.List; +import java.util.UUID; /** * Created by yishuqian on 30/09/2016. @@ -30,24 +37,50 @@ public class BDAnalysisServiceImpl implements BDAnalysisService { @Resource private BDAnalysisMapper bdAnalysisMapper; + @Resource + private StatisticsBDSalesReportMapper bdSalesReportMapper; + @Override public List getSalesAnalysis(JSONObject jsonObject) { return listSalesAnalysis(jsonObject); } - private List listSalesAnalysis(JSONObject jsonObject){ + private List listSalesAnalysis(JSONObject jsonObject) { List listCountApproved = bdAnalysisMapper.countApproved(jsonObject); - List bdSaleList = bdAnalysisMapper.getBDSaleList(jsonObject); - for(JSONObject countApproved : listCountApproved){ - for(JSONObject saleList : bdSaleList){ - if(countApproved.getString("bd_id").equals(saleList.getString("bd_id"))){ - saleList.put("num",countApproved.getString("num")); + List bdSaleList = bdSalesReportMapper.getBDSaleList(jsonObject); + for (JSONObject countApproved : listCountApproved) { + for (JSONObject saleList : bdSaleList) { + if (countApproved.getString("bd_id").equals(saleList.getString("bd_id"))) { + saleList.put("num", countApproved.getString("num")); + } + } + } + SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); + 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("end", DateUtils.addDays(jsonObject.getDate("end"), -2)); + jsonObject.put("end",jsonObject.getDate("end")); + List todaySaleList = bdAnalysisMapper.getBDSaleList(jsonObject); + for (JSONObject todayBDSaleItem : todaySaleList) { + boolean flag = false; + for(JSONObject baSaleItem: bdSaleList){ + if (baSaleItem.getString("bd_id").equals(todayBDSaleItem.getString("bd_id"))) { + BigDecimal newAmount = baSaleItem.getBigDecimal("total").add(todayBDSaleItem.getBigDecimal("total")); + baSaleItem.put("total",newAmount); + flag = true; + } + } + if (!flag) { + bdSaleList.add(todayBDSaleItem); } } } + return bdSaleList; } + //单独计算当日数据 + @Override public List getSalesPartnersByBD(JSONObject jsonObject) { @@ -58,32 +91,32 @@ public class BDAnalysisServiceImpl implements BDAnalysisService { public List getSalesPartnersReportByBD(JSONObject jsonObject) { List bdAnalysis = bdAnalysisMapper.getBDSalePartnerReport(jsonObject); List result = new ArrayList<>(); - String keys_1[] = {"1","2","3","4","5","6","7","8","9"}; - String key_2[] = {"10","11","12"}; - result = getPartnerTypes(keys_1,result,1,5,bdAnalysis); - return getPartnerTypes(key_2,result,2,6,bdAnalysis); + String keys_1[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9"}; + String key_2[] = {"10", "11", "12"}; + result = getPartnerTypes(keys_1, result, 1, 5, bdAnalysis); + return getPartnerTypes(key_2, result, 2, 6, bdAnalysis); } - private List getPartnerTypes(String keys[],List result,int short_length,int long_length,List bdAnalysis){ - for(String key : keys){ + private List getPartnerTypes(String keys[], List result, int short_length, int long_length, List bdAnalysis) { + for (String key : keys) { int countValue = 0; int countTotal = 0; JSONObject object = new JSONObject(); JSONArray list = new JSONArray(); - for(JSONObject type : bdAnalysis){ - if(type.getString("royalpayindustry") != null && type.getString("royalpayindustry").startsWith(key) && (type.getString("royalpayindustry").length()==short_length || type.getString("royalpayindustry").length()==long_length)){ + for (JSONObject type : bdAnalysis) { + if (type.getString("royalpayindustry") != null && type.getString("royalpayindustry").startsWith(key) && (type.getString("royalpayindustry").length() == short_length || type.getString("royalpayindustry").length() == long_length)) { countValue += type.getIntValue("partner_counts"); countTotal += type.getIntValue("total"); list.add(type); } } - if(countValue == 0){ + if (countValue == 0) { continue; } - object.put("count_value",countValue); - object.put("count_total",countTotal); - object.put("mccCode",key); - object.put("children",list); + object.put("count_value", countValue); + object.put("count_total", countTotal); + object.put("mccCode", key); + object.put("children", list); result.add(object); } return result; @@ -92,7 +125,7 @@ public class BDAnalysisServiceImpl implements BDAnalysisService { @Override public void exportSalesExcel(AnalysisBean analysisBean, HttpServletResponse httpResponse, JSONObject manager) throws IOException { httpResponse.setContentType("application/vnd.ms-excel"); - String fileName = analysisBean.getBegin_month()+"~"+analysisBean.getEnd_month(); + String fileName = analysisBean.getBegin_month() + "~" + analysisBean.getEnd_month(); // String fileName = new String(URLEncoder.encode(defaultname,"utf8")); httpResponse.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xls"); @@ -113,20 +146,20 @@ public class BDAnalysisServiceImpl implements BDAnalysisService { List bds = bdAnalysisMapper.getBDSaleList(params); HSSFWorkbook workbook = new HSSFWorkbook(); - for (JSONObject bd:bds){ + for (JSONObject bd : bds) { String bd_id = bd.getString("bd_id"); String bd_name = bd.getString("bd_name"); JSONObject monthParams = new JSONObject(); - monthParams.put("bd_id",bd_id); - monthParams.put("begin_month",analysisBean.getBegin_month()); - monthParams.put("end_month",analysisBean.getEnd_month()); + monthParams.put("bd_id", bd_id); + monthParams.put("begin_month", analysisBean.getBegin_month()); + monthParams.put("end_month", analysisBean.getEnd_month()); List monthTotalSale = bdAnalysisMapper.getMonthSalesList(monthParams); - for (JSONObject month:monthTotalSale){ - monthParams.put("month",month.getString("y_m")); - List clientsMonthSale = bdAnalysisMapper.getClientsMonthSale(bd_id,analysisBean.getBegin_month(),analysisBean.getEnd_month(),month.getString("y_m")); - month.put("clients",clientsMonthSale); + for (JSONObject month : monthTotalSale) { + monthParams.put("month", month.getString("y_m")); + List clientsMonthSale = bdAnalysisMapper.getClientsMonthSale(bd_id, analysisBean.getBegin_month(), analysisBean.getEnd_month(), month.getString("y_m")); + month.put("clients", clientsMonthSale); } - exportExcel(workbook,bd_name,monthTotalSale); + exportExcel(workbook, bd_name, monthTotalSale); } OutputStream outputStream = httpResponse.getOutputStream(); try { @@ -144,14 +177,52 @@ public class BDAnalysisServiceImpl implements BDAnalysisService { return bdAnalysisMapper.countApproved(params); } + /** + * BD销售每日数据统计 + * @param date + */ + @Override + public void generateReport(String date) { + try { + Date beginTime = DateUtils.parseDate(date, new String[]{"yyyy-MM-dd"}); + Date yesterdayEndTime = DateUtils.addDays(beginTime, 1); + String endDate = DateFormatUtils.format(yesterdayEndTime, "yyyy-MM-dd"); + Date endTime = DateUtils.parseDate(endDate, new String[]{"yyyy-MM-dd"}); + JSONObject params = new JSONObject(); + params.put("begin", beginTime); + params.put("end", endTime); + List bdSaleList = bdAnalysisMapper.getOneDayBDSaleList(params); + if (bdSaleList.size() != 0) { + for (JSONObject item : bdSaleList) { + JSONObject existBDSalesReport = bdSalesReportMapper.findByBDIdAndLogDate(item.getString("bd_id"),beginTime); + if(existBDSalesReport==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{ + existBDSalesReport.put("pay_amount",item.getString("pay_amount")); + existBDSalesReport.put("refund_amount",item.getString("refund_amount")); + existBDSalesReport.put("net_amount",item.getString("net_amount")); + bdSalesReportMapper.update(existBDSalesReport); + } + + } + } + } catch (ParseException e) { + e.printStackTrace(); + } + } + @Override public void exportPartnerExcelByBd(AnalysisBean analysisBean, HttpServletResponse httpResponse, JSONObject manager) throws IOException { OutputStream ous = null; - try{ + try { JSONObject parmerters = analysisBean.toParams(null); List listPartnerByBd = bdAnalysisMapper.getBDSalePartnerList(parmerters); httpResponse.setContentType("application/octet-stream;"); - httpResponse.addHeader("Content-Disposition", "attachment; filename=" + "Merchant_list--" +parmerters.getString("bd_name") + analysisBean.getBegin() + "~" + analysisBean.getEnd() + ".xls"); + httpResponse.addHeader("Content-Disposition", "attachment; filename=" + "Merchant_list--" + parmerters.getString("bd_name") + analysisBean.getBegin() + "~" + analysisBean.getEnd() + ".xls"); ous = httpResponse.getOutputStream(); HSSFWorkbook wb = new HSSFWorkbook(); HSSFFont font = wb.createFont(); @@ -159,7 +230,7 @@ public class BDAnalysisServiceImpl implements BDAnalysisService { font.setFontHeightInPoints((short) 15); CellStyle analysisStyle = wb.createCellStyle(); analysisStyle.setFont(font); - Sheet sheet = wb.createSheet("Merchant list" ); + Sheet sheet = wb.createSheet("Merchant list"); sheet.createFreezePane(1, 2); sheet.setDefaultColumnWidth((short) 25); int rowNum = 0; @@ -168,7 +239,7 @@ public class BDAnalysisServiceImpl implements BDAnalysisService { for (int i = 0; i < title.length; i++) { row.createCell(i, Cell.CELL_TYPE_STRING).setCellValue(title[i]); } - for(JSONObject partner : listPartnerByBd){ + for (JSONObject partner : listPartnerByBd) { row = sheet.createRow(++rowNum); row.createCell(0, Cell.CELL_TYPE_STRING).setCellValue(partner.getString("short_name")); row.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(partner.getString("client_moniker")); @@ -176,7 +247,7 @@ public class BDAnalysisServiceImpl implements BDAnalysisService { } wb.write(ous); ous.flush(); - }catch (IOException e){ + } catch (IOException e) { } finally { IOUtils.closeQuietly(ous); } @@ -186,7 +257,7 @@ public class BDAnalysisServiceImpl implements BDAnalysisService { @Override public void exportPartnerExcelByData(AnalysisBean analysisBean, HttpServletResponse httpResponse, JSONObject manager) throws IOException { OutputStream ous = null; - try{ + try { JSONObject parmerters = analysisBean.toParams(null); List listPartnerByData = listSalesAnalysis(parmerters); httpResponse.setContentType("application/octet-stream;"); @@ -198,31 +269,31 @@ public class BDAnalysisServiceImpl implements BDAnalysisService { font.setFontHeightInPoints((short) 15); CellStyle analysisStyle = wb.createCellStyle(); analysisStyle.setFont(font); - Sheet sheet = wb.createSheet("Merchant Sale List" ); + Sheet sheet = wb.createSheet("Merchant Sale List"); sheet.createFreezePane(1, 2); sheet.setDefaultColumnWidth((short) 25); int rowNum = 0; Row row = sheet.createRow(rowNum); - String[] title = {"BD Name", "AUD Amount", "Refund Fee","New Merchants"}; + String[] title = {"BD Name", "AUD Amount", "Refund Fee", "New Merchants"}; for (int i = 0; i < title.length; i++) { row.createCell(i, Cell.CELL_TYPE_STRING).setCellValue(title[i]); } - for(JSONObject dataSale : listPartnerByData){ + for (JSONObject dataSale : listPartnerByData) { row = sheet.createRow(++rowNum); row.createCell(0, Cell.CELL_TYPE_STRING).setCellValue(dataSale.getString("bd_name")); row.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(dataSale.getString("total")); row.createCell(2, Cell.CELL_TYPE_STRING).setCellValue(dataSale.getString("refund_fee")); - row.createCell(3, Cell.CELL_TYPE_STRING).setCellValue(dataSale.getString("num") == null? "0" : dataSale.getString("num")); + row.createCell(3, Cell.CELL_TYPE_STRING).setCellValue(dataSale.getString("num") == null ? "0" : dataSale.getString("num")); } wb.write(ous); ous.flush(); - }catch (IOException e){ + } catch (IOException e) { } finally { IOUtils.closeQuietly(ous); } } - private void exportExcel(HSSFWorkbook workbook,String title,List monthTotalSale) { + private void exportExcel(HSSFWorkbook workbook, String title, List monthTotalSale) { // 声明一个工作薄 // 生成一个表格 HSSFSheet sheet = workbook.createSheet(title); @@ -271,9 +342,9 @@ public class BDAnalysisServiceImpl implements BDAnalysisService { // comment.setAuthor("leno"); //产生表格标题行 - HSSFRow row0= sheet.createRow(0); - HSSFRow row1= sheet.createRow(1); - HSSFRow row2= sheet.createRow(2); + HSSFRow row0 = sheet.createRow(0); + HSSFRow row1 = sheet.createRow(1); + HSSFRow row2 = sheet.createRow(2); HSSFCell cell00 = row0.createCell(0); HSSFCell cell01 = row0.createCell(1); HSSFCell cell20 = row2.createCell(0); @@ -294,15 +365,13 @@ public class BDAnalysisServiceImpl implements BDAnalysisService { cell20.setCellValue(text20); - - for (int i = 0; i < monthTotalSale.size(); i++) { - sheet.addMergedRegion(new CellRangeAddress(0,0,2*i+2,2*i+3)); - HSSFCell cell02 = row0.createCell(i*2+2); - HSSFCell cell12 = row1.createCell(i*2+2); - HSSFCell cell13 = row1.createCell(i*2+3); - HSSFCell cell22 = row2.createCell(i*2+2); - HSSFCell cell23 = row2.createCell(i*2+3); + sheet.addMergedRegion(new CellRangeAddress(0, 0, 2 * i + 2, 2 * i + 3)); + HSSFCell cell02 = row0.createCell(i * 2 + 2); + HSSFCell cell12 = row1.createCell(i * 2 + 2); + HSSFCell cell13 = row1.createCell(i * 2 + 3); + HSSFCell cell22 = row2.createCell(i * 2 + 2); + HSSFCell cell23 = row2.createCell(i * 2 + 3); cell02.setCellStyle(style); cell12.setCellStyle(style); @@ -314,19 +383,18 @@ public class BDAnalysisServiceImpl implements BDAnalysisService { HSSFRichTextString text13 = new HSSFRichTextString("增长百分比"); HSSFRichTextString text22 = new HSSFRichTextString(monthTotalSale.get(i).getString("total")); double rate = 0; - if (i>0){ - BigDecimal lastTotal = monthTotalSale.get(i-1).getBigDecimal("total"); - BigDecimal total = monthTotalSale.get(i).getBigDecimal("total"); - if (lastTotal.compareTo(new BigDecimal(0))==0 && total.compareTo(new BigDecimal(0)) !=0){ - rate=100; - } - else if (lastTotal.compareTo(new BigDecimal(0))==0 && total.compareTo(new BigDecimal(0)) ==0){ - rate=0; - }else { - rate = total.subtract(lastTotal).multiply(new BigDecimal(100)).divide(lastTotal,2,BigDecimal.ROUND_DOWN).doubleValue(); - } + if (i > 0) { + BigDecimal lastTotal = monthTotalSale.get(i - 1).getBigDecimal("total"); + BigDecimal total = monthTotalSale.get(i).getBigDecimal("total"); + if (lastTotal.compareTo(new BigDecimal(0)) == 0 && total.compareTo(new BigDecimal(0)) != 0) { + rate = 100; + } else if (lastTotal.compareTo(new BigDecimal(0)) == 0 && total.compareTo(new BigDecimal(0)) == 0) { + rate = 0; + } else { + rate = total.subtract(lastTotal).multiply(new BigDecimal(100)).divide(lastTotal, 2, BigDecimal.ROUND_DOWN).doubleValue(); + } } - HSSFRichTextString text23 = i==0?new HSSFRichTextString("-"):new HSSFRichTextString(String.valueOf(rate)); + HSSFRichTextString text23 = i == 0 ? new HSSFRichTextString("-") : new HSSFRichTextString(String.valueOf(rate)); cell02.setCellValue(text0); cell12.setCellValue(text12); cell13.setCellValue(text13); @@ -335,35 +403,34 @@ public class BDAnalysisServiceImpl implements BDAnalysisService { } List partnersSale = (List) monthTotalSale.get(0).get("clients"); - for (int m=0;m clients = (List) monthTotalSale.get(n).get("clients"); - HSSFCell celli2 = row.createCell(n*2+2); - HSSFCell celli3 = row.createCell(n*2+3); + HSSFCell celli2 = row.createCell(n * 2 + 2); + HSSFCell celli3 = row.createCell(n * 2 + 3); celli2.setCellStyle(style2); celli3.setCellStyle(style2); HSSFRichTextString texti2 = new HSSFRichTextString(clients.get(m).getString("month_total")); double rate = 0; - if (n>0){ - List lastClients = (List) monthTotalSale.get(n-1).get("clients"); + if (n > 0) { + List lastClients = (List) monthTotalSale.get(n - 1).get("clients"); BigDecimal lastTotal = lastClients.get(m).getBigDecimal("month_total"); BigDecimal total = clients.get(m).getBigDecimal("month_total"); - if (lastTotal.compareTo(new BigDecimal(0))==0 && total.compareTo(new BigDecimal(0)) !=0){ - rate=100; - } - else if (lastTotal.compareTo(new BigDecimal(0))==0 && total.compareTo(new BigDecimal(0)) ==0){ - rate=0; - }else { - rate = total.subtract(lastTotal).multiply(new BigDecimal(100)).divide(lastTotal,2,BigDecimal.ROUND_DOWN).doubleValue(); + if (lastTotal.compareTo(new BigDecimal(0)) == 0 && total.compareTo(new BigDecimal(0)) != 0) { + rate = 100; + } else if (lastTotal.compareTo(new BigDecimal(0)) == 0 && total.compareTo(new BigDecimal(0)) == 0) { + rate = 0; + } else { + rate = total.subtract(lastTotal).multiply(new BigDecimal(100)).divide(lastTotal, 2, BigDecimal.ROUND_DOWN).doubleValue(); } } HSSFRichTextString texti3 = new HSSFRichTextString(String.valueOf(rate)); diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/OrgAnalysisServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/OrgAnalysisServiceImp.java index 66510785d..af9119612 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/OrgAnalysisServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/OrgAnalysisServiceImp.java @@ -1,12 +1,19 @@ 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 com.alibaba.fastjson.JSONObject; +import org.apache.commons.lang3.time.DateUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; import java.util.List; /** @@ -17,14 +24,52 @@ public class OrgAnalysisServiceImp implements OrgAnalysisService { @Resource private TransactionAnalysisMapper transactionAnalysisMapper; + @Resource + private StatisticsBDSalesReportMapper statisticsBDSalesReportMapper; + @Resource private OrgManager orgManager; + @Resource + private CustomerAndOrdersStatisticsMapper customerAndOrdersStatisticsMapper; + @Override public List getSalesAnalysis(JSONObject params,JSONObject manager) { orgManager.checkOrgIds(manager,params); - List OrgTransaction = transactionAnalysisMapper.getOrgTransactionAnalysis(params); - return OrgTransaction; + params.put("org_type",0); + List OrgTransaction = statisticsBDSalesReportMapper.getPartnerAmountList(params); + List 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")); + }} + ); + }); + //判断查询的最后一天是否是当日,若是当日,将当日数据添加至结果集内 + 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")); + List todayOrgTransaction = transactionAnalysisMapper.getOrgTransactionAnalysis(params); + if(todayOrgTransaction.size()!=0){ + for (JSONObject todayOrgTransactionItem : todayOrgTransaction) { + boolean flag = false; + for (JSONObject orgTransaction : newOrgTransaction) { + if (orgTransaction.getString("org_id").equals(todayOrgTransactionItem.getString("org_id"))) { + BigDecimal newAmount = orgTransaction.getBigDecimal("clearing_amount").add(todayOrgTransactionItem.getBigDecimal("amount")); + orgTransaction.put("amount", newAmount); + flag = true; + } + } + if (!flag) { + newOrgTransaction.add(todayOrgTransactionItem); + } + } + } + } + return newOrgTransaction; } @Override diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/BDAnalysisMapper.java b/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/BDAnalysisMapper.java index 9d51ce7ba..c3cc1400c 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/BDAnalysisMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/mappers/BDAnalysisMapper.java @@ -26,4 +26,7 @@ public interface BDAnalysisMapper { List countApproved(JSONObject params); List getBDSalePartnerReport(JSONObject jsonObject); + + //获取指定一天销售数据 + List getOneDayBDSaleList(JSONObject params); } diff --git a/src/main/java/au/com/royalpay/payment/manage/apps/core/impls/AppPermissionSupportImpl.java b/src/main/java/au/com/royalpay/payment/manage/apps/core/impls/AppPermissionSupportImpl.java index 3fceada66..a5eeac222 100644 --- a/src/main/java/au/com/royalpay/payment/manage/apps/core/impls/AppPermissionSupportImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/apps/core/impls/AppPermissionSupportImpl.java @@ -21,7 +21,6 @@ public class AppPermissionSupportImpl implements AppPermissionSupport { private SysAppsMapper sysAppsMapper; private final String signTemplate = "%s&%s&%s&%s&%s"; private Logger logger = LoggerFactory.getLogger(getClass()); - public static final String[] NODES_IP_ADDRESSS = new String[]{"119.28.3.196","150.109.64.108", "119.28.178.24", "119.28.24.146", "119.28.77.25"}; @Override public JSONObject validateSign(String appid, long timestamp, String ip, String requestUri, String sign) { @@ -42,18 +41,9 @@ public class AppPermissionSupportImpl implements AppPermissionSupport { } String auth = app.getString("auth_code"); String str = String.format(signTemplate, appid, auth, timestamp, requestUri, ip); - logger.debug("sso-str before hash:" + str); + logger.debug("sso-str before hash:{}", str); String hash = DigestUtils.sha256Hex(str).toLowerCase(); if (!StringUtils.equals(hash, sign)) { - for (String nodeIp : NODES_IP_ADDRESSS) { - logger.error("[{}]请求的签名有误,使用节点 [{}] 签名", appid, nodeIp); - str = String.format(signTemplate, appid, auth, timestamp, requestUri, nodeIp); - logger.debug("NodeIp check sso-str before hash:" + str); - hash = DigestUtils.sha256Hex(str).toLowerCase(); - if (StringUtils.equals(hash, sign)) { - return app; - } - } throw new ForbiddenException("InvalidSign"); } return app; diff --git a/src/main/java/au/com/royalpay/payment/manage/apps/core/impls/SSOSupportImpl.java b/src/main/java/au/com/royalpay/payment/manage/apps/core/impls/SSOSupportImpl.java index d713a2140..fc82e9d99 100644 --- a/src/main/java/au/com/royalpay/payment/manage/apps/core/impls/SSOSupportImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/apps/core/impls/SSOSupportImpl.java @@ -58,7 +58,7 @@ public class SSOSupportImpl implements SSOSupport { public String cacheClient(String appid, JSONObject clientUser) { String code = Long.toString(System.currentTimeMillis(), 36) + RandomStringUtils.random(10, true, true); String cacheKey = accountCacheKey("client", appid, code); - logger.debug("========cacheClient,key:"+cacheKey+"========"); + logger.debug("========cacheClient,key:{}========", cacheKey); stringRedisTemplate.boundValueOps(cacheKey).set(clientUser.toJSONString(), 30, TimeUnit.SECONDS); return code; } @@ -70,7 +70,7 @@ public class SSOSupportImpl implements SSOSupport { private JSONObject getCachedAccount(String appid, String code, String type) { String cacheKey = accountCacheKey(type, appid, code); - logger.debug("========getCachedAccount,key:"+cacheKey+"========"); + logger.debug("========getCachedAccount,key:{}========", cacheKey); String jsonstr = stringRedisTemplate.boundValueOps(cacheKey).get(); stringRedisTemplate.delete(cacheKey); if (jsonstr != null) { @@ -81,7 +81,7 @@ public class SSOSupportImpl implements SSOSupport { @Override public JSONObject getCachedClientAccount(String appid, String code) { - logger.debug("========getCachedClientAccount,appid:"+appid+",code:"+code+"========"); + logger.debug("========getCachedClientAccount,appid:{},code:{}========", appid, code); return getCachedAccount(appid, code, "client"); } diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/web/AnalysisController.java b/src/main/java/au/com/royalpay/payment/manage/dev/web/AnalysisController.java new file mode 100644 index 000000000..46216c5b4 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/dev/web/AnalysisController.java @@ -0,0 +1,28 @@ +package au.com.royalpay.payment.manage.dev.web; + +import au.com.royalpay.payment.manage.analysis.core.BDAnalysisService; +import org.apache.commons.lang3.time.DateFormatUtils; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +@RestController +@RequestMapping("/analysis") +public class AnalysisController { + + @Resource + private BDAnalysisService bdAnalysisService; + + + @GetMapping("/report/bd/sales") + public void reportDBSalesList(@RequestParam("date") String date) throws ParseException { + Date newDate = new SimpleDateFormat("yyyy-MM-dd").parse(date); + bdAnalysisService.generateReport(DateFormatUtils.format(newDate, "yyyy-MM-dd")); + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/log/StatisticsBDSalesReportMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/log/StatisticsBDSalesReportMapper.java new file mode 100644 index 000000000..eec5be137 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/log/StatisticsBDSalesReportMapper.java @@ -0,0 +1,29 @@ +package au.com.royalpay.payment.manage.mappers.log; + +import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; +import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; +import cn.yixblog.support.mybatis.autosql.annotations.SqlType; +import com.alibaba.fastjson.JSONObject; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +import java.util.List; + +/** + * Created by dulingling on 2019-08-14 + */ +@AutoMapper(tablename = "statistics_bd_sales", pkName = "log_id") +public interface StatisticsBDSalesReportMapper { + + @AutoSql(type = SqlType.INSERT) + void save(JSONObject report); + + List getBDSaleList(JSONObject params); + + List getPartnerAmountList(JSONObject params); + + JSONObject findByBDIdAndLogDate(@Param("bd_id") String bd_id, @Param("log_date")Date beginTime); + + @AutoSql(type = SqlType.UPDATE) + void update(JSONObject existBDSalesReport); +} diff --git a/src/main/java/au/com/royalpay/payment/manage/task/DBSaleAnalysisTask.java b/src/main/java/au/com/royalpay/payment/manage/task/DBSaleAnalysisTask.java new file mode 100644 index 000000000..8ce4fd026 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/task/DBSaleAnalysisTask.java @@ -0,0 +1,34 @@ +package au.com.royalpay.payment.manage.task; + +import au.com.royalpay.payment.manage.analysis.core.BDAnalysisService; +import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler; +import org.apache.commons.lang3.time.DateFormatUtils; +import org.apache.commons.lang3.time.DateUtils; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.Date; + +/** + * Created by dulingling on 2019-08-14 + */ +@Component +@ConditionalOnProperty(value = "app.run-tasks", havingValue = "true") +public class DBSaleAnalysisTask { + + @Resource + private SynchronizedScheduler synchronizedScheduler; + + @Resource + private BDAnalysisService bdAnalysisService; + + @Scheduled(cron = "0 0 1 * * ?") + public void dailyReportAutoGenerateReport() { + synchronizedScheduler.executeProcess("manage_task:dailyDBSaleReportAutoGenerateReport", 120_000, () -> { + Date yesterday = DateUtils.addDays(new Date(), -1); + bdAnalysisService.generateReport(DateFormatUtils.format(yesterday, "yyyy-MM-dd")); + }); + } +} diff --git a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/BDAnalysisMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/BDAnalysisMapper.xml index 2f2de891e..6e06c0c03 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/BDAnalysisMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/BDAnalysisMapper.xml @@ -3,67 +3,41 @@ SELECT - d.bd_name, - d.bd_id, - SUM(if(temp.transaction_type = 'Credit', temp.clearing_amount * d.proportion, -temp.clearing_amount * d.proportion)) total, - ifnull(SUM(if(temp.refund_id IS NOT NULL, if(temp.transaction_type='Debit', temp.clearing_amount, -temp.clearing_amount) * d.proportion, 0)), 0) refund_fee + clinetBD.bd_name, + clinetBD.bd_id, + SUM(if(temp.transaction_type = 'Credit', temp.clearing_amount * clinetBD.proportion, -temp.clearing_amount * clinetBD.proportion)) total, + ifnull(SUM(if(temp.refund_id IS NOT NULL, if(temp.transaction_type='Debit', temp.clearing_amount, -temp.clearing_amount) * clinetBD.proportion, 0)), 0) refund_fee FROM( - SELECT - l.client_id, - l.clearing_amount, - l.refund_id, - l.transaction_type, - l.create_time - FROM pmt_transactions l - INNER JOIN pmt_orders o - ON o.order_id = l.order_id + SELECT + trans.client_id, + trans.clearing_amount, + trans.refund_id, + trans.transaction_type, + trans.create_time + FROM pmt_transactions AS trans + WHERE (trans.transaction_type = 'Credit' OR trans.refund_id IS NOT NULL) + AND trans.system_generate = 0 + AND trans.channel !='Settlement' - AND l.create_time >= #{begin} + AND trans.create_time >= #{begin} - AND l.create_time < #{end} - - - AND DATE_FORMAT(l.create_time, '%Y-%m') >= #{begin_month} + AND trans.create_time < #{end} - - AND DATE_FORMAT(l.create_time, '%Y-%m') <= #{end_month} - - WHERE (l.transaction_type = 'Credit' OR l.refund_id IS NOT NULL) - ) temp - INNER JOIN sys_client_bd d - ON temp.client_id = d.client_id - AND d.start_date <= temp.create_time - AND d.is_valid = '1' - AND (d.end_date IS NULL OR d.end_date > temp.create_time) - - INNER JOIN sys_managers m - ON m.manager_id = d.bd_id - AND m.org_id = #{org_id} - - - INNER JOIN sys_managers m - ON m.manager_id = d.bd_id - AND m.org_id IN - - #{org_id} - - - AND temp.client_id IN( - SELECT b.client_id - FROM sys_client_bd b - INNER JOIN financial_bd_config c - ON c.manager_id = b.bd_id - WHERE b.is_valid = 1 - AND b.start_date <= now() - AND (b.end_date IS NULL OR b.end_date >= now()) - AND (c.bd_group = #{bd_group} OR c.manager_id = #{bd_group}) - - AND c.manager_id = #{bd_group_bd} - - ) + ) AS temp + INNER JOIN sys_client_bd AS clinetBD + ON temp.client_id = clinetBD.client_id + AND clinetBD.start_date <= temp.create_time + AND clinetBD.is_valid = '1' + AND (clinetBD.end_date IS NULL OR clinetBD.end_date > temp.create_time) + + INNER JOIN sys_managers AS manage + ON manage.manager_id = clinetBD.bd_id + + AND manage.org_id = #{org_id} - GROUP BY d.bd_id + + GROUP BY clinetBD.bd_id ORDER BY total DESC @@ -179,11 +153,11 @@ where client_id in(select client_id from sys_clients c where c.approve_time >= #{begin} AND c.approve_time < #{end} AND c.is_valid = 1 AND c.approve_result = 1 ]]> - and c.org_id=#{org_id} - and c.org_id in - #{org_id} - and c.source=1 - and c.source!=1 + and c.org_id=#{org_id} + and c.org_id in + #{org_id} + and c.source=1 + and c.source!=1 - group by bd_id - order by num desc + group by bd_id + order by num desc SELECT c.industry,c.royalpayindustry, @@ -220,4 +194,54 @@ ORDER BY partner_counts DESC; + + + SELECT + clinetBD.bd_name, + clinetBD.bd_id, + manage.org_id, + org.type AS org_type, + org.name AS org_name, + if(org.org_id=1,1,0) AS isOrg, + SUM( IF ( temp.transaction_type = 'Credit', temp.clearing_amount, 0 )) clearing_amount, + SUM(if(temp.transaction_type = 'Credit',temp.clearing_amount * clinetBD.proportion, -temp.clearing_amount * clinetBD.proportion)) pay_amount, + ifnull(SUM(if(temp.refund_id IS NOT NULL, if(temp.transaction_type='Debit', temp.clearing_amount, -temp.clearing_amount) * clinetBD.proportion, 0)), 0) refund_amount, + (SUM(if(temp.transaction_type = 'Credit', temp.clearing_amount * clinetBD.proportion, -temp.clearing_amount * clinetBD.proportion))) - (ifnull(SUM(if(temp.refund_id IS NOT NULL, if(temp.transaction_type='Debit', temp.clearing_amount, -temp.clearing_amount) * clinetBD.proportion, 0)), 0)) AS net_amount + FROM( + SELECT + trans.client_id, + trans.clearing_amount, + trans.refund_id, + trans.transaction_type, + trans.create_time + FROM pmt_transactions AS trans + WHERE (trans.transaction_type = 'Credit' OR trans.refund_id IS NOT NULL) + AND trans.system_generate = 0 + AND trans.channel !='Settlement' + + AND trans.create_time >= #{begin} + + + AND trans.create_time < #{end} + + ) + AS temp + INNER JOIN sys_client_bd AS clinetBD + ON temp.client_id = clinetBD.client_id + AND clinetBD.start_date <= temp.create_time + AND clinetBD.is_valid = '1' + AND (clinetBD.end_date IS NULL OR clinetBD.end_date > temp.create_time) + INNER JOIN sys_managers AS manage + ON manage.manager_id = clinetBD.bd_id + AND manage.org_id IS NOT NULL + INNER JOIN sys_org AS org + ON org.org_id = manage.org_id + + AND manage.org_id = #{org_id} + + GROUP BY clinetBD.bd_id + ORDER BY pay_amount DESC + + + diff --git a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/TransactionAnalysisMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/TransactionAnalysisMapper.xml index 96ee0b611..7990d193a 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/TransactionAnalysisMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/analysis/mappers/TransactionAnalysisMapper.xml @@ -716,20 +716,37 @@ - and t.transaction_time >= #{begin} - and t.transaction_time <= #{end} - and o.org_id=#{org_id} - and o.org_id in + + AND trans.transaction_time >= #{begin} + + + AND trans.transaction_time <= #{end} + + + AND org.org_id=#{org_id} + + + AND org.org_id in #{org_id} - GROUP BY o.org_id order by amount desc + GROUP BY org.org_id + ORDER BY amount DESC diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/log/StatisticsBDSalesReportMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/log/StatisticsBDSalesReportMapper.xml new file mode 100644 index 000000000..06acb7ace --- /dev/null +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/log/StatisticsBDSalesReportMapper.xml @@ -0,0 +1,86 @@ + + + + + SELECT + bd_id, + bd_name, + org_id, + org_name, + SUM(pay_amount) AS total, + SUM(refund_amount) AS refund_fee + FROM statistics_bd_sales + + + AND org_id = #{org_id} + + + AND org_type = #{org_type} + + + AND log_date >= #{begin} + + + AND log_date < #{end} + + + AND org.org_id in + #{org_id} + + + GROUP BY bd_id + ORDER BY total DESC + + + + + SELECT + bd_id, + bd_name, + org_id, + org_name, + SUM(clearing_amount) AS clearing_amount, + SUM(pay_amount) AS total, + SUM(refund_amount) AS refund_fee + FROM statistics_bd_sales + WHERE org_id !=1 + + AND org_id = #{org_id} + + + AND org_type = #{org_type} + + + AND log_date >= #{begin} + + + AND log_date < #{end} + + + AND org_id in + #{org_id} + + GROUP BY bd_id + ORDER BY total DESC + + + + SELECT + log_id, + org_id, + isOrg, + org_name, + org_type, + bd_id, + bd_name, + log_date, + pay_amount, + refund_amount, + net_amount, + create_time, + clearing_amount + FROM statistics_bd_sales + WHERE bd_id = #{bd_id} AND log_date = #{log_date} + + + \ No newline at end of file diff --git a/src/main/ui/static/analysis/bd-sale-volume.js b/src/main/ui/static/analysis/bd-sale-volume.js index 5230d2821..486c1ef05 100644 --- a/src/main/ui/static/analysis/bd-sale-volume.js +++ b/src/main/ui/static/analysis/bd-sale-volume.js @@ -76,7 +76,6 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts', './bd/analysis-b }; $scope.loadSale = function () { - var params = angular.copy($scope.params); if (params.begin) { params.begin = $filter('date')(params.begin, 'yyyyMMdd'); @@ -88,6 +87,7 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts', './bd/analysis-b } else { params.end = $filter('date')(new Date(), 'yyyyMMdd'); } + params.org_id =1; $http.get('/analysis/bd/sales', {params: params}).then(function (resp) { $scope.sales = resp.data; loadSaleChart(); diff --git a/src/main/ui/static/analysis/org-tranaction-analysis.js b/src/main/ui/static/analysis/org-tranaction-analysis.js index 8285fce69..e15d190dd 100644 --- a/src/main/ui/static/analysis/org-tranaction-analysis.js +++ b/src/main/ui/static/analysis/org-tranaction-analysis.js @@ -59,6 +59,7 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./org/analysis-o $scope.showOrg = 'Organization'; $http.get('/sys/orgs', {params: {}}).then(function (resp) { $scope.orgs = resp.data; + $scope.orgs.splice($scope.orgs.findIndex(item => item.org_id === 1), 1) }); } @@ -98,6 +99,7 @@ define(['angular', 'uiBootstrap', 'uiRouter', 'angularEcharts','./org/analysis-o $scope.future_loading = false; }); }; + $scope.chooseToday() $scope.chooseOrgId = function (org) { if (org == 'all') { delete $scope.params.org_id; diff --git a/src/main/ui/static/analysis/templates/bd_sale_analysis.html b/src/main/ui/static/analysis/templates/bd_sale_analysis.html index f2e5b96fe..7fac5442d 100644 --- a/src/main/ui/static/analysis/templates/bd_sale_analysis.html +++ b/src/main/ui/static/analysis/templates/bd_sale_analysis.html @@ -68,19 +68,6 @@ This Year - - - - {{showOrg}} - - - All - {{org.name}} - - - diff --git a/src/main/ui/static/analysis/templates/org_sale_analysis.html b/src/main/ui/static/analysis/templates/org_sale_analysis.html index 191815499..f85c3c73b 100644 --- a/src/main/ui/static/analysis/templates/org_sale_analysis.html +++ b/src/main/ui/static/analysis/templates/org_sale_analysis.html @@ -60,10 +60,6 @@ Last Month - - This - Year - diff --git a/src/main/ui/static/payment/partner/partner-manage.js b/src/main/ui/static/payment/partner/partner-manage.js index 8eb6f29a2..9e5dae172 100644 --- a/src/main/ui/static/payment/partner/partner-manage.js +++ b/src/main/ui/static/payment/partner/partner-manage.js @@ -83,7 +83,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter var removeClientPayDesc = function (items, key) { for (var i = 0; i < items.length; i++) { var item = items[i]; - if (item.indexOf(key)>=0) { + if (item.indexOf(key) >= 0) { items.splice(items.indexOf(item), 1); i = i - 1; } @@ -225,6 +225,18 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }); }; + $scope.exportPartnersExcel = function () { + var params = angular.copy($scope.params); + var param_str = keys(params).map(function (key) { + var value = params[key]; + if (angular.isDate(value)) { + value = $filter('date')(value, 'yyyy-MM-ddTHH:mm:ssZ') + } + return key + '=' + encodeURIComponent(value) + }).join('&'); + window.open('/sys/partners/exporting_excel?'+param_str) + }; + /*$scope.loadLocations = function () { var params = angular.copy($scope.params); $http.get('/sys/partners/merchant/list_locations', {params: params}).then(function (resp) { @@ -411,7 +423,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } } $scope.toggleClientPayType = function (type) { - if ($scope.partner.client_pay_type==null || $scope.partner.client_pay_type==undefined){ + if ($scope.partner.client_pay_type == null || $scope.partner.client_pay_type == undefined) { $scope.partner.client_pay_type = []; } var $idx = $scope.partner.client_pay_type.indexOf(type); @@ -424,13 +436,13 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter } }; $scope.toggleClientPayDesc = function (type) { - if ($scope.partner.client_pay_desc==null || $scope.partner.client_pay_desc==undefined){ + if ($scope.partner.client_pay_desc == null || $scope.partner.client_pay_desc == undefined) { $scope.partner.client_pay_desc = []; } var $idx = $scope.partner.client_pay_desc.indexOf(type); if ($idx >= 0) { if (type == '203') { - removeClientPayDesc($scope.partner.client_pay_desc,'2030') + removeClientPayDesc($scope.partner.client_pay_desc, '2030') } $scope.partner.client_pay_desc.splice($idx, 1); } else { @@ -544,7 +556,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.merchantIsValid = false; return; } - $http.get('/sys/partners/init/check_code_isvalid',{params:{clientMoniker:code}}).then(function (response) { + $http.get('/sys/partners/init/check_code_isvalid', {params: {clientMoniker: code}}).then(function (response) { $scope.merchantIsValid = response.data; $scope.merchantCodeChecked = true; }); @@ -604,7 +616,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter alert("Logo is necessary!"); return; } - if ($scope.partner.client_pay_type.indexOf('2')>=0) { + if ($scope.partner.client_pay_type.indexOf('2') >= 0) { if (!$scope.partner.company_photo) { alert('Shop Photo1 is necessary'); return; @@ -624,11 +636,11 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter }) } - if ($scope.partner.client_pay_type.length==0) { + if ($scope.partner.client_pay_type.length == 0) { alert('请选择商户支付场景') return; } - if ($scope.partner.client_pay_desc.length==0) { + if ($scope.partner.client_pay_desc.length == 0) { alert('请选择商户支付方式') return; } @@ -643,7 +655,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter return; } } - if ( $scope.partner.client_pay_type.indexOf('2') >= 0) { + if ($scope.partner.client_pay_type.indexOf('2') >= 0) { if ($scope.partner.client_pay_desc.join(',').indexOf('20') < 0) { alert("请检查线下支付场景是否已选择支付方式"); return; @@ -1256,7 +1268,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter var $idx = $scope.partner.client_pay_desc.indexOf(type); if ($idx >= 0) { if (type == '203') { - removeClientPayDesc($scope.partner.client_pay_desc,'2030') + removeClientPayDesc($scope.partner.client_pay_desc, '2030') } $scope.partner.client_pay_desc.splice($idx, 1); } else { @@ -1388,11 +1400,11 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter if (!origin_referrer_id && $scope.partner.referrer_id) { content = 'Update partner info successfully,But You Had add new Referrer,Please Change the BD Commission Proportion!'; } - if ($scope.partner.client_pay_type.length==0) { + if ($scope.partner.client_pay_type.length == 0) { alert('请选择商户支付场景') return; } - if ($scope.partner.client_pay_desc.length==0) { + if ($scope.partner.client_pay_desc.length == 0) { alert('请选择商户支付方式') return; } @@ -1402,7 +1414,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter return; } } - if ( $scope.partner.client_pay_type.indexOf('2') >= 0) { + if ($scope.partner.client_pay_type.indexOf('2') >= 0) { if ($scope.partner.client_pay_desc.join(',').indexOf('20') < 0) { alert("请检查线下支付场景是否已选择支付方式"); return; @@ -1764,7 +1776,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter commonDialog.confirm({ title: 'Warning', content: '是否使用该商户的现有信息进件?', - json:$scope.alipayOnline_gms_json + json: $scope.alipayOnline_gms_json }).then(function () { $http.post('/sys/partners/' + $scope.partner.client_moniker + '/register/alipayOnline_gms').then(function () { commonDialog.alert({title: 'Success', content: '提示:AlipayOnline进件成功', type: 'success'}); @@ -2256,8 +2268,8 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter app.controller('partnerSubCtrl', ['$scope', '$http', '$uibModal', function ($scope, $http, $uibModal) { $scope.toShow = false; $scope.init = { - child_each_refund : false, - sub_manage : false + child_each_refund: false, + sub_manage: false } $scope.newSubClient = function () { @@ -2861,7 +2873,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter var $idx = $scope.partner.client_pay_desc.indexOf(type); if ($idx >= 0) { if (type == '203') { - removeClientPayDesc($scope.partner.client_pay_desc,'2030') + removeClientPayDesc($scope.partner.client_pay_desc, '2030') } $scope.partner.client_pay_desc.splice($idx, 1); } else { @@ -2957,7 +2969,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter $scope.merchantIsValid = false; return; } - $http.get('/sys/partners/init/check_code_isvalid',{params:{clientMoniker:code}}).then(function (response) { + $http.get('/sys/partners/init/check_code_isvalid', {params: {clientMoniker: code}}).then(function (response) { $scope.merchantIsValid = response.data; $scope.merchantCodeChecked = true; }); @@ -3018,7 +3030,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter alert("Logo is necessary!"); return; } - if ($scope.partner.client_pay_type.indexOf('2')>=0) { + if ($scope.partner.client_pay_type.indexOf('2') >= 0) { if (!$scope.partner.company_photo) { alert('Shop Photo1 is necessary'); return; @@ -3032,11 +3044,11 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter // alert("Please Locate Merchant Location!"); // return; // } - if ($scope.partner.client_pay_type.length==0) { + if ($scope.partner.client_pay_type.length == 0) { alert('请选择商户支付场景') return; } - if ($scope.partner.client_pay_desc.length==0) { + if ($scope.partner.client_pay_desc.length == 0) { alert('请选择商户支付方式') return; } @@ -3046,7 +3058,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter return; } } - if ( $scope.partner.client_pay_type.indexOf('2') >= 0) { + if ($scope.partner.client_pay_type.indexOf('2') >= 0) { if ($scope.partner.client_pay_desc.join(',').indexOf('20') < 0) { alert("请检查线下支付场景是否已选择支付方式"); return; diff --git a/src/main/ui/static/payment/partner/templates/partners.html b/src/main/ui/static/payment/partner/templates/partners.html index bbbce7ada..016b5e155 100644 --- a/src/main/ui/static/payment/partner/templates/partners.html +++ b/src/main/ui/static/payment/partner/templates/partners.html @@ -386,6 +386,9 @@ ng-click="loadPartners(1)"> Search + + Export +