diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/controller/ParamsReportEOController.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/controller/ParamsReportEOController.java index 6e663cf50..1ba513ce4 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/controller/ParamsReportEOController.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/controller/ParamsReportEOController.java @@ -6,7 +6,9 @@ import com.jero.common.api.vo.Result; import com.jero.common.aspect.annotation.AutoLog; import com.jero.common.system.base.controller.JeroController; import com.jero.modules.cert.report.entity.ParamsReportEO; +import com.jero.modules.cert.report.entity.ParamsReportExportHistoryEO; import com.jero.modules.cert.report.service.IParamsReportEOService; +import com.jero.modules.cert.report.service.IParamsReportExportHistoryEOService; import com.jero.modules.system.util.StringUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -35,6 +37,9 @@ import java.util.List; public class ParamsReportEOController extends JeroController { @Autowired private IParamsReportEOService paramsReportEOService; + + @Autowired + private IParamsReportExportHistoryEOService paramsReportExportHistoryEOService; /** * 分页列表查询 @@ -66,6 +71,37 @@ public class ParamsReportEOController extends JeroController exportHistoryPage(ParamsReportExportHistoryEO paramsReportExportHistoryEO, + @RequestParam(name="cut") String cut, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize) { + if (StringUtils.isNotEmpty(paramsReportExportHistoryEO.getProjectName())) { + paramsReportExportHistoryEO.setProjectName(paramsReportExportHistoryEO.getProjectName().replace("%", "\\%")); + } + + if (StringUtils.isNotEmpty(paramsReportExportHistoryEO.getTitle())) { + paramsReportExportHistoryEO.setTitle(paramsReportExportHistoryEO.getTitle().replace("%", "\\%")); + } + + IPage page = new Page(pageNo, pageSize); + IPage pageList = paramsReportExportHistoryEOService.queryPage(page, paramsReportExportHistoryEO, cut); + return Result.OK(pageList); + } + + + diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/entity/ParamsReportExportHistoryEO.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/entity/ParamsReportExportHistoryEO.java new file mode 100644 index 000000000..67a91a94f --- /dev/null +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/entity/ParamsReportExportHistoryEO.java @@ -0,0 +1,98 @@ +package com.jero.modules.cert.report.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import com.jero.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; + + +/** + * @Description: 上报库导出历史 + * @Author: jero-boot + * @Date: 2022-07-04 + * @Version: V1.0 + */ +@Data +@TableName("params_report_export_history") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="params_report_export_history对象", description="上报库导出历史") +public class ParamsReportExportHistoryEO implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private String id; + + /**创建人*/ + @ApiModelProperty(value = "创建人") + private String createBy; + + /**创建日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建日期") + private java.util.Date createTime; + + /**更新人*/ + @ApiModelProperty(value = "更新人") + private String updateBy; + + /**更新日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新日期") + private java.util.Date updateTime; + + /**所属部门*/ + @ApiModelProperty(value = "所属部门") + private String sysOrgCode; + + /**上报库id*/ + @Excel(name = "上报库id", width = 15) + @ApiModelProperty(value = "上报库id") + private String paramsManifestId; + + /**导出类型*/ + @Excel(name = "导出类型", width = 15) + @ApiModelProperty(value = "导出类型") + private String exportType; + + /**导出时间*/ + @Excel(name = "导出时间", width = 15, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "导出时间") + private java.util.Date exportTime; + + /**导出文件id*/ + @Excel(name = "导出文件id", width = 15) + @ApiModelProperty(value = "导出文件id") + private String exportFileId; + + @TableField(exist = false) + @ApiModelProperty(value = "导出文件名称") + private String exportFileName; + + @TableField(exist = false) + @ApiModelProperty(value = "项目名称") + private String projectName; + + @TableField(exist = false) + @ApiModelProperty(value = "清单标题") + private String title; +} diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/enums/ExportTypeEnum.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/enums/ExportTypeEnum.java new file mode 100644 index 000000000..6a4782be3 --- /dev/null +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/enums/ExportTypeEnum.java @@ -0,0 +1,59 @@ +package com.jero.modules.cert.report.enums; + +import com.jero.common.constant.enums.CutEnum; + +import java.util.HashMap; +import java.util.Map; + +public enum ExportTypeEnum { + NORMAL("常规导出","1","Normal export"), + CUSTOM("自定义导出","2","Custom export"); + + String name; + String value; + String enName; + + ExportTypeEnum(String name, String value, String enName) { + this.name = name; + this.value = value; + this.enName = enName; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getEnName() { + return enName; + } + + public void setEnName(String enName) { + this.enName = enName; + } + + public static Map toMap(String cut){ + Map map = new HashMap<>(); + if (CutEnum.CN.getValue().equals(cut)) { + for (ExportTypeEnum exportTypeEnum : ExportTypeEnum.values()) { + map.put(exportTypeEnum.getValue(), exportTypeEnum.getName()); + } + } else if (CutEnum.EN.getValue().equals(cut)) { + for (ExportTypeEnum exportTypeEnum : ExportTypeEnum.values()) { + map.put(exportTypeEnum.getValue(), exportTypeEnum.getEnName()); + } + } + return map; + } +} diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/mapper/ParamsReportExportHistoryEOMapper.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/mapper/ParamsReportExportHistoryEOMapper.java new file mode 100644 index 000000000..0cf024066 --- /dev/null +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/mapper/ParamsReportExportHistoryEOMapper.java @@ -0,0 +1,19 @@ +package com.jero.modules.cert.report.mapper; + +import java.util.List; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.apache.ibatis.annotations.Param; +import com.jero.modules.cert.report.entity.ParamsReportExportHistoryEO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 上报库导出历史 + * @Author: jero-boot + * @Date: 2022-07-04 + * @Version: V1.0 + */ +public interface ParamsReportExportHistoryEOMapper extends BaseMapper { + + IPage pageInfo(@Param("page") IPage page, ParamsReportExportHistoryEO paramsReportExportHistoryEO); +} diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/mapper/xml/ParamsReportExportHistoryEOMapper.xml b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/mapper/xml/ParamsReportExportHistoryEOMapper.xml new file mode 100644 index 000000000..8451ceabe --- /dev/null +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/mapper/xml/ParamsReportExportHistoryEOMapper.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + preh.id as id, + preh.export_type as export_type, + preh.export_time as export_time, + preh.export_file_id as export_file_id, + preh.params_manifest_id as params_manifest_id, + pr.create_by as create_by, + pr.create_time as create_time, + pr.update_by as update_by, + pr.update_time as update_time, + pm.title as title, + concat(pni.project_name,'-',pyni.year_name) as project_name + + + + + + + AND project_name LIKE CONCAT(CONCAT('%',#{paramsReportExportHistoryEO.projectName}),'%') + + + AND title LIKE CONCAT(CONCAT('%',#{paramsReportExportHistoryEO.title}),'%') + + + AND params_manifest_id = #{paramsReportExportHistoryEO.paramsManifestId} + + + + + + + \ No newline at end of file diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/service/IParamsReportExportHistoryEOService.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/service/IParamsReportExportHistoryEOService.java new file mode 100644 index 000000000..c69874c9c --- /dev/null +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/service/IParamsReportExportHistoryEOService.java @@ -0,0 +1,64 @@ +package com.jero.modules.cert.report.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.jero.modules.cert.report.entity.ParamsReportExportHistoryEO; +import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + +/** + * @Description: 上报库导出历史 + * @Author: jero-boot + * @Date: 2022-07-04 + * @Version: V1.0 + */ +public interface IParamsReportExportHistoryEOService extends IService { + + /** + * 保存 + * + * @param paramsReportExportHistoryEO + * @return + */ + void add(ParamsReportExportHistoryEO paramsReportExportHistoryEO); + + /** + * 更新 + * + * @param paramsReportExportHistoryEO + * @return + */ + void editById(ParamsReportExportHistoryEO paramsReportExportHistoryEO); + + /** + * 通过id删除 + * + * @param id + * @return + */ + void deleteById(String id); + + /** + * 批量删除 + * + * @param ids + * @return + */ + void deleteByIds(List ids); + + /** + * 通过id查询 + * + * @param id + * @return + */ + ParamsReportExportHistoryEO queryById(String id); + + /** + * 列表查询 + * + * @return + */ + List queryList(); + + IPage queryPage(IPage page, ParamsReportExportHistoryEO paramsReportExportHistoryEO, String cut); +} diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/service/impl/ParamsReportDetailEOServiceImpl.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/service/impl/ParamsReportDetailEOServiceImpl.java index 7a88644e6..1f890ed77 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/service/impl/ParamsReportDetailEOServiceImpl.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/report/service/impl/ParamsReportDetailEOServiceImpl.java @@ -21,10 +21,13 @@ import com.jero.modules.cert.collect.vo.ParamsConfigDataVO; import com.jero.modules.cert.report.entity.ParamsReportConfigDataEO; import com.jero.modules.cert.report.entity.ParamsReportConfigEO; import com.jero.modules.cert.report.entity.ParamsReportDetailEO; +import com.jero.modules.cert.report.entity.ParamsReportExportHistoryEO; +import com.jero.modules.cert.report.enums.ExportTypeEnum; import com.jero.modules.cert.report.mapper.ParamsReportDetailEOMapper; import com.jero.modules.cert.report.service.IParamsReportConfigDataEOService; import com.jero.modules.cert.report.service.IParamsReportConfigEOService; import com.jero.modules.cert.report.service.IParamsReportDetailEOService; +import com.jero.modules.cert.report.service.IParamsReportExportHistoryEOService; import com.jero.modules.cert.report.vo.ParamsReportDetailVO; import com.jero.modules.cert.template.enums.ControlTypeEnum; import com.jero.modules.document.enums.FieldTypeEnum; @@ -43,6 +46,7 @@ import com.jero.modules.system.entity.SysDictItem; import com.jero.modules.system.service.ISysDictItemService; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.http.entity.ContentType; import org.apache.poi.common.usermodel.HyperlinkType; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.hssf.util.HSSFColor; @@ -54,7 +58,9 @@ import org.apache.poi.xssf.usermodel.*; import org.aspectj.util.FileUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.mock.web.MockMultipartFile; import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -93,6 +99,9 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl implements IParamsReportExportHistoryEOService { + + @Autowired + private ParamsReportExportHistoryEOMapper paramsReportExportHistoryEOMapper; + + @Autowired + private IOSSFileService ossFileService; + /** + * 保存 + * + * @param paramsReportExportHistoryEO + * @return + */ + @Override + public void add(ParamsReportExportHistoryEO paramsReportExportHistoryEO) { + Date now = new Date(); + paramsReportExportHistoryEO.setCreateTime(now); + paramsReportExportHistoryEO.setUpdateTime(now); + save(paramsReportExportHistoryEO); + } + + /** + * 更新 + * + * @param paramsReportExportHistoryEO + * @return + */ + @Override + public void editById(ParamsReportExportHistoryEO paramsReportExportHistoryEO) { + Date now = new Date(); + paramsReportExportHistoryEO.setUpdateTime(now); + saveOrUpdate(paramsReportExportHistoryEO); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @Override + public void deleteById(String id) { + removeById(id); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @Override + public void deleteByIds(List ids) { + removeByIds(ids); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @Override + public ParamsReportExportHistoryEO queryById(String id) { + return getById(id); + } + + /** + * 列表查询 + * + * @return + */ + @Override + public List queryList() { + return list(); + } + + @Override + public IPage queryPage(IPage page, ParamsReportExportHistoryEO paramsReportExportHistoryEO, String cut) { + IPage pageInfo = paramsReportExportHistoryEOMapper.pageInfo(page, paramsReportExportHistoryEO); + List list = pageInfo.getRecords(); + + Map exportTypeMap = ExportTypeEnum.toMap(cut); + list.forEach(exportHistoryEO -> { + // 处理文件名 + OSSFile ossFile = ossFileService.getById(exportHistoryEO.getExportFileId()); + if (ObjectUtil.isNotEmpty(ossFile)) { + exportHistoryEO.setExportFileName(ossFile.getFileName()); + } + + // 处理导出类型 + exportHistoryEO.setExportType(exportTypeMap.get(exportHistoryEO.getExportType())); + }); + + return pageInfo; + } +} diff --git a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/oss/service/impl/OSSFileServiceImpl.java b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/oss/service/impl/OSSFileServiceImpl.java index 6786e76ff..df73c3ae6 100644 --- a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/oss/service/impl/OSSFileServiceImpl.java +++ b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/oss/service/impl/OSSFileServiceImpl.java @@ -203,6 +203,9 @@ public class OSSFileServiceImpl extends ServiceImpl impl OSSFile oSSFile = new OSSFile(); String ctxPath = uploadCospath; + if (org.apache.commons.lang.StringUtils.isNotBlank(bizPath)) { + ctxPath += bizPath; + } String fileName = null; String fileType = null; @@ -227,7 +230,17 @@ public class OSSFileServiceImpl extends ServiceImpl impl throw new JeroBootException("Only upload pdf,word,excel type of file Please select the file again!"); } } - } else { + } else if ("2".equals(state)) { + String fileTypeStrTwo = ".doc,.DOC,.docx,.DOCX,.xls, .XLS,.xlsx,.XLSX"; + //固定文件 + if (!fileTypeStrTwo.contains(fileType)) { + if (cut.equals(CutEnum.CN.getValue())) { + throw new JeroBootException("只能够上传word,excel类型的文件。请重新选择文件!"); + } else { + throw new JeroBootException("Only upload word,excel type of file Please select the file again!"); + } + } + } else { if (CommonUtils.limitFileSuffix(orgName, fileSuffixLimits)) { if (cut.equals(CutEnum.CN.getValue())) { throw new JeroBootException("不能上传" + StringUtils.join(fileSuffixLimits, ",") + "类型的文件。请重新选择文件!");