NoCarController.java 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  1. package com.jkcredit.invoice.controller.localBussiness;
  2. import cn.afterturn.easypoi.excel.ExcelImportUtil;
  3. import cn.afterturn.easypoi.excel.entity.ImportParams;
  4. import com.alibaba.fastjson.JSON;
  5. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  6. import com.jkcredit.invoice.annotation.LoginRequired;
  7. import com.jkcredit.invoice.mapper.waybill.NoCarWaybillMapper;
  8. import com.jkcredit.invoice.model.entity.Calculate.NoCarCalculateInfor;
  9. import com.jkcredit.invoice.model.entity.customer.CustomerCarRec;
  10. import com.jkcredit.invoice.model.entity.customer.CustomerOper;
  11. import com.jkcredit.invoice.model.entity.customer.CustomerRec;
  12. import com.jkcredit.invoice.model.entity.invoice.BillInvoice;
  13. import com.jkcredit.invoice.model.entity.waybill.NoCarWayBill;
  14. import com.jkcredit.invoice.service.CalculateInfor.NoCarCalculateInfoService;
  15. import com.jkcredit.invoice.service.customer.CustomerOperService;
  16. import com.jkcredit.invoice.service.lowerService.NoCarService;
  17. import com.jkcredit.invoice.service.nocar.NoCarBillWayImportService;
  18. import com.jkcredit.invoice.service.nocar.NoCarBillWayService;
  19. import com.jkcredit.invoice.service.nocar.NoCarRecService;
  20. import com.jkcredit.invoice.service.nocar.NocarInvoiceService;
  21. import com.jkcredit.invoice.util.ReadExcelUtil;
  22. import com.jkcredit.invoice.util.RespR;
  23. import io.swagger.annotations.Api;
  24. import io.swagger.annotations.ApiOperation;
  25. import lombok.extern.slf4j.Slf4j;
  26. import org.apache.poi.util.IOUtils;
  27. import org.springframework.beans.factory.annotation.Autowired;
  28. import org.springframework.util.ResourceUtils;
  29. import org.springframework.util.StringUtils;
  30. import org.springframework.web.bind.annotation.*;
  31. import org.springframework.web.multipart.MultipartFile;
  32. import javax.servlet.http.HttpServletResponse;
  33. import java.io.*;
  34. import java.net.URLEncoder;
  35. import java.text.DateFormat;
  36. import java.text.SimpleDateFormat;
  37. import java.util.ArrayList;
  38. import java.util.Base64;
  39. import java.util.List;
  40. @Slf4j
  41. @Api(tags = "无车操作")
  42. @RestController
  43. @RequestMapping(value = {"/noCar"})
  44. public class NoCarController {
  45. @Autowired
  46. NoCarRecService noCarRecService;
  47. @Autowired
  48. NoCarBillWayService noCarBillWayService;
  49. @Autowired
  50. NoCarBillWayImportService noCarBillWayImportService;
  51. @Autowired
  52. NocarInvoiceService nocarInvoiceService;
  53. @Autowired
  54. NoCarCalculateInfoService noCarCalculateInfoService;
  55. @Autowired
  56. NoCarWaybillMapper noCarWaybillMapper;
  57. @Autowired
  58. NoCarService noCarService;
  59. @Autowired
  60. CustomerOperService customerOperService;
  61. /**
  62. * 分页查询无车备案信息
  63. *
  64. * @param page 参数集
  65. * @return 用户集合
  66. */
  67. @PostMapping("/findCarRec")
  68. @ApiOperation(value="分页查询无车/自有车备案信息", notes="分页查询无车/自有车备案信息")
  69. @LoginRequired
  70. public RespR getCustomersByPage(Page page, CustomerCarRec customerCarRec) {
  71. try {
  72. if(!StringUtils.isEmpty(customerCarRec.getStartTime()) && !"null".equals(customerCarRec.getStartTime())){
  73. String [] res = customerCarRec.getStartTime().split(",");
  74. customerCarRec.setStartTime(res[0]);
  75. customerCarRec.setEndTime(res[1].replace("00:00:00","23:59:59"));
  76. }else{
  77. customerCarRec.setStartTime(null);
  78. }
  79. RespR respR = new RespR(noCarRecService.findByPageAndCarRec(page, customerCarRec));
  80. return respR;
  81. }catch (Exception e){
  82. e.printStackTrace();
  83. return new RespR(false,e.getMessage());
  84. }
  85. }
  86. public void setTimeDue(NoCarWayBill noCarWayBill){
  87. if(!StringUtils.isEmpty(noCarWayBill.getStartBegin()) && !"null".equals(noCarWayBill.getStartBegin())){
  88. String [] res = noCarWayBill.getStartBegin().split(",");
  89. noCarWayBill.setStartBegin(res[0]);
  90. noCarWayBill.setStartEnd(res[1].replace("00:00:00","23:59:59"));
  91. }else{
  92. noCarWayBill.setStartBegin(null);
  93. }
  94. if(!StringUtils.isEmpty(noCarWayBill.getEndBegin()) && !"null".equals(noCarWayBill.getEndBegin())){
  95. String [] res = noCarWayBill.getEndBegin().split(",");
  96. noCarWayBill.setEndBegin(res[0]);
  97. noCarWayBill.setEndEnd(res[1].replace("00:00:00","23:59:59"));
  98. }else{
  99. noCarWayBill.setEndBegin(null);
  100. }
  101. }
  102. public void setTimeDue2(NoCarWayBill noCarWayBill){
  103. if("null".equals(noCarWayBill.getStartBegin())){
  104. noCarWayBill.setStartBegin(null);
  105. }
  106. if("null".equals(noCarWayBill.getStartEnd())){
  107. noCarWayBill.setStartEnd(null);
  108. }
  109. if("null".equals(noCarWayBill.getEndBegin())){
  110. noCarWayBill.setEndBegin(null);
  111. }
  112. if("null".equals(noCarWayBill.getEndEnd())){
  113. noCarWayBill.setEndEnd(null);
  114. }
  115. }
  116. /**
  117. * 分页查询运单信息
  118. *
  119. * @param page 参数集
  120. * @return 用户集合
  121. */
  122. @PostMapping("/findBillWay")
  123. @ApiOperation(value="分页查询无车运单信息", notes="分页查询无车运单信息")
  124. @LoginRequired
  125. public RespR findBillWay(Page page, NoCarWayBill noCarWayBill) {
  126. try {
  127. setTimeDue(noCarWayBill);
  128. RespR respR = new RespR(noCarBillWayService.findByPageAndWayBill(page, noCarWayBill));
  129. return respR;
  130. }catch (Exception e){
  131. e.printStackTrace();
  132. return new RespR(false,e.getMessage());
  133. }
  134. }
  135. /**
  136. * 分页查询客户运单信息
  137. *
  138. * @param page 参数集
  139. * @return 用户集合
  140. */
  141. @PostMapping("/findBillWayCust")
  142. @ApiOperation(value="分页查询无车运单信息", notes="分页查询无车运单信息")
  143. @LoginRequired
  144. public RespR findBillWayCust(Page page, NoCarWayBill noCarWayBill) {
  145. try {
  146. setTimeDue2(noCarWayBill);
  147. RespR respR = new RespR(noCarBillWayService.findByPageAndWayBill(page, noCarWayBill));
  148. return respR;
  149. }catch (Exception e){
  150. e.printStackTrace();
  151. return new RespR(false,e.getMessage());
  152. }
  153. }
  154. /**
  155. * 分页查询运单信息
  156. *
  157. * @param page 参数集
  158. * @return 用户集合
  159. */
  160. @PostMapping("/findImportBillWay")
  161. @ApiOperation(value="分页查询无车运单信息", notes="分页查询无车运单信息")
  162. @LoginRequired
  163. public RespR findImportBillWay(Page page, NoCarWayBill noCarWayBill) {
  164. try {
  165. setTimeDue(noCarWayBill);
  166. RespR respR = new RespR(noCarBillWayImportService.findByPageAndWayBill(page, noCarWayBill));
  167. return respR;
  168. }catch (Exception e){
  169. e.printStackTrace();
  170. return new RespR(false,e.getMessage());
  171. }
  172. }
  173. /**
  174. * 重新获取发票并更新状态
  175. *
  176. * @return 用户集合
  177. */
  178. @PostMapping("/updateStatus")
  179. @ApiOperation(value="重新获取发票并更新状态", notes="重新获取发票并更新状态")
  180. @LoginRequired
  181. public RespR updateStatus(String noCarWayBillStr) {
  182. List<NoCarWayBill> noCarWayBills = JSON.parseArray(noCarWayBillStr,NoCarWayBill.class);
  183. if(noCarWayBills!=null && noCarWayBills.size()>0){
  184. noCarWayBills.stream().forEach(noCarWayBill -> {
  185. try {
  186. noCarService.getInvoiceByWayBillNumReal(noCarWayBill,true);
  187. }catch (Exception e){
  188. e.printStackTrace();
  189. }
  190. });
  191. }
  192. return new RespR("更新成功");
  193. }
  194. public void delGetInvoce(Integer historyFlag){
  195. log.info("开始取票HISflag:"+historyFlag);
  196. NoCarWayBill carWayBill = new NoCarWayBill();
  197. carWayBill.setHisFlag(historyFlag);
  198. carWayBill.setBillwayStatus(2);
  199. List<NoCarWayBill> noCarWayBillsMdEnd = noCarWaybillMapper.selectByHisFlagAndBillStatus(carWayBill);
  200. if(noCarWayBillsMdEnd!=null && noCarWayBillsMdEnd.size()>0){
  201. noCarWayBillsMdEnd.stream().forEach(noCarWayBill -> {
  202. noCarService.getInvoiceByWayBillNumReal(noCarWayBill,true);
  203. });
  204. }
  205. }
  206. /**
  207. * 分页查询异常运单信息
  208. *
  209. * @param page 参数集
  210. * @return 用户集合
  211. */
  212. @PostMapping("/findBillWayException")
  213. @ApiOperation(value="分页查询异常运单信息", notes="分页查询异常运单信息")
  214. @LoginRequired
  215. public RespR findBillWayException(Page page, NoCarWayBill noCarWayBill) {
  216. try {
  217. setTimeDue(noCarWayBill);
  218. RespR respR = new RespR(noCarBillWayService.findByPageAndWayBillException(page, noCarWayBill));
  219. return respR;
  220. }catch (Exception e){
  221. e.printStackTrace();
  222. return new RespR(false,e.getMessage());
  223. }
  224. }
  225. /**
  226. * 分页查询无车运单信息
  227. *
  228. * @param page 参数集
  229. * @return 用户集合
  230. */
  231. @PostMapping("/findNocarInvoices")
  232. @ApiOperation(value="分页查询无车发票信息", notes="分页查询无车发票信息")
  233. @LoginRequired
  234. public RespR findNocarInvoices(Page page, BillInvoice billInvoice) {
  235. try {
  236. if(!StringUtils.isEmpty(billInvoice.getInvoiceMakeTime()) && !"null".equals(billInvoice.getInvoiceMakeTime())){
  237. String [] res =billInvoice.getInvoiceMakeTime().split(",");
  238. billInvoice.setInvoiceMakeStart(res[0]);
  239. billInvoice.setInvoiceMakeEnd(res[1].replace("00:00:00","23:59:59"));
  240. }
  241. if(!StringUtils.isEmpty(billInvoice.getCalculateTime()) && !"null".equals(billInvoice.getCalculateTime())){
  242. String [] res =billInvoice.getCalculateTime().split(",");
  243. billInvoice.setCalculateTimeStart(res[0]);
  244. billInvoice.setCalculateTimeEnd(res[1].replace("00:00:00","23:59:59"));
  245. }
  246. RespR respR = new RespR(nocarInvoiceService.findByPageAndInvoice(page, billInvoice));
  247. return respR;
  248. }catch (Exception e){
  249. e.printStackTrace();
  250. return new RespR(false,e.getMessage());
  251. }
  252. }
  253. /**
  254. * 批量查询无车发票信息
  255. *
  256. * @param file 参数集
  257. * @return
  258. */
  259. @PostMapping("/batchImportNocarInvoices")
  260. @ApiOperation(value="批量查询无车发票信息", notes="批量查询无车发票信息")
  261. @LoginRequired
  262. public RespR batchImportNocarInvoices(@RequestParam("file") MultipartFile file) {
  263. try {
  264. ImportParams params = new ImportParams();
  265. params.setTitleRows(1);
  266. params.setHeadRows(1);
  267. // params.setKeyIndex(2);
  268. List<BillInvoice> list = ExcelImportUtil.importExcel(file.getInputStream(), BillInvoice.class,params) ;
  269. RespR respR = nocarInvoiceService.findImportNocarInvoices(list);
  270. return respR;
  271. }catch (Exception e){
  272. e.printStackTrace();
  273. return new RespR(false,e.getMessage());
  274. }
  275. }
  276. /**
  277. * 批量查询无车运单信息
  278. *
  279. * @param file 参数集
  280. * @return
  281. */
  282. @PostMapping("/batchImportNocarBillWay")
  283. @ApiOperation(value="批量查询无车运单信息", notes="批量查询无车运单信息")
  284. @LoginRequired
  285. public RespR batchImportNocarBillWay(@RequestParam("file") MultipartFile file) {
  286. try {
  287. ImportParams params = new ImportParams();
  288. params.setTitleRows(1);
  289. params.setHeadRows(1);
  290. // params.setKeyIndex(2);
  291. List<NoCarWayBill> list = ExcelImportUtil.importExcel(file.getInputStream(), NoCarWayBill.class,params) ;
  292. RespR respR = noCarBillWayService.findImportNocarBillWay(list);
  293. return respR;
  294. }catch (Exception e){
  295. e.printStackTrace();
  296. return new RespR(false,e.getMessage());
  297. }
  298. }
  299. /**
  300. * 分页查询无车运单统计信息
  301. *
  302. * @param billInvoice
  303. * @return 用户集合
  304. */
  305. @PostMapping("/findNocarInvoicesStatic")
  306. @ApiOperation(value="分页查询无车发票统计信息", notes="分页查询无车发票统计信息")
  307. @LoginRequired
  308. public RespR findNocarInvoicesStatic(BillInvoice billInvoice) {
  309. try {
  310. if(!StringUtils.isEmpty(billInvoice.getInvoiceMakeTime()) && !"null".equals(billInvoice.getInvoiceMakeTime())){
  311. String [] res =billInvoice.getInvoiceMakeTime().split(",");
  312. billInvoice.setInvoiceMakeStart(res[0]);
  313. billInvoice.setInvoiceMakeEnd(res[1].replace("00:00:00","23:59:59"));
  314. }
  315. if(!StringUtils.isEmpty(billInvoice.getCalculateTime()) && !"null".equals(billInvoice.getCalculateTime())){
  316. String [] res =billInvoice.getCalculateTime().split(",");
  317. billInvoice.setCalculateTimeStart(res[0]);
  318. billInvoice.setCalculateTimeEnd(res[1].replace("00:00:00","23:59:59"));
  319. }
  320. RespR respR = new RespR(nocarInvoiceService.findInvoiceStatics(billInvoice));
  321. return respR;
  322. }catch (Exception e){
  323. e.printStackTrace();
  324. return new RespR(false,e.getMessage());
  325. }
  326. }
  327. /**
  328. * 批量运单导入
  329. *
  330. * @param file 参数集
  331. * @return
  332. */
  333. @PostMapping("/batchImprotBillWay")
  334. @ApiOperation(value="批量运单导入", notes="批量运单导入")
  335. @LoginRequired
  336. public RespR batchImprotBillWay(@RequestParam("file") MultipartFile file,String customerName) {
  337. try {
  338. ImportParams params = new ImportParams();
  339. params.setTitleRows(1);
  340. params.setHeadRows(1);
  341. params.setKeyIndex(2);
  342. List<NoCarWayBill> list = ExcelImportUtil.importExcel(file.getInputStream(), NoCarWayBill.class,params) ;
  343. buildDate(list);
  344. RespR respR = noCarBillWayService.batchBillWayStart(list,customerName);
  345. return respR;
  346. }catch (Exception e){
  347. e.printStackTrace();
  348. return new RespR(false,e.getMessage());
  349. }
  350. }
  351. /**
  352. * 批量运单导入
  353. *
  354. * @param file 参数集
  355. * @return
  356. */
  357. @PostMapping("/batchImprotHistoryBillWay")
  358. @ApiOperation(value="批量历史运单导入", notes="批量历史运单导入")
  359. @LoginRequired
  360. public RespR batchImprotHistoryBillWay(@RequestParam("file") MultipartFile file,String customerName) {
  361. try {
  362. ImportParams params = new ImportParams();
  363. params.setTitleRows(1);
  364. params.setHeadRows(1);
  365. params.setKeyIndex(2);
  366. List<NoCarWayBill> list = ExcelImportUtil.importExcel(file.getInputStream(), NoCarWayBill.class,params);
  367. log.info("1111111111"+list.size());
  368. buildDate(list);
  369. RespR respR = noCarBillWayService.batchHsitoryBillWay(list,customerName);
  370. return respR;
  371. }catch (Exception e){
  372. e.printStackTrace();
  373. return new RespR(false,e.getMessage());
  374. }
  375. }
  376. /**
  377. * 批量运单导入
  378. *
  379. * @param file 参数集
  380. * @return
  381. */
  382. @PostMapping("/batchImprotEndBillWay")
  383. @ApiOperation(value="批量运单结束", notes="批量运单结束")
  384. @LoginRequired
  385. public RespR batchImprotEndBillWay(@RequestParam("file") MultipartFile file,String customerName) {
  386. try {
  387. ImportParams params = new ImportParams();
  388. params.setTitleRows(1);
  389. params.setHeadRows(1);
  390. params.setKeyIndex(2);
  391. List<NoCarWayBill> list = ExcelImportUtil.importExcel(file.getInputStream(), NoCarWayBill.class,params);
  392. buildDateEnd(list);
  393. log.info("1111111111"+list.size());
  394. RespR respR = noCarBillWayService.batchBillWayEnd(list,customerName);
  395. return respR;
  396. }catch (Exception e){
  397. e.printStackTrace();
  398. return new RespR(false,e.getMessage());
  399. }
  400. }
  401. public void buildDate(List<NoCarWayBill> list){
  402. StringBuffer sb = new StringBuffer();
  403. DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  404. int i = 0;
  405. for(NoCarWayBill noCarWayBill:list){
  406. try {
  407. noCarWayBill.setStartTime(format.format(noCarWayBill.getStartTimeDate()));
  408. noCarWayBill.setPredictEndTime(format.format(noCarWayBill.getPredictEndTimeDate()));
  409. if(noCarWayBill.getFeeD() !=null){
  410. noCarWayBill.setFee(Math.round(noCarWayBill.getFeeD()*100));
  411. }
  412. noCarWayBill.setTaxplayerCode(noCarWayBill.getTaxplayerCode().trim());
  413. noCarWayBill.setBillNum(noCarWayBill.getBillNum().trim());
  414. }catch (Exception e){
  415. sb.append(noCarWayBill.getBillNum()+"#");
  416. log.info(noCarWayBill.getBillNum());
  417. i++;
  418. }
  419. }
  420. if(i>0){
  421. throw new RuntimeException(sb.toString()+"数据存在错误,请检查文件中数据,金额是否有空的,时间是否全是时间格式");
  422. }
  423. }
  424. public void buildDateEnd(List<NoCarWayBill> list){
  425. DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  426. int i = 0;
  427. StringBuffer sb = new StringBuffer();
  428. for(NoCarWayBill noCarWayBill:list){
  429. try{
  430. noCarWayBill.setPredictEndTime(format.format(noCarWayBill.getActEndTimeDate()));
  431. }catch (Exception e){
  432. sb.append(noCarWayBill.getBillNum()+"#");
  433. log.info(noCarWayBill.getBillNum());
  434. i++;
  435. }
  436. }
  437. if(i>0){
  438. throw new RuntimeException(sb.toString()+"数据存在错误,请检查文件中数据,金额是否有空的,时间是否全是时间格式");
  439. }
  440. }
  441. /**
  442. * 分页查询无车计费信息
  443. *
  444. * @param page 参数集
  445. * @return 用户集合
  446. */
  447. @PostMapping("/findBatchList")
  448. @ApiOperation(value="运单批次号查询", notes="运单批次号查询")
  449. @LoginRequired
  450. public RespR findBatchList(Page page, CustomerOper customerOper) {
  451. try {
  452. RespR respR = new RespR(customerOperService.findAllCustomerOper(page, customerOper));
  453. return respR;
  454. }catch (Exception e){
  455. e.printStackTrace();
  456. return new RespR(false,e.getMessage());
  457. }
  458. }
  459. /**
  460. * 分页查询无车计费信息
  461. *
  462. * @param page 参数集
  463. * @return 用户集合
  464. */
  465. @PostMapping("/findNocarCalculateInfo")
  466. @ApiOperation(value="分页查询无车计费信息", notes="分页查询无车计费信息")
  467. @LoginRequired
  468. public RespR findNocarCalculateInfo(Page page, NoCarCalculateInfor carCalculateInfor) {
  469. try {
  470. setTimeDue1(carCalculateInfor);
  471. RespR respR = new RespR(noCarCalculateInfoService.findByPageAndCalculateInfor(page, carCalculateInfor));
  472. return respR;
  473. }catch (Exception e){
  474. e.printStackTrace();
  475. return new RespR(false,e.getMessage());
  476. }
  477. }
  478. /**
  479. * 分页查询无车计费统计信息
  480. *
  481. * @param carCalculateInfor 参数集
  482. * @return 用户集合
  483. */
  484. @PostMapping("/findNocarCalculateInfoStatis")
  485. @ApiOperation(value="分页查询无车计费统计信息", notes="分页查询无车计费统计信息")
  486. @LoginRequired
  487. public RespR findNocarCalculateInfoStatis(NoCarCalculateInfor carCalculateInfor) {
  488. try {
  489. setTimeDue1(carCalculateInfor);
  490. RespR respR = new RespR(noCarCalculateInfoService.findNocarCalculateInfoStatis(carCalculateInfor));
  491. return respR;
  492. }catch (Exception e){
  493. e.printStackTrace();
  494. return new RespR(false,e.getMessage());
  495. }
  496. }
  497. @GetMapping("/templateDownload")
  498. @ApiOperation(value="模板下载", notes="模板下载")
  499. public RespR contractDownload(String fileName,HttpServletResponse response){
  500. if("1".equals(fileName)){
  501. fileName = "运单模板.xlsx";
  502. }else if("2".equals(fileName)){
  503. fileName = "运单结束模板.xlsx";
  504. }else if("3".equals(fileName)){
  505. fileName = "历史运单模板.xlsx";
  506. }else if("4".equals(fileName)){
  507. fileName = "无车发票查询模板.xlsx";
  508. }else if("5".equals(fileName)){
  509. fileName = "无车运单查询模板.xlsx";
  510. }else if("6".equals(fileName)){
  511. fileName = "自有车交易查询模板.xlsx";
  512. }else if("7".equals(fileName)){
  513. fileName = "自有车发票查询模板.xlsx";
  514. }
  515. OutputStream outputStream = null;
  516. InputStream inputStream = null;
  517. try {
  518. File file = new File("/home/app/excel/"+fileName);
  519. inputStream = new FileInputStream(file);
  520. response.setHeader("Content-Disposition", "attachment;filename="+ URLEncoder.encode(fileName, "UTF-8"));
  521. outputStream = response.getOutputStream();
  522. IOUtils.copy(inputStream, outputStream);
  523. response.flushBuffer();
  524. return new RespR(true);
  525. } catch (IOException e) {
  526. } finally {
  527. IOUtils.closeQuietly(inputStream);
  528. IOUtils.closeQuietly(outputStream);
  529. }
  530. return new RespR(false);
  531. }
  532. public void setTimeDue1(NoCarCalculateInfor carCalculateInfor){
  533. if(!StringUtils.isEmpty(carCalculateInfor.getInvoiceMakeTime()) && !"null".equals(carCalculateInfor.getInvoiceMakeTime())){
  534. String [] res = carCalculateInfor.getInvoiceMakeTime().split(",");
  535. carCalculateInfor.setInvoiceMakeStart(res[0]);
  536. carCalculateInfor.setInvoiceMakeEnd(res[1].replace("00:00:00","23:59:59"));
  537. }else{
  538. carCalculateInfor.setInvoiceMakeTime(null);
  539. }
  540. if(!StringUtils.isEmpty(carCalculateInfor.getCalculateTime()) && !"null".equals(carCalculateInfor.getCalculateTime())){
  541. String [] res = carCalculateInfor.getCalculateTime().split(",");
  542. carCalculateInfor.setCalculateStart(res[0]);
  543. carCalculateInfor.setCalculateEnd(res[1].replace("00:00:00","23:59:59"));
  544. }else{
  545. carCalculateInfor.setCalculateTime(null);
  546. }
  547. }
  548. }