Browse Source

update: 安全模块导出功能优化

zhongwei
liwen 3 months ago
parent
commit
3b55e5954a
  1. 22
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenanceDetailImgVO.java
  2. 21
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenanceDetailStrVO.java
  3. 5
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenanceDetailVO.java
  4. 22
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordDetailImgVO.java
  5. 21
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordDetailStrVO.java
  6. 5
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordDetailVO.java
  7. 22
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordDetailImgVO.java
  8. 21
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordDetailStrVO.java
  9. 7
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordDetailVO.java
  10. 4
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailImgVO.java
  11. 4
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailStrVO.java
  12. 22
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordDetailImgVO.java
  13. 21
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordDetailStrVO.java
  14. 7
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordDetailVO.java
  15. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CarController.java
  16. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/ConferenceController.java
  17. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java
  18. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java
  19. 1
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarMaintenanceService.java
  20. 40
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java
  21. 28
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarUsedRecordServiceImpl.java
  22. 22
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferenceRecordServiceImpl.java
  23. 35
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java
  24. BIN
      hzims-service/safeproduct/src/main/resources/template/卫生考核表(五周).docx
  25. BIN
      hzims-service/safeproduct/src/main/resources/template/卫生考核表(四周).docx

22
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenanceDetailImgVO.java

@ -0,0 +1,22 @@
package com.hnac.hzims.safeproduct.vo;
import cn.afterturn.easypoi.entity.ImageEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @author liwen
* @date 2024-08-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "车辆维保记录VO类-图片实体类")
public class CarMaintenanceDetailImgVO extends CarMaintenanceDetailVO {
@ApiModelProperty("图片列表")
private List<ImageEntity> images;
}

21
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenanceDetailStrVO.java

@ -0,0 +1,21 @@
package com.hnac.hzims.safeproduct.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @author liwen
* @date 2024-08-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "车辆维保记录VO类-图片字符串类")
public class CarMaintenanceDetailStrVO extends CarMaintenanceDetailVO {
@ApiModelProperty("图片列表")
private List<String> images;
}

5
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMaintenanceDetailVO.java

@ -1,12 +1,10 @@
package com.hnac.hzims.safeproduct.vo;
import cn.afterturn.easypoi.entity.ImageEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author liwen
@ -64,9 +62,6 @@ public class CarMaintenanceDetailVO {
@ApiModelProperty("维保类型")
private String maintenanceType;
@ApiModelProperty("图片列表")
private List<ImageEntity> images;
@ApiModelProperty("年份")
private String year;

22
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordDetailImgVO.java

@ -0,0 +1,22 @@
package com.hnac.hzims.safeproduct.vo;
import cn.afterturn.easypoi.entity.ImageEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @author liwen
* @date 2024-08-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "车辆用车记录VO类-图片实体类")
public class CarUsedRecordDetailImgVO extends CarUsedRecordDetailVO {
@ApiModelProperty("图片列表")
private List<ImageEntity> images;
}

21
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordDetailStrVO.java

@ -0,0 +1,21 @@
package com.hnac.hzims.safeproduct.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @author liwen
* @date 2024-08-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "车辆用车记录VO类-图片字符串类")
public class CarUsedRecordDetailStrVO extends CarUsedRecordDetailVO {
@ApiModelProperty("图片列表")
private List<String> images;
}

5
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarUsedRecordDetailVO.java

@ -1,13 +1,11 @@
package com.hnac.hzims.safeproduct.vo;
import cn.afterturn.easypoi.entity.ImageEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* @author liwen
@ -65,9 +63,6 @@ public class CarUsedRecordDetailVO {
@ApiModelProperty("确认时间")
private Date confirmationTime;
@ApiModelProperty("图片列表")
private List<ImageEntity> images;
@ApiModelProperty("年份")
private String year;

22
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordDetailImgVO.java

@ -0,0 +1,22 @@
package com.hnac.hzims.safeproduct.vo;
import cn.afterturn.easypoi.entity.ImageEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @author liwen
* @date 2024-08-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "会议记录VO类-图片实体类")
public class ConferenceRecordDetailImgVO extends ConferenceRecordDetailVO {
@ApiModelProperty("图片列表")
private List<ImageEntity> images;
}

21
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordDetailStrVO.java

@ -0,0 +1,21 @@
package com.hnac.hzims.safeproduct.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @author liwen
* @date 2024-08-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "会议记录VO类-图片实体类")
public class ConferenceRecordDetailStrVO extends ConferenceRecordDetailVO {
@ApiModelProperty("图片列表")
private List<String> images;
}

7
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/ConferenceRecordDetailVO.java

@ -1,13 +1,9 @@
package com.hnac.hzims.safeproduct.vo;
import cn.afterturn.easypoi.entity.ImageEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author liwen
* @date 2024-01-15
@ -55,9 +51,6 @@ public class ConferenceRecordDetailVO {
@ApiModelProperty("会议附件")
private String filePath;
@ApiModelProperty("图片列表")
private List<ImageEntity> images;
@ApiModelProperty("年份")
private String year;

4
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailImgVO.java

@ -4,11 +4,13 @@ import cn.afterturn.easypoi.entity.ImageEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
@Data
@ApiModel(value = "演练记录表VO类")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "演练记录表VO类-图片实体类")
public class RehearsalRecordDetailImgVO extends RehearsalRecordDetailVO {
@ApiModelProperty("图片列表")

4
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailStrVO.java

@ -3,11 +3,13 @@ package com.hnac.hzims.safeproduct.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
@Data
@ApiModel(value = "演练记录表VO类")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "演练记录表VO类-图片字符串类")
public class RehearsalRecordDetailStrVO extends RehearsalRecordDetailVO {
@ApiModelProperty("图片列表")

22
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordDetailImgVO.java

@ -0,0 +1,22 @@
package com.hnac.hzims.safeproduct.vo;
import cn.afterturn.easypoi.entity.ImageEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @author liwen
* @date 2024-08-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "培训记录表VO类-图片实体类")
public class TrainRecordDetailImgVO extends TrainRecordDetailVO {
@ApiModelProperty("图片列表")
private List<ImageEntity> images;
}

21
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordDetailStrVO.java

@ -0,0 +1,21 @@
package com.hnac.hzims.safeproduct.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @author liwen
* @date 2024-08-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "培训记录表VO类-图片字符串类")
public class TrainRecordDetailStrVO extends TrainRecordDetailVO {
@ApiModelProperty("图片列表")
private List<String> images;
}

7
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainRecordDetailVO.java

@ -1,13 +1,9 @@
package com.hnac.hzims.safeproduct.vo;
import cn.afterturn.easypoi.entity.ImageEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author liwen
* @date 2024-01-15
@ -55,9 +51,6 @@ public class TrainRecordDetailVO {
@ApiModelProperty("培训附件")
private String filePath;
@ApiModelProperty("图片列表")
private List<ImageEntity> images;
@ApiModelProperty("年份")
private String year;

3
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CarController.java

@ -19,7 +19,6 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
@ -41,7 +40,7 @@ import java.util.Map;
@AllArgsConstructor
@Business(module = Constants.APP_NAME, value = "车辆管理", ignore = false)
@Api(value = "车辆管理", tags = "车辆管理接口")
public class CarController extends BladeController {
public class CarController {
private final ICarService carService;

3
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/ConferenceController.java

@ -17,7 +17,6 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
@ -38,7 +37,7 @@ import java.util.Map;
@RequestMapping("/conference")
@Business(module = Constants.APP_NAME, value = "会议管理", ignore = false)
@Api(value = "会议管理", tags = "会议管理接口")
public class ConferenceController extends BladeController {
public class ConferenceController {
private final IConferencePlanService conferencePlanService;

3
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java

@ -19,7 +19,6 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
@ -40,7 +39,7 @@ import java.util.Map;
@RequestMapping("/rehearsal")
@Business(module = Constants.APP_NAME, value = "演练管理", ignore = false)
@Api(value = "演练管理", tags = "演练管理接口")
public class RehearsalController extends BladeController {
public class RehearsalController {
private final IRehearsalRecordService rehearsalRecordService;

3
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java

@ -23,7 +23,6 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
@ -45,7 +44,7 @@ import java.util.Map;
@RequestMapping("/train")
@Business(module = Constants.APP_NAME, value = "培训管理", ignore = false)
@Api(value = "培训管理", tags = "培训管理接口")
public class TrainController extends BladeController {
public class TrainController {
private final ITrainPlanService trainPlanService;

1
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICarMaintenanceService.java

@ -10,7 +10,6 @@ import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**

40
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarMaintenanceServiceImpl.java

@ -17,11 +17,14 @@ import com.hnac.hzims.safeproduct.mapper.CarMaintenanceMapper;
import com.hnac.hzims.safeproduct.mapper.CarMapper;
import com.hnac.hzims.safeproduct.service.ICarMaintenanceService;
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.CarMaintenancePageVO;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
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.Value;
import org.springframework.stereotype.Service;
@ -123,20 +126,6 @@ public class CarMaintenanceServiceImpl extends ServiceImpl<CarMaintenanceMapper,
public void exportCarMaintenanceData(Long id, HttpServletResponse response) {
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();
carMaintenanceDetailVO.setYear(code.substring(4, 8));
@ -148,7 +137,28 @@ public class CarMaintenanceServiceImpl extends ServiceImpl<CarMaintenanceMapper,
} else {
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 wordPath = savePath + "/车辆维保记录单" + SafeProductConstant.DOCX_SUFFIX;
String pdfPath = savePath + "/车辆维保记录单" + SafeProductConstant.PDF_SUFFIX;

28
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CarUsedRecordServiceImpl.java

@ -14,11 +14,14 @@ import com.hnac.hzims.safeproduct.enums.CarUsedRecordEnum;
import com.hnac.hzims.safeproduct.mapper.CarUsedRecordMapper;
import com.hnac.hzims.safeproduct.service.ICarUsedRecordService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import com.hnac.hzims.safeproduct.vo.CarUsedRecordDetailImgVO;
import com.hnac.hzims.safeproduct.vo.CarUsedRecordDetailStrVO;
import com.hnac.hzims.safeproduct.vo.CarUsedRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.CarUsedRecordPageVO;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@ -117,25 +120,32 @@ public class CarUsedRecordServiceImpl extends ServiceImpl<CarUsedRecordMapper, C
public void exportCarUsedRecordData(Long id, HttpServletResponse response) {
CarUsedRecordDetailVO carUsedRecordDetailVO = this.getCarUsedRecord(id);
// 数据处理
// 表头年月
String code = carUsedRecordDetailVO.getCode();
carUsedRecordDetailVO.setYear(code.substring(4, 8));
carUsedRecordDetailVO.setMonth(code.substring(8, 10));
// 图片
List<ImageEntity> list = new ArrayList<>();
Map<String, Object> params;
if (StringUtils.isNotEmpty(carUsedRecordDetailVO.getImgPath())) {
List<ImageEntity> list = new ArrayList<>();
CarUsedRecordDetailImgVO imgVO = new CarUsedRecordDetailImgVO();
BeanUtils.copyProperties(carUsedRecordDetailVO, imgVO);
String[] imgArr = carUsedRecordDetailVO.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 {
// 添加空的ImageEntity,防止数据填入时显示"{{"
list.add(new ImageEntity());
List<String> list = new ArrayList<>();
list.add("");
CarUsedRecordDetailStrVO strVO = new CarUsedRecordDetailStrVO();
BeanUtils.copyProperties(carUsedRecordDetailVO, strVO);
strVO.setImages(list);
params = BaseUtil.obj2Map(strVO);
}
carUsedRecordDetailVO.setImages(list);
// 表头年月
String code = carUsedRecordDetailVO.getCode();
carUsedRecordDetailVO.setYear(code.substring(4, 8));
carUsedRecordDetailVO.setMonth(code.substring(8, 10));
Map<String, Object> params = BaseUtil.obj2Map(carUsedRecordDetailVO);
String templateFile = "template/用车记录单" + SafeProductConstant.DOCX_SUFFIX;
String wordPath = savePath + "/用车记录单" + SafeProductConstant.DOCX_SUFFIX;
String pdfPath = savePath + "/用车记录单" + SafeProductConstant.PDF_SUFFIX;

22
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferenceRecordServiceImpl.java

@ -17,9 +17,12 @@ import com.hnac.hzims.safeproduct.mapper.ConferenceRecordMapper;
import com.hnac.hzims.safeproduct.service.IConferenceRecordService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import com.hnac.hzims.safeproduct.utils.TimeUtils;
import com.hnac.hzims.safeproduct.vo.ConferenceRecordDetailImgVO;
import com.hnac.hzims.safeproduct.vo.ConferenceRecordDetailStrVO;
import com.hnac.hzims.safeproduct.vo.ConferenceRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.ConferenceRecordVO;
import org.springblade.core.mp.support.Query;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -120,28 +123,33 @@ public class ConferenceRecordServiceImpl extends ServiceImpl<ConferenceRecordMap
String standardContent = conferenceRecordDetailVO.getContent().replaceAll("\n", "\r\n");
conferenceRecordDetailVO.setContent(standardContent);
// 图片
List<ImageEntity> list = new ArrayList<>();
Map<String, Object> params;
if (StringUtils.isNotEmpty(conferenceRecordDetailVO.getImgPath())) {
List<ImageEntity> list = new ArrayList<>();
ConferenceRecordDetailImgVO imgVO = new ConferenceRecordDetailImgVO();
BeanUtils.copyProperties(conferenceRecordDetailVO, imgVO);
String[] imgArr = conferenceRecordDetailVO.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 {
// 添加空的ImageEntity,防止数据填入时显示"{{"
list.add(new ImageEntity());
List<String> list = new ArrayList<>();
list.add("");
ConferenceRecordDetailStrVO strVO = new ConferenceRecordDetailStrVO();
BeanUtils.copyProperties(conferenceRecordDetailVO, strVO);
strVO.setImages(list);
params = BaseUtil.obj2Map(strVO);
}
conferenceRecordDetailVO.setImages(list);
Map<String, Object> params = BaseUtil.obj2Map(conferenceRecordDetailVO);
String templateFile = "template/会议记录表" + SafeProductConstant.DOCX_SUFFIX;
String wordPath = savePath + "/会议记录表" + SafeProductConstant.DOCX_SUFFIX;
String pdfPath = savePath + "/会议记录表" + SafeProductConstant.PDF_SUFFIX;
BaseUtil.exportDocument(templateFile, params, wordPath, pdfPath,"filePath", response);
}
/**
* 查询会议记录表详情
*/

35
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java

@ -19,10 +19,13 @@ import com.hnac.hzims.safeproduct.service.ITestService;
import com.hnac.hzims.safeproduct.service.ITrainRecordService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import com.hnac.hzims.safeproduct.utils.TimeUtils;
import com.hnac.hzims.safeproduct.vo.TrainRecordDetailImgVO;
import com.hnac.hzims.safeproduct.vo.TrainRecordDetailStrVO;
import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO;
import com.hnac.hzims.safeproduct.vo.TrainRecordVO;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -163,20 +166,32 @@ public class TrainRecordServiceImpl extends ServiceImpl<TrainRecordMapper, Train
// 评价:换行符使用\r\n
String standardCommand = trainRecordDetailVO.getCommand().replaceAll("\n", "\r\n");
trainRecordDetailVO.setCommand(standardCommand);
// 图片
if (StringUtils.isNotEmpty(trainRecordDetailVO.getImgPath())) {
trainRecordDetailVO.setImages(Arrays.stream(trainRecordDetailVO.getImgPath().split(",")).map(img->
new ImageEntity(BaseUtil.imgToByte(savePath + BaseUtil.downloadFileByUrl(img, savePath)), 180, 150)
).collect(Collectors.toList()));
} else {
// 添加空的ImageEntity,防止数据填入时显示"{{"
trainRecordDetailVO.setImages(Collections.singletonList(new ImageEntity()));
}
// 表头年月
String code = trainRecordDetailVO.getCode();
trainRecordDetailVO.setYear(code.substring(4, 8));
trainRecordDetailVO.setMonth(code.substring(8, 10));
Map<String, Object> params = BaseUtil.obj2Map(trainRecordDetailVO);
// 图片
Map<String, Object> params;
if (StringUtils.isNotEmpty(trainRecordDetailVO.getImgPath())) {
List<ImageEntity> list = new ArrayList<>();
TrainRecordDetailImgVO imgVO = new TrainRecordDetailImgVO();
BeanUtils.copyProperties(trainRecordDetailVO, imgVO);
String[] imgArr = trainRecordDetailVO.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("");
TrainRecordDetailStrVO strVO = new TrainRecordDetailStrVO();
BeanUtils.copyProperties(trainRecordDetailVO, strVO);
strVO.setImages(list);
params = BaseUtil.obj2Map(strVO);
}
String templateFile = "template/培训记录表" + SafeProductConstant.DOCX_SUFFIX;
String wordPath = savePath + "/培训记录表" + SafeProductConstant.DOCX_SUFFIX;
String pdfPath = savePath + "/培训记录表" + SafeProductConstant.PDF_SUFFIX;

BIN
hzims-service/safeproduct/src/main/resources/template/卫生考核表(五周).docx

Binary file not shown.

BIN
hzims-service/safeproduct/src/main/resources/template/卫生考核表(四周).docx

Binary file not shown.
Loading…
Cancel
Save