| | |
| | | |
| | | |
| | | 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.ExcelUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.model.TBalanceModifyRecord; |
| | | import com.stylefeng.guns.modular.system.model.TCompany; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.service.ITCompanyService; |
| | | import com.stylefeng.guns.modular.system.service.IUserActivityDiscount1Service; |
| | | import com.stylefeng.guns.modular.system.service.IUserCouponRecordService; |
| | | import com.stylefeng.guns.modular.system.service.IUserRedPacketRecordService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.text.DateFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 报表控制器 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/report") |
| | | public class ReportController extends BaseController { |
| | | public class ReportController { |
| | | |
| | | private String PREFIX = "/system/report/"; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private IUserActivityDiscount1Service userActivityDiscount1Service; |
| | | |
| | | |
| | | @Autowired |
| | | private ITBalanceModifyRecordService balanceModifyRecordService; |
| | | |
| | | |
| | | @Autowired |
| | | private ITPubWithdrawalService tPubWithdrawalService; |
| | | |
| | | @Autowired |
| | | private IComplaintDeductmoneyService complaintDeductmoneyService; |
| | | |
| | | @Autowired |
| | | private ITTaxiCardPaymentService taxiCardPaymentService; |
| | | |
| | | @Autowired |
| | | private ITOrderTaxiService orderTaxiService; |
| | | |
| | | /** |
| | | * 跳转到用户管理首页 |
| | | */ |
| | | @RequestMapping("user") |
| | | public String user() { |
| | | return PREFIX + "tUser.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到订单收益 |
| | | * @return |
| | | */ |
| | | @RequestMapping("order") |
| | | public String order() { |
| | | return PREFIX + "order.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转公司 |
| | | * @return |
| | | */ |
| | | @RequestMapping("company") |
| | | public String company() { |
| | | return PREFIX + "tCompany.html"; |
| | | } |
| | | |
| | | /** |
| | | * 分公司收益 |
| | | * @return |
| | | */ |
| | | @RequestMapping("companyIncome") |
| | | public String companyIncome() { |
| | | return PREFIX + "companyIncome.html"; |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/orderList") |
| | | @ResponseBody |
| | | public Object orderList(String insertTime, |
| | | String ids,Integer type,String payType) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | /*if (ShiroKit.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{*/ |
| | | |
| | | List<Map<String,Object>> list = orderTaxiService.getOrderList(page,beginTime,endTime,ids,type,payType,ShiroKit.getUser().getObjectId()); |
| | | page.setRecords(list); |
| | | /* }*/ |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | |
| | | @RequestMapping("/exportOrder") |
| | | @ResponseBody |
| | | public Object exportOrder(HttpServletResponse response, String insertTime, |
| | | String ids,Integer type,String payType){ |
| | | try { |
| | | Date date = new Date(); |
| | | DateFormat format = new SimpleDateFormat("yyyyMMdd"); |
| | | String time = format.format(date); |
| | | String fileName = "订单收益"+time+".xls"; |
| | | String[] title = new String[] {"订单时间","订单号","订单类型" |
| | | ,"支付方式","订单状态","司机名称","司机手机号","用户名称" |
| | | ,"用户id","用户手机号","平台收入","订单收入","附加费" |
| | | ,"加价费","节假日服务费","取消费","改派费","超时罚款" |
| | | ,"优惠金额","感谢费","小件物流差价费","平台支出","司机收入" |
| | | ,"附加费","节假日服务费","加价费","感谢费","小件物流差价费","余额" |
| | | }; |
| | | |
| | | |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | List<Map<String,Object>> mapList = orderTaxiService.getOrderListEx(beginTime,endTime,ids,type,payType,ShiroKit.getUser().getObjectId()); |
| | | |
| | | 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("insertTime").toString(); |
| | | values[i][1]=d.get("orderNum").toString(); |
| | | values[i][2]=d.get("type").toString().equals("1")?"快车": |
| | | d.get("type").toString().equals("2")?"出租车": |
| | | d.get("type").toString().equals("3")?"城际": |
| | | d.get("type").toString().equals("4")?"同城物流":"跨城物流"; |
| | | values[i][3]=d.get("payTypeName").toString(); |
| | | values[i][4]=d.get("payState").toString(); |
| | | values[i][5]=d.get("driverName").toString(); |
| | | values[i][6]=d.get("driverPhone").toString(); |
| | | values[i][7]=d.get("userName").toString(); |
| | | values[i][8]=d.get("userId").toString(); |
| | | values[i][9]=d.get("userPhone").toString(); |
| | | values[i][10]=d.get("totalMoney").toString(); |
| | | values[i][11]=d.get("orderMoney").toString(); |
| | | values[i][12]=d.get("additionalMoney").toString(); |
| | | values[i][13]=d.get("tipMoney").toString(); |
| | | values[i][14]=d.get("holidayFee").toString(); |
| | | values[i][15]=d.get("cancleMoney").toString(); |
| | | values[i][16]=d.get("reassignMoney").toString(); |
| | | values[i][17]=d.get("timeOutMoney").toString(); |
| | | values[i][18]=d.get("discountAmount").toString(); |
| | | values[i][19]=d.get("thankYouFee").toString(); |
| | | values[i][20]=d.get("spreadMoney").toString(); |
| | | values[i][21]=d.get("driverMoney").toString(); |
| | | values[i][22]=(Double.parseDouble(d.get("driverMoney").toString())-Double.parseDouble(d.get("additionalMoney").toString()) |
| | | -Double.parseDouble(d.get("holidayFee").toString()) |
| | | -Double.parseDouble(d.get("tipMoney").toString()) |
| | | -Double.parseDouble(d.get("thankYouFee").toString()) |
| | | -Double.parseDouble(d.get("spreadMoney").toString()) |
| | | )+""; |
| | | values[i][23]=d.get("additionalMoney").toString(); |
| | | values[i][24]=d.get("holidayFee").toString(); |
| | | values[i][25]=d.get("tipMoney").toString(); |
| | | values[i][26]=d.get("thankYouFee").toString(); |
| | | values[i][27]=d.get("spreadMoney").toString(); |
| | | values[i][28]=(Double.parseDouble(d.get("totalMoney").toString())-Double.parseDouble(d.get("driverMoney").toString()))+""; |
| | | } |
| | | String fileNameTitle="订单收益"; |
| | | HSSFWorkbook wb = ExcelUtil.getHSSFWorkbookTime(fileNameTitle+time, title, values, null,insertTime); |
| | | 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; |
| | | } |
| | | |
| | | @RequestMapping(value = "/companyIncomeList") |
| | | @ResponseBody |
| | | public Object companyIncomeList(String insertTime, |
| | | String ids) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | |
| | | List<Map<String,Object>> list = companyService.getCompanyIncomeList(page,beginTime,endTime,ids); |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("id","合计"); |
| | | map.put("money",companyService.getSumCompanyIncomeMoney(beginTime,endTime,ids)); |
| | | list.add(map); |
| | | page.setRecords(list); |
| | | } |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | |
| | | @RequestMapping("/exportCompanyIncome") |
| | | @ResponseBody |
| | | public Object exportCompanyIncome(HttpServletResponse response, String insertTime, @RequestParam String ids){ |
| | | try { |
| | | Date date = new Date(); |
| | | DateFormat format = new SimpleDateFormat("yyyyMMdd"); |
| | | String time = format.format(date); |
| | | String fileName = "分公司收益"+time+".xls"; |
| | | String[] title = new String[] {"id","公司名称","收益金额"}; |
| | | |
| | | |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | List<Map<String,Object>> mapList = companyService.getCompanyIncomeListEx(beginTime,endTime,ids); |
| | | |
| | | 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("id").toString(); |
| | | values[i][1]=d.get("name").toString(); |
| | | values[i][2]=d.get("money").toString(); |
| | | } |
| | | String fileNameTitle="分公司收益"; |
| | | HSSFWorkbook wb = ExcelUtil.getHSSFWorkbookTime(fileNameTitle+time, title, values, null,insertTime); |
| | | 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; |
| | | } |
| | | |
| | | /** |
| | | * 跳转司机管理页面 |
| | | * @return |
| | | */ |
| | | @RequestMapping("driver") |
| | | public String driver() { |
| | | return PREFIX + "tDriver.html"; |
| | | } |
| | | |
| | | /** |
| | | * 打车卡 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/taxiCardPayment") |
| | | public String taxiCardPayment() { |
| | | return PREFIX + "taxiCardPayment.html"; |
| | | } |
| | | @RequestMapping(value = "/taxiCardPaymentList") |
| | | @ResponseBody |
| | | public Object taxiCardPaymentList(String insertTime, |
| | | String ids,String type) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | |
| | | List<Map<String,Object>> list = taxiCardPaymentService.getList(page,beginTime,endTime,ids,type,null,null,null,null,ShiroKit.getUser().getObjectId()); |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("id","合计"); |
| | | map.put("payMoney",taxiCardPaymentService.getSumMoney(beginTime,endTime,ids,type,null,null,null,null,ShiroKit.getUser().getObjectId())); |
| | | list.add(map); |
| | | page.setRecords(list); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | |
| | | @RequestMapping("/exportTaxiCardPayment") |
| | | @ResponseBody |
| | | public Object exportTaxiCardPaymentList(HttpServletResponse response, String insertTime, @RequestParam String ids,String type){ |
| | | try { |
| | | Date date = new Date(); |
| | | DateFormat format = new SimpleDateFormat("yyyyMMdd"); |
| | | String time = format.format(date); |
| | | String fileName = "打车卡"+time+".xls"; |
| | | String[] title = new String[] {"支付时间","乘客名称","乘客电话","订单ID","打车卡类型","用户支付金额"}; |
| | | |
| | | |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | List<Map<String,Object>> mapList = taxiCardPaymentService.getListEx(beginTime,endTime,ids,type,null,null,null,null,ShiroKit.getUser().getObjectId()); |
| | | |
| | | 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("id").toString(); |
| | | values[i][4]=d.get("typeName").toString(); |
| | | values[i][5]=d.get("payMoney").toString(); |
| | | } |
| | | String fileNameTitle="打车卡"; |
| | | HSSFWorkbook wb = ExcelUtil.getHSSFWorkbookTime(fileNameTitle+time, title, values, null,insertTime); |
| | | 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; |
| | | } |
| | | /** |
| | | * 跳转投诉扣款 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/complaintDeductmoney") |
| | | public String complaintDeductmoney() { |
| | | return PREFIX + "complaintDeductmoney.html"; |
| | | } |
| | | |
| | | @RequestMapping(value = "/complaintDeductmoneyList") |
| | | @ResponseBody |
| | | public Object complaintDeductmoneyList(String insertTime, |
| | | String ids) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | |
| | | List<Map<String,Object>> list = complaintDeductmoneyService.getList(page,beginTime,endTime,ids,null,null,null,ShiroKit.getUser().getObjectId()); |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("id","合计"); |
| | | map.put("money",complaintDeductmoneyService.getSumMoney(beginTime,endTime,ids,null,null,null,ShiroKit.getUser().getObjectId())); |
| | | list.add(map); |
| | | page.setRecords(list); |
| | | } |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | |
| | | @RequestMapping("/exportComplaintDeductmoney") |
| | | @ResponseBody |
| | | public Object exportComplaintDeductmoney(HttpServletResponse response, String insertTime, @RequestParam String ids){ |
| | | try { |
| | | Date date = new Date(); |
| | | DateFormat format = new SimpleDateFormat("yyyyMMdd"); |
| | | String time = format.format(date); |
| | | String fileName = "投诉扣款"+time+".xls"; |
| | | String[] title = new String[] {"司机名称","处罚时间","司机电话","投诉扣款"}; |
| | | |
| | | Wrapper wrapper = new EntityWrapper<TBalanceModifyRecord>(); |
| | | |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | List<Map<String,Object>> mapList = complaintDeductmoneyService.getListEx(beginTime,endTime,ids,null,null,null,ShiroKit.getUser().getObjectId()); |
| | | |
| | | 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("name").toString(); |
| | | values[i][1]=d.get("createTime").toString(); |
| | | values[i][2]=d.get("phone").toString(); |
| | | values[i][3]=d.get("money").toString(); |
| | | } |
| | | String fileNameTitle="投诉扣款"; |
| | | HSSFWorkbook wb = ExcelUtil.getHSSFWorkbookTime(fileNameTitle+time, title, values, null,insertTime); |
| | | 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; |
| | | } |
| | | |
| | | /** |
| | | * 投诉扣款 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/balanceModify") |
| | | public String balanceModifyIndex() { |
| | | return PREFIX + "balanceModify.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到提现列表首页 |
| | | */ |
| | | @RequestMapping("withdrawal") |
| | | public String withdrawal() { |
| | | return PREFIX + "tPubWithdrawal.html"; |
| | | } |
| | | /** |
| | | * 获取提现列表列表 |
| | | */ |
| | | @RequestMapping(value = "/withdrawalList") |
| | | @ResponseBody |
| | | public Object withdrawalList(String insertTime, |
| | | String ids) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | if (ShiroKit.getUser().getRoleType() != 1){ |
| | | page.setRecords(null); |
| | | }else{ |
| | | |
| | | List<Map<String,Object>> list = tPubWithdrawalService.getReportWithdrawalList(page,beginTime,endTime,ids); |
| | | Map<String,Object> map = tPubWithdrawalService.getSumMoney(beginTime,endTime,ids); |
| | | if(map!=null){ |
| | | map.put("id","合计"); |
| | | list.add(map); |
| | | } |
| | | page.setRecords(list); |
| | | } |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | |
| | | @RequestMapping("/exportWithdrawal") |
| | | @ResponseBody |
| | | public Object exportWithdrawal(HttpServletResponse response, String insertTime, @RequestParam String ids){ |
| | | try { |
| | | Date date = new Date(); |
| | | DateFormat format = new SimpleDateFormat("yyyyMMdd"); |
| | | String time = format.format(date); |
| | | String fileName = "司机提现"+time+".xls"; |
| | | String[] title = new String[] {"司机名称","提现时间","提现金额","提现扣除手续费"}; |
| | | |
| | | Wrapper wrapper = new EntityWrapper<TBalanceModifyRecord>(); |
| | | |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | List<Map<String,Object>> mapList = tPubWithdrawalService.getReportWithdrawalListEx(beginTime,endTime,ids); |
| | | |
| | | 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("userName").toString(); |
| | | values[i][1]=d.get("insertTime").toString(); |
| | | values[i][2]=d.get("money").toString(); |
| | | values[i][3]=(Double.parseDouble(d.get("money").toString())-Double.parseDouble(d.get("realGetMoney").toString()))+""; |
| | | } |
| | | String fileNameTitle="司机提现"; |
| | | HSSFWorkbook wb = ExcelUtil.getHSSFWorkbookTime(fileNameTitle+time, title, values, null,insertTime); |
| | | 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; |
| | | } |
| | | |
| | | /** |
| | | * 余额修改记录列表 |
| | | * @return |
| | | */ |
| | | @RequestMapping("/balanceModifylist") |
| | | @ResponseBody |
| | | public Object balanceModifylist(String userId, String startTime, String endTime) { |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | Wrapper wrapper = new EntityWrapper<TBalanceModifyRecord>(); |
| | | wrapper.eq("1",1); |
| | | if (ToolUtil.isNotEmpty(userId)){ |
| | | wrapper.last(" and find_in_set(userId,\""+ userId+"\")"); |
| | | } |
| | | if (ToolUtil.isNotEmpty(startTime) && ToolUtil.isNotEmpty(endTime)){ |
| | | wrapper.between("createTime",startTime + " 00:00:00",endTime + " 23:59:59"); |
| | | } |
| | | List<Map<String,Object>> list = balanceModifyRecordService.selectMapsPage(page,wrapper).getRecords(); |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("id","合计"); |
| | | map.put("money",balanceModifyRecordService.getSumMoney(userId,ToolUtil.isEmpty(startTime)?null:startTime + " 00:00:00",ToolUtil.isEmpty(startTime)?null:endTime + " 23:59:59")); |
| | | list.add(map); |
| | | page.setRecords(list); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 导出用户余额修改记录 |
| | | * @param response |
| | | * @param userId |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | @RequestMapping("/exportRecordBalanceModify") |
| | | @ResponseBody |
| | | public Object exportRecordBalanceModify(HttpServletResponse response, @RequestParam String userId, |
| | | @RequestParam String startTime, @RequestParam String endTime){ |
| | | try { |
| | | Date date = new Date(); |
| | | DateFormat format = new SimpleDateFormat("yyyyMMdd"); |
| | | String time = format.format(date); |
| | | String fileName = "余额修改记录"+time+".xls"; |
| | | String[] title = new String[] {"修改时间","流水ID","用户ID","用户名称","用户手机号","金额","类型"}; |
| | | |
| | | Wrapper wrapper = new EntityWrapper<TBalanceModifyRecord>(); |
| | | |
| | | wrapper.eq("1",1); |
| | | if (ToolUtil.isNotEmpty(userId)){ |
| | | wrapper.last(" and find_in_set(userId,\""+ userId+"\")"); |
| | | } |
| | | String searchTime=""; |
| | | if (ToolUtil.isNotEmpty(startTime) && ToolUtil.isNotEmpty(endTime)){ |
| | | searchTime=startTime+" - "+endTime; |
| | | wrapper.between("createTime",startTime + " 00:00:00",endTime + " 23:59:59"); |
| | | } |
| | | List<Map<String,Object>> mapList = balanceModifyRecordService.selectMaps(wrapper); |
| | | for (Map<String, Object> map : mapList) { |
| | | if (map.get("type").toString().equals("1")){ |
| | | map.put("typeStr","增加"); |
| | | }else if (map.get("type").toString().equals("2")){ |
| | | map.put("typeStr","减少"); |
| | | } |
| | | } |
| | | |
| | | 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("recordID").toString(); |
| | | values[i][2]=d.get("userId").toString(); |
| | | if (ToolUtil.isNotEmpty(d.get("userName"))){ |
| | | values[i][3]=d.get("userName").toString(); |
| | | }else { |
| | | values[i][3]=""; |
| | | } |
| | | if (ToolUtil.isNotEmpty(d.get("phone"))){ |
| | | values[i][4]=d.get("phone").toString(); |
| | | }else { |
| | | values[i][4]=""; |
| | | } |
| | | values[i][5]=d.get("money").toString(); |
| | | values[i][6]=d.get("typeStr").toString(); |
| | | } |
| | | String fileNameTitle="余额修改记录"; |
| | | HSSFWorkbook wb = ExcelUtil.getHSSFWorkbookTime(fileNameTitle+time, title, values, null,searchTime); |
| | | 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; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置文件响应头 |
| | | * @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(); |
| | | } |
| | | } |
| | | } |