Commit e67f9ef9 authored by KeYong's avatar KeYong

更新

parent 7852ec98
......@@ -117,9 +117,9 @@ public class DutyCarController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping("/exportExcel")
@ApiOperation(httpMethod = "GET", value = "车辆执勤导出", notes = "车辆执勤导出")
public void exportExcel(HttpServletResponse response, @ApiParam(value = "开始日期", required = true) @RequestParam String beginDate,
public ResponseModel exportExcel(HttpServletResponse response, @ApiParam(value = "开始日期", required = true) @RequestParam String beginDate,
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate) throws ParseException {
iDutyCarService.downloadList(beginDate, endDate, response);
return ResponseHelper.buildResponse(iDutyCarService.downloadList(beginDate, endDate, response));
}
/**
......
package com.yeejoin.amos.boot.module.common.biz.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.common.api.dto.DutyCarDto;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
......@@ -47,7 +48,7 @@ public interface IDutyCommonService {
*/
String getGroupCode();
void downloadList(String beginDate, String endDate, HttpServletResponse response) throws ParseException;
List<DutyCarDto> downloadList(String beginDate, String endDate, HttpServletResponse response) throws ParseException;
/**
* 值班数据入库
......
package com.yeejoin.amos.boot.module.common.biz.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.api.dto.DutyCarDto;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonShiftDto;
import com.yeejoin.amos.boot.module.common.api.entity.DutyPersonShift;
import com.yeejoin.amos.boot.module.common.api.entity.DutyShift;
......@@ -88,7 +90,7 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
.le(endDate != null, DutyPersonShift::getDutyDate, endDate)).stream().map(e -> {
DutyPersonShiftDto dto = new DutyPersonShiftDto();
Bean.copyExistPropertis(e, dto);
dto.setShiftName(keyNameMap.get(e.getSequenceNbr()));
dto.setShiftName(keyNameMap.get(e.getShiftId()));
return dto;
}).collect(Collectors.toList());
m.put("dutyShift", personShiftList);
......@@ -175,30 +177,28 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
}
@Override
public void downloadList(String beginDate, String endDate, HttpServletResponse response) throws ParseException {
public List<DutyCarDto> downloadList(String beginDate, String endDate, HttpServletResponse response) throws ParseException {
List<Map<String, Object>> maps = this.list(beginDate, endDate);
String groupCode = this.getGroupCode();
SimpleDateFormat sdf = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN);
Date d = sdf.parse(beginDate);
Calendar calendar = Calendar.getInstance();
calendar.setTime(d);
List<String> dayByMonth = DateUtils.getDayByMonth(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH));
List<Map<String, Object>> contentList = new ArrayList<>();
String fileName;
if (0 < maps.size()) {
for (Map<String, Object> map : maps) {
}
}
if ("dutyCar".equals(groupCode)) {
fileName = "车辆执勤值班表";
} else {
fileName = "消防人员值班表";
}
// Workbook workbook = initExcel(appKey, orgCode, getTitleMap(year, mouth), contentList);
// ExcelUtils.exportExcel(workbook, fileName, response);
JSONArray jsonArray = new JSONArray();
jsonArray.addAll(maps);
List<DutyCarDto> list = jsonArray.toJavaList(DutyCarDto.class);
return list;
// String groupCode = this.getGroupCode();
// String fileName;
// List<Map<String, Object>> contentList = new ArrayList<>();
// if (0 < maps.size()) {
// for (Map<String, Object> map : maps) {
//
// }
// }
// if ("dutyCar".equals(groupCode)) {
// fileName = "车辆执勤值班表";
//
// } else {
// fileName = "消防人员值班表";
//
// }
// return null;
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment