|
|
@ -19,10 +19,13 @@ import com.hnac.hzims.safeproduct.mapper.RehearsalRecordMapper; |
|
|
|
import com.hnac.hzims.safeproduct.service.IRehearsalRecordService; |
|
|
|
import com.hnac.hzims.safeproduct.service.IRehearsalRecordService; |
|
|
|
import com.hnac.hzims.safeproduct.utils.BaseUtil; |
|
|
|
import com.hnac.hzims.safeproduct.utils.BaseUtil; |
|
|
|
import com.hnac.hzims.safeproduct.utils.TimeUtils; |
|
|
|
import com.hnac.hzims.safeproduct.utils.TimeUtils; |
|
|
|
|
|
|
|
import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailImgVO; |
|
|
|
|
|
|
|
import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailStrVO; |
|
|
|
import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO; |
|
|
|
import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO; |
|
|
|
import com.hnac.hzims.safeproduct.vo.RehearsalRecordlVO; |
|
|
|
import com.hnac.hzims.safeproduct.vo.RehearsalRecordlVO; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springblade.core.mp.support.Query; |
|
|
|
import org.springblade.core.mp.support.Query; |
|
|
|
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -150,23 +153,6 @@ public class RehearsalRecordServiceImpl extends ServiceImpl<RehearsalRecordMappe |
|
|
|
if (StringUtils.isNotEmpty(rehearsalRecordDetailVO.getActualEndTime())){ |
|
|
|
if (StringUtils.isNotEmpty(rehearsalRecordDetailVO.getActualEndTime())){ |
|
|
|
rehearsalRecordDetailVO.setActualEndTime(TimeUtils.format(rehearsalRecordDetailVO.getActualEndTime())); |
|
|
|
rehearsalRecordDetailVO.setActualEndTime(TimeUtils.format(rehearsalRecordDetailVO.getActualEndTime())); |
|
|
|
} |
|
|
|
} |
|
|
|
// 图片
|
|
|
|
|
|
|
|
List<ImageEntity> list = new ArrayList<>(); |
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(rehearsalRecordDetailVO.getImgPath())) { |
|
|
|
|
|
|
|
String[] imgArr = rehearsalRecordDetailVO.getImgPath().split(","); |
|
|
|
|
|
|
|
for (String img : imgArr) { |
|
|
|
|
|
|
|
ImageEntity imageEntity = new ImageEntity(BaseUtil.imgToByte(savePath + |
|
|
|
|
|
|
|
BaseUtil.downloadFileByUrl(img, savePath)), 180, 150); |
|
|
|
|
|
|
|
list.add(imageEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 添加空的ImageEntity,防止数据填入时显示"{{"
|
|
|
|
|
|
|
|
ImageEntity imageEntity = new ImageEntity(); |
|
|
|
|
|
|
|
// 设置空字符串,防止空指针报错
|
|
|
|
|
|
|
|
imageEntity.setUrl(""); |
|
|
|
|
|
|
|
list.add(imageEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
rehearsalRecordDetailVO.setImages(list); |
|
|
|
|
|
|
|
// 记录:换行符使用\r\n
|
|
|
|
// 记录:换行符使用\r\n
|
|
|
|
String standardRecord = rehearsalRecordDetailVO.getRecord().replaceAll("\n", "\r\n"); |
|
|
|
String standardRecord = rehearsalRecordDetailVO.getRecord().replaceAll("\n", "\r\n"); |
|
|
|
rehearsalRecordDetailVO.setRecord(standardRecord); |
|
|
|
rehearsalRecordDetailVO.setRecord(standardRecord); |
|
|
@ -186,7 +172,28 @@ public class RehearsalRecordServiceImpl extends ServiceImpl<RehearsalRecordMappe |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
rehearsalRecordDetailVO.setRehearsalMethod(RehearsalMethodEnum.OFFLINE.getDesc()); |
|
|
|
rehearsalRecordDetailVO.setRehearsalMethod(RehearsalMethodEnum.OFFLINE.getDesc()); |
|
|
|
} |
|
|
|
} |
|
|
|
Map<String, Object> params = BaseUtil.obj2Map(rehearsalRecordDetailVO); |
|
|
|
// 图片
|
|
|
|
|
|
|
|
Map<String, Object> params; |
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(rehearsalRecordDetailVO.getImgPath())) { |
|
|
|
|
|
|
|
List<ImageEntity> list = new ArrayList<>(); |
|
|
|
|
|
|
|
RehearsalRecordDetailImgVO imgVO = new RehearsalRecordDetailImgVO(); |
|
|
|
|
|
|
|
BeanUtils.copyProperties(rehearsalRecordDetailVO, imgVO); |
|
|
|
|
|
|
|
String[] imgArr = rehearsalRecordDetailVO.getImgPath().split(","); |
|
|
|
|
|
|
|
for (String img : imgArr) { |
|
|
|
|
|
|
|
ImageEntity imageEntity = new ImageEntity(BaseUtil.imgToByte(savePath + |
|
|
|
|
|
|
|
BaseUtil.downloadFileByUrl(img, savePath)), 180, 150); |
|
|
|
|
|
|
|
list.add(imageEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
imgVO.setImages(list); |
|
|
|
|
|
|
|
params = BaseUtil.obj2Map(imgVO); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
List<String> list = new ArrayList<>(); |
|
|
|
|
|
|
|
list.add(""); |
|
|
|
|
|
|
|
RehearsalRecordDetailStrVO strVO = new RehearsalRecordDetailStrVO(); |
|
|
|
|
|
|
|
BeanUtils.copyProperties(rehearsalRecordDetailVO, strVO); |
|
|
|
|
|
|
|
strVO.setImages(list); |
|
|
|
|
|
|
|
params = BaseUtil.obj2Map(strVO); |
|
|
|
|
|
|
|
} |
|
|
|
String templateFile = "template/演练记录表" + SafeProductConstant.DOCX_SUFFIX; |
|
|
|
String templateFile = "template/演练记录表" + SafeProductConstant.DOCX_SUFFIX; |
|
|
|
String wordPath = savePath + "/演练记录表" + SafeProductConstant.DOCX_SUFFIX; |
|
|
|
String wordPath = savePath + "/演练记录表" + SafeProductConstant.DOCX_SUFFIX; |
|
|
|
String pdfPath = savePath + "/演练记录表" + SafeProductConstant.PDF_SUFFIX; |
|
|
|
String pdfPath = savePath + "/演练记录表" + SafeProductConstant.PDF_SUFFIX; |
|
|
|