|
|
@ -17,11 +17,14 @@ import com.hnac.hzims.safeproduct.mapper.CarMaintenanceMapper; |
|
|
|
import com.hnac.hzims.safeproduct.mapper.CarMapper; |
|
|
|
import com.hnac.hzims.safeproduct.mapper.CarMapper; |
|
|
|
import com.hnac.hzims.safeproduct.service.ICarMaintenanceService; |
|
|
|
import com.hnac.hzims.safeproduct.service.ICarMaintenanceService; |
|
|
|
import com.hnac.hzims.safeproduct.utils.BaseUtil; |
|
|
|
import com.hnac.hzims.safeproduct.utils.BaseUtil; |
|
|
|
|
|
|
|
import com.hnac.hzims.safeproduct.vo.CarMaintenanceDetailImgVO; |
|
|
|
|
|
|
|
import com.hnac.hzims.safeproduct.vo.CarMaintenanceDetailStrVO; |
|
|
|
import com.hnac.hzims.safeproduct.vo.CarMaintenanceDetailVO; |
|
|
|
import com.hnac.hzims.safeproduct.vo.CarMaintenanceDetailVO; |
|
|
|
import com.hnac.hzims.safeproduct.vo.CarMaintenancePageVO; |
|
|
|
import com.hnac.hzims.safeproduct.vo.CarMaintenancePageVO; |
|
|
|
import org.springblade.core.mp.support.Query; |
|
|
|
import org.springblade.core.mp.support.Query; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
|
|
|
|
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; |
|
|
@ -123,20 +126,6 @@ public class CarMaintenanceServiceImpl extends ServiceImpl<CarMaintenanceMapper, |
|
|
|
public void exportCarMaintenanceData(Long id, HttpServletResponse response) { |
|
|
|
public void exportCarMaintenanceData(Long id, HttpServletResponse response) { |
|
|
|
CarMaintenanceDetailVO carMaintenanceDetailVO = this.getCarMaintenance(id); |
|
|
|
CarMaintenanceDetailVO carMaintenanceDetailVO = this.getCarMaintenance(id); |
|
|
|
// 数据处理
|
|
|
|
// 数据处理
|
|
|
|
// 图片
|
|
|
|
|
|
|
|
List<ImageEntity> list = new ArrayList<>(); |
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(carMaintenanceDetailVO.getImgPath())) { |
|
|
|
|
|
|
|
String[] imgArr = carMaintenanceDetailVO.getImgPath().split(","); |
|
|
|
|
|
|
|
for (String img : imgArr) { |
|
|
|
|
|
|
|
ImageEntity imageEntity = new ImageEntity(BaseUtil.imgToByte(savePath + |
|
|
|
|
|
|
|
BaseUtil.downloadFileByUrl(img, savePath)), 180, 150); |
|
|
|
|
|
|
|
list.add(imageEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 添加空的ImageEntity,防止数据填入时显示"{{"
|
|
|
|
|
|
|
|
list.add(new ImageEntity()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
carMaintenanceDetailVO.setImages(list); |
|
|
|
|
|
|
|
// 表头年月
|
|
|
|
// 表头年月
|
|
|
|
String code = carMaintenanceDetailVO.getCode(); |
|
|
|
String code = carMaintenanceDetailVO.getCode(); |
|
|
|
carMaintenanceDetailVO.setYear(code.substring(4, 8)); |
|
|
|
carMaintenanceDetailVO.setYear(code.substring(4, 8)); |
|
|
@ -148,7 +137,28 @@ public class CarMaintenanceServiceImpl extends ServiceImpl<CarMaintenanceMapper, |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
carMaintenanceDetailVO.setMaintenanceType(CarMaintenanceTypeEnum.REPAIR.getDesc()); |
|
|
|
carMaintenanceDetailVO.setMaintenanceType(CarMaintenanceTypeEnum.REPAIR.getDesc()); |
|
|
|
} |
|
|
|
} |
|
|
|
Map<String, Object> params = BaseUtil.obj2Map(carMaintenanceDetailVO); |
|
|
|
// 图片
|
|
|
|
|
|
|
|
Map<String, Object> params; |
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(carMaintenanceDetailVO.getImgPath())) { |
|
|
|
|
|
|
|
List<ImageEntity> list = new ArrayList<>(); |
|
|
|
|
|
|
|
CarMaintenanceDetailImgVO imgVO = new CarMaintenanceDetailImgVO(); |
|
|
|
|
|
|
|
BeanUtils.copyProperties(carMaintenanceDetailVO, imgVO); |
|
|
|
|
|
|
|
String[] imgArr = carMaintenanceDetailVO.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(""); |
|
|
|
|
|
|
|
CarMaintenanceDetailStrVO strVO = new CarMaintenanceDetailStrVO(); |
|
|
|
|
|
|
|
BeanUtils.copyProperties(carMaintenanceDetailVO, 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; |
|
|
|