|
|
@ -8,6 +8,8 @@ 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.platform.domain.Attachment; |
|
|
|
import org.dromara.platform.domain.AttachmentSerializer; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.dromara.platform.domain.bo.DailyInspectionReportBo; |
|
|
|
import org.dromara.platform.domain.vo.DailyInspectionReportVo; |
|
|
@ -39,7 +41,20 @@ public class DailyInspectionReportServiceImpl implements IDailyInspectionReportS |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public DailyInspectionReportVo queryById(Long id){ |
|
|
|
return baseMapper.selectVoById(id); |
|
|
|
DailyInspectionReportVo dailyInspectionReportVo = baseMapper.selectVoById(id); |
|
|
|
String attachment = dailyInspectionReportVo.getAttachment(); |
|
|
|
if (StringUtils.isNotBlank(attachment)) { |
|
|
|
AttachmentSerializer serializer = new AttachmentSerializer(); |
|
|
|
List<Attachment> attachments = serializer.deserializeAttachments(attachment); |
|
|
|
dailyInspectionReportVo.setAttachments(attachments); |
|
|
|
} |
|
|
|
String inspectionPhoto = dailyInspectionReportVo.getInspectionPhoto(); |
|
|
|
if (StringUtils.isNotBlank(inspectionPhoto)) { |
|
|
|
AttachmentSerializer serializer = new AttachmentSerializer(); |
|
|
|
List<Attachment> inspectionPhotos = serializer.deserializeAttachments(inspectionPhoto); |
|
|
|
dailyInspectionReportVo.setAttachments(inspectionPhotos); |
|
|
|
} |
|
|
|
return dailyInspectionReportVo; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -98,6 +113,17 @@ public class DailyInspectionReportServiceImpl implements IDailyInspectionReportS |
|
|
|
add.setInspectionUnit("测试巡检单位"); |
|
|
|
add.setType("前端(默认)"); |
|
|
|
validEntityBeforeSave(add); |
|
|
|
List<Attachment> attachments = bo.getAttachments(); |
|
|
|
AttachmentSerializer serializer1 = new AttachmentSerializer(); |
|
|
|
String serializedAttachment = serializer1.serializeAttachments(attachments); |
|
|
|
add.setAttachment(serializedAttachment); |
|
|
|
|
|
|
|
List<Attachment> inspectionPhotos = bo.getInspectionPhotos(); |
|
|
|
AttachmentSerializer serializer2 = new AttachmentSerializer(); |
|
|
|
String serializedInspectionPhoto = serializer2.serializeAttachments(inspectionPhotos); |
|
|
|
add.setInspectionPhoto(serializedInspectionPhoto); |
|
|
|
|
|
|
|
|
|
|
|
boolean flag = baseMapper.insert(add) > 0; |
|
|
|
if (flag) { |
|
|
|
bo.setId(add.getId()); |
|
|
@ -114,7 +140,17 @@ public class DailyInspectionReportServiceImpl implements IDailyInspectionReportS |
|
|
|
@Override |
|
|
|
public Boolean updateByBo(DailyInspectionReportBo bo) { |
|
|
|
DailyInspectionReport update = MapstructUtils.convert(bo, DailyInspectionReport.class); |
|
|
|
validEntityBeforeSave(update); |
|
|
|
//validEntityBeforeSave(update);
|
|
|
|
List<Attachment> attachments = bo.getAttachments(); |
|
|
|
AttachmentSerializer serializer1 = new AttachmentSerializer(); |
|
|
|
String serializedAttachment = serializer1.serializeAttachments(attachments); |
|
|
|
update.setAttachment(serializedAttachment); |
|
|
|
|
|
|
|
List<Attachment> inspectionPhotos = bo.getInspectionPhotos(); |
|
|
|
AttachmentSerializer serializer2 = new AttachmentSerializer(); |
|
|
|
String serializedInspectionPhoto = serializer2.serializeAttachments(inspectionPhotos); |
|
|
|
update.setInspectionPhoto(serializedInspectionPhoto); |
|
|
|
|
|
|
|
return baseMapper.updateById(update) > 0; |
|
|
|
} |
|
|
|
|
|
|
|