Browse Source

update: 卫生考核表导出功能

zhongwei
liwen 3 months ago
parent
commit
b61c438e72
  1. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java
  2. 8
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java

3
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java

@ -20,7 +20,6 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -41,7 +40,7 @@ import java.util.Map;
@RequestMapping("/hygiene") @RequestMapping("/hygiene")
@Business(module = Constants.APP_NAME, value = "卫生自查") @Business(module = Constants.APP_NAME, value = "卫生自查")
@Api(value = "卫生自查", tags = "卫生自查接口") @Api(value = "卫生自查", tags = "卫生自查接口")
public class HygieneController extends BladeController { public class HygieneController {
private final IHygienePlanService hygienePlanService; private final IHygienePlanService hygienePlanService;

8
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java

@ -235,6 +235,9 @@ public class HygieneRecordServiceImpl extends ServiceImpl<HygieneRecordMapper, H
// 周结束日 // 周结束日
LocalDate lastWeekDay = firstWeekDay.with(TemporalAdjusters.next(DayOfWeek.SATURDAY)); LocalDate lastWeekDay = firstWeekDay.with(TemporalAdjusters.next(DayOfWeek.SATURDAY));
Date weekEnd = DateUtil.toDate(lastWeekDay); Date weekEnd = DateUtil.toDate(lastWeekDay);
if (lastDate.before(weekEnd)) {
weekEnd = lastDate;
}
// 存储周数据 // 存储周数据
HygieneWeekVO weekVO = new HygieneWeekVO(); HygieneWeekVO weekVO = new HygieneWeekVO();
weekVO.setWeekNum(weekNum++); weekVO.setWeekNum(weekNum++);
@ -394,13 +397,14 @@ public class HygieneRecordServiceImpl extends ServiceImpl<HygieneRecordMapper, H
exportVO.setEvaluationList(evaluationExportList); exportVO.setEvaluationList(evaluationExportList);
Map<String, Object> params = BaseUtil.obj2Map(exportVO); Map<String, Object> params = BaseUtil.obj2Map(exportVO);
String templateFile; String templateFile;
// 根据周数匹配不同模板文件
if (weekList.size() == 4) { if (weekList.size() == 4) {
templateFile = "template/卫生考核表(四周)" + SafeProductConstant.DOCX_SUFFIX; templateFile = "template/卫生考核表(四周)" + SafeProductConstant.DOCX_SUFFIX;
} else { } else {
templateFile = "template/卫生考核表(五周)" + SafeProductConstant.DOCX_SUFFIX; templateFile = "template/卫生考核表(五周)" + SafeProductConstant.DOCX_SUFFIX;
} }
String wordPath = "D:/" + "/卫生考核表" + SafeProductConstant.DOCX_SUFFIX; String wordPath = savePath + "/卫生考核表" + SafeProductConstant.DOCX_SUFFIX;
String pdfPath = "D:/" + "/卫生考核表" + SafeProductConstant.PDF_SUFFIX; String pdfPath = savePath + "/卫生考核表" + SafeProductConstant.PDF_SUFFIX;
BaseUtil.exportDocument(templateFile, params, wordPath, pdfPath, "",response); BaseUtil.exportDocument(templateFile, params, wordPath, pdfPath, "",response);
} }

Loading…
Cancel
Save