大时代的小青年呀 3 years ago
parent 5ce2489495
commit 41de9a96c1

@ -0,0 +1,74 @@
package com.anjiplus.template.gaea.business.modules.export.controller;
import com.anji.plus.gaea.annotation.log.GaeaAuditLog;
import com.anji.plus.gaea.bean.ResponseBean;
import com.anji.plus.gaea.curd.controller.GaeaBaseController;
import com.anji.plus.gaea.curd.service.GaeaBaseService;
import com.anji.plus.gaea.utils.GaeaBeanUtils;
import com.anjiplus.template.gaea.business.modules.export.controller.dto.GaeaExportDTO;
import com.anjiplus.template.gaea.business.modules.export.controller.param.GaeaExportParam;
import com.anjiplus.template.gaea.business.modules.export.controller.param.GaeaExportQueryParam;
import com.anjiplus.template.gaea.business.modules.export.dao.entity.GaeaExport;
import com.anjiplus.template.gaea.business.modules.export.service.GaeaExportService;
import com.anji.plus.gaea.export.vo.ExportOperation;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.stream.Collectors;
/**
* (GaeaExport)
*
* @author makejava
* @since 2021-02-07 17:12:31
*/
@RestController
@RequestMapping("/export")
@Api(value = "/export", tags = "导出中心")
public class GaeaExportController extends GaeaBaseController<GaeaExportParam, GaeaExport, GaeaExportDTO> {
@Autowired
private GaeaExportService gaeaExportService;
@Override
public GaeaBaseService<GaeaExportParam, GaeaExport> getService() {
return gaeaExportService;
}
@Override
public GaeaExport getEntity() {
return new GaeaExport();
}
@Override
public GaeaExportDTO getDTO() {
return new GaeaExportDTO();
}
@PostMapping("/queryAdvanceExport")
@GaeaAuditLog(pageTitle = "高级查询")
public ResponseBean queryExportInfo(@RequestBody GaeaExportQueryParam param) {
Page<GaeaExport> exportList=gaeaExportService.getExportListPage(param);
List<GaeaExportDTO> list = exportList.getRecords().stream()
.map(entity -> GaeaBeanUtils.copyAndFormatter(entity, getDTO()))
.collect(Collectors.toList());
Page<GaeaExportDTO> pageDto = new Page<>();
pageDto.setCurrent(exportList.getCurrent());
pageDto.setRecords(list);
pageDto.setPages(exportList.getPages());
pageDto.setTotal(exportList.getTotal());
pageDto.setSize(exportList.getSize());
return responseSuccessWithData(pageDto);
}
@PostMapping("/saveExportLog")
public Boolean export(@RequestBody ExportOperation exportOperation) {
return gaeaExportService.saveExportLog(exportOperation);
}
}

@ -0,0 +1,144 @@
package com.anjiplus.template.gaea.business.modules.export.controller.dto;
import com.anji.plus.gaea.curd.dto.GaeaBaseDTO;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalDateTime;
import java.util.Date;
/**
* (GaeaExport)
*
* @author makejava
* @since 2021-02-07 17:12:25
*/
@ApiModel(value = "导出中心")
public class GaeaExportDTO extends GaeaBaseDTO {
/**
* t_fileidhttp://auth/file/download/fileId
*/
@ApiModelProperty(value = "文件在t_file中的id前端传它来读流接口显示http://auth/file/download/fileId")
private String fileId;
/**
* :6
*/
@ApiModelProperty(value = "文件标题,比如:对账单报表6月份报表")
private String fileTitle;
/**
*
*/
@ApiModelProperty(value = "导出前,查询的数据开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime resultStartTime;
/**
*
*/
@ApiModelProperty(value = "导出前,查询的数据结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime resultEndTime;
/**
*
*/
@ApiModelProperty(value = "导出查询结果,数据总条数")
private Long resultSize;
/**
*
*/
@ApiModelProperty(value = "文件导出触发时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime fileCreateTime;
/**
*
*/
@ApiModelProperty(value = "文件生成完成时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime fileFinishTime;
/**
* creatingsuccess,failed
*/
@ApiModelProperty(value = "文件状态creating生成中success生成成功,failed生成失败")
private String fileStatus;
/**
*
*/
@ApiModelProperty(value = "备注")
private String remark;
public String getFileId() {
return fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId;
}
public String getFileTitle() {
return fileTitle;
}
public void setFileTitle(String fileTitle) {
this.fileTitle = fileTitle;
}
public Long getResultSize() {
return resultSize;
}
public void setResultSize(Long resultSize) {
this.resultSize = resultSize;
}
public LocalDateTime getResultStartTime() {
return resultStartTime;
}
public void setResultStartTime(LocalDateTime resultStartTime) {
this.resultStartTime = resultStartTime;
}
public LocalDateTime getResultEndTime() {
return resultEndTime;
}
public void setResultEndTime(LocalDateTime resultEndTime) {
this.resultEndTime = resultEndTime;
}
public LocalDateTime getFileCreateTime() {
return fileCreateTime;
}
public void setFileCreateTime(LocalDateTime fileCreateTime) {
this.fileCreateTime = fileCreateTime;
}
public LocalDateTime getFileFinishTime() {
return fileFinishTime;
}
public void setFileFinishTime(LocalDateTime fileFinishTime) {
this.fileFinishTime = fileFinishTime;
}
public String getFileStatus() {
return fileStatus;
}
public void setFileStatus(String fileStatus) {
this.fileStatus = fileStatus;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}

@ -0,0 +1,26 @@
package com.anjiplus.template.gaea.business.modules.export.controller.param;
import com.anji.plus.gaea.annotation.Query;
import com.anji.plus.gaea.constant.QueryEnum;
import com.anji.plus.gaea.curd.params.PageParam;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
/**
* (GaeaExport)param
*
* @author makejava
* @since 2021-02-07 17:12:26
*/
@Getter
@Setter
public class GaeaExportParam extends PageParam implements Serializable {
/**
*
*/
@Query(QueryEnum.LIKE)
private String fileTitle;
}

@ -0,0 +1,23 @@
package com.anjiplus.template.gaea.business.modules.export.controller.param;
import com.anjiplus.template.gaea.common.dto.BaseQueryBO;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
/**
*
*
* @Author: peiyanni
* @Date: 2021/2/20 12:49
*/
@Setter
@Getter
public class GaeaExportQueryParam extends BaseQueryBO implements Serializable{
/**
*
*/
private String fileTitle;
}

@ -0,0 +1,30 @@
package com.anjiplus.template.gaea.business.modules.export.dao;
import com.anjiplus.template.gaea.business.modules.export.controller.param.GaeaExportQueryParam;
import com.anjiplus.template.gaea.business.modules.export.dao.entity.GaeaExport;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.anji.plus.gaea.curd.mapper.GaeaBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* (GaeaExport)Mapper
*
* @author makejava
* @since 2021-02-07 17:12:16
*/
@Mapper
public interface GaeaExportMapper extends GaeaBaseMapper<GaeaExport> {
/**
*
* @param page
* @param bo
* @param wrapper
* @return
*/
List<GaeaExport> queryExportInfo(Page<GaeaExport> page, @Param("bo") GaeaExportQueryParam bo, @Param(Constants.WRAPPER) QueryWrapper wrapper);
}

@ -0,0 +1,126 @@
package com.anjiplus.template.gaea.business.modules.export.dao.entity;
import com.anji.plus.gaea.annotation.Formatter;
import com.baomidou.mybatisplus.annotation.TableName;
import com.anji.plus.gaea.curd.entity.GaeaBaseEntity;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* (GaeaExport)
*
* @author peiyanni
* @since 2021-02-07 17:12:14
*/
@TableName("gaea_export")
public class GaeaExport extends GaeaBaseEntity implements Serializable {
/**
* t_fileidhttp://auth/file/download/fileId
*/
private String fileId;
/**
* :6
*/
private String fileTitle;
/**
*
*/
private LocalDateTime resultStartTime;
/**
*
*/
private LocalDateTime resultEndTime;
/**
*
*/
private Long resultSize;
/** 文件导出触发时间 */
private LocalDateTime fileCreateTime;
/** 文件生成完成时间 */
private LocalDateTime fileFinishTime;
/**
* creatingsuccess,failed
*/
@Formatter(dictCode="FILE_STATUS",targetField = "fileStatus")
private String fileStatus;
/**
*
*/
private String remark;
public String getFileId() {
return fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId;
}
public String getFileTitle() {
return fileTitle;
}
public void setFileTitle(String fileTitle) {
this.fileTitle = fileTitle;
}
public LocalDateTime getResultStartTime() {
return resultStartTime;
}
public LocalDateTime getResultEndTime() {
return resultEndTime;
}
public LocalDateTime getFileFinishTime() {
return fileFinishTime;
}
public void setFileFinishTime(LocalDateTime fileFinishTime) {
this.fileFinishTime = fileFinishTime;
}
public Long getResultSize() {
return resultSize;
}
public void setResultSize(Long resultSize) {
this.resultSize = resultSize;
}
public void setResultStartTime(LocalDateTime resultStartTime) {
this.resultStartTime = resultStartTime;
}
public void setResultEndTime(LocalDateTime resultEndTime) {
this.resultEndTime = resultEndTime;
}
public LocalDateTime getFileCreateTime() {
return fileCreateTime;
}
public void setFileCreateTime(LocalDateTime fileCreateTime) {
this.fileCreateTime = fileCreateTime;
}
public String getFileStatus() {
return fileStatus;
}
public void setFileStatus(String fileStatus) {
this.fileStatus = fileStatus;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}

@ -0,0 +1,32 @@
package com.anjiplus.template.gaea.business.modules.export.service;
import com.anjiplus.template.gaea.business.modules.export.dao.entity.GaeaExport;
import com.anji.plus.gaea.export.vo.ExportOperation;
import com.anjiplus.template.gaea.business.modules.export.controller.param.GaeaExportParam;
import com.anjiplus.template.gaea.business.modules.export.controller.param.GaeaExportQueryParam;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.anji.plus.gaea.curd.service.GaeaBaseService;
/**
* (GaeaExport)Service
*
* @author peiyanni
* @since 2021-02-07 17:12:22
*/
public interface GaeaExportService extends GaeaBaseService<GaeaExportParam, GaeaExport> {
/**
* -
* QueryWrapper QueryWrapper
* @param queryParam
* @return
*/
Page<GaeaExport> getExportListPage(GaeaExportQueryParam queryParam, QueryWrapper ...qe);
/**
* Gaea_export
* @param exportOperation
* @return
*/
Boolean saveExportLog(ExportOperation exportOperation);
}

@ -0,0 +1,73 @@
package com.anjiplus.template.gaea.business.modules.export.service.impl;
import com.anjiplus.template.gaea.business.modules.export.dao.GaeaExportMapper;
import com.anjiplus.template.gaea.business.modules.export.dao.entity.GaeaExport;
import com.anjiplus.template.gaea.business.modules.export.service.GaeaExportService;
import com.anjiplus.template.gaea.business.modules.file.dao.GaeaFileMapper;
import com.anjiplus.template.gaea.business.modules.file.entity.GaeaFile;
import com.anji.plus.gaea.export.vo.ExportOperation;
import com.anjiplus.template.gaea.business.modules.export.controller.param.GaeaExportQueryParam;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.anjiplus.template.gaea.common.aop.GaeaQuery;
import com.anji.plus.gaea.curd.mapper.GaeaBaseMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
* (GaeaExport)ServiceImpl
*
* @author makejava
* @since 2021-02-07 17:12:24
*/
@Service
public class GaeaExportServiceImpl implements GaeaExportService {
@Autowired
private GaeaExportMapper gaeaExportMapper;
@Autowired
private GaeaFileMapper gaeaFileMapper;
@Override
public GaeaBaseMapper<GaeaExport> getMapper() {
return gaeaExportMapper;
}
@Override
@GaeaQuery
public Page<GaeaExport> getExportListPage(GaeaExportQueryParam queryParam, QueryWrapper... qe) {
Page<GaeaExport> page = new Page<>(queryParam.getPageNumber(), queryParam.getPageSize());
QueryWrapper queryWrapper = (null != qe && qe.length > 0) ? qe[0] : null;
List<GaeaExport> gaeaExports = gaeaExportMapper.queryExportInfo(page, queryParam, queryWrapper);
page.setRecords(gaeaExports);
return page;
}
@Override
@Transactional
public Boolean saveExportLog(ExportOperation exportOperation) {
//需要保存两张表数据 gaea_file ,gaea_export数据
Date nowDate = new Date();
GaeaFile gaeaFile = new GaeaFile();
gaeaFile.setFileId(exportOperation.getFileId());
gaeaFile.setFilePath(exportOperation.getFilePath());
gaeaFile.setCreateBy(exportOperation.getCreaterUsername());
gaeaFile.setCreateTime(nowDate);
gaeaFile.setUpdateBy(exportOperation.getCreaterUsername());
gaeaFile.setUpdateTime(nowDate);
gaeaFileMapper.insert(gaeaFile);
GaeaExport export = new GaeaExport();
BeanUtils.copyProperties(exportOperation, export);
export.setCreateBy(exportOperation.getCreaterUsername());
export.setCreateTime(nowDate);
export.setUpdateBy(exportOperation.getCreaterUsername());
export.setUpdateTime(nowDate);
gaeaExportMapper.insert(export);
return true;
}
}
Loading…
Cancel
Save