Commit 84047537 by 王军业

【导出项】

1 parent e403b559
......@@ -2,9 +2,12 @@ package com.vion.financial.excel;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelIgnore;
@JsonInclude(value=Include.NON_NULL)
public class ExportModel {
@Excel(name="合同编号",orderNum="0")
private String contract_unid; //合同编号
......
......@@ -565,16 +565,17 @@
<select id="exportContracts" parameterType="com.vion.financial.vo.SelectVo" resultType="com.vion.financial.excel.ExportModel">
select (
select
<if test="columns == null">
*
</if>
<if test="columns !=null">
<foreach collection="columns" index="index" item="column" open=" " separator="," close=" ">
#{column}
</foreach>
contract_unid,
<foreach collection="columns" index="index" item="column" separator=",">
${column}
</foreach>
</if>
) from (select
from (select
contract_unid, salesperson_unid, province, city, county, province_name,city_name,county_name,
guarantee_period, sign_date, product_line_type, contract_state,
contract_type, cast(contract_amount as decimal(18,2)), cast(deduct_amount as decimal(18,2)), contract_amount_note,
......@@ -719,7 +720,7 @@
and is_delete=false
and project_unid is not null
and customer_unid is not null
)
) contract
</select>
......
......@@ -59,6 +59,7 @@ import com.vion.financial.vo.SuccessCode;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import cn.afterturn.easypoi.handler.inter.IExcelDataHandler;
......@@ -577,13 +578,92 @@ public class ContractServiceImpl implements ContractService {
}
try {
DownLoad downLoad =new DownLoad();
downLoad.exportExcel(list, "合同Excel表格", "合同Excel表格", ExportModel.class, "合同.xls", response);
if(selectVo.getColumns() != null && selectVo.getColumns().length > 0) {
//动态生成excel表头
ExcelExportEntity excelExportEntity = new ExcelExportEntity("合同编号");
excelExportEntity.setWidth(20);
excelExportEntity.setKey("contract_unid");
}else {
downLoad.exportExcel(list, "合同Excel表格", "合同Excel表格", ExportModel.class, "合同.xls", response);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/* private void dynamicHeader( List<ExportModel> list) {
try {
List<ExcelExportEntity> colList = new ArrayList<ExcelExportEntity>();
ExcelExportEntity colEntity = new ExcelExportEntity("合同编号", "contract_unid");
colList.add(colEntity);
colEntity = new ExcelExportEntity("供应商", "supplier");
colEntity.setNeedMerge(true);
colList.add(colEntity);
ExcelExportEntity deliColGroup = new ExcelExportEntity("得力", "deli");
List<ExcelExportEntity> deliColList = new ArrayList<ExcelExportEntity>();
deliColList.add(new ExcelExportEntity("市场价", "orgPrice"));
deliColList.add(new ExcelExportEntity("专区价", "salePrice"));
deliColGroup.setList(deliColList);
colList.add(deliColGroup);
ExcelExportEntity jdColGroup = new ExcelExportEntity("京东", "jd");
List<ExcelExportEntity> jdColList = new ArrayList<ExcelExportEntity>();
jdColList.add(new ExcelExportEntity("市场价", "orgPrice"));
jdColList.add(new ExcelExportEntity("专区价", "salePrice"));
jdColGroup.setList(jdColList);
colList.add(jdColGroup);
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
for (int i = 0; i < 10; i++) {
Map<String, Object> valMap = new HashMap<String, Object>();
valMap.put("title", "名称." + i);
valMap.put("supplier", "供应商." + i);
List<Map<String, Object>> deliDetailList = new ArrayList<Map<String, Object>>();
for (int j = 0; j < 3; j++) {
Map<String, Object> deliValMap = new HashMap<String, Object>();
deliValMap.put("orgPrice", "得力.市场价." + j);
deliValMap.put("salePrice", "得力.专区价." + j);
deliDetailList.add(deliValMap);
}
valMap.put("deli", deliDetailList);
List<Map<String, Object>> jdDetailList = new ArrayList<Map<String, Object>>();
for (int j = 0; j < 2; j++) {
Map<String, Object> jdValMap = new HashMap<String, Object>();
jdValMap.put("orgPrice", "京东.市场价." + j);
jdValMap.put("salePrice", "京东.专区价." + j);
jdDetailList.add(jdValMap);
}
valMap.put("jd", jdDetailList);
list.add(valMap);
}
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("价格分析表", "数据"), colList,
list);
FileOutputStream fos = new FileOutputStream("D:/价格分析表.tt.xls");
workbook.write(fos);
fos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}*/
@Override
public Object importExcel(MultipartFile file) {
......
......@@ -88,13 +88,13 @@ public class ContractVo extends SelectVo{
return contract_unid;
}
public void setContract_unid(String contract_unid) {
this.contract_unid = contract_unid;
this.contract_unid = contract_unid.trim();
}
public String getSalesperson_unid() {
return salesperson_unid;
}
public void setSalesperson_unid(String salesperson_unid) {
this.salesperson_unid = salesperson_unid;
this.salesperson_unid = salesperson_unid.trim();
}
public Integer getProject_unid() {
return project_unid;
......@@ -106,13 +106,13 @@ public class ContractVo extends SelectVo{
return project_name;
}
public void setProject_name(String project_name) {
this.project_name = project_name;
this.project_name = project_name.trim();
}
public String getCustomer_name() {
return customer_name;
}
public void setCustomer_name(String customer_name) {
this.customer_name = customer_name;
this.customer_name = customer_name.trim();
}
public Integer getCustomer_unid() {
return customer_unid;
......@@ -124,19 +124,19 @@ public class ContractVo extends SelectVo{
return province;
}
public void setProvince(String province) {
this.province = province;
this.province = province.trim();
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
this.city = city.trim();
}
public String getCounty() {
return county;
}
public void setCounty(String county) {
this.county = county;
this.county = county.trim();
}
public Integer getGuarantee_period() {
return guarantee_period;
......@@ -155,19 +155,19 @@ public class ContractVo extends SelectVo{
return product_line_type;
}
public void setProduct_line_type(String product_line_type) {
this.product_line_type = product_line_type;
this.product_line_type = product_line_type.trim();
}
public String getContract_state() {
return contract_state;
}
public void setContract_state(String contract_state) {
this.contract_state = contract_state;
this.contract_state = contract_state.trim();
}
public String getContract_type() {
return contract_type;
}
public void setContract_type(String contract_type) {
this.contract_type = contract_type;
this.contract_type = contract_type.trim();
}
public Double getContract_amount() {
return contract_amount;
......@@ -185,7 +185,7 @@ public class ContractVo extends SelectVo{
return contract_amount_note;
}
public void setContract_amount_note(String contract_amount_note) {
this.contract_amount_note = contract_amount_note;
this.contract_amount_note = contract_amount_note.trim();
}
public Double getStop_amount() {
return stop_amount;
......@@ -197,7 +197,7 @@ public class ContractVo extends SelectVo{
return reback_note;
}
public void setReback_note(String reback_note) {
this.reback_note = reback_note;
this.reback_note = reback_note.trim();
}
public Double getExemptions_amount() {
return exemptions_amount;
......@@ -209,7 +209,7 @@ public class ContractVo extends SelectVo{
return contract_remain_note;
}
public void setContract_remain_note(String contract_remain_note) {
this.contract_remain_note = contract_remain_note;
this.contract_remain_note = contract_remain_note.trim();
}
public Boolean getIs_archive() {
return is_archive;
......@@ -227,7 +227,7 @@ public class ContractVo extends SelectVo{
return bad_amount_note;
}
public void setBad_amount_note(String bad_amount_note) {
this.bad_amount_note = bad_amount_note;
this.bad_amount_note = bad_amount_note.trim();
}
public Double getConfirm_income_amount() {
return confirm_income_amount;
......@@ -259,13 +259,13 @@ public class ContractVo extends SelectVo{
return mainten_start_point;
}
public void setMainten_start_point(String mainten_start_point) {
this.mainten_start_point = mainten_start_point;
this.mainten_start_point = mainten_start_point.trim();
}
public String getContract_note() {
return contract_note;
}
public void setContract_note(String contract_note) {
this.contract_note = contract_note;
this.contract_note = contract_note.trim();
}
public Boolean getIs_delete() {
return is_delete;
......@@ -289,13 +289,13 @@ public class ContractVo extends SelectVo{
return business_table;
}
public void setBusiness_table(String business_table) {
this.business_table = business_table;
this.business_table = business_table.trim();
}
public String getBusiness_unid() {
return business_unid;
}
public void setBusiness_unid(String business_unid) {
this.business_unid = business_unid;
this.business_unid = business_unid.trim();
}
public Double getTotal_reback_amount() {
return total_reback_amount;
......@@ -331,19 +331,19 @@ public class ContractVo extends SelectVo{
return year;
}
public void setYear(String year) {
this.year = year;
this.year = year.trim();
}
public String getMonth() {
return month;
}
public void setMonth(String month) {
this.month = month;
this.month = month.trim();
}
public String getSalesperson_name() {
return salesperson_name;
}
public void setSalesperson_name(String salesperson_name) {
this.salesperson_name = salesperson_name;
this.salesperson_name = salesperson_name.trim();
}
public Integer getList_size() {
return list_size;
......@@ -432,43 +432,43 @@ public class ContractVo extends SelectVo{
return province_name;
}
public void setProvince_name(String province_name) {
this.province_name = province_name;
this.province_name = province_name.trim();
}
public String getCity_name() {
return city_name;
}
public void setCity_name(String city_name) {
this.city_name = city_name;
this.city_name = city_name.trim();
}
public String getCounty_name() {
return county_name;
}
public void setCounty_name(String county_name) {
this.county_name = county_name;
this.county_name = county_name.trim();
}
public String getProduct_line_type_name() {
return product_line_type_name;
}
public void setProduct_line_type_name(String product_line_type_name) {
this.product_line_type_name = product_line_type_name;
this.product_line_type_name = product_line_type_name.trim();
}
public String getContract_state_name() {
return contract_state_name;
}
public void setContract_state_name(String contract_state_name) {
this.contract_state_name = contract_state_name;
this.contract_state_name = contract_state_name.trim();
}
public String getContract_type_name() {
return contract_type_name;
}
public void setContract_type_name(String contract_type_name) {
this.contract_type_name = contract_type_name;
this.contract_type_name = contract_type_name.trim();
}
public String getAmount_state_unid_name() {
return amount_state_unid_name;
}
public void setAmount_state_unid_name(String amount_state_unid_name) {
this.amount_state_unid_name = amount_state_unid_name;
this.amount_state_unid_name = amount_state_unid_name.trim();
}
public Double getMainten_pay() {
return mainten_pay;
......
......@@ -42,6 +42,8 @@ public class SelectVo {
private Integer offset; //设置查询起始位置
private Integer limit; //设置每次查询条数
private List<String> salesperson_unids;
private String[] columns;
/*
* 查询条件
*/
......@@ -219,6 +221,12 @@ public class SelectVo {
public void setSalesperson_unid(String salesperson_unid) {
this.salesperson_unid = salesperson_unid;
}
public String[] getColumns() {
return columns;
}
public void setColumns(String[] columns) {
this.columns = columns;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!