| @@ -242,147 +242,6 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| excelService.exportExcel(list, "账单数据.xls", response); | excelService.exportExcel(list, "账单数据.xls", response); | ||||
| } | } | ||||
| /* | |||||
| @Override | |||||
| public void exportBill(HttpServletRequest request, HttpServletResponse response, WxBillAll wxBillAll) { | |||||
| //得到当前月 | |||||
| //String month = DateUtils.getSystemTime("yyyy-MM"); | |||||
| //设置查询参数-当前月 | |||||
| //wxBillAll.setMonth(month); | |||||
| //查询 | |||||
| Map<Object, List<Map<String, Object>>> billMapList = wxBillAllMapper.list(wxBillAll).parallelStream().collect(Collectors.groupingBy(x -> { | |||||
| return x.get("merchantId"); | |||||
| })); | |||||
| XSSFWorkbook workbook; | |||||
| String filepath = Constant.fileDirectory; | |||||
| File savefile = new File(filepath); | |||||
| if (!savefile.exists()) { | |||||
| savefile.mkdirs(); | |||||
| } | |||||
| String filename = UUID.randomUUID() + ".xlsx"; | |||||
| filepath = filepath + filename; | |||||
| try { | |||||
| File file = new File(filepath); | |||||
| workbook = new XSSFWorkbook(); | |||||
| int count=1; | |||||
| Set<Map.Entry<Object, List<Map<String, Object>>>> entries = billMapList.entrySet(); | |||||
| for(Map.Entry<Object, List<Map<String, Object>>> entry:entries){ | |||||
| List<Map<String, Object>> billList = entry.getValue(); | |||||
| Map<String, Object> billInfo = billList.get(0); | |||||
| String merchantName = billInfo.get("merchantName").toString(); | |||||
| XSSFSheet sheet = workbook.createSheet(merchantName+"-"+count++); | |||||
| Row row = sheet.createRow(0); | |||||
| Cell shopNumberCell = row.createCell(0); | |||||
| Cell merchantNameCell = row.createCell(1); | |||||
| Cell shopTypeCell = row.createCell(2); | |||||
| Cell billNameCell = row.createCell(3); | |||||
| Cell receivePayCell = row.createCell(4); | |||||
| Cell payCell = row.createCell(5); | |||||
| Cell oweCell = row.createCell(6); | |||||
| Cell receiveDateCell = row.createCell(7); | |||||
| Cell expiredDayCell = row.createCell(8); | |||||
| Cell statusCell = row.createCell(9); | |||||
| shopNumberCell.setCellValue("商铺号"); | |||||
| merchantNameCell.setCellValue("商户名称"); | |||||
| shopTypeCell.setCellValue("商铺类型"); | |||||
| billNameCell.setCellValue("费用类型"); | |||||
| receivePayCell.setCellValue("实际应收金额(元)"); | |||||
| payCell.setCellValue("实收金额(元)"); | |||||
| oweCell.setCellValue("欠缴金额(元)"); | |||||
| receiveDateCell.setCellValue("缴款截止日期"); | |||||
| expiredDayCell.setCellValue("逾期天数"); | |||||
| statusCell.setCellValue("账单状态"); | |||||
| for (int i = 0,size=billList.size(); i < size; i++) { | |||||
| row = sheet.createRow(i + 1); | |||||
| shopNumberCell = row.createCell(0); | |||||
| merchantNameCell = row.createCell(1); | |||||
| shopTypeCell = row.createCell(2); | |||||
| billNameCell = row.createCell(3); | |||||
| receivePayCell = row.createCell(4); | |||||
| payCell = row.createCell(5); | |||||
| oweCell = row.createCell(6); | |||||
| receiveDateCell = row.createCell(7); | |||||
| expiredDayCell = row.createCell(8); | |||||
| statusCell = row.createCell(9); | |||||
| Map<String, Object> billMap = billList.get(i); | |||||
| logger.info(billMap.toString()); | |||||
| try { | |||||
| shopNumberCell.setCellValue(billMap.get("shopNumber").toString()); | |||||
| merchantNameCell.setCellValue(billMap.get("merchantName").toString()); | |||||
| shopTypeCell.setCellValue(EnumRentShopType.getEnum((Integer) billMap.get("rentShopType")).getMessage()); | |||||
| billNameCell.setCellValue(billMap.get("name").toString()); | |||||
| BigDecimal needPay = new BigDecimal(billMap.get("pay").toString()).divide(new BigDecimal(100)); | |||||
| payCell.setCellValue(needPay.toString()); | |||||
| BigDecimal receivePay = new BigDecimal(billMap.get("receivePay").toString()).divide(new BigDecimal(100)); | |||||
| receivePayCell.setCellValue(receivePay.toString()); | |||||
| BigDecimal owe = new BigDecimal(billMap.get("owe").toString()).divide(new BigDecimal(100)); | |||||
| oweCell.setCellValue(owe.toString()); | |||||
| String receiveDate = DateUtils.date2String((Date) billMap.get("receiveDate"), "yyyy-MM-dd"); | |||||
| receiveDateCell.setCellValue(receiveDate); | |||||
| expiredDayCell.setCellValue(billMap.get("expiredDay").toString()); | |||||
| statusCell.setCellValue(EnumBillRentStatus.getEnum((Integer) billMap.get("status")).getMessage()); | |||||
| } catch (Exception e) { | |||||
| logger.error("错误数据:" + billMap.toString()); | |||||
| continue; | |||||
| } | |||||
| } | |||||
| row = sheet.createRow(billList.size()+1); | |||||
| Cell managerInfoCell = row.createCell(0); | |||||
| Cell managerCell = row.createCell(1); | |||||
| Cell managerPhoneCell = row.createCell(2); | |||||
| managerInfoCell.setCellValue("负责人信息:"); | |||||
| managerCell.setCellValue(billInfo.get("manager")==null?"":billInfo.get("manager").toString()); | |||||
| managerPhoneCell.setCellValue(billInfo.get("managerPhone")==null?"":billInfo.get("managerPhone").toString()); | |||||
| } | |||||
| FileOutputStream fileOut = new FileOutputStream(file); | |||||
| workbook.write(fileOut); | |||||
| fileOut.close(); | |||||
| workbook.close(); | |||||
| downFile(filepath, filename, "账单数据.xlsx",response, request); | |||||
| FileUtils.forceDelete(file); | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| public void downFile(String filePath, String filename, String exportFileName,HttpServletResponse response, | |||||
| HttpServletRequest req) throws IOException { | |||||
| try { | |||||
| response.reset(); | |||||
| response.setContentType("bin"); | |||||
| String agent = req.getHeader("user-agent"); | |||||
| if (agent.contains("Firefox")) { | |||||
| response.setHeader("Content-disposition", | |||||
| "attachment; filename=" | |||||
| + new String(exportFileName.getBytes("GB2312"), | |||||
| "ISO-8859-1")); | |||||
| } else { | |||||
| response | |||||
| .setHeader("Content-disposition", | |||||
| "attachment; filename=" | |||||
| + java.net.URLEncoder.encode(exportFileName, | |||||
| "UTF-8")); | |||||
| } | |||||
| // 循环取出流中的数据 | |||||
| byte[] b = new byte[1024]; | |||||
| int len; | |||||
| InputStream inStream = new FileInputStream(filePath); | |||||
| while ((len = inStream.read(b)) > 0) | |||||
| response.getOutputStream().write(b, 0, len); | |||||
| inStream.close(); | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| */ | |||||
| private int updateBillOtherDeposit(Map<String, Object> bill) { | private int updateBillOtherDeposit(Map<String, Object> bill) { | ||||
| logger.info("updateBillOtherDeposit params:" + bill.toString()); | logger.info("updateBillOtherDeposit params:" + bill.toString()); | ||||
| @@ -157,133 +157,6 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| }); | }); | ||||
| excelService.exportExcel(list,null,"会员信息",WxCUserBasicInfoVo.class,"会员信息数据.xls",response); | excelService.exportExcel(list,null,"会员信息",WxCUserBasicInfoVo.class,"会员信息数据.xls",response); | ||||
| } | } | ||||
| /* | |||||
| @Override | |||||
| public void exportData(WxCUserBasicInfo basicInfo, HttpServletRequest request, HttpServletResponse response) { | |||||
| List<WxCUserBasicInfoVo> memberlist = wxCUserBasicInfoMapper.findVoList(basicInfo); | |||||
| SXSSFWorkbook workbook; | |||||
| String filepath = Constant.fileDirectory; | |||||
| File savefile = new File(filepath); | |||||
| if (!savefile.exists()) { | |||||
| savefile.mkdirs(); | |||||
| } | |||||
| String filename = UUID.randomUUID() + ".xlsx"; | |||||
| filepath = filepath + filename; | |||||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| List<Long> tagIdList = new ArrayList<Long>(); | |||||
| try { | |||||
| File file = new File(filepath); | |||||
| workbook = new SXSSFWorkbook(100); | |||||
| SXSSFSheet sheetTwo = workbook.createSheet("会员信息"); | |||||
| Row rowtwo = sheetTwo.createRow(0); | |||||
| Cell nameCellTwo = rowtwo.createCell(0); | |||||
| Cell sexCellTwo = rowtwo.createCell(1); | |||||
| Cell phoneCellTwo = rowtwo.createCell(2); | |||||
| Cell nickNameCellTwo = rowtwo.createCell(3); | |||||
| Cell educationCellTwo = rowtwo.createCell(4); | |||||
| Cell birthdateCellTwo = rowtwo.createCell(5); | |||||
| Cell addrCellTwo = rowtwo.createCell(6); | |||||
| Cell updateDateCellTwo = rowtwo.createCell(7); | |||||
| Cell createDateCellTwo = rowtwo.createCell(8); | |||||
| Cell tagCellTwo = rowtwo.createCell(9); | |||||
| Cell scoreCellTwo = rowtwo.createCell(10); | |||||
| nameCellTwo.setCellValue("姓名"); | |||||
| sexCellTwo.setCellValue("性别"); | |||||
| phoneCellTwo.setCellValue("手机号"); | |||||
| nickNameCellTwo.setCellValue("微信昵称"); | |||||
| educationCellTwo.setCellValue("学历"); | |||||
| birthdateCellTwo.setCellValue("生日"); | |||||
| addrCellTwo.setCellValue("地址"); | |||||
| updateDateCellTwo.setCellValue("上次活跃时间"); | |||||
| createDateCellTwo.setCellValue("注册时间"); | |||||
| tagCellTwo.setCellValue("标签"); | |||||
| scoreCellTwo.setCellValue("成长值"); | |||||
| for (int i = 0; i < memberlist.size(); i++) { | |||||
| rowtwo = sheetTwo.createRow(i + 1); | |||||
| nameCellTwo = rowtwo.createCell(0); | |||||
| sexCellTwo = rowtwo.createCell(1); | |||||
| phoneCellTwo = rowtwo.createCell(2); | |||||
| nickNameCellTwo = rowtwo.createCell(3); | |||||
| educationCellTwo = rowtwo.createCell(4); | |||||
| birthdateCellTwo = rowtwo.createCell(5); | |||||
| addrCellTwo = rowtwo.createCell(6); | |||||
| updateDateCellTwo = rowtwo.createCell(7); | |||||
| createDateCellTwo = rowtwo.createCell(8); | |||||
| tagCellTwo = rowtwo.createCell(9); | |||||
| scoreCellTwo = rowtwo.createCell(10); | |||||
| WxCUserBasicInfoVo entity = memberlist.get(i); | |||||
| String sexStr = "保密"; | |||||
| if (entity.getSex() == 1) | |||||
| sexStr = "男"; | |||||
| else if (entity.getSex() == 2) | |||||
| sexStr = "女"; | |||||
| nameCellTwo.setCellValue(entity.getName()); | |||||
| sexCellTwo.setCellValue(sexStr); | |||||
| phoneCellTwo.setCellValue(entity.getPhone()); | |||||
| nickNameCellTwo.setCellValue(entity.getNickName()); | |||||
| educationCellTwo.setCellValue(entity.getEducation()); | |||||
| if (entity.getBirthdate() != null) | |||||
| birthdateCellTwo.setCellValue(sdf.format(entity.getBirthdate())); | |||||
| addrCellTwo.setCellValue(entity.getAddressStr()); | |||||
| updateDateCellTwo.setCellValue(sdf.format(entity.getUpdateDate())); | |||||
| createDateCellTwo.setCellValue(sdf.format(entity.getCreateDate())); | |||||
| if (entity != null) { | |||||
| if (entity.getTagId() != null && entity.getTags() != null) { | |||||
| if (StringUtils.isNotBlank(entity.getTags())) { | |||||
| List<Long> ids = JSONObject.parseArray(entity.getTags(), Long.class); | |||||
| if (!ids.isEmpty()) { | |||||
| String tagNames = ""; | |||||
| String tagIds = ""; | |||||
| tagIdList.clear(); | |||||
| for(Long id: ids) { | |||||
| for(WxTags tag: tagList) { | |||||
| if(id.equals(tag.getId())) { | |||||
| tagNames += tag.getName() + "/"; | |||||
| tagIds += tag.getId() + ","; | |||||
| tagIdList.add(tag.getId()); | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| if (StringUtils.isNotBlank(tagNames)) { | |||||
| entity.setTagNames(tagNames.substring(0, tagNames.length() - 1)); | |||||
| tagCellTwo.setCellValue(entity.getTagNames()); | |||||
| } | |||||
| if (StringUtils.isNoneBlank(tagIds)) { | |||||
| entity.setTagIds(tagIds.substring(0, tagIds.length() - 1)); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| // 成长值 | |||||
| if (entity.getPoins() != null) { | |||||
| scoreCellTwo.setCellValue(entity.getPoins()); | |||||
| } | |||||
| } | |||||
| FileOutputStream fileOut = new FileOutputStream(file); | |||||
| workbook.write(fileOut); | |||||
| fileOut.close(); | |||||
| workbook.close(); | |||||
| DownFileUtil.downFile(filepath,"会员信息数据.xlsx",response, request); | |||||
| FileUtils.forceDelete(file); | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| */ | |||||
| public void exportTemplate(HttpServletRequest request, HttpServletResponse response, String tenantId) { | public void exportTemplate(HttpServletRequest request, HttpServletResponse response, String tenantId) { | ||||
| List<WxCUserBasicInfoVo> list = new ArrayList<>(); | List<WxCUserBasicInfoVo> list = new ArrayList<>(); | ||||
| @@ -359,135 +232,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| excelService.exportExcel(list,null,"会员信息模板",WxCUserBasicInfoVo.class,"会员信息模板.xls",response); | excelService.exportExcel(list,null,"会员信息模板",WxCUserBasicInfoVo.class,"会员信息模板.xls",response); | ||||
| } | } | ||||
| /* | |||||
| @Override | |||||
| public void exportTemplate(HttpServletRequest request, HttpServletResponse response, String tenantId) { | |||||
| SXSSFWorkbook workbook; | |||||
| String filepath = Constant.fileDirectory; | |||||
| File savefile = new File(filepath); | |||||
| if (!savefile.exists()) { | |||||
| savefile.mkdirs(); | |||||
| } | |||||
| String filename = UUID.randomUUID() + ".xlsx"; | |||||
| filepath = filepath + filename; | |||||
| try { | |||||
| File file = new File(filepath); | |||||
| workbook = new SXSSFWorkbook(100); | |||||
| SXSSFSheet sheetTwo = workbook.createSheet("会员信息"); | |||||
| Row rowtwo = sheetTwo.createRow(0); | |||||
| Cell nameCellTwo = rowtwo.createCell(0); | |||||
| Cell sexCellTwo = rowtwo.createCell(1); | |||||
| Cell phoneCellTwo = rowtwo.createCell(2); | |||||
| Cell nickNameCellTwo = rowtwo.createCell(3); | |||||
| Cell educationCellTwo = rowtwo.createCell(4); | |||||
| Cell birthdateCellTwo = rowtwo.createCell(5); | |||||
| Cell addrCellTwo = rowtwo.createCell(6); | |||||
| Cell updateDateCellTwo = rowtwo.createCell(7); | |||||
| Cell createDateCellTwo = rowtwo.createCell(8); | |||||
| Cell tagCellTwo = rowtwo.createCell(9); | |||||
| Cell scoreCellTwo = rowtwo.createCell(10); | |||||
| nameCellTwo.setCellValue("姓名"); | |||||
| sexCellTwo.setCellValue("性别"); | |||||
| phoneCellTwo.setCellValue("手机号"); | |||||
| nickNameCellTwo.setCellValue("微信昵称"); | |||||
| educationCellTwo.setCellValue("学历"); | |||||
| birthdateCellTwo.setCellValue("生日"); | |||||
| addrCellTwo.setCellValue("地址"); | |||||
| updateDateCellTwo.setCellValue("上次活跃时间"); | |||||
| createDateCellTwo.setCellValue("注册时间"); | |||||
| tagCellTwo.setCellValue("标签"); | |||||
| scoreCellTwo.setCellValue("成长值"); | |||||
| { | |||||
| rowtwo = sheetTwo.createRow(1); | |||||
| nameCellTwo = rowtwo.createCell(0); | |||||
| sexCellTwo = rowtwo.createCell(1); | |||||
| phoneCellTwo = rowtwo.createCell(2); | |||||
| nickNameCellTwo = rowtwo.createCell(3); | |||||
| educationCellTwo = rowtwo.createCell(4); | |||||
| birthdateCellTwo = rowtwo.createCell(5); | |||||
| addrCellTwo = rowtwo.createCell(6); | |||||
| updateDateCellTwo = rowtwo.createCell(7); | |||||
| createDateCellTwo = rowtwo.createCell(8); | |||||
| tagCellTwo = rowtwo.createCell(9); | |||||
| scoreCellTwo = rowtwo.createCell(10); | |||||
| nameCellTwo.setCellValue("例子1"); | |||||
| sexCellTwo.setCellValue("保密"); | |||||
| phoneCellTwo.setCellValue("13900010001"); | |||||
| nickNameCellTwo.setCellValue("昵称"); | |||||
| educationCellTwo.setCellValue("本科"); | |||||
| birthdateCellTwo.setCellValue("2018-09-10"); | |||||
| addrCellTwo.setCellValue("地址"); | |||||
| updateDateCellTwo.setCellValue("2018-08-10"); | |||||
| createDateCellTwo.setCellValue("2018-08-10"); | |||||
| tagCellTwo.setCellValue("附近住户"); | |||||
| scoreCellTwo.setCellValue("100"); | |||||
| } | |||||
| { | |||||
| rowtwo = sheetTwo.createRow(2); | |||||
| nameCellTwo = rowtwo.createCell(0); | |||||
| sexCellTwo = rowtwo.createCell(1); | |||||
| phoneCellTwo = rowtwo.createCell(2); | |||||
| nickNameCellTwo = rowtwo.createCell(3); | |||||
| educationCellTwo = rowtwo.createCell(4); | |||||
| birthdateCellTwo = rowtwo.createCell(5); | |||||
| addrCellTwo = rowtwo.createCell(6); | |||||
| updateDateCellTwo = rowtwo.createCell(7); | |||||
| createDateCellTwo = rowtwo.createCell(8); | |||||
| tagCellTwo = rowtwo.createCell(9); | |||||
| nameCellTwo.setCellValue("例子2"); | |||||
| sexCellTwo.setCellValue("男"); | |||||
| phoneCellTwo.setCellValue("13900020002"); | |||||
| nickNameCellTwo.setCellValue("昵称"); | |||||
| educationCellTwo.setCellValue("本科"); | |||||
| birthdateCellTwo.setCellValue("2018-09-10"); | |||||
| addrCellTwo.setCellValue("地址"); | |||||
| updateDateCellTwo.setCellValue("2018-08-10"); | |||||
| createDateCellTwo.setCellValue("2018-08-10"); | |||||
| tagCellTwo.setCellValue("男/附近住户"); | |||||
| scoreCellTwo.setCellValue("200"); | |||||
| } | |||||
| { | |||||
| rowtwo = sheetTwo.createRow(3); | |||||
| nameCellTwo = rowtwo.createCell(0); | |||||
| sexCellTwo = rowtwo.createCell(1); | |||||
| phoneCellTwo = rowtwo.createCell(2); | |||||
| nickNameCellTwo = rowtwo.createCell(3); | |||||
| educationCellTwo = rowtwo.createCell(4); | |||||
| birthdateCellTwo = rowtwo.createCell(5); | |||||
| addrCellTwo = rowtwo.createCell(6); | |||||
| updateDateCellTwo = rowtwo.createCell(7); | |||||
| createDateCellTwo = rowtwo.createCell(8); | |||||
| tagCellTwo = rowtwo.createCell(9); | |||||
| nameCellTwo.setCellValue("例子3"); | |||||
| sexCellTwo.setCellValue("女"); | |||||
| phoneCellTwo.setCellValue("13900030003"); | |||||
| nickNameCellTwo.setCellValue("昵称"); | |||||
| educationCellTwo.setCellValue("本科"); | |||||
| birthdateCellTwo.setCellValue("2018-09-10"); | |||||
| addrCellTwo.setCellValue("地址"); | |||||
| updateDateCellTwo.setCellValue("2018-08-10"); | |||||
| createDateCellTwo.setCellValue("2018-08-10"); | |||||
| tagCellTwo.setCellValue("女/附近住户"); | |||||
| scoreCellTwo.setCellValue("110"); | |||||
| } | |||||
| FileOutputStream fileOut = new FileOutputStream(file); | |||||
| workbook.write(fileOut); | |||||
| fileOut.close(); | |||||
| workbook.close(); | |||||
| DownFileUtil.downFile(filepath, "会员信息模板.xlsx",response, request); | |||||
| FileUtils.forceDelete(file); | |||||
| } catch (Exception e) { | |||||
| logger.error("导出模板:" + e.getMessage()); | |||||
| } | |||||
| } | |||||
| */ | |||||
| public WxCUserBasicInfo InitUserBaseInfo(CUserBaseInfoT uBase, String tenantId) { | public WxCUserBasicInfo InitUserBaseInfo(CUserBaseInfoT uBase, String tenantId) { | ||||
| if (StringUtils.isBlank(uBase.getPhone())) { | if (StringUtils.isBlank(uBase.getPhone())) { | ||||
| @@ -740,78 +485,5 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| excelService.exportExcel(list,null,sheetName,WxCarPayRecord.class,sheetName+".xls",response); | excelService.exportExcel(list,null,sheetName,WxCarPayRecord.class,sheetName+".xls",response); | ||||
| } | } | ||||
| /* | |||||
| @Override | |||||
| public void exportCarPayData(WxCarPayRecord record, HttpServletRequest request, HttpServletResponse response) { | |||||
| List<WxCarPayRecord> carPayList = wxCarPayRecordMapper.findCarPayList(record); | |||||
| SXSSFWorkbook workbook; | |||||
| String filepath = Constant.fileDirectory; | |||||
| File savefile = new File(filepath); | |||||
| if (!savefile.exists()) { | |||||
| savefile.mkdirs(); | |||||
| } | |||||
| String filename = UUID.randomUUID() + ".xlsx"; | |||||
| filepath = filepath + filename; | |||||
| try { | |||||
| File file = new File(filepath); | |||||
| workbook = new SXSSFWorkbook(100); | |||||
| String sheetName = (record.getIsPay()!=null && 1==record.getIsPay())?"线上缴费车辆列表":"进出车辆列表"; | |||||
| SXSSFSheet sheetTwo = workbook.createSheet(sheetName); | |||||
| Row rowtwo = sheetTwo.createRow(0); | |||||
| Cell cell1 = rowtwo.createCell(0); | |||||
| Cell cell2 = rowtwo.createCell(1); | |||||
| Cell cell3 = rowtwo.createCell(2); | |||||
| Cell cell4 = rowtwo.createCell(3); | |||||
| Cell cell5 = rowtwo.createCell(4); | |||||
| Cell cell6 = rowtwo.createCell(5); | |||||
| cell1.setCellValue("车牌"); | |||||
| cell2.setCellValue("车主电话"); | |||||
| cell3.setCellValue("进场时间"); | |||||
| cell4.setCellValue("出场时间"); | |||||
| cell5.setCellValue("停车时长(分钟)"); | |||||
| cell6.setCellValue("缴费金额(元)"); | |||||
| for (int i = 0; i < carPayList.size(); i++) { | |||||
| rowtwo = sheetTwo.createRow(i + 1); | |||||
| cell1 = rowtwo.createCell(0); | |||||
| cell2 = rowtwo.createCell(1); | |||||
| cell3 = rowtwo.createCell(2); | |||||
| cell4 = rowtwo.createCell(3); | |||||
| cell5 = rowtwo.createCell(4); | |||||
| cell6 = rowtwo.createCell(5); | |||||
| WxCarPayRecord entity = carPayList.get(i); | |||||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | |||||
| cell1.setCellValue(entity.getPlateNumber()); | |||||
| cell2.setCellValue(entity.getPhone()); | |||||
| if(entity.getEntranceTime() != null) { | |||||
| cell3.setCellValue(sdf.format(entity.getEntranceTime())); | |||||
| } | |||||
| if(entity.getExitTime() != null) { | |||||
| cell4.setCellValue(sdf.format(entity.getExitTime())); | |||||
| } | |||||
| if(entity.getStayedTime() != null) { | |||||
| cell5.setCellValue(entity.getStayedTime()); | |||||
| } | |||||
| if(entity.getFee() != null) { | |||||
| cell6.setCellValue(entity.getFee()); | |||||
| } | |||||
| } | |||||
| FileOutputStream fileOut = new FileOutputStream(file); | |||||
| workbook.write(fileOut); | |||||
| fileOut.close(); | |||||
| workbook.close(); | |||||
| String name = (record.getIsPay()!=null && 1==record.getIsPay())?"线上缴费车辆数据":"进出车辆数据"; | |||||
| DownFileUtil.downFile(filepath,name+".xlsx",response, request); | |||||
| FileUtils.forceDelete(file); | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| */ | |||||
| } | } | ||||
| @@ -501,128 +501,5 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| List<WxCardSpendVo> list = wxCardSpendMapper.findCardSpendVoList(wxCardSpendVo); | List<WxCardSpendVo> list = wxCardSpendMapper.findCardSpendVoList(wxCardSpendVo); | ||||
| excelService.exportExcel(list,null,"消费记录",WxCardSpendVo.class,"消费记录.xls",response); | excelService.exportExcel(list,null,"消费记录",WxCardSpendVo.class,"消费记录.xls",response); | ||||
| } | } | ||||
| /* | |||||
| @Override | |||||
| public void exportData(WxCardSpendVo wxCardSpendVo, HttpServletRequest request, HttpServletResponse response) { | |||||
| List<WxCardSpendVo> cardSpendVoList = wxCardSpendMapper.findCardSpendVoList(wxCardSpendVo); | |||||
| XSSFWorkbook workbook; | |||||
| String filepath = Constant.fileDirectory; | |||||
| File savefile = new File(filepath); | |||||
| if (!savefile.exists()) { | |||||
| savefile.mkdirs(); | |||||
| } | |||||
| String filename = UUID.randomUUID() + ".xlsx"; | |||||
| filepath = filepath + filename; | |||||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||||
| DecimalFormat df = new DecimalFormat("0.00"); | |||||
| try { | |||||
| File file = new File(filepath); | |||||
| workbook = new XSSFWorkbook(); | |||||
| XSSFSheet sheetTwo = workbook.createSheet("消费记录"); | |||||
| Row rowtwo = sheetTwo.createRow(0); | |||||
| Cell idCellTwo = rowtwo.createCell(0); | |||||
| Cell ownerCellTwo = rowtwo.createCell(1); | |||||
| Cell phoneCellTwo = rowtwo.createCell(2); | |||||
| Cell cardNameCellTwo = rowtwo.createCell(3); | |||||
| Cell merchantNameCellTwo = rowtwo.createCell(4); | |||||
| Cell costCellTwo = rowtwo.createCell(5); | |||||
| Cell costTimeCellTwo = rowtwo.createCell(6); | |||||
| Cell receivePayCellTwo = rowtwo.createCell(7); | |||||
| Cell realReceivePayCellTwo = rowtwo.createCell(8); | |||||
| Cell payStatusCellTwo = rowtwo.createCell(9); | |||||
| idCellTwo.setCellValue("ID"); | |||||
| ownerCellTwo.setCellValue("消费者"); | |||||
| phoneCellTwo.setCellValue("手机号"); | |||||
| cardNameCellTwo.setCellValue("卡名"); | |||||
| merchantNameCellTwo.setCellValue("商户"); | |||||
| costCellTwo.setCellValue("消费金额"); | |||||
| costTimeCellTwo.setCellValue("地址"); | |||||
| receivePayCellTwo.setCellValue("收款金额"); | |||||
| realReceivePayCellTwo.setCellValue("收款实际金额"); | |||||
| payStatusCellTwo.setCellValue("收款状态"); | |||||
| for (int i = 0; i < cardSpendVoList.size(); i++) { | |||||
| rowtwo = sheetTwo.createRow(i + 1); | |||||
| idCellTwo = rowtwo.createCell(0); | |||||
| ownerCellTwo = rowtwo.createCell(1); | |||||
| phoneCellTwo = rowtwo.createCell(2); | |||||
| cardNameCellTwo = rowtwo.createCell(3); | |||||
| merchantNameCellTwo = rowtwo.createCell(4); | |||||
| costCellTwo = rowtwo.createCell(5); | |||||
| costTimeCellTwo = rowtwo.createCell(6); | |||||
| receivePayCellTwo = rowtwo.createCell(7); | |||||
| realReceivePayCellTwo = rowtwo.createCell(8); | |||||
| payStatusCellTwo = rowtwo.createCell(9); | |||||
| WxCardSpendVo entity = cardSpendVoList.get(i); | |||||
| idCellTwo.setCellValue(String.valueOf(entity.getId())); | |||||
| ownerCellTwo.setCellValue(entity.getOnickName()); | |||||
| phoneCellTwo.setCellValue(entity.getOuPhone()); | |||||
| cardNameCellTwo.setCellValue(entity.getTitle()); | |||||
| merchantNameCellTwo.setCellValue(entity.getMerchantName()); | |||||
| String dStr = df.format((float)entity.getDeductionAmount()/100); | |||||
| costCellTwo.setCellValue(dStr); | |||||
| if (entity.getCreateDate() != null) | |||||
| costTimeCellTwo.setCellValue(sdf.format(entity.getCreateDate())); | |||||
| dStr = df.format((float)entity.getPayment()/100); | |||||
| receivePayCellTwo.setCellValue(dStr); | |||||
| dStr = df.format((float)entity.getRealPayment()/100); | |||||
| realReceivePayCellTwo.setCellValue(dStr); | |||||
| String statusStr = "未支付"; | |||||
| if (entity.getPayStatus().equals(EnumCardSpendStatus.NOT_PAY.getCode())) | |||||
| statusStr = "未支付"; | |||||
| else if (entity.getPayStatus().equals(EnumCardSpendStatus.PS_SHARED.getCode())) | |||||
| statusStr = "已分账"; | |||||
| else if (entity.getPayStatus().equals(EnumCardSpendStatus.MANUAL_PAY.getCode())) | |||||
| statusStr = "已手工分账"; | |||||
| payStatusCellTwo.setCellValue(statusStr); | |||||
| } | |||||
| FileOutputStream fileOut = new FileOutputStream(file); | |||||
| workbook.write(fileOut); | |||||
| fileOut.close(); | |||||
| workbook.close(); | |||||
| downFile(filepath, filename,"消费记录.xlsx",response, request); | |||||
| FileUtils.forceDelete(file); | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| public void downFile(String filePath, String filename, String exportFileName, | |||||
| HttpServletResponse response, HttpServletRequest req) throws IOException { | |||||
| try { | |||||
| response.reset(); | |||||
| response.setContentType("bin"); | |||||
| String agent = req.getHeader("user-agent"); | |||||
| if (agent.contains("Firefox")) { | |||||
| response.setHeader("Content-disposition", | |||||
| "attachment; filename=" | |||||
| + new String(exportFileName.getBytes("GB2312"), | |||||
| "ISO-8859-1")); | |||||
| } else { | |||||
| response | |||||
| .setHeader("Content-disposition", | |||||
| "attachment; filename=" | |||||
| + java.net.URLEncoder.encode(exportFileName, | |||||
| "UTF-8")); | |||||
| } | |||||
| // 循环取出流中的数据 | |||||
| byte[] b = new byte[1024]; | |||||
| int len; | |||||
| InputStream inStream = new FileInputStream(filePath); | |||||
| while ((len = inStream.read(b)) > 0) | |||||
| response.getOutputStream().write(b, 0, len); | |||||
| inStream.close(); | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| */ | |||||
| } | } | ||||
| @@ -85,119 +85,5 @@ public class WxMerchantSubsidyServiceImpl implements WxMerchantSubsidyService { | |||||
| excelService.exportExcel(list,null,"补贴记录",WxMerchantSubsidyVo.class,"补贴记录.xls",response); | excelService.exportExcel(list,null,"补贴记录",WxMerchantSubsidyVo.class,"补贴记录.xls",response); | ||||
| } | } | ||||
| /* | |||||
| @Override | |||||
| public void exportData(WxMerchantSubsidy wxMerchantSubsidy, HttpServletRequest request, HttpServletResponse response) { | |||||
| List<WxMerchantSubsidyVo> subsidyVoList = wxMerchantSubsidyMapper.findVoList(wxMerchantSubsidy); | |||||
| XSSFWorkbook workbook; | |||||
| String filepath = Constant.fileDirectory; | |||||
| File savefile = new File(filepath); | |||||
| if (!savefile.exists()) { | |||||
| savefile.mkdirs(); | |||||
| } | |||||
| String filename = UUID.randomUUID() + ".xlsx"; | |||||
| filepath = filepath + filename; | |||||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||||
| DecimalFormat df = new DecimalFormat("0.00"); | |||||
| try { | |||||
| File file = new File(filepath); | |||||
| workbook = new XSSFWorkbook(); | |||||
| XSSFSheet sheetTwo = workbook.createSheet("补贴记录"); | |||||
| Row rowtwo = sheetTwo.createRow(0); | |||||
| Cell idCellTwo = rowtwo.createCell(0); | |||||
| Cell merchantNameCellTwo = rowtwo.createCell(1); | |||||
| Cell createDateCellTwo = rowtwo.createCell(2); | |||||
| Cell orderPaymentCellTwo = rowtwo.createCell(3); | |||||
| Cell receiverPaymentCellTwo = rowtwo.createCell(4); | |||||
| Cell subsidyCellTwo = rowtwo.createCell(5); | |||||
| Cell statusCellTwo = rowtwo.createCell(6); | |||||
| idCellTwo.setCellValue("交易单号"); | |||||
| merchantNameCellTwo.setCellValue("消费商户"); | |||||
| createDateCellTwo.setCellValue("交易时间"); | |||||
| orderPaymentCellTwo.setCellValue("本次消费(元)"); | |||||
| receiverPaymentCellTwo.setCellValue("商户应收(元)"); | |||||
| subsidyCellTwo.setCellValue("补贴(元)"); | |||||
| statusCellTwo.setCellValue("补贴状态"); | |||||
| for (int i = 0; i < subsidyVoList.size(); i++) { | |||||
| rowtwo = sheetTwo.createRow(i + 1); | |||||
| idCellTwo = rowtwo.createCell(0); | |||||
| merchantNameCellTwo = rowtwo.createCell(1); | |||||
| createDateCellTwo = rowtwo.createCell(2); | |||||
| orderPaymentCellTwo = rowtwo.createCell(3); | |||||
| receiverPaymentCellTwo = rowtwo.createCell(4); | |||||
| subsidyCellTwo = rowtwo.createCell(5); | |||||
| statusCellTwo = rowtwo.createCell(6); | |||||
| WxMerchantSubsidyVo entity = subsidyVoList.get(i); | |||||
| idCellTwo.setCellValue(String.valueOf(entity.getOrderId())); | |||||
| merchantNameCellTwo.setCellValue(entity.getMerchantName()); | |||||
| if (entity.getCreateDate() != null) | |||||
| createDateCellTwo.setCellValue(sdf.format(entity.getCreateDate())); | |||||
| String dStr = df.format((float)entity.getOrderPayment()/100); | |||||
| orderPaymentCellTwo.setCellValue(dStr); | |||||
| dStr = df.format((float)entity.getReceiverPayment()/100); | |||||
| receiverPaymentCellTwo.setCellValue(dStr); | |||||
| dStr = df.format((float)entity.getSubsidy()/100); | |||||
| subsidyCellTwo.setCellValue(dStr); | |||||
| String statusStr = "未补贴"; | |||||
| if (entity.getStatus().equals(EnumMerchantSubsidyStatus.NOT_SUBSIDY.getCode())) { | |||||
| statusStr = "未补贴"; | |||||
| } else if (entity.getStatus().equals(EnumMerchantSubsidyStatus.AUTO_SUBSIDIED.getCode())) { | |||||
| statusStr = "已自动补贴"; | |||||
| } else if (entity.getStatus().equals(EnumMerchantSubsidyStatus.MANUAL_SUBSIDIED.getCode())) { | |||||
| statusStr = "已手工补贴"; | |||||
| } | |||||
| statusCellTwo.setCellValue(statusStr); | |||||
| } | |||||
| FileOutputStream fileOut = new FileOutputStream(file); | |||||
| workbook.write(fileOut); | |||||
| fileOut.close(); | |||||
| workbook.close(); | |||||
| downFile(filepath, filename,"补贴记录.xlsx",response, request); | |||||
| FileUtils.forceDelete(file); | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| public void downFile(String filePath, String filename, String exportFileName, | |||||
| HttpServletResponse response, HttpServletRequest req) throws IOException { | |||||
| try { | |||||
| response.reset(); | |||||
| response.setContentType("bin"); | |||||
| String agent = req.getHeader("user-agent"); | |||||
| if (agent.contains("Firefox")) { | |||||
| response.setHeader("Content-disposition", | |||||
| "attachment; filename=" | |||||
| + new String(exportFileName.getBytes("GB2312"), | |||||
| "ISO-8859-1")); | |||||
| } else { | |||||
| response | |||||
| .setHeader("Content-disposition", | |||||
| "attachment; filename=" | |||||
| + java.net.URLEncoder.encode(exportFileName, | |||||
| "UTF-8")); | |||||
| } | |||||
| // 循环取出流中的数据 | |||||
| byte[] b = new byte[1024]; | |||||
| int len; | |||||
| InputStream inStream = new FileInputStream(filePath); | |||||
| while ((len = inStream.read(b)) > 0) | |||||
| response.getOutputStream().write(b, 0, len); | |||||
| inStream.close(); | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| */ | |||||
| } | } | ||||
| @@ -156,134 +156,4 @@ public class WxShopServiceImpl implements WxShopService { | |||||
| String name = EnumRentShopType.SHOP.getCode().equals(wxShop.getType())?"店铺列表":"多经点位列表"; | String name = EnumRentShopType.SHOP.getCode().equals(wxShop.getType())?"店铺列表":"多经点位列表"; | ||||
| excelService.exportExcel(list,null, name, WxShopVo.class,name+".xls",response); | excelService.exportExcel(list,null, name, WxShopVo.class,name+".xls",response); | ||||
| } | } | ||||
| /* | |||||
| @Override | |||||
| public void exportShop(WxShop wxShop, HttpServletRequest request, HttpServletResponse response) { | |||||
| List<Map<String,Object>> shopList = wxShopMapper.findListWithMerchantMap(wxShop); | |||||
| SXSSFWorkbook workbook; | |||||
| String filepath = Constant.fileDirectory; | |||||
| File savefile = new File(filepath); | |||||
| if (!savefile.exists()) { | |||||
| savefile.mkdirs(); | |||||
| } | |||||
| String filename = UUID.randomUUID() + ".xlsx"; | |||||
| filepath = filepath + filename; | |||||
| try { | |||||
| File file = new File(filepath); | |||||
| workbook = new SXSSFWorkbook(100); | |||||
| String sheetName = EnumRentShopType.SHOP.getCode().equals(wxShop.getType())?"店铺列表":"多经点位列表"; | |||||
| SXSSFSheet sheetTwo = workbook.createSheet(sheetName); | |||||
| Row rowtwo = sheetTwo.createRow(0); | |||||
| Cell cell1,cell2,cell3,cell4,cell5,cell6,cell7,cell8,cell9,cell10,cell11; | |||||
| if(EnumRentShopType.POINT.getCode().equals(wxShop.getType())){ | |||||
| Cell cell0 = rowtwo.createCell(0); | |||||
| cell0.setCellValue("多经点位类型"); | |||||
| cell1 = rowtwo.createCell(1); | |||||
| cell2 = rowtwo.createCell(2); | |||||
| cell3 = rowtwo.createCell(3); | |||||
| cell4 = rowtwo.createCell(4); | |||||
| cell5 = rowtwo.createCell(5); | |||||
| cell6 = rowtwo.createCell(6); | |||||
| cell7 = rowtwo.createCell(7); | |||||
| cell8 = rowtwo.createCell(8); | |||||
| cell9 = rowtwo.createCell(9); | |||||
| cell10 = rowtwo.createCell(10); | |||||
| cell11 = rowtwo.createCell(11); | |||||
| }else{ | |||||
| cell1 = rowtwo.createCell(0); | |||||
| cell2 = rowtwo.createCell(1); | |||||
| cell3 = rowtwo.createCell(2); | |||||
| cell4 = rowtwo.createCell(3); | |||||
| cell5 = rowtwo.createCell(4); | |||||
| cell6 = rowtwo.createCell(5); | |||||
| cell7 = rowtwo.createCell(6); | |||||
| cell8 = rowtwo.createCell(7); | |||||
| cell9 = rowtwo.createCell(8); | |||||
| cell10 = rowtwo.createCell(9); | |||||
| cell11 = rowtwo.createCell(10); | |||||
| } | |||||
| cell1.setCellValue(EnumRentShopType.SHOP.getCode().equals(wxShop.getType())?"商铺号":"多经点位号"); | |||||
| cell2.setCellValue("租赁商户"); | |||||
| cell3.setCellValue("楼层"); | |||||
| cell4.setCellValue("楼座"); | |||||
| cell5.setCellValue("建筑面积(㎡)"); | |||||
| cell6.setCellValue("计租面积(㎡)"); | |||||
| cell7.setCellValue(EnumRentShopType.SHOP.getCode().equals(wxShop.getType())?"商铺状态":"多经点位状态"); | |||||
| // 商户信息 | |||||
| cell8.setCellValue("经营业态"); | |||||
| cell9.setCellValue("品牌"); | |||||
| cell10.setCellValue("负责人"); | |||||
| cell11.setCellValue("负责人电话"); | |||||
| for (int i = 0; i < shopList.size(); i++) { | |||||
| rowtwo = sheetTwo.createRow(i + 1); | |||||
| Map<String,Object> entity = shopList.get(i); | |||||
| if(EnumRentShopType.POINT.getCode().equals(wxShop.getType())){ | |||||
| Cell cell0 = rowtwo.createCell(0); | |||||
| if (entity.get("pointType") != null) { | |||||
| cell0.setCellValue(EnumPointType.getEnum((Integer) entity.get("pointType")).getMessage()); | |||||
| } | |||||
| cell1 = rowtwo.createCell(1); | |||||
| cell2 = rowtwo.createCell(2); | |||||
| cell3 = rowtwo.createCell(3); | |||||
| cell4 = rowtwo.createCell(4); | |||||
| cell5 = rowtwo.createCell(5); | |||||
| cell6 = rowtwo.createCell(6); | |||||
| cell7 = rowtwo.createCell(7); | |||||
| cell8 = rowtwo.createCell(8); | |||||
| cell9 = rowtwo.createCell(9); | |||||
| cell10 = rowtwo.createCell(10); | |||||
| cell11 = rowtwo.createCell(11); | |||||
| }else{ | |||||
| cell1 = rowtwo.createCell(0); | |||||
| cell2 = rowtwo.createCell(1); | |||||
| cell3 = rowtwo.createCell(2); | |||||
| cell4 = rowtwo.createCell(3); | |||||
| cell5 = rowtwo.createCell(4); | |||||
| cell6 = rowtwo.createCell(5); | |||||
| cell7 = rowtwo.createCell(6); | |||||
| cell8 = rowtwo.createCell(7); | |||||
| cell9 = rowtwo.createCell(8); | |||||
| cell10 = rowtwo.createCell(9); | |||||
| cell11 = rowtwo.createCell(10); | |||||
| } | |||||
| cell1.setCellValue((String)entity.get("shopNumber")); | |||||
| cell2.setCellValue((String)entity.get("merchantName")); | |||||
| cell3.setCellValue((String)entity.get("floor")); | |||||
| cell4.setCellValue((String)entity.get("building")); | |||||
| cell5.setCellValue((String)entity.get("buildArea")); | |||||
| cell6.setCellValue((String)entity.get("operationArea")); | |||||
| if(entity.get("status") != null) { | |||||
| if(EnumShopStatus.RENT.getCode().equals(entity.get("status"))) { | |||||
| cell7.setCellValue("已出租"); | |||||
| // 查询商户信息 | |||||
| cell8.setCellValue((String)entity.get("title")); | |||||
| cell9.setCellValue((String)entity.get("brand")); | |||||
| cell10.setCellValue((String)entity.get("link_person")); | |||||
| cell11.setCellValue((String)entity.get("link_phone")); | |||||
| }else{ | |||||
| cell7.setCellValue("未出租"); | |||||
| } | |||||
| } | |||||
| } | |||||
| FileOutputStream fileOut = new FileOutputStream(file); | |||||
| workbook.write(fileOut); | |||||
| fileOut.close(); | |||||
| workbook.close(); | |||||
| String name = EnumRentShopType.SHOP.getCode().equals(wxShop.getType())?"店铺列表":"多经点位列表"; | |||||
| DownFileUtil.downFile(filepath,name+".xlsx",response, request); | |||||
| FileUtils.forceDelete(file); | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| */ | |||||
| } | } | ||||