11-19-模板初版(完成版)
This commit is contained in:
@ -19,12 +19,15 @@ import org.dromara.common.core.utils.ObjectUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.mechanical.domain.BusMechanicalrewriting;
|
||||
import org.dromara.mechanical.service.impl.BusMechanicalrewritingServiceImpl;
|
||||
import org.dromara.out.service.impl.OutConstructionValueRangeServiceImpl;
|
||||
import org.dromara.progress.domain.enums.PgsProgressCategoryTypeEnum;
|
||||
import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryDatePlanVo;
|
||||
import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryDateTotalVo;
|
||||
import org.dromara.progress.service.IPgsProgressCategoryService;
|
||||
import org.dromara.project.domain.vo.project.BusProjectVo;
|
||||
import org.dromara.project.service.IBusAttendanceService;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.safety.domain.HseSafetyWeeklyReport;
|
||||
import org.dromara.safety.domain.dto.safetyweeklyreport.HseSafetyWeeklyReportCreateReq;
|
||||
@ -51,7 +54,9 @@ import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Scanner;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 安全周报Service业务层处理
|
||||
@ -78,6 +83,12 @@ public class HseSafetyWeeklyReportServiceImpl extends ServiceImpl<HseSafetyWeekl
|
||||
@Autowired
|
||||
private OutConstructionValueRangeServiceImpl outConstructionValueRangeService;
|
||||
|
||||
@Autowired
|
||||
private BusMechanicalrewritingServiceImpl busMechanicalrewritingService;
|
||||
|
||||
@Autowired
|
||||
private IBusAttendanceService busAttendanceService;
|
||||
|
||||
/**
|
||||
* 查询安全周报
|
||||
*
|
||||
@ -135,7 +146,7 @@ public class HseSafetyWeeklyReportServiceImpl extends ServiceImpl<HseSafetyWeekl
|
||||
validEntityBeforeSave(safetyWeeklyReport, true);
|
||||
|
||||
//处理周期
|
||||
Integer weekOfYear = outConstructionValueRangeService.getCurrentWeekOfYear(LocalDate.now().toString());
|
||||
Integer weekOfYear = outConstructionValueRangeService.getCurrentWeekOfYear(String.valueOf(req.getScope()));
|
||||
safetyWeeklyReport.setWeek(weekOfYear.toString());
|
||||
|
||||
//处理Excel
|
||||
@ -182,6 +193,17 @@ public class HseSafetyWeeklyReportServiceImpl extends ServiceImpl<HseSafetyWeekl
|
||||
*/
|
||||
private void validEntityBeforeSave(HseSafetyWeeklyReport entity, Boolean create) {
|
||||
// TODO 做一些数据校验,如唯一约束
|
||||
|
||||
//判断是否已生成过周报
|
||||
LambdaQueryWrapper<HseSafetyWeeklyReport> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(HseSafetyWeeklyReport::getProjectId, entity.getProjectId());
|
||||
lambdaQueryWrapper.eq(HseSafetyWeeklyReport::getScope, entity.getScope());
|
||||
lambdaQueryWrapper.eq(HseSafetyWeeklyReport::getScopeEnd, entity.getScopeEnd());
|
||||
List<HseSafetyWeeklyReport> list = this.list(lambdaQueryWrapper);
|
||||
if (list != null && !list.isEmpty()){
|
||||
throw new ServiceException("已生成过周报", HttpStatus.WARN);
|
||||
}
|
||||
|
||||
Long projectId = entity.getProjectId();
|
||||
if (create) {
|
||||
if (projectId == null) {
|
||||
@ -484,7 +506,7 @@ public class HseSafetyWeeklyReportServiceImpl extends ServiceImpl<HseSafetyWeekl
|
||||
createQualityStatusModule(sheet, workbook, 8, headerStyle, contentStyle);
|
||||
|
||||
// 9. 人员设备模块(第10行)- 合并F-L列
|
||||
createPersonnelEquipmentModule(sheet, workbook, 9, headerStyle, contentStyle);
|
||||
createPersonnelEquipmentModule(sheet, workbook, 9, headerStyle, contentStyle,report);
|
||||
|
||||
// 10. 施工进度统计表(第11-18行)- 修正为7行数据
|
||||
createConstructionProgressTable(sheet, workbook, 10, headerStyle, contentStyle, tableHeaderStyle);
|
||||
@ -823,7 +845,8 @@ public class HseSafetyWeeklyReportServiceImpl extends ServiceImpl<HseSafetyWeekl
|
||||
* 人员设备模块(第10行)- 恢复原来的合并范围
|
||||
*/
|
||||
private void createPersonnelEquipmentModule(Sheet sheet, Workbook workbook, int startRow,
|
||||
CellStyle headerStyle, CellStyle contentStyle) {
|
||||
CellStyle headerStyle, CellStyle contentStyle,
|
||||
HseSafetyWeeklyReport report) {
|
||||
Row personnelRow = sheet.createRow(startRow);
|
||||
personnelRow.setHeightInPoints(25);
|
||||
|
||||
@ -837,10 +860,29 @@ public class HseSafetyWeeklyReportServiceImpl extends ServiceImpl<HseSafetyWeekl
|
||||
|
||||
Cell contentCell = personnelRow.createCell(2);
|
||||
|
||||
//统计考勤
|
||||
//语句
|
||||
StringBuffer sb = new StringBuffer();
|
||||
//打卡人数统计
|
||||
sb.append("本周施工人员: ");
|
||||
Long count = busAttendanceService.getAttendanceUserCountByDate(report.getProjectId(), report.getScope(), report.getScopeEnd());
|
||||
if (count != null && count > 0){
|
||||
sb.append( count).append("人。");
|
||||
}
|
||||
//机械统计
|
||||
LambdaQueryWrapper<BusMechanicalrewriting> query = new LambdaQueryWrapper<>();
|
||||
query.eq(BusMechanicalrewriting::getProjectId, report.getProjectId());
|
||||
query.between(BusMechanicalrewriting::getEntryTime, report.getScope(), report.getScopeEnd());
|
||||
List<BusMechanicalrewriting> mechanicalrewritingList = busMechanicalrewritingService.list(query);
|
||||
//统计并分类
|
||||
Map<String, Long> deviceCountMap = mechanicalrewritingList.stream()
|
||||
.collect(Collectors.groupingBy(BusMechanicalrewriting::getDevicename, Collectors.counting()));
|
||||
sb.append("\n共投入机械: ");
|
||||
for (String key : deviceCountMap.keySet()) {
|
||||
sb.append(key).append(deviceCountMap.get(key)).append("/n");
|
||||
}
|
||||
|
||||
|
||||
contentCell.setCellValue("本周施工人员633人,共投入光伏钻机21台,小蜜蜂钻机6台,履带式潜孔钻机4台,柴油发动空压机6台,无人机18台,汽油发动振捣棒20台,小型电动工具一批。");
|
||||
// contentCell.setCellValue("本周施工人员633人,共投入光伏钻机21台,小蜜蜂钻机6台,履带式潜孔钻机4台,柴油发动空压机6台,无人机18台,汽油发动振捣棒20台,小型电动工具一批。");
|
||||
contentCell.setCellValue(sb.toString());
|
||||
contentCell.setCellStyle(contentStyle);
|
||||
|
||||
// 恢复原来的合并范围:C-L列
|
||||
|
||||
Reference in New Issue
Block a user