package com.cardinfo.action.mer;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import com.cardinfo.action.base.BaseAction;
import com.cardinfo.model.Tagent;
import com.cardinfo.model.Tcity;
import com.cardinfo.model.Tgroup;
import com.cardinfo.model.Tmcc;
import com.cardinfo.model.Tmcclist;
import com.cardinfo.model.Tmerchat;
import com.cardinfo.model.Torgan;
import com.cardinfo.model.Tpack;
import com.cardinfo.model.Tparadic;
import com.cardinfo.model.Tprovince;
import com.cardinfo.model.Trate;
import com.cardinfo.model.TrecieveOrgan;
import com.cardinfo.model.Tuser;
import com.cardinfo.service.mer.TaccountServiceI;
import com.cardinfo.service.mer.TcityServiceI;
import com.cardinfo.service.mer.TftpServiceI;
import com.cardinfo.service.mer.TgroupServiceI;
import com.cardinfo.service.mer.TlinkmanServiceI;
import com.cardinfo.service.mer.TmccListServiceI;
import com.cardinfo.service.mer.TmccServiceI;
import com.cardinfo.service.mer.TmerchatServiceI;
import com.cardinfo.service.mer.TpackServiceI;
import com.cardinfo.service.mer.TparadicServiceI;
import com.cardinfo.service.mer.TprovinceServiceI;
import com.cardinfo.service.mer.TrateServiceI;
import com.cardinfo.service.mer.TrecieveOrganServiceI;
import com.cardinfo.service.sys.AgentOrgServiceI;
import com.cardinfo.service.sys.OrganServiceI;
import com.cardinfo.util.Const;
import com.cardinfo.view.Grid;
import com.cardinfo.view.MerchInfo;
import com.cardinfo.view.Merchant;
import com.cardinfo.view.Page;
import com.opensymphony.xwork2.ModelDriven;
/**
*
* 导出excel
*
*/
@ParentPackage(value = "cardinfoPackage")
@Namespace("/mer")
@Action(value = "exportExcel")
public class ExportExcel extends BaseAction<MerchInfo> implements
ModelDriven<MerchInfo> {
private static final long serialVersionUID = 1L;
private static final Logger logger = Logger.getLogger(ExportExcel.class);
private MerchInfo merchInfo = new MerchInfo();
private TmerchatServiceI tmerchatService; // 商户基本信息
private TaccountServiceI taccountService; // 账户信息
private TlinkmanServiceI tlinkmanService; // 联系人
private TftpServiceI tftpService; // 上传ftp
private TparadicServiceI tparadicService;
private TprovinceServiceI tprovinceService;
private TcityServiceI tcityService;
private TgroupServiceI tgroupService;
private TrecieveOrganServiceI trecieveOrganService;
private TmccListServiceI tmccListService;
private TmccServiceI tmccService;
private TpackServiceI tpackService;
private AgentOrgServiceI agenOrgService;
private OrganServiceI organService;
private TrateServiceI trateService;
//导出商户信息excel(以ID形式显示)
public void exportCsv() throws IOException{
Page<Tmerchat> page=new Page<Tmerchat>();
page.setPageNo(this.page); //设置当前页码
page.setPageSize(this.rows);
Tuser tuser = (Tuser) getSession().getAttribute(Const.SESSION_USER);
String userName=tuser.getUserName();
Long belongId = tuser.getBelongId();//所属ID
Long belongTo = tuser.getBelongTo(); //用户属性 0:商户 1:组织机构 2:拓展机构
page.getParams().put("id", belongId);
page.getParams().put("belong_to", belongTo);
page.getParams().put("creator", userName);
if(merchInfo.getMerchName() !=null && !merchInfo.getMerchName().equals(""))
page.getParams().put("merchName", merchInfo.getMerchName().trim());
if(merchInfo.getMerchSname() !=null && !merchInfo.getMerchSname().equals(""))
page.getParams().put("merchSname", merchInfo.getMerchSname().trim());
if(merchInfo.getLawyerName() !=null && !merchInfo.getLawyerName().equals(""))
page.getParams().put("lawyerName", merchInfo.getLawyerName().trim());
List<MerchInfo> merchList = tmerchatService.selectMerchInfo(page);
Merchant merchant=new Merchant();
// return;
HttpServletResponse response = getResponse();
response.setContentType("application/octet-stream;charset=iso-8859-1");
try {
response.setHeader("Content-Disposition", "attachment;filename="+java.net.URLEncoder.encode("商户信息.xls", "UTF-8"));
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
HSSFWorkbook book = new HSSFWorkbook();
HSSFSheet sheet = book.createSheet("商户信息");
HSSFRow row = sheet.createRow(0);
//表格标题字段
String []colums={" 商户名称 ","商户简称","税务登记号","项目名称","项目来源","清算周期","商户所属省份","商户所属市","商户类型","商户拓展机构","收单机构","组织机构",
"工商营业执照号","营业执照有效期","工商注册地址 ","工商注册省份","工商注册地址邮编","营业地址","营业地址省份","营业地址邮编","组织机构代码","组织机构证有效日期",
"商户所属行业","商户类别(MCC)","法人姓名","法人证件类型","法人证件编号","法人证件有效期","法人联系电话","开户银行","结算账号","结算账户名称","服务费金额(元)","产品名称",
"扣率版本","扣率","最低收费额(元)","最高收费额(元)","交易渠道","联系人姓名","联系人电话","联系人邮政编码 ","联系人地址","联系人电子邮箱","是否开通T+0","是否开通理财 "};
for(int j=0;j<colums.length;j++){
row.createCell(j).setCellValue(colums[j]);
}
// 取出商户信息
for(int i=0;i<merchList.size();i++){ // eg: 2 , i,0,1
HSSFRow row1 = sheet.createRow(i+1);
row1.createCell(0).setCellValue(merchList.get(i).getMerchName());
row1.createCell(1).setCellValue(merchList.get(i).getMerchSname());
row1.createCell(2).setCellValue(merchList.get(i).getTaxregNo());
row1.createCell(3).setCellValue(merchList.get(i).getProgramName());
row1.createCell(4).setCellValue(merchList.get(i).getProgramSource());
row1.createCell(5).setCellValue(merchList.get(i).getClearPeroid());
row1.createCell(6).setCellValue(merchList.get(i).getProvince()); //商户省份
row1.createCell(7).setCellValue(merchList.get(i).getCity());//商户市
row1.createCell(8).setCellValue(merchList.get(i).getMerchType());
row1.createCell(9).setCellValue(merchList.get(i).getMerchOran());
row1.createCell(10).setCellValue(merchList.get(i).getRecieveOrgan());
row1.createCell(11).setCellValue(merchList.get(i).getOrgId()+"");
row1.createCell(12).setCellValue(merchList.get(i).getBusiLicense());
row1.createCell(13).setCellValue(merchList.get(i).getBusiLicenceTime());
row1.createCell(14).setCellValue(merchList.get(i).getBusiAddr());
row1.createCell(16).setCellValue(merchList.get(i).getBusiPostCode());
row1.createCell(17).setCellValue(merchList.get(i).getTradeAddr());
row1.createCell(18).setCellValue(merchList.get(i).getTradeProvince());
row1.createCell(19).setCellValue(merchList.get(i).getTradePostCode());
row1.createCell(20).setCellValue(merchList.get(i).getInstiCode());
row1.createCell(21).setCellValue(merchList.get(i).getInstiTime());
row1.createCell(22).setCellValue(merchList.get(i).getMerchFrom());
row1.createCell(23).setCellValue(merchList.get(i).getMerchItem());
row1.createCell(24).setCellValue(merchList.get(i).getLawyerName());
row1.createCell(25).setCellValue(merchList.get(i).getLawyCertiType());
row1.createCell(26).setCellValue(merchList.get(i).getLawyCertiNo());
row1.createCell(27).setCellValue(merchList.get(i).getLawyerTime());
row1.createCell(28).setCellValue(merchList.get(i).getLawyTelNo());
row1.createCell(29).setCellValue(merchList.get(i).getCheckBank());
row1.createCell(30).setCellValue(merchList.get(i).getAccountNo());
row1.createCell(31).setCellValue(merchList.get(i).getAccountName());
row1.createCell(32).setCellValue(merchList.get(i).getAccountTatal()+"");
row1.createCell(33).setCellValue(merchList.get(i).getProductName());
row1.createCell(34).setCellValue(merchList.get(i).getRoteVersion());
//按商户类型定义收费标准 ("扣率","最低收费额","最高收费额")
List<Trate> rateList=trateService.selectRateList();
for (Trate trate : rateList) {
if(merchList.get(i).getRoteVersion().equals(trate.getBusiPackCode())){
row1.createCell(35).setCellValue(trate.getFeeRate());
row1.createCell(36).setCellValue(trate.getMinFee());
row1.createCell(37).setCellValue(trate.getMaxFee());
}
}
row1.createCell(38).setCellValue(merchList.get(i).getTrasalChannel());
row1.createCell(39).setCellValue(merchList.get(i).getContactName());
row1.createCell(40).setCellValue(merchList.get(i).getContactMobile());
row1.createCell(41).setCellValue(merchList.get(i).getPostCode());
row1.createCell(42).setCellValue(merchList.get(i).getContactAddr());
row1.createCell(43).setCellValue(merchList.get(i).getContactEmail());
row1.createCell(44).setCellValue(merchList.get(i).getIsopenT()+"");
row1.createCell(45).setCellValue(merchList.get(i).getIsfinancial()+"");
}
book.write(response.getOutputStream());
}
//导出商户信息excel不分页
public void exportCsv1() throws IOException{
Tuser tuser = (Tuser) getSession().getAttribute(Const.SESSION_USER);
String userName=tuser.getUserName();
Long belongId = tuser.getBelongId();//所属ID
Long belongTo = tuser.getBelongTo(); //用户属性 0:商户 1:组织机构 2:拓展机构
List<MerchInfo> merchList = tmerchatService.selectMerchInfoNotByPage(belongId);
Merchant merchant=new Merchant();
HttpServletResponse response = getResponse();
response.setContentType("application/octet-stream;charset=iso-8859-1");
try {
response.setHeader("Content-Disposition", "attachment;filename="+java.net.URLEncoder.encode("商户信息.xls", "UTF-8"));
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
HSSFWorkbook book = new HSSFWorkbook();
HSSFSheet sheet = book.createSheet("商户信息");
HSSFRow row = sheet.createRow(0);
//表格标题字段
String []colums={" 商户名称 ","商户简称","税务登记号","项目名称","项目来源","清算周期","商户所属省份","商户所属市","商户类型","商户拓展机构","收单机构","组织机构",
"工商营业执照号","营业执照有效期","工商注册地址 ","工商注册省份","工商注册地址邮编","营业地址","营业地址省份","营业地址邮编","组织机构代码","组织机构证有效日期",
"商户所属行业","商户类别(MCC)","法人姓名","法人证件类型","法人证件编号","法人证件有效期","法人联系电话","开户银行","结算账号","结算账户名称","服务费金额(元)","产品名称",
"扣率版本","扣率","最低收费额(元)","最高收费额(元)","交易渠道","联系人姓名","联系人电话","联系人邮政编码 ","联系人地址","联系人电子邮箱","是否开通T+0","是否开通理财 "};
for(int j=0;j<colums.length;j++){
row.createCell(j).setCellValue(colums[j]);
}
// 取出商户信息
for(int i=0;i<merchList.size();i++){ // eg: 2 , i,0,1
HSSFRow row1 = sheet.createRow(i+1);
row1.createCell(0).setCellValue(merchList.get(i).getMerchName());
row1.createCell(1).setCellValue(merchList.get(i).getMerchSname());
row1.createCell(2).setCellValue(merchList.get(i).getTaxregNo());
row1.createCell(3).setCellValue(merchList.get(i).getProgramName());
row1.createCell(4).setCellValue(merchList.get(i).getProgramSource());
row1.createCell(5).setCellValue(merchList.get(i).getClearPeroid());
row1.createCell(6).setCellValue(merchList.get(i).getProvince()); //商户省份
row1.createCell(7).setCellValue(merchList.get(i).getCity());//商户市
row1.createCell(8).setCellValue(merchList.get(i).getMerchType());
row1.createCell(9).setCellValue(merchList.get(i).getMerchOran());
row1.createCell(10).setCellValue(merchList.get(i).getRecieveOrgan());
row1.createCell(11).setCellValue(merchList.get(i).getOrgId()+"");
row1.createCell(12).setCellValue(merchList.get(i).getBusiLicense());
row1.createCell(13).setCellValue(merchList.get(i).getBusiLicenceTime());
row1.createCell(14).setCellValue(merchList.get(i).getBusiAddr());
row1.createCell(16).setCellValue(merchList.get(i).getBusiPostCode());
row1.createCell(17).setCellValue(merchList.get(i).getTradeAddr());
row1.createCell(18).setCellValue(merchList.get(i).getTradeProvince());
row1.createCell(19).setCellValue(merchList.get(i).getTradePostCode());
row1.createCell(20).setCellValue(merchList.get(i).getInstiCode());
row1.createCell(21).setCellValue(merchList.get(i).getInstiTime());
row1.createCell(22).setCellValue(merchList.get(i).getMerchFrom());
row1.createCell(23).setCellValue(merchList.get(i).getMerchItem());
row1.createCell(24).setCellValue(merchList.get(i).getLawyerName());
row1.createCell(25).setCellValue(merchList.get(i).getLawyCertiType());
row1.createCell(26).setCellValue(merchList.get(i).getLawyCertiNo());
row1.createCell(27).setCellValue(merchList.get(i).getLawyerTime());
row1.createCell(28).setCellValue(merchList.get(i).getLawyTelNo());
row1.createCell(29).setCellValue(merchList.get(i).getCheckBank());
row1.createCell(30).setCellValue(merchList.get(i).getAccountNo());
row1.createCell(31).setCellValue(merchList.get(i).getAccountName());
row1.createCell(32).setCellValue(merchList.get(i).getAccountTatal()+"");
row1.createCell(33).setCellValue(merchList.get(i).getProductName());
row1.createCell(34).setCellValue(merchList.get(i).getRoteVersion());
//按商户类型定义收费标准 ("扣率","最低收费额","最高收费额")
List<Trate> rateList=trateService.selectRateList();
for (Trate trate : rateList) {
if(merchList.get(i).getRoteVersion().equals(trate.getBusiPackCode())){
row1.createCell(35).setCellValue(trate.getFeeRate());
row1.createCell(36).setCellValue(trate.getMinFee());
row1.createCell(37).setCellValue(trate.getMaxFee());
}
}
row1.createCell(38).setCellValue(merchList.get(i).getTrasalChannel());
row1.createCell(39).setCellValue(merchList.get(i).getContactName());
row1.createCell(40).setCellValue(merchList.get(i).getContactMobile());
row1.createCell(41).setCellValue(merchList.get(i).getPostCode());
row1.createCell(42).setCellValue(merchList.get(i).getContactAddr());
row1.createCell(43).setCellValue(merchList.get(i).getContactEmail());
row1.createCell(44).setCellValue(merchList.get(i).getIsopenT()+"");
row1.createCell(45).setCellValue(merchList.get(i).getIsfinancial()+"");
}
book.write(response.getOutputStream());
}
//导出商户信息excel(ID转name形式)
/*public void exportCsv() throws IOException {
Page<Tmerchat> page=new Page<Tmerchat>();
page.setPageNo(this.page); //设置当前页码
page.setPageSize(this.rows);
Tuser tuser = (Tuser) getSession().getAttribute(Const.SESSION_USER);
String userName=tuser.getUserName();
Long belongId = tuser.getBelongId();//所属ID
Long belongTo = tuser.getBelongTo(); //用户属性 0:商户 1:组织机构 2:拓展机构
page.getParams().put("id", belongId);
page.getParams().put("belong_to", belongTo);
page.getParams().put("creator", userName);
if(merchInfo.getMerchName() !=null && !merchInfo.getMerchName().equals(""))
page.getParams().put("merchName", merchInfo.getMerchName().trim());
if(merchInfo.getMerchSname() !=null && !merchInfo.getMerchSname().equals(""))
page.getParams().put("merchSname", merchInfo.getMerchSname().trim());
if(merchInfo.getLawyerName() !=null && !merchInfo.getLawyerName().equals(""))
page.getParams().put("lawyerName", merchInfo.getLawyerName().trim());
List<MerchInfo> merchList = tmerchatService.selectMerchInfo(page);
Merchant merchant=new Merchant();
// return;
HttpServletResponse response = getResponse();
response.setContentType("application/octet-stream;charset=iso-8859-1");
try {
response.setHeader("Content-Disposition", "attachment;filename="+java.net.URLEncoder.encode("商户信息.xls", "UTF-8"));
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
HSSFWorkbook book = new HSSFWorkbook();
HSSFSheet sheet = book.createSheet("商户信息");
HSSFRow row = sheet.createRow(0);
//表格标题字段
String []colums={" 商户名称 ","商户简称","税务登记号","项目名称","项目来源","清算周期","商户所属省份","商户所属市","商户类型","商户拓展机构","收单机构","组织机构",
"工商营业执照号","营业执照有效期","工商注册地址 ","工商注册省份","工商注册地址邮编","营业地址","营业地址省份","营业地址邮编","组织机构代码","组织机构证有效日期",
"商户所属行业","商户类别(MCC)","法人姓名","法人证件类型","法人证件编号","法人证件有效期","法人联系电话","开户银行","结算账号","结算账户名称","服务费金额(元)","产品名称",
"扣率版本","交易渠道","联系人姓名","联系人电话","联系人邮政编码 ","联系人地址","联系人电子邮箱","是否开通T+0","是否开通理财 "};
for(int j=0;j<colums.length;j++){
row.createCell(j).setCellValue(colums[j]);
}
// 取出商户信息
for(int i=0;i<merchList.size();i++){ // eg: 2 , i,0,1
HSSFRow row1 = sheet.createRow(i+1);
row1.createCell(0).setCellValue(merchList.get(i).getMerchName());
row1.createCell(1).setCellValue(merchList.get(i).getMerchSname());
row1.createCell(2).setCellValue(merchList.get(i).getTaxregNo());
List<Tparadic> palist=tparadicService.selectParaInfo();
for (Tparadic tparadic : palist) {
//商户类型
if(Integer.parseInt(merchList.get(i).getMerchType())==tparadic.getTid()){
merchInfo.setMerchTypeName(tparadic.getParaName());
row1.createCell(8).setCellValue(merchInfo.getMerchTypeName());
}else if(Integer.parseInt(merchList.get(i).getProgramName())==tparadic.getTid()){
//项目名称
merchInfo.setProgramName1(tparadic.getParaName());
row1.createCell(3).setCellValue(merchInfo.getProgramName1());
}else if(Integer.parseInt(merchList.get(i).getProgramSource())==tparadic.getTid()){
//项目来源
merchInfo.setProgramSourceName(tparadic.getParaName());
row1.createCell(4).setCellValue(merchInfo.getProgramSourceName());
}else if(Integer.parseInt(merchList.get(i).getClearPeroid())==tparadic.getTid()){
//清算周期
merchInfo.setClearPeroidName(tparadic.getParaName());
row1.createCell(5).setCellValue(merchInfo.getClearPeroidName());
}else if(merchList.get(i).getLawyCertiType()==tparadic.getTid()){
//身份证
merchInfo.setLawyCertiTypeName(tparadic.getParaName());
row1.createCell(25).setCellValue(merchInfo.getLawyCertiTypeName());
}
}
List<Tprovince> pList=tprovinceService.selectProvince(); //省
for (Tprovince tprovince : pList) {
if(merchList.get(i).getProvince()==tprovince.getpId()){
merchInfo.setProvinceName(tprovince.getpName());
row1.createCell(6).setCellValue(merchInfo.getProvinceName()); //商户省份
}
else if(merchant.getProvince()==tprovince.getpId()){
merchant.setProvinceName(tprovince.getpName());
}
else if(merchList.get(i).getBusiProvince()==tprovince.getpId()){
merchInfo.setBusiProvinceName(tprovince.getpName());
row1.createCell(15).setCellValue(merchInfo.getBusiProvinceName()); //工商省份
}else if(merchList.get(i).getTradeProvince()==tprovince.getpId()){
merchInfo.setTradeProvinceName(tprovince.getpName()); //营业执照省份
row1.createCell(18).setCellValue(merchInfo.getTradeProvinceName());
}
}
List<Tcity> cList= tcityService.selectByTcity(); //市
for (Tcity tcity : cList) {
if(merchList.get(i).getCity().equals(tcity.getcId())){
merchInfo.setCityName(tcity.getcName());
row1.createCell(7).setCellValue(merchInfo.getCityName());//商户市
}
}
//收单机构
List<TrecieveOrgan> recieveList=trecieveOrganService.selectRecieveOrganList();
for (TrecieveOrgan trecieveOrgan : recieveList) {
if(merchList.get(i).getRecieveOrgan().equals(trecieveOrgan.getOrganCode())){
merchInfo.setRecieveOrganName(trecieveOrgan.getOrganName());
row1.createCell(10).setCellValue(merchInfo.getRecieveOrganName());
}
}
//商户所属行业
List<Tmcc> mcc = tmccService.selectMccList();
for (Tmcc tmcc : mcc) {
if(merchList.get(i).getMerchFrom().equals(tmcc.getMcc())){
merchInfo.setMerchFromName(tmcc.getMccname());
row1.createCell(22).setCellValue(merchInfo.getMerchFromName());
}
}
//商户所属行业item
List<Tmcclist> mccList=tmccListService.selectMccItemList();
for (Tmcclist tmcclist : mccList) {
if(merchList.get(i).getMerchItem().equals(tmcclist.getMcclist())){
merchInfo.setMerchItemName(tmcclist.getMcccont());
row1.createCell(23).setCellValue(merchInfo.getMerchItemName());
}
}
//扣率版本
List<Tpack> packList=tpackService.selectPackList();
for (Tpack tpack : packList) {
if(merchList.get(i).getRoteVersion().equals(tpack.getBusiPackCode())){
merchInfo.setRoteVersionName(tpack.getBusiPackName());
row1.createCell(34).setCellValue(merchInfo.getRoteVersionName());
}
}
//商户拓展机构merchOran
List<Tagent> agentList=agenOrgService.agentList();
for (Tagent tagent : agentList) {
if (merchList.get(i).getMerchOran()==tagent.getId()) {
merchInfo.setMerchOranName(tagent.getAgentName());
row1.createCell(9).setCellValue(merchInfo.getMerchOranName());
}
}
//商户组织机构oragnId
List<Torgan> organList= organService.selectByAllOrgan();
for (Torgan torgan : organList) {
if( merchList.get(i).getOrgId().longValue()==torgan.getId()){
merchInfo.setOrgIdName(torgan.getOrganName());
row1.createCell(11).setCellValue(merchInfo.getOrgIdName());
}
}
row1.createCell(12).setCellValue(merchList.get(i).getBusiLicense());
row1.createCell(13).setCellValue(merchList.get(i).getBusiLicenceTime());
row1.createCell(14).setCellValue(merchList.get(i).getBusiAddr());
row1.createCell(16).setCellValue(merchList.get(i).getBusiPostCode());
row1.createCell(17).setCellValue(merchList.get(i).getTradeAddr());
row1.createCell(19).setCellValue(merchList.get(i).getTradePostCode());
row1.createCell(20).setCellValue(merchList.get(i).getInstiCode());
row1.createCell(21).setCellValue(merchList.get(i).getInstiTime());
row1.createCell(24).setCellValue(merchList.get(i).getLawyerName());
row1.createCell(26).setCellValue(merchList.get(i).getLawyCertiNo());
row1.createCell(27).setCellValue(merchList.get(i).getLawyerTime());
row1.createCell(28).setCellValue(merchList.get(i).getLawyTelNo());
row1.createCell(29).setCellValue(merchList.get(i).getCheckBank());
row1.createCell(30).setCellValue(merchList.get(i).getAccountNo());
row1.createCell(31).setCellValue(merchList.get(i).getAccountName());
row1.createCell(32).setCellValue(merchList.get(i).getAccountTatal()+"");
//产品名称 id 转name
List<Tgroup> groupList=tgroupService.selectGroup();
for (Tgroup tgroup : groupList) {
if (merchList.get(i).getProductName().equals(tgroup.getGroupCode())) {
merchInfo.setProductName1(tgroup.getGroupName());
row1.createCell(33).setCellValue(merchInfo.getProductName1());
}
}
if(merchList.get(i).getTrasalChannel().equals("0000")){ //交易渠道0000 ---中国银联
row1.createCell(35).setCellValue("中国银联");
}
row1.createCell(36).setCellValue(merchList.get(i).getContactName());
row1.createCell(37).setCellValue(merchList.get(i).getContactMobile());
row1.createCell(38).setCellValue(merchList.get(i).getPostCode());
row1.createCell(39).setCellValue(merchList.get(i).getContactAddr());
row1.createCell(40).setCellValue(merchList.get(i).getContactEmail());
//是否开通T+0 是:1,否 :0
if(merchList.get(i).getIsopenT().intValue()==0){
row1.createCell(41).setCellValue("未开通");
}else{
row1.createCell(41).setCellValue("开通");
}
//是否开通理财 是:1,否 :0
if(merchList.get(i).getIsfinancial().intValue()==0){
row1.createCell(42).setCellValue("未开通");
}else{
row1.createCell(42).setCellValue("开通");
}
}
book.write(response.getOutputStream());
}*/
public MerchInfo getMerchInfo() {
return merchInfo;
}
public void setMerchInfo(MerchInfo merchInfo) {
this.merchInfo = merchInfo;
}
public TmerchatServiceI getTmerchatService() {
return tmerchatService;
}
public void setTmerchatService(TmerchatServiceI tmerchatService) {
this.tmerchatService = tmerchatService;
}
public TaccountServiceI getTaccountService() {
return taccountService;
}
public void setTaccountService(TaccountServiceI taccountService) {
this.taccountService = taccountService;
}
public TlinkmanServiceI getTlinkmanService() {
return tlinkmanService;
}
public void setTlinkmanService(TlinkmanServiceI tlinkmanService) {
this.tlinkmanService = tlinkmanService;
}
public TftpServiceI getTftpService() {
return tftpService;
}
public void setTftpService(TftpServiceI tftpService) {
this.tftpService = tftpService;
}
public TparadicServiceI getTparadicService() {
return tparadicService;
}
public void setTparadicService(TparadicServiceI tparadicService) {
this.tparadicService = tparadicService;
}
public TprovinceServiceI getTprovinceService() {
return tprovinceService;
}
public void setTprovinceService(TprovinceServiceI tprovinceService) {
this.tprovinceService = tprovinceService;
}
public TcityServiceI getTcityService() {
return tcityService;
}
public void setTcityService(TcityServiceI tcityService) {
this.tcityService = tcityService;
}
public TgroupServiceI getTgroupService() {
return tgroupService;
}
public void setTgroupService(TgroupServiceI tgroupService) {
this.tgroupService = tgroupService;
}
public TrecieveOrganServiceI getTrecieveOrganService() {
return trecieveOrganService;
}
public void setTrecieveOrganService(
TrecieveOrganServiceI trecieveOrganService) {
this.trecieveOrganService = trecieveOrganService;
}
public TmccListServiceI getTmccListService() {
return tmccListService;
}
public void setTmccListService(TmccListServiceI tmccListService) {
this.tmccListService = tmccListService;
}
public TmccServiceI getTmccService() {
return tmccService;
}
public void setTmccService(TmccServiceI tmccService) {
this.tmccService = tmccService;
}
public TpackServiceI getTpackService() {
return tpackService;
}
public void setTpackService(TpackServiceI tpackService) {
this.tpackService = tpackService;
}
public AgentOrgServiceI getAgenOrgService() {
return agenOrgService;
}
public void setAgenOrgService(AgentOrgServiceI agenOrgService) {
this.agenOrgService = agenOrgService;
}
public OrganServiceI getOrganService() {
return organService;
}
public void setOrganService(OrganServiceI organService) {
this.organService = organService;
}
public MerchInfo getModel() {
// TODO Auto-generated method stub
return merchInfo;
}
public void setTrateService(TrateServiceI trateService) {
this.trateService = trateService;
}
public TrateServiceI getTrateService() {
return trateService;
}
}
import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import com.cardinfo.action.base.BaseAction;
import com.cardinfo.model.Tagent;
import com.cardinfo.model.Tcity;
import com.cardinfo.model.Tgroup;
import com.cardinfo.model.Tmcc;
import com.cardinfo.model.Tmcclist;
import com.cardinfo.model.Tmerchat;
import com.cardinfo.model.Torgan;
import com.cardinfo.model.Tpack;
import com.cardinfo.model.Tparadic;
import com.cardinfo.model.Tprovince;
import com.cardinfo.model.Trate;
import com.cardinfo.model.TrecieveOrgan;
import com.cardinfo.model.Tuser;
import com.cardinfo.service.mer.TaccountServiceI;
import com.cardinfo.service.mer.TcityServiceI;
import com.cardinfo.service.mer.TftpServiceI;
import com.cardinfo.service.mer.TgroupServiceI;
import com.cardinfo.service.mer.TlinkmanServiceI;
import com.cardinfo.service.mer.TmccListServiceI;
import com.cardinfo.service.mer.TmccServiceI;
import com.cardinfo.service.mer.TmerchatServiceI;
import com.cardinfo.service.mer.TpackServiceI;
import com.cardinfo.service.mer.TparadicServiceI;
import com.cardinfo.service.mer.TprovinceServiceI;
import com.cardinfo.service.mer.TrateServiceI;
import com.cardinfo.service.mer.TrecieveOrganServiceI;
import com.cardinfo.service.sys.AgentOrgServiceI;
import com.cardinfo.service.sys.OrganServiceI;
import com.cardinfo.util.Const;
import com.cardinfo.view.Grid;
import com.cardinfo.view.MerchInfo;
import com.cardinfo.view.Merchant;
import com.cardinfo.view.Page;
import com.opensymphony.xwork2.ModelDriven;
/**
*
* 导出excel
*
*/
@ParentPackage(value = "cardinfoPackage")
@Namespace("/mer")
@Action(value = "exportExcel")
public class ExportExcel extends BaseAction<MerchInfo> implements
ModelDriven<MerchInfo> {
private static final long serialVersionUID = 1L;
private static final Logger logger = Logger.getLogger(ExportExcel.class);
private MerchInfo merchInfo = new MerchInfo();
private TmerchatServiceI tmerchatService; // 商户基本信息
private TaccountServiceI taccountService; // 账户信息
private TlinkmanServiceI tlinkmanService; // 联系人
private TftpServiceI tftpService; // 上传ftp
private TparadicServiceI tparadicService;
private TprovinceServiceI tprovinceService;
private TcityServiceI tcityService;
private TgroupServiceI tgroupService;
private TrecieveOrganServiceI trecieveOrganService;
private TmccListServiceI tmccListService;
private TmccServiceI tmccService;
private TpackServiceI tpackService;
private AgentOrgServiceI agenOrgService;
private OrganServiceI organService;
private TrateServiceI trateService;
//导出商户信息excel(以ID形式显示)
public void exportCsv() throws IOException{
Page<Tmerchat> page=new Page<Tmerchat>();
page.setPageNo(this.page); //设置当前页码
page.setPageSize(this.rows);
Tuser tuser = (Tuser) getSession().getAttribute(Const.SESSION_USER);
String userName=tuser.getUserName();
Long belongId = tuser.getBelongId();//所属ID
Long belongTo = tuser.getBelongTo(); //用户属性 0:商户 1:组织机构 2:拓展机构
page.getParams().put("id", belongId);
page.getParams().put("belong_to", belongTo);
page.getParams().put("creator", userName);
if(merchInfo.getMerchName() !=null && !merchInfo.getMerchName().equals(""))
page.getParams().put("merchName", merchInfo.getMerchName().trim());
if(merchInfo.getMerchSname() !=null && !merchInfo.getMerchSname().equals(""))
page.getParams().put("merchSname", merchInfo.getMerchSname().trim());
if(merchInfo.getLawyerName() !=null && !merchInfo.getLawyerName().equals(""))
page.getParams().put("lawyerName", merchInfo.getLawyerName().trim());
List<MerchInfo> merchList = tmerchatService.selectMerchInfo(page);
Merchant merchant=new Merchant();
// return;
HttpServletResponse response = getResponse();
response.setContentType("application/octet-stream;charset=iso-8859-1");
try {
response.setHeader("Content-Disposition", "attachment;filename="+java.net.URLEncoder.encode("商户信息.xls", "UTF-8"));
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
HSSFWorkbook book = new HSSFWorkbook();
HSSFSheet sheet = book.createSheet("商户信息");
HSSFRow row = sheet.createRow(0);
//表格标题字段
String []colums={" 商户名称 ","商户简称","税务登记号","项目名称","项目来源","清算周期","商户所属省份","商户所属市","商户类型","商户拓展机构","收单机构","组织机构",
"工商营业执照号","营业执照有效期","工商注册地址 ","工商注册省份","工商注册地址邮编","营业地址","营业地址省份","营业地址邮编","组织机构代码","组织机构证有效日期",
"商户所属行业","商户类别(MCC)","法人姓名","法人证件类型","法人证件编号","法人证件有效期","法人联系电话","开户银行","结算账号","结算账户名称","服务费金额(元)","产品名称",
"扣率版本","扣率","最低收费额(元)","最高收费额(元)","交易渠道","联系人姓名","联系人电话","联系人邮政编码 ","联系人地址","联系人电子邮箱","是否开通T+0","是否开通理财 "};
for(int j=0;j<colums.length;j++){
row.createCell(j).setCellValue(colums[j]);
}
// 取出商户信息
for(int i=0;i<merchList.size();i++){ // eg: 2 , i,0,1
HSSFRow row1 = sheet.createRow(i+1);
row1.createCell(0).setCellValue(merchList.get(i).getMerchName());
row1.createCell(1).setCellValue(merchList.get(i).getMerchSname());
row1.createCell(2).setCellValue(merchList.get(i).getTaxregNo());
row1.createCell(3).setCellValue(merchList.get(i).getProgramName());
row1.createCell(4).setCellValue(merchList.get(i).getProgramSource());
row1.createCell(5).setCellValue(merchList.get(i).getClearPeroid());
row1.createCell(6).setCellValue(merchList.get(i).getProvince()); //商户省份
row1.createCell(7).setCellValue(merchList.get(i).getCity());//商户市
row1.createCell(8).setCellValue(merchList.get(i).getMerchType());
row1.createCell(9).setCellValue(merchList.get(i).getMerchOran());
row1.createCell(10).setCellValue(merchList.get(i).getRecieveOrgan());
row1.createCell(11).setCellValue(merchList.get(i).getOrgId()+"");
row1.createCell(12).setCellValue(merchList.get(i).getBusiLicense());
row1.createCell(13).setCellValue(merchList.get(i).getBusiLicenceTime());
row1.createCell(14).setCellValue(merchList.get(i).getBusiAddr());
row1.createCell(16).setCellValue(merchList.get(i).getBusiPostCode());
row1.createCell(17).setCellValue(merchList.get(i).getTradeAddr());
row1.createCell(18).setCellValue(merchList.get(i).getTradeProvince());
row1.createCell(19).setCellValue(merchList.get(i).getTradePostCode());
row1.createCell(20).setCellValue(merchList.get(i).getInstiCode());
row1.createCell(21).setCellValue(merchList.get(i).getInstiTime());
row1.createCell(22).setCellValue(merchList.get(i).getMerchFrom());
row1.createCell(23).setCellValue(merchList.get(i).getMerchItem());
row1.createCell(24).setCellValue(merchList.get(i).getLawyerName());
row1.createCell(25).setCellValue(merchList.get(i).getLawyCertiType());
row1.createCell(26).setCellValue(merchList.get(i).getLawyCertiNo());
row1.createCell(27).setCellValue(merchList.get(i).getLawyerTime());
row1.createCell(28).setCellValue(merchList.get(i).getLawyTelNo());
row1.createCell(29).setCellValue(merchList.get(i).getCheckBank());
row1.createCell(30).setCellValue(merchList.get(i).getAccountNo());
row1.createCell(31).setCellValue(merchList.get(i).getAccountName());
row1.createCell(32).setCellValue(merchList.get(i).getAccountTatal()+"");
row1.createCell(33).setCellValue(merchList.get(i).getProductName());
row1.createCell(34).setCellValue(merchList.get(i).getRoteVersion());
//按商户类型定义收费标准 ("扣率","最低收费额","最高收费额")
List<Trate> rateList=trateService.selectRateList();
for (Trate trate : rateList) {
if(merchList.get(i).getRoteVersion().equals(trate.getBusiPackCode())){
row1.createCell(35).setCellValue(trate.getFeeRate());
row1.createCell(36).setCellValue(trate.getMinFee());
row1.createCell(37).setCellValue(trate.getMaxFee());
}
}
row1.createCell(38).setCellValue(merchList.get(i).getTrasalChannel());
row1.createCell(39).setCellValue(merchList.get(i).getContactName());
row1.createCell(40).setCellValue(merchList.get(i).getContactMobile());
row1.createCell(41).setCellValue(merchList.get(i).getPostCode());
row1.createCell(42).setCellValue(merchList.get(i).getContactAddr());
row1.createCell(43).setCellValue(merchList.get(i).getContactEmail());
row1.createCell(44).setCellValue(merchList.get(i).getIsopenT()+"");
row1.createCell(45).setCellValue(merchList.get(i).getIsfinancial()+"");
}
book.write(response.getOutputStream());
}
//导出商户信息excel不分页
public void exportCsv1() throws IOException{
Tuser tuser = (Tuser) getSession().getAttribute(Const.SESSION_USER);
String userName=tuser.getUserName();
Long belongId = tuser.getBelongId();//所属ID
Long belongTo = tuser.getBelongTo(); //用户属性 0:商户 1:组织机构 2:拓展机构
List<MerchInfo> merchList = tmerchatService.selectMerchInfoNotByPage(belongId);
Merchant merchant=new Merchant();
HttpServletResponse response = getResponse();
response.setContentType("application/octet-stream;charset=iso-8859-1");
try {
response.setHeader("Content-Disposition", "attachment;filename="+java.net.URLEncoder.encode("商户信息.xls", "UTF-8"));
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
HSSFWorkbook book = new HSSFWorkbook();
HSSFSheet sheet = book.createSheet("商户信息");
HSSFRow row = sheet.createRow(0);
//表格标题字段
String []colums={" 商户名称 ","商户简称","税务登记号","项目名称","项目来源","清算周期","商户所属省份","商户所属市","商户类型","商户拓展机构","收单机构","组织机构",
"工商营业执照号","营业执照有效期","工商注册地址 ","工商注册省份","工商注册地址邮编","营业地址","营业地址省份","营业地址邮编","组织机构代码","组织机构证有效日期",
"商户所属行业","商户类别(MCC)","法人姓名","法人证件类型","法人证件编号","法人证件有效期","法人联系电话","开户银行","结算账号","结算账户名称","服务费金额(元)","产品名称",
"扣率版本","扣率","最低收费额(元)","最高收费额(元)","交易渠道","联系人姓名","联系人电话","联系人邮政编码 ","联系人地址","联系人电子邮箱","是否开通T+0","是否开通理财 "};
for(int j=0;j<colums.length;j++){
row.createCell(j).setCellValue(colums[j]);
}
// 取出商户信息
for(int i=0;i<merchList.size();i++){ // eg: 2 , i,0,1
HSSFRow row1 = sheet.createRow(i+1);
row1.createCell(0).setCellValue(merchList.get(i).getMerchName());
row1.createCell(1).setCellValue(merchList.get(i).getMerchSname());
row1.createCell(2).setCellValue(merchList.get(i).getTaxregNo());
row1.createCell(3).setCellValue(merchList.get(i).getProgramName());
row1.createCell(4).setCellValue(merchList.get(i).getProgramSource());
row1.createCell(5).setCellValue(merchList.get(i).getClearPeroid());
row1.createCell(6).setCellValue(merchList.get(i).getProvince()); //商户省份
row1.createCell(7).setCellValue(merchList.get(i).getCity());//商户市
row1.createCell(8).setCellValue(merchList.get(i).getMerchType());
row1.createCell(9).setCellValue(merchList.get(i).getMerchOran());
row1.createCell(10).setCellValue(merchList.get(i).getRecieveOrgan());
row1.createCell(11).setCellValue(merchList.get(i).getOrgId()+"");
row1.createCell(12).setCellValue(merchList.get(i).getBusiLicense());
row1.createCell(13).setCellValue(merchList.get(i).getBusiLicenceTime());
row1.createCell(14).setCellValue(merchList.get(i).getBusiAddr());
row1.createCell(16).setCellValue(merchList.get(i).getBusiPostCode());
row1.createCell(17).setCellValue(merchList.get(i).getTradeAddr());
row1.createCell(18).setCellValue(merchList.get(i).getTradeProvince());
row1.createCell(19).setCellValue(merchList.get(i).getTradePostCode());
row1.createCell(20).setCellValue(merchList.get(i).getInstiCode());
row1.createCell(21).setCellValue(merchList.get(i).getInstiTime());
row1.createCell(22).setCellValue(merchList.get(i).getMerchFrom());
row1.createCell(23).setCellValue(merchList.get(i).getMerchItem());
row1.createCell(24).setCellValue(merchList.get(i).getLawyerName());
row1.createCell(25).setCellValue(merchList.get(i).getLawyCertiType());
row1.createCell(26).setCellValue(merchList.get(i).getLawyCertiNo());
row1.createCell(27).setCellValue(merchList.get(i).getLawyerTime());
row1.createCell(28).setCellValue(merchList.get(i).getLawyTelNo());
row1.createCell(29).setCellValue(merchList.get(i).getCheckBank());
row1.createCell(30).setCellValue(merchList.get(i).getAccountNo());
row1.createCell(31).setCellValue(merchList.get(i).getAccountName());
row1.createCell(32).setCellValue(merchList.get(i).getAccountTatal()+"");
row1.createCell(33).setCellValue(merchList.get(i).getProductName());
row1.createCell(34).setCellValue(merchList.get(i).getRoteVersion());
//按商户类型定义收费标准 ("扣率","最低收费额","最高收费额")
List<Trate> rateList=trateService.selectRateList();
for (Trate trate : rateList) {
if(merchList.get(i).getRoteVersion().equals(trate.getBusiPackCode())){
row1.createCell(35).setCellValue(trate.getFeeRate());
row1.createCell(36).setCellValue(trate.getMinFee());
row1.createCell(37).setCellValue(trate.getMaxFee());
}
}
row1.createCell(38).setCellValue(merchList.get(i).getTrasalChannel());
row1.createCell(39).setCellValue(merchList.get(i).getContactName());
row1.createCell(40).setCellValue(merchList.get(i).getContactMobile());
row1.createCell(41).setCellValue(merchList.get(i).getPostCode());
row1.createCell(42).setCellValue(merchList.get(i).getContactAddr());
row1.createCell(43).setCellValue(merchList.get(i).getContactEmail());
row1.createCell(44).setCellValue(merchList.get(i).getIsopenT()+"");
row1.createCell(45).setCellValue(merchList.get(i).getIsfinancial()+"");
}
book.write(response.getOutputStream());
}
//导出商户信息excel(ID转name形式)
/*public void exportCsv() throws IOException {
Page<Tmerchat> page=new Page<Tmerchat>();
page.setPageNo(this.page); //设置当前页码
page.setPageSize(this.rows);
Tuser tuser = (Tuser) getSession().getAttribute(Const.SESSION_USER);
String userName=tuser.getUserName();
Long belongId = tuser.getBelongId();//所属ID
Long belongTo = tuser.getBelongTo(); //用户属性 0:商户 1:组织机构 2:拓展机构
page.getParams().put("id", belongId);
page.getParams().put("belong_to", belongTo);
page.getParams().put("creator", userName);
if(merchInfo.getMerchName() !=null && !merchInfo.getMerchName().equals(""))
page.getParams().put("merchName", merchInfo.getMerchName().trim());
if(merchInfo.getMerchSname() !=null && !merchInfo.getMerchSname().equals(""))
page.getParams().put("merchSname", merchInfo.getMerchSname().trim());
if(merchInfo.getLawyerName() !=null && !merchInfo.getLawyerName().equals(""))
page.getParams().put("lawyerName", merchInfo.getLawyerName().trim());
List<MerchInfo> merchList = tmerchatService.selectMerchInfo(page);
Merchant merchant=new Merchant();
// return;
HttpServletResponse response = getResponse();
response.setContentType("application/octet-stream;charset=iso-8859-1");
try {
response.setHeader("Content-Disposition", "attachment;filename="+java.net.URLEncoder.encode("商户信息.xls", "UTF-8"));
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
HSSFWorkbook book = new HSSFWorkbook();
HSSFSheet sheet = book.createSheet("商户信息");
HSSFRow row = sheet.createRow(0);
//表格标题字段
String []colums={" 商户名称 ","商户简称","税务登记号","项目名称","项目来源","清算周期","商户所属省份","商户所属市","商户类型","商户拓展机构","收单机构","组织机构",
"工商营业执照号","营业执照有效期","工商注册地址 ","工商注册省份","工商注册地址邮编","营业地址","营业地址省份","营业地址邮编","组织机构代码","组织机构证有效日期",
"商户所属行业","商户类别(MCC)","法人姓名","法人证件类型","法人证件编号","法人证件有效期","法人联系电话","开户银行","结算账号","结算账户名称","服务费金额(元)","产品名称",
"扣率版本","交易渠道","联系人姓名","联系人电话","联系人邮政编码 ","联系人地址","联系人电子邮箱","是否开通T+0","是否开通理财 "};
for(int j=0;j<colums.length;j++){
row.createCell(j).setCellValue(colums[j]);
}
// 取出商户信息
for(int i=0;i<merchList.size();i++){ // eg: 2 , i,0,1
HSSFRow row1 = sheet.createRow(i+1);
row1.createCell(0).setCellValue(merchList.get(i).getMerchName());
row1.createCell(1).setCellValue(merchList.get(i).getMerchSname());
row1.createCell(2).setCellValue(merchList.get(i).getTaxregNo());
List<Tparadic> palist=tparadicService.selectParaInfo();
for (Tparadic tparadic : palist) {
//商户类型
if(Integer.parseInt(merchList.get(i).getMerchType())==tparadic.getTid()){
merchInfo.setMerchTypeName(tparadic.getParaName());
row1.createCell(8).setCellValue(merchInfo.getMerchTypeName());
}else if(Integer.parseInt(merchList.get(i).getProgramName())==tparadic.getTid()){
//项目名称
merchInfo.setProgramName1(tparadic.getParaName());
row1.createCell(3).setCellValue(merchInfo.getProgramName1());
}else if(Integer.parseInt(merchList.get(i).getProgramSource())==tparadic.getTid()){
//项目来源
merchInfo.setProgramSourceName(tparadic.getParaName());
row1.createCell(4).setCellValue(merchInfo.getProgramSourceName());
}else if(Integer.parseInt(merchList.get(i).getClearPeroid())==tparadic.getTid()){
//清算周期
merchInfo.setClearPeroidName(tparadic.getParaName());
row1.createCell(5).setCellValue(merchInfo.getClearPeroidName());
}else if(merchList.get(i).getLawyCertiType()==tparadic.getTid()){
//身份证
merchInfo.setLawyCertiTypeName(tparadic.getParaName());
row1.createCell(25).setCellValue(merchInfo.getLawyCertiTypeName());
}
}
List<Tprovince> pList=tprovinceService.selectProvince(); //省
for (Tprovince tprovince : pList) {
if(merchList.get(i).getProvince()==tprovince.getpId()){
merchInfo.setProvinceName(tprovince.getpName());
row1.createCell(6).setCellValue(merchInfo.getProvinceName()); //商户省份
}
else if(merchant.getProvince()==tprovince.getpId()){
merchant.setProvinceName(tprovince.getpName());
}
else if(merchList.get(i).getBusiProvince()==tprovince.getpId()){
merchInfo.setBusiProvinceName(tprovince.getpName());
row1.createCell(15).setCellValue(merchInfo.getBusiProvinceName()); //工商省份
}else if(merchList.get(i).getTradeProvince()==tprovince.getpId()){
merchInfo.setTradeProvinceName(tprovince.getpName()); //营业执照省份
row1.createCell(18).setCellValue(merchInfo.getTradeProvinceName());
}
}
List<Tcity> cList= tcityService.selectByTcity(); //市
for (Tcity tcity : cList) {
if(merchList.get(i).getCity().equals(tcity.getcId())){
merchInfo.setCityName(tcity.getcName());
row1.createCell(7).setCellValue(merchInfo.getCityName());//商户市
}
}
//收单机构
List<TrecieveOrgan> recieveList=trecieveOrganService.selectRecieveOrganList();
for (TrecieveOrgan trecieveOrgan : recieveList) {
if(merchList.get(i).getRecieveOrgan().equals(trecieveOrgan.getOrganCode())){
merchInfo.setRecieveOrganName(trecieveOrgan.getOrganName());
row1.createCell(10).setCellValue(merchInfo.getRecieveOrganName());
}
}
//商户所属行业
List<Tmcc> mcc = tmccService.selectMccList();
for (Tmcc tmcc : mcc) {
if(merchList.get(i).getMerchFrom().equals(tmcc.getMcc())){
merchInfo.setMerchFromName(tmcc.getMccname());
row1.createCell(22).setCellValue(merchInfo.getMerchFromName());
}
}
//商户所属行业item
List<Tmcclist> mccList=tmccListService.selectMccItemList();
for (Tmcclist tmcclist : mccList) {
if(merchList.get(i).getMerchItem().equals(tmcclist.getMcclist())){
merchInfo.setMerchItemName(tmcclist.getMcccont());
row1.createCell(23).setCellValue(merchInfo.getMerchItemName());
}
}
//扣率版本
List<Tpack> packList=tpackService.selectPackList();
for (Tpack tpack : packList) {
if(merchList.get(i).getRoteVersion().equals(tpack.getBusiPackCode())){
merchInfo.setRoteVersionName(tpack.getBusiPackName());
row1.createCell(34).setCellValue(merchInfo.getRoteVersionName());
}
}
//商户拓展机构merchOran
List<Tagent> agentList=agenOrgService.agentList();
for (Tagent tagent : agentList) {
if (merchList.get(i).getMerchOran()==tagent.getId()) {
merchInfo.setMerchOranName(tagent.getAgentName());
row1.createCell(9).setCellValue(merchInfo.getMerchOranName());
}
}
//商户组织机构oragnId
List<Torgan> organList= organService.selectByAllOrgan();
for (Torgan torgan : organList) {
if( merchList.get(i).getOrgId().longValue()==torgan.getId()){
merchInfo.setOrgIdName(torgan.getOrganName());
row1.createCell(11).setCellValue(merchInfo.getOrgIdName());
}
}
row1.createCell(12).setCellValue(merchList.get(i).getBusiLicense());
row1.createCell(13).setCellValue(merchList.get(i).getBusiLicenceTime());
row1.createCell(14).setCellValue(merchList.get(i).getBusiAddr());
row1.createCell(16).setCellValue(merchList.get(i).getBusiPostCode());
row1.createCell(17).setCellValue(merchList.get(i).getTradeAddr());
row1.createCell(19).setCellValue(merchList.get(i).getTradePostCode());
row1.createCell(20).setCellValue(merchList.get(i).getInstiCode());
row1.createCell(21).setCellValue(merchList.get(i).getInstiTime());
row1.createCell(24).setCellValue(merchList.get(i).getLawyerName());
row1.createCell(26).setCellValue(merchList.get(i).getLawyCertiNo());
row1.createCell(27).setCellValue(merchList.get(i).getLawyerTime());
row1.createCell(28).setCellValue(merchList.get(i).getLawyTelNo());
row1.createCell(29).setCellValue(merchList.get(i).getCheckBank());
row1.createCell(30).setCellValue(merchList.get(i).getAccountNo());
row1.createCell(31).setCellValue(merchList.get(i).getAccountName());
row1.createCell(32).setCellValue(merchList.get(i).getAccountTatal()+"");
//产品名称 id 转name
List<Tgroup> groupList=tgroupService.selectGroup();
for (Tgroup tgroup : groupList) {
if (merchList.get(i).getProductName().equals(tgroup.getGroupCode())) {
merchInfo.setProductName1(tgroup.getGroupName());
row1.createCell(33).setCellValue(merchInfo.getProductName1());
}
}
if(merchList.get(i).getTrasalChannel().equals("0000")){ //交易渠道0000 ---中国银联
row1.createCell(35).setCellValue("中国银联");
}
row1.createCell(36).setCellValue(merchList.get(i).getContactName());
row1.createCell(37).setCellValue(merchList.get(i).getContactMobile());
row1.createCell(38).setCellValue(merchList.get(i).getPostCode());
row1.createCell(39).setCellValue(merchList.get(i).getContactAddr());
row1.createCell(40).setCellValue(merchList.get(i).getContactEmail());
//是否开通T+0 是:1,否 :0
if(merchList.get(i).getIsopenT().intValue()==0){
row1.createCell(41).setCellValue("未开通");
}else{
row1.createCell(41).setCellValue("开通");
}
//是否开通理财 是:1,否 :0
if(merchList.get(i).getIsfinancial().intValue()==0){
row1.createCell(42).setCellValue("未开通");
}else{
row1.createCell(42).setCellValue("开通");
}
}
book.write(response.getOutputStream());
}*/
public MerchInfo getMerchInfo() {
return merchInfo;
}
public void setMerchInfo(MerchInfo merchInfo) {
this.merchInfo = merchInfo;
}
public TmerchatServiceI getTmerchatService() {
return tmerchatService;
}
public void setTmerchatService(TmerchatServiceI tmerchatService) {
this.tmerchatService = tmerchatService;
}
public TaccountServiceI getTaccountService() {
return taccountService;
}
public void setTaccountService(TaccountServiceI taccountService) {
this.taccountService = taccountService;
}
public TlinkmanServiceI getTlinkmanService() {
return tlinkmanService;
}
public void setTlinkmanService(TlinkmanServiceI tlinkmanService) {
this.tlinkmanService = tlinkmanService;
}
public TftpServiceI getTftpService() {
return tftpService;
}
public void setTftpService(TftpServiceI tftpService) {
this.tftpService = tftpService;
}
public TparadicServiceI getTparadicService() {
return tparadicService;
}
public void setTparadicService(TparadicServiceI tparadicService) {
this.tparadicService = tparadicService;
}
public TprovinceServiceI getTprovinceService() {
return tprovinceService;
}
public void setTprovinceService(TprovinceServiceI tprovinceService) {
this.tprovinceService = tprovinceService;
}
public TcityServiceI getTcityService() {
return tcityService;
}
public void setTcityService(TcityServiceI tcityService) {
this.tcityService = tcityService;
}
public TgroupServiceI getTgroupService() {
return tgroupService;
}
public void setTgroupService(TgroupServiceI tgroupService) {
this.tgroupService = tgroupService;
}
public TrecieveOrganServiceI getTrecieveOrganService() {
return trecieveOrganService;
}
public void setTrecieveOrganService(
TrecieveOrganServiceI trecieveOrganService) {
this.trecieveOrganService = trecieveOrganService;
}
public TmccListServiceI getTmccListService() {
return tmccListService;
}
public void setTmccListService(TmccListServiceI tmccListService) {
this.tmccListService = tmccListService;
}
public TmccServiceI getTmccService() {
return tmccService;
}
public void setTmccService(TmccServiceI tmccService) {
this.tmccService = tmccService;
}
public TpackServiceI getTpackService() {
return tpackService;
}
public void setTpackService(TpackServiceI tpackService) {
this.tpackService = tpackService;
}
public AgentOrgServiceI getAgenOrgService() {
return agenOrgService;
}
public void setAgenOrgService(AgentOrgServiceI agenOrgService) {
this.agenOrgService = agenOrgService;
}
public OrganServiceI getOrganService() {
return organService;
}
public void setOrganService(OrganServiceI organService) {
this.organService = organService;
}
public MerchInfo getModel() {
// TODO Auto-generated method stub
return merchInfo;
}
public void setTrateService(TrateServiceI trateService) {
this.trateService = trateService;
}
public TrateServiceI getTrateService() {
return trateService;
}
}