|
|
@ -28,10 +28,7 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.*; |
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -141,7 +138,7 @@ public class TrainRecordServiceImpl extends ServiceImpl<TrainRecordMapper, Train |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void exportTrainRecordData(Long id, HttpServletResponse response) { |
|
|
|
public void exportTrainRecordData(Long id, HttpServletResponse response) { |
|
|
|
TrainRecordDetailVO trainRecordDetailVO = this.getTrainRecordDetailById(id); |
|
|
|
TrainRecordDetailVO trainRecordDetailVO = this.baseMapper.getTrainRecordDetailById(id); |
|
|
|
// 数据处理
|
|
|
|
// 数据处理
|
|
|
|
// 培训方式
|
|
|
|
// 培训方式
|
|
|
|
String trainMethod = trainRecordDetailVO.getTrainMethod(); |
|
|
|
String trainMethod = trainRecordDetailVO.getTrainMethod(); |
|
|
@ -153,19 +150,14 @@ public class TrainRecordServiceImpl extends ServiceImpl<TrainRecordMapper, Train |
|
|
|
trainRecordDetailVO.setTrainMethod(TrainMethodEnum.OFFLINE.getDesc()); |
|
|
|
trainRecordDetailVO.setTrainMethod(TrainMethodEnum.OFFLINE.getDesc()); |
|
|
|
} |
|
|
|
} |
|
|
|
// 图片
|
|
|
|
// 图片
|
|
|
|
List<ImageEntity> list = new ArrayList<>(); |
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(trainRecordDetailVO.getImgPath())) { |
|
|
|
if (StringUtils.isNotEmpty(trainRecordDetailVO.getImgPath())) { |
|
|
|
String[] imgArr = trainRecordDetailVO.getImgPath().split(","); |
|
|
|
trainRecordDetailVO.setImages(Arrays.stream(trainRecordDetailVO.getImgPath().split(",")).map(img-> |
|
|
|
for (String img : imgArr) { |
|
|
|
new ImageEntity(BaseUtil.imgToByte(savePath + BaseUtil.downloadFileByUrl(img, savePath)), 180, 150) |
|
|
|
ImageEntity imageEntity = new ImageEntity(BaseUtil.imgToByte(savePath + |
|
|
|
).collect(Collectors.toList())); |
|
|
|
BaseUtil.downloadFileByUrl(img, savePath)), 180, 150); |
|
|
|
|
|
|
|
list.add(imageEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// 添加空的ImageEntity,防止数据填入时显示"{{"
|
|
|
|
// 添加空的ImageEntity,防止数据填入时显示"{{"
|
|
|
|
list.add(new ImageEntity()); |
|
|
|
trainRecordDetailVO.setImages(Collections.singletonList(new ImageEntity())); |
|
|
|
} |
|
|
|
} |
|
|
|
trainRecordDetailVO.setImages(list); |
|
|
|
|
|
|
|
// 表头年月
|
|
|
|
// 表头年月
|
|
|
|
String code = trainRecordDetailVO.getCode(); |
|
|
|
String code = trainRecordDetailVO.getCode(); |
|
|
|
trainRecordDetailVO.setYear(code.substring(4, 8)); |
|
|
|
trainRecordDetailVO.setYear(code.substring(4, 8)); |
|
|
|