xuhy
2025-01-09 712f70b2936079a131ecb1e63c6d337171618cad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
package com.stylefeng.guns.modular.system.controller.general;
 
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.core.common.constant.factory.PageFactory;
import com.stylefeng.guns.core.shiro.ShiroKit;
 
import com.stylefeng.guns.core.util.DateUtil;
import com.stylefeng.guns.core.util.ExcelUtil;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.service.*;
import net.sf.json.JSONObject;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
 
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
 
@Controller
@RequestMapping("/tTaxiCard")
public class TTaxiCardController extends BaseController {
 
    private String PREFIX = "/system/tTaxiCard/";
 
    @Autowired
    private ITTaxiCardService taxiCardService;
 
    @Autowired
    private ISysCouponRecordService couponRecordService;
 
    @Autowired
    private ITCompanyCityService companyCityService;
 
    @Autowired
    private ITRegionService regionService;
 
    @Autowired
    private ITCompanyService companyService;
 
    @Autowired
    private IUserService userService;
 
    @Autowired
    private ITTaxiCardPaymentService taxiCardPaymentService;
 
    @RequestMapping("")
    public String index(){
        return PREFIX + "tTaxiCard.html";
    }
 
    @RequestMapping("/audit")
    public String audit(){
        return PREFIX + "tTaxiCardAudit.html";
    }
 
    @RequestMapping("/tTaxiCardPayment/{cardId}")
    public String tTaxiCardPayment(@PathVariable Integer cardId, Model model){
        model.addAttribute("cardId",cardId);
        return PREFIX + "tTaxiCardPayment.html";
    }
 
    @RequestMapping("/tTaxiCardPayment_detail/{paymentId}")
    public String tTaxiCardPaymentDetail(@PathVariable Integer paymentId, Model model){
        Map<String,Object> map = taxiCardService.searchRecordDetail(paymentId);
        JSONObject json = JSONObject.fromObject(map.get("content"));
        if (json.containsKey("businessTypes")){
            List<Integer> list = JSONArray.parseArray(json.getString("businessTypes"),Integer.class);
            StringBuilder str = new StringBuilder();
            for (Integer integer : list) {
                if (integer == 1){
                    str.append("快车,");
                }else if (integer == 2){
                    str.append("出租车,");
                }else if (integer == 3){
                    str.append("跨城出行,");
                }else if (integer == 4){
                    str.append("同城小件物流,");
                }else if (integer == 5){
                    str.append("跨城小件物流,");
                }
            }
            map.put("businessTypes",str.substring(0,str.length()-1));
        }
 
        ///   使用期至
        String validDateTo = DateUtil.plusDay(Integer.parseInt(map.get("validDate").toString()),map.get("createTime").toString());
        String momentDate = DateUtil.getTime();
        if (DateUtil.compareTime(validDateTo, momentDate)){
            map.put("validDateTo",validDateTo);
        }else {
            map.put("validDateTo",validDateTo + " (<span style='color:red'>已过期</span>)");
        }
 
        ///   使用时间段
        if (json.containsKey("timeQuantum")){
            List<String> list = JSONArray.parseArray(json.getString("timeQuantum"),String.class);
            StringBuilder stringBuilder = new StringBuilder();
            for (String s : list) {
                stringBuilder.append(s);
                stringBuilder.append(" , ");
            }
            map.put("timeQuantum",stringBuilder.substring(0,stringBuilder.length()-3));
        }
 
        ///  使用地区
        String[] arr = map.get("companyCityId").toString().split(";");
        StringBuilder cityName = new StringBuilder();
        for (String s : arr) {
            TCompanyCity companyCity = companyCityService.selectById(s);
            String name = regionService.selectOne(new EntityWrapper<TRegion>().eq("code",companyCity.getCityCode())).getName();
            cityName.append(name).append(",");
        }
        map.put("cityName",cityName.substring(0,cityName.length()-1));
 
        Integer taxiCardId = taxiCardPaymentService.selectById(paymentId).getTaxiCardId();
        TTaxiCard tTaxiCard = taxiCardService.selectById(taxiCardId);
        if (tTaxiCard.getType() == 6){  ///   优惠包
            JSONObject jsonn = JSONObject.fromObject(tTaxiCard.getContent());
            String coupons = json.getString("coupons");
            List<String> list = JSON.parseArray(coupons,String.class);
 
            int couponsNum = 0;
            for (String s : list) {
                List<Integer> list1 = JSON.parseArray(s,Integer.class);
                couponsNum += list1.get(0);
            }
            map.put("note","送" + couponsNum + "张寄件优惠券");
        }else if (tTaxiCard.getType() == 5){  ///   物流打折卡
            JSONObject jsonn = JSONObject.fromObject(tTaxiCard.getContent());
            String discount = json.getString("discount");
            map.put("note","每次寄件打" + discount + "折");
        }else if (tTaxiCard.getType() == 4){  ///   打折天数卡
            JSONObject jsonn = JSONObject.fromObject(tTaxiCard.getContent());
            String discount = json.getString("discount");
            map.put("note","享" + tTaxiCard.getValidDate() + "天打" + discount + "折");
        }else if (tTaxiCard.getType() == 3){  ///   次数卡
            JSONObject jsonn = JSONObject.fromObject(tTaxiCard.getContent());
            String discountAmount = json.getString("discountAmount");
            map.put("note","每次打车最高抵扣" + discountAmount + "元");
        }else if (tTaxiCard.getType() == 2){  ///   优惠卡
            JSONObject jsonn = JSONObject.fromObject(tTaxiCard.getContent());
            String fullReduction = json.getString("fullReduction");
            List<String> list = JSON.parseArray(fullReduction,String.class);
 
            List<Double> doubles = new ArrayList<>();
            for (String s : list) {
                List<Double> list1 = JSON.parseArray(s,Double.class);
                doubles.add(list1.get(1));
            }
            Collections.sort(doubles);
            map.put("note","最高优惠" + doubles.get(doubles.size()-1) + "元");
        }else if (tTaxiCard.getType() == 1){  ///   次数卡
            JSONObject jsonn = JSONObject.fromObject(tTaxiCard.getContent());
            String time = json.getString("time");
            String discount = json.getString("discount");
            map.put("note","享" + time + "次打折打" + discount + "折");
        }
        model.addAttribute("item",map);
        return PREFIX + "tTaxiCardPayment_detail.html";
    }
 
    @RequestMapping("/tTaxiCard_add")
    public String tTaxiCardAdd(Model model){
        model.addAttribute("roleType",ShiroKit.getUser().getRoleType());
        return PREFIX + "tTaxiCard_add.html";
    }
 
    ///   跳转选择优惠券
    @RequestMapping("/openCheckCoupons/{num}")
    public String openCheckCoupons(@PathVariable Integer num, Model model){
        model.addAttribute("jumpType",2);
        model.addAttribute("num",num);
        return "/system/sysCouponRecord/sysCouponRecord.html";
    }
 
    @RequestMapping("/tTaxiCard_edit/{id}")
    public String tTaxiCardEdit(@PathVariable Integer id, Model model){
        TTaxiCard tTaxiCard = taxiCardService.selectById(id);
        model.addAttribute("viewIdentity","myself");   ///   查看角色--自己
 
        model.addAttribute("item",tTaxiCard);
        model.addAttribute("roleType",ShiroKit.getUser().getRoleType());
        return PREFIX + "tTaxiCard_edit.html";
    }
 
    @RequestMapping("/tTaxiCardBranch_edit/{id}")
    public String tTaxiCardBranch_edit(@PathVariable Integer id, Model model){
        TTaxiCard tTaxiCard = taxiCardService.selectById(id);
        model.addAttribute("viewIdentity","you");   ///   查看角色--对方
        model.addAttribute("item",tTaxiCard);
        model.addAttribute("roleType",userService.selectById(tTaxiCard.getCreateUserId()).getRoleType());
        return PREFIX + "tTaxiCardAudit_detail.html";
    }
 
    @RequestMapping("/tTaxiCardList")
    @ResponseBody
    public Object ttaxiCardList(String startTime, String endTime, Integer type, String nameStr){
        Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage();
        Wrapper wrapper = new EntityWrapper<TTaxiCard>().eq("auditStatus",2)
                .eq("companyId",ShiroKit.getUser().getObjectId()).orderBy("id",false);
 
        if (ToolUtil.isNotEmpty(startTime) && ToolUtil.isNotEmpty(endTime)){
            wrapper.between("createTime",startTime + " 00:00:00",endTime + " 23:59:59");
        }
 
        if (ToolUtil.isNotEmpty(type)){
            wrapper.eq("type",type);
        }
 
        if (ToolUtil.isNotEmpty(nameStr)){
            wrapper.like("name",nameStr);
        }
 
        List<Map<String,Object>> list = taxiCardService.selectMapsPage(page,wrapper).getRecords();
        List<Map<String,Object>> listx = new ArrayList<>();
 
        for (Map<String, Object> map : list) {
 
            JSONObject json = JSONObject.fromObject(map.get("content"));
 
            if (json.containsKey("businessTypes")){
                String businessTypes = json.getString("businessTypes");
                List<String> list1 = JSON.parseArray(businessTypes,String.class);
                StringBuilder businessType = new StringBuilder();
                for (String s : list1) {
                    switch (s) {
                        case "1":
                            businessType.append("快车,");
                            break;
                        case "2":
                            businessType.append("出租车,");
                            break;
                        case "3":
                            businessType.append("跨城出行,");
                            break;
                        case "4":
                            businessType.append("同城小件物流,");
                            break;
                        case "5":
                            businessType.append("跨城小件物流,");
                            break;
                    }
                }
 
                if (ToolUtil.isNotEmpty(businessType)){
                    map.put("businessTypes",businessType.substring(0,businessType.length()-1));
                }
            }
 
            if (ToolUtil.isNotEmpty(map.get("companyCityId"))){
                String[] arr = map.get("companyCityId").toString().split(";");
                StringBuilder cityName = new StringBuilder();
                for (String s : arr) {
                    TCompanyCity companyCity = companyCityService.selectById(s);
                    if (ToolUtil.isNotEmpty(companyCity)){
                        String name = regionService.selectOne(new EntityWrapper<TRegion>().eq("code",companyCity.getCityCode())).getName();
                        cityName.append(name).append(",");
                    }
                }
 
                if (cityName.length()>1){
                    map.put("cityName",cityName.substring(0,cityName.length()-1));
                    listx.add(map);
                }
            }else {
                map.put("cityName","全国");
                listx.add(map);
            }
        }
        page.setRecords(listx);
        return super.packForBT(page);
    }
 
 
    @RequestMapping("/tTaxiCardAuditList")
    @ResponseBody
    public Object tTaxiCardAuditList(String startTime, String endTime, Integer type, String nameStr){
        Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage();
        Wrapper wrapper = new EntityWrapper<TTaxiCard>().ne("companyId",ShiroKit.getUser().getObjectId()).orderBy("id",false);
 
        if (ToolUtil.isNotEmpty(startTime) && ToolUtil.isNotEmpty(endTime)){
            wrapper.between("createTime",startTime + " 00:00:00",endTime + " 23:59:59");
        }
 
        if (ToolUtil.isNotEmpty(type)){
            wrapper.eq("type",type);
        }
 
        if (ToolUtil.isNotEmpty(nameStr)){
            wrapper.like("name",nameStr);
        }
 
        List<Map<String,Object>> list = taxiCardService.selectMapsPage(page,wrapper).getRecords();
        List<Map<String,Object>> listx = new ArrayList<>();
 
        for (Map<String, Object> map : list) {
            map.put("companyName",companyService.selectById(map.get("companyId").toString()).getName());
 
            JSONObject json = JSONObject.fromObject(map.get("content"));
 
            if (json.containsKey("businessTypes")){
                String businessTypes = json.getString("businessTypes");
                List<String> list1 = JSON.parseArray(businessTypes,String.class);
                StringBuilder businessType = new StringBuilder();
                for (String s : list1) {
                    switch (s) {
                        case "1":
                            businessType.append("快车,");
                            break;
                        case "2":
                            businessType.append("出租车,");
                            break;
                        case "3":
                            businessType.append("跨城出行,");
                            break;
                        case "4":
                            businessType.append("同城小件物流,");
                            break;
                        case "5":
                            businessType.append("跨城小件物流,");
                            break;
                    }
                }
 
                if (ToolUtil.isNotEmpty(businessType)){
                    map.put("businessTypes",businessType.substring(0,businessType.length()-1));
                }
            }
 
            String[] arr = map.get("companyCityId").toString().split(";");
            StringBuilder cityName = new StringBuilder();
            for (String s : arr) {
                TCompanyCity companyCity = companyCityService.selectById(s);
                if (ToolUtil.isNotEmpty(companyCity)){
                    String name = regionService.selectOne(new EntityWrapper<TRegion>().eq("code",companyCity.getCityCode())).getName();
                    cityName.append(name).append(",");
                }
            }
 
            if (cityName.length()>1){
                map.put("cityName",cityName.substring(0,cityName.length()-1));
                listx.add(map);
            }
        }
        page.setRecords(listx);
        return super.packForBT(page);
    }
 
 
    ///   查询打车卡购买记录列表
    @RequestMapping("/tTaxiCardPaymentList")
    @ResponseBody
    public Object tTaxiCardPaymentList(Integer takeCardId, String startTime, String endTime, String name){
        Page<Map<String,Object>> page = new PageFactory<Map<String,Object>>().defaultPage();
        page.setRecords(taxiCardService.tTaxiCardPaymentList(takeCardId,page,startTime,endTime,name));
        return super.packForBT(page);
    }
 
    ///   初始化适用城市选择器
    @RequestMapping("/initSuitCity")
    @ResponseBody
    public Object initSuitCity(){
        List<TCompanyCity> list = companyCityService.selectList(new EntityWrapper<TCompanyCity>().eq("companyId",ShiroKit.getUser().getObjectId()));
        List<String> stringList = new ArrayList<>();
        for (TCompanyCity tCompanyCity : list) {
            String area = "";
            area += tCompanyCity.getId() + ";";
            if (ToolUtil.isNotEmpty(tCompanyCity.getProvinceCode())){
                area += regionService.selectOne(new EntityWrapper<TRegion>().eq("code",tCompanyCity.getProvinceCode())).getName();
            }
            if (ToolUtil.isNotEmpty(tCompanyCity.getCityCode())){
                area += regionService.selectOne(new EntityWrapper<TRegion>().eq("code",tCompanyCity.getCityCode())).getName();
            }
            if (ToolUtil.isNotEmpty(tCompanyCity.getAreaCode())){
                area += regionService.selectOne(new EntityWrapper<TRegion>().eq("code",tCompanyCity.getAreaCode())).getName();
            }
 
            stringList.add(area);
        }
        return stringList;
    }
 
 
    ///   初始化平台--查看分公司适用城市选择器
    @RequestMapping("/initSuitCityBranch")
    @ResponseBody
    public Object initSuitCityBranch(Integer id){
        List<TCompanyCity> list = companyCityService.selectList(new EntityWrapper<TCompanyCity>().eq("companyId",taxiCardService.selectById(id).getCompanyId()));
        List<String> stringList = new ArrayList<>();
        for (TCompanyCity tCompanyCity : list) {
            String area = "";
            area += tCompanyCity.getId() + ";";
            if (ToolUtil.isNotEmpty(tCompanyCity.getProvinceCode())){
                area += regionService.selectOne(new EntityWrapper<TRegion>().eq("code",tCompanyCity.getProvinceCode())).getName();
            }
            if (ToolUtil.isNotEmpty(tCompanyCity.getCityCode())){
                area += regionService.selectOne(new EntityWrapper<TRegion>().eq("code",tCompanyCity.getCityCode())).getName();
            }
            if (ToolUtil.isNotEmpty(tCompanyCity.getAreaCode())){
                area += regionService.selectOne(new EntityWrapper<TRegion>().eq("code",tCompanyCity.getAreaCode())).getName();
            }
 
            stringList.add(area);
        }
        return stringList;
    }
 
 
    @RequestMapping("/add")
    @ResponseBody
    public Object add(TTaxiCard taxiCard){
        Integer companyId = ShiroKit.getUser().getObjectId();
        Integer createUserId = ShiroKit.getUser().getId();
        taxiCard.setCompanyId(companyId);
        taxiCard.setCreateUserId(createUserId);
        taxiCard.setState(2);
        if (ShiroKit.getUser().getRoleType() == 1){
            taxiCard.setAuditStatus(2);
        }else {
            taxiCard.setAuditStatus(1);
        }
        taxiCard.setCreateTime(DateUtil.parseTime(DateUtil.getTime()));
 
        String note = taxiCard.getNote();
        note = note.replaceAll("& lt;", "<").replaceAll("& gt;", ">");
 
        note = note.replaceAll("\\(", "& #40;").replaceAll("\\)", "& #41;");
        taxiCard.setNote(note);
 
        System.out.println(taxiCard);
        taxiCardService.insert(taxiCard);
        return SUCCESS_TIP;
    }
 
 
    @RequestMapping("/searchPayment")
    @ResponseBody
    public Object searchPayment(Integer id){
        TTaxiCardPayment tTaxiCardPayment = taxiCardPaymentService.selectOne(new EntityWrapper<TTaxiCardPayment>().eq("taxiCardId",id));
        if (ToolUtil.isNotEmpty(tTaxiCardPayment)){
            return "该打车卡已经产生交易记录,不允许再编辑";
        }
        return SUCCESS_TIP;
    }
 
 
    @RequestMapping("/edit")
    @ResponseBody
    public Object edit(TTaxiCard taxiCard){
        String note = taxiCard.getNote();
        note = note.replaceAll("& lt;", "<").replaceAll("& gt;", ">");
 
        note = note.replaceAll("\\(", "& #40;").replaceAll("\\)", "& #41;");
        taxiCard.setNote(note);
 
        System.out.println(taxiCard);
        taxiCardService.updateById(taxiCard);
        return SUCCESS_TIP;
    }
 
 
    @RequestMapping("/delete")
    @ResponseBody
    public Object delete(Integer id){
        TTaxiCardPayment tTaxiCardPayment = taxiCardPaymentService.selectOne(new EntityWrapper<TTaxiCardPayment>().eq("taxiCardId",id));
        if (ToolUtil.isNotEmpty(tTaxiCardPayment)){
            return "该打车卡已经被用户购买,不允许删除";
        }
        taxiCardService.deleteById(id);
        return SUCCESS_TIP;
    }
 
 
    @RequestMapping("/updateState")
    @ResponseBody
    public Object updateState(Integer id, Integer state){
        TTaxiCard tTaxiCard = taxiCardService.selectById(id);
        tTaxiCard.setState(state);
        taxiCardService.updateById(tTaxiCard);
        return SUCCESS_TIP;
    }
 
 
    @RequestMapping("/auditSubmit")
    @ResponseBody
    public Object auditSubmit(TTaxiCard taxiCard){
        taxiCardService.updateById(taxiCard);
        return SUCCESS_TIP;
    }
 
 
    ///   查询优惠券
    @RequestMapping("/searchCoupons")
    @ResponseBody
    public Object searchCoupons(){
        Integer companyId = ShiroKit.getUser().getObjectId();
        return couponRecordService.selectList(new EntityWrapper<SysCouponRecord>().eq("companyId",companyId));
    }
 
    ///   查询优惠券名称
    @RequestMapping("/searchCouponsById")
    @ResponseBody
    public Object searchCouponsById(Integer id){
        return couponRecordService.selectById(id);
    }
 
 
    ///   查询content对应的json
    @RequestMapping("/searchContent")
    @ResponseBody
    public Object searchContent(Integer id){
        return taxiCardService.selectById(id).getContent();
    }
 
 
    ///   导出某张打车卡的所有购买记录
    @RequestMapping(value = "/exportAllRecord")
    @ResponseBody
    public Object exportAllRecord(HttpServletResponse response,@RequestParam Integer takeCardId,@RequestParam String startTime,
                                  @RequestParam String endTime,@RequestParam String name) {
        try {
            Date date = new Date();
            DateFormat format = new SimpleDateFormat("yyyyMMdd");
            String time = format.format(date);
            String fileName = "打车卡购买记录"+time+".xls";
            String[] title = new String[] {"购买时间","用户名称","用户手机号","打车卡名称","金额"};
            List<Map<String,Object>> mapList = taxiCardService.tTaxiCardPaymentLists(takeCardId,startTime,endTime,name);
 
            String[][] values = new String[mapList.size()][];
            for (int i = 0; i < mapList.size(); i++) {
                Map<String,Object> d=mapList.get(i);
                values[i] = new String[title.length];
                values[i][0]=d.get("createTime").toString();
                values[i][1]=d.get("nickName").toString();
                values[i][2]=d.get("phone").toString();
                values[i][3]=d.get("cardName").toString();
                values[i][4]=d.get("payMoney").toString();
            }
            String fileNameTitle="打车卡购买记录";
            HSSFWorkbook wb = ExcelUtil.getHSSFWorkbook(fileNameTitle+time, title, values, null);
            this.setResponseHeader(response, fileName);
            OutputStream os = response.getOutputStream();
            wb.write(os);
            os.flush();
            os.close();
 
        } catch (Exception e) {
            e.printStackTrace();
            /*return ApiUtil.putFailObj("导出失败");*/
        }
        return SUCCESS_TIP;
    }
 
 
    /**
     * 设置文件响应头
     * @param response
     * @param fileName
     */
    private void setResponseHeader(HttpServletResponse response, String fileName) {
        try {
            response.setContentType("application/octet-stream;charset=UTF-8");
            response.setHeader("Content-Disposition", "attachment;filename=" + new String(fileName.getBytes(),"iso-8859-1"));
            response.addHeader("Pargam", "no-cache");
            response.addHeader("Cache-Control", "no-cache");
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}