去掉 在使用jasperreport导出excel时长数字型字符串会自动已科学计数法显示的方法
exporter.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE);
select salary_calculation_detail_id,
NVL2(referee,referee,' ') refereeTemp,
NVL2(customer_manager,customer_manager,' ')customermanager,
NVL2(group_User_Extern_Code, group_User_Extern_Code,' ' ) groupUserExternCode,
CASE is_Two
WHEN 1 THEN
'双方'
WHEN 2 THEN
'三方'
ELSE
'未知'
end is_TwoTemp,
case is_New
when 1 then
'新'
when 0 then
'老'
else
'空'
end isNewTemp,
NVL2(ticket_Number, ticket_Number, ' ') as ticket_NumberTemp,
origin_airport || '-->' || destination_airport airline,
NVL2(office_Code, office_Code, ' ') as officeCode,
NVL2(f_Carrier, f_Carrier, ' ') as fCarrier,
NVL2(product_Code, product_Code, ' ') as productCode,
NVL2(passenger_Name, passenger_Name, ' ') as passengerName,
NVL2(berth, berth, ' ') berthTemp,
NVL2(segment_Fare, segment_Fare, 0) segmentFare,
NVL2(segment_Precentage, segment_Precentage, 0) segmentPrecentage,
NVL2(segment_Cash, segment_Cash, 0) segment_Cash,
NVL2(memo, memo, ' ') memoTemp,
CASE F_IS_VALID
when null then
'无效'
when 0 then
'无效'
when 1 then
(case C_IS_VALID
when null then
'无效'
when 0 then
'无效'
when 1 then
(case P_IS_VALID
when null then
'无效'
when 0 then
'无效'
when 1 then
(case O_IS_VALID
when null then
'无效'
when 0 then
'无效'
when 1 then
(case DB_IS_VALID
when null then
'无效'
when 0 then
'无效'
when 1 then
((case IB_IS_VALID
when null then
'无效'
when 0 then
'无效'
when 1 then
'有效'
else
'有效'
end)) else '有效' end) else '有效' end) else '有效' end) else '有效' end)
else '有效' end as valid
from salary_calculation_detail
where 1=1
$P!{paramsStr}
String[] refereeArray=new String[1];
refereeArray[0]=currentRefereeCode;
String[] customerArray=new String[1];
customerArray[0]=currentCustomerId;
//客户经理sql字符串
String customerString=trasactionInQuerySql(customerArray);
//推荐人sql字符串
String refereelistString=trasactionInQuerySql(refereeArray);
//参数列表,查询条件
Map params=new HashMap();
StringBuffer sql=new StringBuffer();
String sqlOne=" and referee_no in( "+refereelistString+") and customer_id in ( "+customerString+") ";
sql.append(sqlOne);
sql.append(" and begin_date >= to_date('"+qDate+"','yyyy-MM') and begin_date < add_months(to_date('"+qDate+"','yyyy-MM'),1)");
sql.append(" and end_date >= to_date('"+qDate+"','yyyy-MM') and end_date < add_months(to_date('"+qDate+"','yyyy-MM'),1) ");
params.put("paramsStr", sql.toString());
Connection connection=this.salesAccountCommissionDAO.getHibernateConnection();
File business_rpt = new File(request.getSession().getServletContext().getRealPath("/")+"/reports/salaryCalculationRDetailReport.jasper");
JasperPrint jasperPrint = null;
try {
jasperPrint = JasperFillManager.fillReport(business_rpt.getPath(),
params, connection);
} catch (JRException e) {
e.printStackTrace();
}
JRExporter exporter = null;
exporter = new JRXlsExporter();
response.setContentType("application/vnd.ms-excel;charset=gb2312");
//where referee_code in( $P{refereelistString}) and to_char(salary_date,'yyyy-MM')= $P{qDate}
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.CHARACTER_ENCODING, "GBK");
exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE); // 删除记录最下面的空行
OutputStream ouputStream = response.getOutputStream();
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream);
exporter.exportReport();
//ouputStream.close();
return null;