Commit e67f9ef9 authored by KeYong's avatar KeYong

更新

parent 7852ec98
...@@ -117,9 +117,9 @@ public class DutyCarController extends BaseController { ...@@ -117,9 +117,9 @@ public class DutyCarController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping("/exportExcel") @GetMapping("/exportExcel")
@ApiOperation(httpMethod = "GET", value = "车辆执勤导出", notes = "车辆执勤导出") @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 { @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; package com.yeejoin.amos.boot.module.common.biz.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.common.api.dto.DutyCarDto;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.text.ParseException; import java.text.ParseException;
...@@ -47,7 +48,7 @@ public interface IDutyCommonService { ...@@ -47,7 +48,7 @@ public interface IDutyCommonService {
*/ */
String getGroupCode(); 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; 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.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Sequence; import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; 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.dto.DutyPersonShiftDto;
import com.yeejoin.amos.boot.module.common.api.entity.DutyPersonShift; import com.yeejoin.amos.boot.module.common.api.entity.DutyPersonShift;
import com.yeejoin.amos.boot.module.common.api.entity.DutyShift; import com.yeejoin.amos.boot.module.common.api.entity.DutyShift;
...@@ -88,7 +90,7 @@ public class DutyCommonServiceImpl implements IDutyCommonService { ...@@ -88,7 +90,7 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
.le(endDate != null, DutyPersonShift::getDutyDate, endDate)).stream().map(e -> { .le(endDate != null, DutyPersonShift::getDutyDate, endDate)).stream().map(e -> {
DutyPersonShiftDto dto = new DutyPersonShiftDto(); DutyPersonShiftDto dto = new DutyPersonShiftDto();
Bean.copyExistPropertis(e, dto); Bean.copyExistPropertis(e, dto);
dto.setShiftName(keyNameMap.get(e.getSequenceNbr())); dto.setShiftName(keyNameMap.get(e.getShiftId()));
return dto; return dto;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
m.put("dutyShift", personShiftList); m.put("dutyShift", personShiftList);
...@@ -175,30 +177,28 @@ public class DutyCommonServiceImpl implements IDutyCommonService { ...@@ -175,30 +177,28 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
} }
@Override @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); List<Map<String, Object>> maps = this.list(beginDate, endDate);
String groupCode = this.getGroupCode(); JSONArray jsonArray = new JSONArray();
SimpleDateFormat sdf = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN); jsonArray.addAll(maps);
Date d = sdf.parse(beginDate); List<DutyCarDto> list = jsonArray.toJavaList(DutyCarDto.class);
Calendar calendar = Calendar.getInstance(); return list;
calendar.setTime(d); // String groupCode = this.getGroupCode();
List<String> dayByMonth = DateUtils.getDayByMonth(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH)); // String fileName;
List<Map<String, Object>> contentList = new ArrayList<>(); // List<Map<String, Object>> contentList = new ArrayList<>();
String fileName; // if (0 < maps.size()) {
if (0 < maps.size()) { // for (Map<String, Object> map : maps) {
for (Map<String, Object> map : maps) { //
// }
} // }
} // if ("dutyCar".equals(groupCode)) {
if ("dutyCar".equals(groupCode)) { // fileName = "车辆执勤值班表";
fileName = "车辆执勤值班表"; //
// } else {
} else { // fileName = "消防人员值班表";
fileName = "消防人员值班表"; //
// }
} // return null;
// Workbook workbook = initExcel(appKey, orgCode, getTitleMap(year, mouth), contentList);
// ExcelUtils.exportExcel(workbook, fileName, response);
} }
@Override @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