|
|
|
@ -31,6 +31,11 @@ import org.apache.commons.lang3.RandomStringUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
|
|
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFFont;
|
|
|
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
|
|
|
|
|
import org.apache.poi.hssf.util.HSSFColor;
|
|
|
|
|
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
|
|
@ -684,7 +689,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
public void generateReferrer(String monthStr) {
|
|
|
|
public void generateReferrer(String monthStr) {
|
|
|
|
@ -857,8 +861,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@ -1224,4 +1226,73 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
|
|
|
|
return financialSeniorPartnerCommissionMapper.find(year, month, orgId);
|
|
|
|
return financialSeniorPartnerCommissionMapper.find(year, month, orgId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void exportMonthFiles(String monthStr, HttpServletResponse resp) throws Exception {
|
|
|
|
|
|
|
|
OutputStream ous = null;
|
|
|
|
|
|
|
|
Date monthDate = parseMonth(monthStr);
|
|
|
|
|
|
|
|
Calendar monthCal = Calendar.getInstance();
|
|
|
|
|
|
|
|
monthCal.setTime(monthDate);
|
|
|
|
|
|
|
|
int year = monthCal.get(Calendar.YEAR);
|
|
|
|
|
|
|
|
int month = monthCal.get(Calendar.MONTH) + 1;
|
|
|
|
|
|
|
|
List<JSONObject> report = financialPartnerCommissionMapper.listWithOrgInfo(year, month);
|
|
|
|
|
|
|
|
if (report != null) {
|
|
|
|
|
|
|
|
resp.setContentType("application/octet-stream;");
|
|
|
|
|
|
|
|
resp.addHeader("Content-Disposition", "attachment; filename=" + "CityPartner_Commission_Info_" + monthStr + ".xls");
|
|
|
|
|
|
|
|
ous = resp.getOutputStream();
|
|
|
|
|
|
|
|
HSSFWorkbook wb = new HSSFWorkbook();
|
|
|
|
|
|
|
|
Cell cell = null;
|
|
|
|
|
|
|
|
HSSFFont font = wb.createFont();
|
|
|
|
|
|
|
|
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
|
|
|
|
|
|
|
|
font.setFontHeightInPoints((short) 10);
|
|
|
|
|
|
|
|
CellStyle titleStyle = wb.createCellStyle();
|
|
|
|
|
|
|
|
titleStyle.setFont(font);
|
|
|
|
|
|
|
|
HSSFCellStyle style = wb.createCellStyle();
|
|
|
|
|
|
|
|
style.setFillForegroundColor(HSSFColor.RED.index);
|
|
|
|
|
|
|
|
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
|
|
|
|
|
|
|
|
Sheet sheet = wb.createSheet("CityPartner_Commission_Info_" + month);
|
|
|
|
|
|
|
|
sheet.setDefaultColumnWidth(20);
|
|
|
|
|
|
|
|
int rowNum = 0;
|
|
|
|
|
|
|
|
Row row = sheet.createRow(rowNum);
|
|
|
|
|
|
|
|
String[] CommissionTitle = {"City Partner Name", "Transaction Amount", "Total Charge", "RoyalPay Charge", "Net Charge", "City Partner Charge", "Share Charge", "Type"};
|
|
|
|
|
|
|
|
for (int i = 0; i < CommissionTitle.length; i++) {
|
|
|
|
|
|
|
|
cell = row.createCell(i, Cell.CELL_TYPE_STRING);
|
|
|
|
|
|
|
|
cell.setCellStyle(titleStyle);
|
|
|
|
|
|
|
|
cell.setCellValue(CommissionTitle[i]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (JSONObject log : report) {
|
|
|
|
|
|
|
|
row = sheet.createRow(++rowNum);
|
|
|
|
|
|
|
|
StringBuffer name = new StringBuffer(log.getString("name"));
|
|
|
|
|
|
|
|
if (log.get("parent_org_id") == null) {
|
|
|
|
|
|
|
|
name.append("(一级代理)");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
name.append("(二级代理)");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String type = "";
|
|
|
|
|
|
|
|
switch (log.getIntValue("commission_type")) {
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
type = "渠道计算法";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
|
|
type = "总交易额比例";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
|
|
type = "收益比例";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
row.createCell(0, Cell.CELL_TYPE_STRING).setCellValue(name.toString());
|
|
|
|
|
|
|
|
row.createCell(1, Cell.CELL_TYPE_STRING).setCellValue(log.getBigDecimal("gross_amount") == null ? BigDecimal.ZERO.toPlainString() : log.getBigDecimal("gross_amount").toPlainString());
|
|
|
|
|
|
|
|
row.createCell(2, Cell.CELL_TYPE_STRING).setCellValue(log.getBigDecimal("total_charge") == null ? BigDecimal.ZERO.toPlainString() : log.getBigDecimal("total_charge").toPlainString());
|
|
|
|
|
|
|
|
row.createCell(3, Cell.CELL_TYPE_STRING).setCellValue(log.getBigDecimal("royalpay_charge") == null ? BigDecimal.ZERO.toPlainString() : log.getBigDecimal("royalpay_charge").toPlainString());
|
|
|
|
|
|
|
|
row.createCell(4, Cell.CELL_TYPE_STRING).setCellValue(log.getBigDecimal("net_charge") == null ? BigDecimal.ZERO.toPlainString() : log.getBigDecimal("net_charge").toPlainString());
|
|
|
|
|
|
|
|
row.createCell(5, Cell.CELL_TYPE_STRING).setCellValue(log.getBigDecimal("org_charge") == null ? BigDecimal.ZERO.toPlainString() : log.getBigDecimal("org_charge").toPlainString());
|
|
|
|
|
|
|
|
row.createCell(6, Cell.CELL_TYPE_STRING).setCellValue(log.getBigDecimal("share_charge") == null ? BigDecimal.ZERO.toPlainString() : log.getBigDecimal("share_charge").toPlainString());
|
|
|
|
|
|
|
|
row.createCell(7, Cell.CELL_TYPE_STRING).setCellValue(type);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
wb.write(ous);
|
|
|
|
|
|
|
|
ous.flush();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|