NoCarController.java 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  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. try {
  184. if(noCarWayBills!=null && noCarWayBills.size()>0){
  185. noCarWayBills.stream().forEach(noCarWayBill -> {
  186. noCarService.getInvoiceByWayBillNumReal(noCarWayBill,true);
  187. });
  188. }
  189. return new RespR("更新成功");
  190. }catch (Exception e){
  191. e.printStackTrace();
  192. return new RespR(false,e.getMessage());
  193. }
  194. }
  195. public void delGetInvoce(Integer historyFlag){
  196. log.info("开始取票HISflag:"+historyFlag);
  197. NoCarWayBill carWayBill = new NoCarWayBill();
  198. carWayBill.setHisFlag(historyFlag);
  199. carWayBill.setBillwayStatus(2);
  200. List<NoCarWayBill> noCarWayBillsMdEnd = noCarWaybillMapper.selectByHisFlagAndBillStatus(carWayBill);
  201. if(noCarWayBillsMdEnd!=null && noCarWayBillsMdEnd.size()>0){
  202. noCarWayBillsMdEnd.stream().forEach(noCarWayBill -> {
  203. noCarService.getInvoiceByWayBillNumReal(noCarWayBill,true);
  204. });
  205. }
  206. }
  207. /**
  208. * 分页查询异常运单信息
  209. *
  210. * @param page 参数集
  211. * @return 用户集合
  212. */
  213. @PostMapping("/findBillWayException")
  214. @ApiOperation(value="分页查询异常运单信息", notes="分页查询异常运单信息")
  215. @LoginRequired
  216. public RespR findBillWayException(Page page, NoCarWayBill noCarWayBill) {
  217. try {
  218. setTimeDue(noCarWayBill);
  219. RespR respR = new RespR(noCarBillWayService.findByPageAndWayBillException(page, noCarWayBill));
  220. return respR;
  221. }catch (Exception e){
  222. e.printStackTrace();
  223. return new RespR(false,e.getMessage());
  224. }
  225. }
  226. /**
  227. * 分页查询无车运单信息
  228. *
  229. * @param page 参数集
  230. * @return 用户集合
  231. */
  232. @PostMapping("/findNocarInvoices")
  233. @ApiOperation(value="分页查询无车发票信息", notes="分页查询无车发票信息")
  234. @LoginRequired
  235. public RespR findNocarInvoices(Page page, BillInvoice billInvoice) {
  236. try {
  237. if(!StringUtils.isEmpty(billInvoice.getInvoiceMakeTime()) && !"null".equals(billInvoice.getInvoiceMakeTime())){
  238. String [] res =billInvoice.getInvoiceMakeTime().split(",");
  239. billInvoice.setInvoiceMakeStart(res[0]);
  240. billInvoice.setInvoiceMakeEnd(res[1].replace("00:00:00","23:59:59"));
  241. }
  242. if(!StringUtils.isEmpty(billInvoice.getCalculateTime()) && !"null".equals(billInvoice.getCalculateTime())){
  243. String [] res =billInvoice.getCalculateTime().split(",");
  244. billInvoice.setCalculateTimeStart(res[0]);
  245. billInvoice.setCalculateTimeEnd(res[1].replace("00:00:00","23:59:59"));
  246. }
  247. RespR respR = new RespR(nocarInvoiceService.findByPageAndInvoice(page, billInvoice));
  248. return respR;
  249. }catch (Exception e){
  250. e.printStackTrace();
  251. return new RespR(false,e.getMessage());
  252. }
  253. }
  254. /**
  255. * 批量查询无车发票信息
  256. *
  257. * @param file 参数集
  258. * @return
  259. */
  260. @PostMapping("/batchImportNocarInvoices")
  261. @ApiOperation(value="批量查询无车发票信息", notes="批量查询无车发票信息")
  262. @LoginRequired
  263. public RespR batchImportNocarInvoices(@RequestParam("file") MultipartFile file) {
  264. try {
  265. ImportParams params = new ImportParams();
  266. params.setTitleRows(1);
  267. params.setHeadRows(1);
  268. // params.setKeyIndex(2);
  269. List<BillInvoice> list = ExcelImportUtil.importExcel(file.getInputStream(), BillInvoice.class,params) ;
  270. RespR respR = nocarInvoiceService.findImportNocarInvoices(list);
  271. return respR;
  272. }catch (Exception e){
  273. e.printStackTrace();
  274. return new RespR(false,e.getMessage());
  275. }
  276. }
  277. /**
  278. * 批量查询无车运单信息
  279. *
  280. * @param file 参数集
  281. * @return
  282. */
  283. @PostMapping("/batchImportNocarBillWay")
  284. @ApiOperation(value="批量查询无车运单信息", notes="批量查询无车运单信息")
  285. @LoginRequired
  286. public RespR batchImportNocarBillWay(@RequestParam("file") MultipartFile file) {
  287. try {
  288. ImportParams params = new ImportParams();
  289. params.setTitleRows(1);
  290. params.setHeadRows(1);
  291. // params.setKeyIndex(2);
  292. List<NoCarWayBill> list = ExcelImportUtil.importExcel(file.getInputStream(), NoCarWayBill.class,params) ;
  293. RespR respR = noCarBillWayService.findImportNocarBillWay(list);
  294. return respR;
  295. }catch (Exception e){
  296. e.printStackTrace();
  297. return new RespR(false,e.getMessage());
  298. }
  299. }
  300. /**
  301. * 分页查询无车运单统计信息
  302. *
  303. * @param billInvoice
  304. * @return 用户集合
  305. */
  306. @PostMapping("/findNocarInvoicesStatic")
  307. @ApiOperation(value="分页查询无车发票统计信息", notes="分页查询无车发票统计信息")
  308. @LoginRequired
  309. public RespR findNocarInvoicesStatic(BillInvoice billInvoice) {
  310. try {
  311. if(!StringUtils.isEmpty(billInvoice.getInvoiceMakeTime()) && !"null".equals(billInvoice.getInvoiceMakeTime())){
  312. String [] res =billInvoice.getInvoiceMakeTime().split(",");
  313. billInvoice.setInvoiceMakeStart(res[0]);
  314. billInvoice.setInvoiceMakeEnd(res[1]);
  315. }
  316. if(!StringUtils.isEmpty(billInvoice.getCalculateTime()) && !"null".equals(billInvoice.getCalculateTime())){
  317. String [] res =billInvoice.getCalculateTime().split(",");
  318. billInvoice.setCalculateTimeStart(res[0]);
  319. billInvoice.setCalculateTimeEnd(res[1]);
  320. }
  321. RespR respR = new RespR(nocarInvoiceService.findInvoiceStatics(billInvoice));
  322. return respR;
  323. }catch (Exception e){
  324. e.printStackTrace();
  325. return new RespR(false,e.getMessage());
  326. }
  327. }
  328. /**
  329. * 批量运单导入
  330. *
  331. * @param file 参数集
  332. * @return
  333. */
  334. @PostMapping("/batchImprotBillWay")
  335. @ApiOperation(value="批量运单导入", notes="批量运单导入")
  336. @LoginRequired
  337. public RespR batchImprotBillWay(@RequestParam("file") MultipartFile file,String customerName) {
  338. try {
  339. ImportParams params = new ImportParams();
  340. params.setTitleRows(1);
  341. params.setHeadRows(1);
  342. params.setKeyIndex(2);
  343. List<NoCarWayBill> list = ExcelImportUtil.importExcel(file.getInputStream(), NoCarWayBill.class,params) ;
  344. buildDate(list);
  345. RespR respR = noCarBillWayService.batchBillWayStart(list,customerName);
  346. return respR;
  347. }catch (Exception e){
  348. e.printStackTrace();
  349. return new RespR(false,e.getMessage());
  350. }
  351. }
  352. /**
  353. * 批量运单导入
  354. *
  355. * @param file 参数集
  356. * @return
  357. */
  358. @PostMapping("/batchImprotHistoryBillWay")
  359. @ApiOperation(value="批量历史运单导入", notes="批量历史运单导入")
  360. @LoginRequired
  361. public RespR batchImprotHistoryBillWay(@RequestParam("file") MultipartFile file,String customerName) {
  362. try {
  363. ImportParams params = new ImportParams();
  364. params.setTitleRows(1);
  365. params.setHeadRows(1);
  366. params.setKeyIndex(2);
  367. List<NoCarWayBill> list = ExcelImportUtil.importExcel(file.getInputStream(), NoCarWayBill.class,params);
  368. log.info("1111111111"+list.size());
  369. buildDate(list);
  370. RespR respR = noCarBillWayService.batchHsitoryBillWay(list,customerName);
  371. return respR;
  372. }catch (Exception e){
  373. e.printStackTrace();
  374. return new RespR(false,e.getMessage());
  375. }
  376. }
  377. /**
  378. * 批量运单导入
  379. *
  380. * @param file 参数集
  381. * @return
  382. */
  383. @PostMapping("/batchImprotEndBillWay")
  384. @ApiOperation(value="批量运单结束", notes="批量运单结束")
  385. @LoginRequired
  386. public RespR batchImprotEndBillWay(@RequestParam("file") MultipartFile file,String customerName) {
  387. try {
  388. ImportParams params = new ImportParams();
  389. params.setTitleRows(1);
  390. params.setHeadRows(1);
  391. params.setKeyIndex(2);
  392. List<NoCarWayBill> list = ExcelImportUtil.importExcel(file.getInputStream(), NoCarWayBill.class,params);
  393. buildDateEnd(list);
  394. log.info("1111111111"+list.size());
  395. RespR respR = noCarBillWayService.batchBillWayEnd(list,customerName);
  396. return respR;
  397. }catch (Exception e){
  398. e.printStackTrace();
  399. return new RespR(false,e.getMessage());
  400. }
  401. }
  402. public void buildDate(List<NoCarWayBill> list){
  403. StringBuffer sb = new StringBuffer();
  404. DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  405. int i = 0;
  406. for(NoCarWayBill noCarWayBill:list){
  407. try {
  408. noCarWayBill.setStartTime(format.format(noCarWayBill.getStartTimeDate()));
  409. noCarWayBill.setPredictEndTime(format.format(noCarWayBill.getPredictEndTimeDate()));
  410. if(noCarWayBill.getFeeD() !=null){
  411. noCarWayBill.setFee(Math.round(noCarWayBill.getFeeD()*100));
  412. }
  413. noCarWayBill.setTaxplayerCode(noCarWayBill.getTaxplayerCode().trim());
  414. noCarWayBill.setBillNum(noCarWayBill.getBillNum().trim());
  415. }catch (Exception e){
  416. sb.append(noCarWayBill.getBillNum()+"#");
  417. log.info(noCarWayBill.getBillNum());
  418. i++;
  419. }
  420. }
  421. if(i>0){
  422. throw new RuntimeException(sb.toString()+"数据存在错误,请检查文件中数据,金额是否有空的,时间是否全是时间格式");
  423. }
  424. }
  425. public void buildDateEnd(List<NoCarWayBill> list){
  426. DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  427. int i = 0;
  428. StringBuffer sb = new StringBuffer();
  429. for(NoCarWayBill noCarWayBill:list){
  430. try{
  431. noCarWayBill.setPredictEndTime(format.format(noCarWayBill.getActEndTimeDate()));
  432. }catch (Exception e){
  433. sb.append(noCarWayBill.getBillNum()+"#");
  434. log.info(noCarWayBill.getBillNum());
  435. i++;
  436. }
  437. }
  438. if(i>0){
  439. throw new RuntimeException(sb.toString()+"数据存在错误,请检查文件中数据,金额是否有空的,时间是否全是时间格式");
  440. }
  441. }
  442. /**
  443. * 分页查询无车计费信息
  444. *
  445. * @param page 参数集
  446. * @return 用户集合
  447. */
  448. @PostMapping("/findBatchList")
  449. @ApiOperation(value="运单批次号查询", notes="运单批次号查询")
  450. @LoginRequired
  451. public RespR findBatchList(Page page, CustomerOper customerOper) {
  452. try {
  453. RespR respR = new RespR(customerOperService.findAllCustomerOper(page, customerOper));
  454. return respR;
  455. }catch (Exception e){
  456. e.printStackTrace();
  457. return new RespR(false,e.getMessage());
  458. }
  459. }
  460. /**
  461. * 分页查询无车计费信息
  462. *
  463. * @param page 参数集
  464. * @return 用户集合
  465. */
  466. @PostMapping("/findNocarCalculateInfo")
  467. @ApiOperation(value="分页查询无车计费信息", notes="分页查询无车计费信息")
  468. @LoginRequired
  469. public RespR findNocarCalculateInfo(Page page, NoCarCalculateInfor carCalculateInfor) {
  470. try {
  471. setTimeDue1(carCalculateInfor);
  472. RespR respR = new RespR(noCarCalculateInfoService.findByPageAndCalculateInfor(page, carCalculateInfor));
  473. return respR;
  474. }catch (Exception e){
  475. e.printStackTrace();
  476. return new RespR(false,e.getMessage());
  477. }
  478. }
  479. /**
  480. * 分页查询无车计费统计信息
  481. *
  482. * @param carCalculateInfor 参数集
  483. * @return 用户集合
  484. */
  485. @PostMapping("/findNocarCalculateInfoStatis")
  486. @ApiOperation(value="分页查询无车计费统计信息", notes="分页查询无车计费统计信息")
  487. @LoginRequired
  488. public RespR findNocarCalculateInfoStatis(NoCarCalculateInfor carCalculateInfor) {
  489. try {
  490. setTimeDue1(carCalculateInfor);
  491. RespR respR = new RespR(noCarCalculateInfoService.findNocarCalculateInfoStatis(carCalculateInfor));
  492. return respR;
  493. }catch (Exception e){
  494. e.printStackTrace();
  495. return new RespR(false,e.getMessage());
  496. }
  497. }
  498. @GetMapping("/templateDownload")
  499. @ApiOperation(value="模板下载", notes="模板下载")
  500. public RespR contractDownload(String fileName,HttpServletResponse response){
  501. if("1".equals(fileName)){
  502. fileName = "运单模板.xlsx";
  503. }else if("2".equals(fileName)){
  504. fileName = "运单结束模板.xlsx";
  505. }else if("3".equals(fileName)){
  506. fileName = "历史运单模板.xlsx";
  507. }else if("4".equals(fileName)){
  508. fileName = "无车发票查询模板.xlsx";
  509. }else if("5".equals(fileName)){
  510. fileName = "无车运单查询模板.xlsx";
  511. }else if("6".equals(fileName)){
  512. fileName = "自有车交易查询模板.xlsx";
  513. }else if("7".equals(fileName)){
  514. fileName = "自有车发票查询模板.xlsx";
  515. }
  516. OutputStream outputStream = null;
  517. InputStream inputStream = null;
  518. try {
  519. File file = new File("/home/app/excel/"+fileName);
  520. inputStream = new FileInputStream(file);
  521. response.setHeader("Content-Disposition", "attachment;filename="+ URLEncoder.encode(fileName, "UTF-8"));
  522. outputStream = response.getOutputStream();
  523. IOUtils.copy(inputStream, outputStream);
  524. response.flushBuffer();
  525. return new RespR(true);
  526. } catch (IOException e) {
  527. } finally {
  528. IOUtils.closeQuietly(inputStream);
  529. IOUtils.closeQuietly(outputStream);
  530. }
  531. return new RespR(false);
  532. }
  533. public void setTimeDue1(NoCarCalculateInfor carCalculateInfor){
  534. if(!StringUtils.isEmpty(carCalculateInfor.getInvoiceMakeTime()) && !"null".equals(carCalculateInfor.getInvoiceMakeTime())){
  535. String [] res = carCalculateInfor.getInvoiceMakeTime().split(",");
  536. carCalculateInfor.setInvoiceMakeStart(res[0]);
  537. carCalculateInfor.setInvoiceMakeEnd(res[1].replace("00:00:00","23:59:59"));
  538. }else{
  539. carCalculateInfor.setInvoiceMakeTime(null);
  540. }
  541. if(!StringUtils.isEmpty(carCalculateInfor.getCalculateTime()) && !"null".equals(carCalculateInfor.getCalculateTime())){
  542. String [] res = carCalculateInfor.getCalculateTime().split(",");
  543. carCalculateInfor.setCalculateStart(res[0]);
  544. carCalculateInfor.setCalculateEnd(res[1].replace("00:00:00","23:59:59"));
  545. }else{
  546. carCalculateInfor.setCalculateTime(null);
  547. }
  548. }
  549. }