|
|
@ -1,5 +1,7 @@ |
|
|
|
package org.dromara.platform.service.impl; |
|
|
|
|
|
|
|
import jakarta.annotation.Resource; |
|
|
|
import org.dromara.common.core.domain.model.LoginUser; |
|
|
|
import org.dromara.common.core.utils.MapstructUtils; |
|
|
|
import org.dromara.common.core.utils.StringUtils; |
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
|
@ -8,8 +10,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import org.dromara.common.satoken.utils.LoginHelper; |
|
|
|
import org.dromara.platform.domain.Attachment; |
|
|
|
import org.dromara.platform.domain.AttachmentSerializer; |
|
|
|
import org.dromara.platform.service.IProjectInfoService; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.dromara.platform.domain.bo.DailyInspectionReportBo; |
|
|
|
import org.dromara.platform.domain.vo.DailyInspectionReportVo; |
|
|
@ -17,9 +21,11 @@ import org.dromara.platform.domain.DailyInspectionReport; |
|
|
|
import org.dromara.platform.mapper.DailyInspectionReportMapper; |
|
|
|
import org.dromara.platform.service.IDailyInspectionReportService; |
|
|
|
|
|
|
|
import java.util.Comparator; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Collection; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* 巡检日报Service业务层处理 |
|
|
@ -33,6 +39,9 @@ public class DailyInspectionReportServiceImpl implements IDailyInspectionReportS |
|
|
|
|
|
|
|
private final DailyInspectionReportMapper baseMapper; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private IProjectInfoService projectInfoService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询巡检日报 |
|
|
|
* |
|
|
@ -52,7 +61,7 @@ public class DailyInspectionReportServiceImpl implements IDailyInspectionReportS |
|
|
|
if (StringUtils.isNotBlank(inspectionPhoto)) { |
|
|
|
AttachmentSerializer serializer = new AttachmentSerializer(); |
|
|
|
List<Attachment> inspectionPhotos = serializer.deserializeAttachments(inspectionPhoto); |
|
|
|
dailyInspectionReportVo.setAttachments(inspectionPhotos); |
|
|
|
dailyInspectionReportVo.setInspectionPhotos(inspectionPhotos); |
|
|
|
} |
|
|
|
return dailyInspectionReportVo; |
|
|
|
} |
|
|
@ -68,6 +77,12 @@ public class DailyInspectionReportServiceImpl implements IDailyInspectionReportS |
|
|
|
public TableDataInfo<DailyInspectionReportVo> queryPageList(DailyInspectionReportBo bo, PageQuery pageQuery) { |
|
|
|
LambdaQueryWrapper<DailyInspectionReport> lqw = buildQueryWrapper(bo); |
|
|
|
Page<DailyInspectionReportVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
|
|
|
List<DailyInspectionReportVo> records = result.getRecords(); |
|
|
|
List<DailyInspectionReportVo> sortedRecords = records.stream() |
|
|
|
.sorted(Comparator.comparing(DailyInspectionReportVo::getCreateTime).reversed()) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
result.setRecords(sortedRecords); |
|
|
|
|
|
|
|
return TableDataInfo.build(result); |
|
|
|
} |
|
|
|
|
|
|
@ -110,9 +125,17 @@ public class DailyInspectionReportServiceImpl implements IDailyInspectionReportS |
|
|
|
@Override |
|
|
|
public Boolean insertByBo(DailyInspectionReportBo bo) { |
|
|
|
DailyInspectionReport add = MapstructUtils.convert(bo, DailyInspectionReport.class); |
|
|
|
add.setInspectionUnit("测试巡检单位"); |
|
|
|
String projectName = bo.getProjectName(); |
|
|
|
String inspectionUnit = projectInfoService.getContractPartyANameByProjectName(projectName); |
|
|
|
add.setInspectionUnit(inspectionUnit); |
|
|
|
add.setType("前端(默认)"); |
|
|
|
validEntityBeforeSave(add); |
|
|
|
LoginUser loginUser = LoginHelper.getLoginUser(); |
|
|
|
String nickname = loginUser.getNickname(); |
|
|
|
add.setInspectionPeople(nickname); |
|
|
|
String deptName = loginUser.getDeptName(); |
|
|
|
add.setIoCompany(deptName); |
|
|
|
|
|
|
|
List<Attachment> attachments = bo.getAttachments(); |
|
|
|
AttachmentSerializer serializer1 = new AttachmentSerializer(); |
|
|
|
String serializedAttachment = serializer1.serializeAttachments(attachments); |
|
|
|