会计报表
parent
fb74d22a6e
commit
1b12610c96
@ -0,0 +1,35 @@
|
|||||||
|
-- 创建会计账簿表
|
||||||
|
CREATE TABLE `lyr-one`.`Untitled` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '账簿id',
|
||||||
|
`uri` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '账簿文件uri',
|
||||||
|
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '账簿文件名称',
|
||||||
|
`company_id` bigint(20) NULL DEFAULT NULL COMMENT '业务实体名称',
|
||||||
|
`company` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务实体',
|
||||||
|
`type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '细分类型',
|
||||||
|
`year` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会计年度',
|
||||||
|
`period` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会计期间',
|
||||||
|
`source` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '账簿来源',
|
||||||
|
`digest` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '摘要',
|
||||||
|
`creator` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者',
|
||||||
|
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`updater` datetime NULL DEFAULT NULL COMMENT '修改者',
|
||||||
|
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
|
||||||
|
`deleted` bit(1) NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
|
`encrypt` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '加密',
|
||||||
|
`archive_id` bigint(20) NULL DEFAULT NULL COMMENT '归档id',
|
||||||
|
`archive_state` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '归档状态',
|
||||||
|
`dept_id` bigint(20) NULL DEFAULT NULL COMMENT '部门id',
|
||||||
|
`dept_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属部门',
|
||||||
|
`tenant_id` bigint(20) NULL DEFAULT NULL COMMENT '住户编号',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = MyISAM AUTO_INCREMENT = 90 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会计账簿表' ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
|
||||||
|
SELECT `id` INTO @menuId FROM system_menu WHERE `name` = '会计档案';
|
||||||
|
|
||||||
|
INSERT INTO `lyr-one`.`system_menu` ( `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('会计账簿', '', 2, 1, @menuId, 'book', 'education', 'accounting/book/index', 'Book', 0, b'1', b'1', b'1', '', '2023-09-20 15:09:58', '', '2023-09-20 15:09:58', b'0');
|
||||||
|
SET @menuId2 = LAST_INSERT_ID();
|
||||||
|
INSERT INTO `lyr-one`.`system_menu` ( `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('创建会计账簿', 'archives:accounting-book:create', 3, 1, @menuId2 , '', '', '', '', 0, b'1', b'1', b'1', '', '2023-09-22 11:20:21', '', '2023-09-22 11:20:21', b'0');
|
||||||
|
INSERT INTO `lyr-one`.`system_menu` ( `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('获取会计账簿列表', 'archives:accounting-book:query', 3, 2, @menuId2 , '', '', '', '', 0, b'1', b'1', b'1', '', '2023-09-22 11:21:56', '', '2023-09-22 11:22:38', b'0');
|
||||||
|
INSERT INTO `lyr-one`.`system_menu` ( `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('删除会计账簿', 'archives:accounting-book:delete', 3, 3, @menuId2 , '', '', '', '', 0, b'1', b'1', b'1', '', '2023-09-22 11:22:50', '', '2023-09-22 11:22:50', b'0');
|
||||||
|
INSERT INTO `lyr-one`.`system_menu` ( `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('修改会计账簿', 'archives:accounting-book:update', 3, 4, @menuId2 , '', '', '', '', 0, b'1', b'1', b'1', '', '2023-09-22 11:23:18', '', '2023-09-22 11:23:18', b'0');
|
@ -0,0 +1,153 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.controller.admin.accountingreport;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
|
||||||
|
import cn.iocoder.yudao.framework.file.core.client.s3.S3FileClient;
|
||||||
|
import cn.iocoder.yudao.framework.file.core.client.s3.S3FileClientConfig;
|
||||||
|
import cn.iocoder.yudao.module.accounting.controller.admin.accountingreport.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.accounting.convert.accountingreport.AccountingReportConvert;
|
||||||
|
import cn.iocoder.yudao.module.accounting.dal.dataobject.accountingreport.AccountingReportDO;
|
||||||
|
import cn.iocoder.yudao.module.accounting.service.accountingreport.AccountingReportService;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
|
import javax.validation.*;
|
||||||
|
import javax.servlet.http.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||||
|
@Tag(name = "管理后台 - 会计报表")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/archives/accounting-report")
|
||||||
|
@Validated
|
||||||
|
public class AccountingReportController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AccountingReportService accountingReportService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RedisTemplate redisTemplate;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建会计报表")
|
||||||
|
@PreAuthorize("@ss.hasPermission('archives:accounting-report:create')")
|
||||||
|
public CommonResult<Long> createAccountingReport(@Valid @RequestBody AccountingReportCreateReqVO createReqVO) {
|
||||||
|
return success(accountingReportService.createAccountingReport(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 账簿上传
|
||||||
|
*/
|
||||||
|
@PostMapping("/upload")
|
||||||
|
@Operation(summary = "上传会计报表")
|
||||||
|
@PreAuthorize("@ss.hasPermission('archives:accounting-report:create')")
|
||||||
|
public String uploadAccountingBook(@RequestPart("file") MultipartFile multipartFile, @RequestParam("type") String type) {
|
||||||
|
try {
|
||||||
|
//TODO minio配置 后续修改
|
||||||
|
S3FileClientConfig config = new S3FileClientConfig();
|
||||||
|
// 配置成你自己的
|
||||||
|
config.setAccessKey("minioadmin");
|
||||||
|
config.setAccessSecret("minioadmin");
|
||||||
|
config.setBucket("ktg-mes");
|
||||||
|
config.setDomain(null);
|
||||||
|
// 默认 9000 endpoint
|
||||||
|
config.setEndpoint("https://www.lyrfp.com");
|
||||||
|
|
||||||
|
// 执行上传
|
||||||
|
String uri = testExecuteUpload(config, multipartFile);
|
||||||
|
// String uri = fileService.createFile(multipartFile.getOriginalFilename(), multipartFile.getOriginalFilename(), multipartFile.getBytes());
|
||||||
|
//加入redis缓存
|
||||||
|
redisTemplate.boundValueOps("reportFileUrlKey").set(uri);
|
||||||
|
redisTemplate.boundValueOps("reportFileKeyName").set(multipartFile.getOriginalFilename());
|
||||||
|
redisTemplate.boundValueOps("reportFileKeyType").set(type);
|
||||||
|
return uri;
|
||||||
|
} catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return "vo";
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO minio上传函数 后续封装为公用方法
|
||||||
|
private String testExecuteUpload(S3FileClientConfig config,MultipartFile file) throws Exception {
|
||||||
|
// 校验配置
|
||||||
|
ValidationUtils.validate(Validation.buildDefaultValidatorFactory().getValidator(), config);
|
||||||
|
// 创建 Client
|
||||||
|
S3FileClient client = new S3FileClient(0L, config);
|
||||||
|
client.init();
|
||||||
|
// 上传文件
|
||||||
|
String path = file.getOriginalFilename();
|
||||||
|
// byte[] content = ResourceUtil.readBytes(file);
|
||||||
|
return client.upload(file.getBytes(), path, "xls/xlsx");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新会计报表")
|
||||||
|
@PreAuthorize("@ss.hasPermission('archives:accounting-report:update')")
|
||||||
|
public CommonResult<Boolean> updateAccountingReport(@Valid @RequestBody AccountingReportUpdateReqVO updateReqVO) {
|
||||||
|
accountingReportService.updateAccountingReport(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除会计报表")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('archives:accounting-report:delete')")
|
||||||
|
public CommonResult<Boolean> deleteAccountingReport(@RequestParam("id") Long id) {
|
||||||
|
accountingReportService.deleteAccountingReport(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得会计报表")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('archives:accounting-report:query')")
|
||||||
|
public CommonResult<AccountingReportRespVO> getAccountingReport(@RequestParam("id") Long id) {
|
||||||
|
AccountingReportDO accountingReport = accountingReportService.getAccountingReport(id);
|
||||||
|
return success(AccountingReportConvert.INSTANCE.convert(accountingReport));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Operation(summary = "获得会计报表列表")
|
||||||
|
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||||
|
@PreAuthorize("@ss.hasPermission('archives:accounting-report:query')")
|
||||||
|
public CommonResult<List<AccountingReportRespVO>> getAccountingReportList(@RequestParam("ids") Collection<Long> ids) {
|
||||||
|
List<AccountingReportDO> list = accountingReportService.getAccountingReportList(ids);
|
||||||
|
return success(AccountingReportConvert.INSTANCE.convertList(list));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得会计报表分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('archives:accounting-report:query')")
|
||||||
|
public CommonResult<PageResult<AccountingReportRespVO>> getAccountingReportPage(@Valid AccountingReportPageReqVO pageVO) {
|
||||||
|
PageResult<AccountingReportDO> pageResult = accountingReportService.getAccountingReportPage(pageVO);
|
||||||
|
return success(AccountingReportConvert.INSTANCE.convertPage(pageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出会计报表 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('archives:accounting-report:export')")
|
||||||
|
@OperateLog(type = EXPORT)
|
||||||
|
public void exportAccountingReportExcel(@Valid AccountingReportExportReqVO exportReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
List<AccountingReportDO> list = accountingReportService.getAccountingReportList(exportReqVO);
|
||||||
|
// 导出 Excel
|
||||||
|
List<AccountingReportExcelVO> datas = AccountingReportConvert.INSTANCE.convertList02(list);
|
||||||
|
ExcelUtils.write(response, "会计报表.xls", "数据", AccountingReportExcelVO.class, datas);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.controller.admin.accountingreport.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 会计报表创建 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class AccountingReportCreateReqVO extends AccountingReportBaseVO {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.controller.admin.accountingreport.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会计报表 Excel VO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AccountingReportExcelVO {
|
||||||
|
|
||||||
|
@ExcelProperty("报表id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ExcelProperty("报表文件名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ExcelProperty("报表文件url")
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
@ExcelProperty("业务实体id")
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
@ExcelProperty("业务实体")
|
||||||
|
private String company;
|
||||||
|
|
||||||
|
@ExcelProperty("细分类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@ExcelProperty("账套编号")
|
||||||
|
private String bookCode;
|
||||||
|
|
||||||
|
@ExcelProperty("会计年度")
|
||||||
|
private String year;
|
||||||
|
|
||||||
|
@ExcelProperty("会计期间")
|
||||||
|
private String period;
|
||||||
|
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@ExcelProperty("加密")
|
||||||
|
private String encrypt;
|
||||||
|
|
||||||
|
@ExcelProperty("归档id")
|
||||||
|
private Long archiveId;
|
||||||
|
|
||||||
|
@ExcelProperty("归档状态")
|
||||||
|
private String archiveState;
|
||||||
|
|
||||||
|
@ExcelProperty("部门id")
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
@ExcelProperty("所属部门")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.controller.admin.accountingreport.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 会计报表分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class AccountingReportPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "报表文件名称", example = "赵六")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "报表文件url", example = "https://www.iocoder.cn")
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
@Schema(description = "业务实体id", example = "9885")
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
@Schema(description = "业务实体")
|
||||||
|
private String company;
|
||||||
|
|
||||||
|
@Schema(description = "细分类型", example = "1")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@Schema(description = "账套编号")
|
||||||
|
private String bookCode;
|
||||||
|
|
||||||
|
@Schema(description = "会计年度")
|
||||||
|
private String year;
|
||||||
|
|
||||||
|
@Schema(description = "会计期间")
|
||||||
|
private String period;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
@Schema(description = "加密")
|
||||||
|
private String encrypt;
|
||||||
|
|
||||||
|
@Schema(description = "归档id", example = "25739")
|
||||||
|
private Long archiveId;
|
||||||
|
|
||||||
|
@Schema(description = "归档状态")
|
||||||
|
private String archiveState;
|
||||||
|
|
||||||
|
@Schema(description = "部门id", example = "6314")
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
@Schema(description = "所属部门", example = "赵六")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.controller.admin.accountingreport.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 会计报表 Response VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class AccountingReportRespVO extends AccountingReportBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "报表id", requiredMode = Schema.RequiredMode.REQUIRED, example = "23780")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.controller.admin.accountingreport.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 会计报表更新 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class AccountingReportUpdateReqVO extends AccountingReportBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "报表id", requiredMode = Schema.RequiredMode.REQUIRED, example = "23780")
|
||||||
|
@NotNull(message = "报表id不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.convert.accountingreport;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.accounting.controller.admin.accountingreport.vo.AccountingReportCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.accounting.controller.admin.accountingreport.vo.AccountingReportExcelVO;
|
||||||
|
import cn.iocoder.yudao.module.accounting.controller.admin.accountingreport.vo.AccountingReportRespVO;
|
||||||
|
import cn.iocoder.yudao.module.accounting.controller.admin.accountingreport.vo.AccountingReportUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.accounting.dal.dataobject.accountingreport.AccountingReportDO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会计报表 Convert
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface AccountingReportConvert {
|
||||||
|
|
||||||
|
AccountingReportConvert INSTANCE = Mappers.getMapper(AccountingReportConvert.class);
|
||||||
|
|
||||||
|
AccountingReportDO convert(AccountingReportCreateReqVO bean);
|
||||||
|
|
||||||
|
AccountingReportDO convert(AccountingReportUpdateReqVO bean);
|
||||||
|
|
||||||
|
AccountingReportRespVO convert(AccountingReportDO bean);
|
||||||
|
|
||||||
|
List<AccountingReportRespVO> convertList(List<AccountingReportDO> list);
|
||||||
|
|
||||||
|
PageResult<AccountingReportRespVO> convertPage(PageResult<AccountingReportDO> page);
|
||||||
|
|
||||||
|
List<AccountingReportExcelVO> convertList02(List<AccountingReportDO> list);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,84 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.dal.dataobject.accountingreport;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会计报表 DO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@TableName("archives_accounting_report")
|
||||||
|
@KeySequence("archives_accounting_report_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AccountingReportDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报表id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 报表文件名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 报表文件url
|
||||||
|
*/
|
||||||
|
private String url;
|
||||||
|
/**
|
||||||
|
* 业务实体id
|
||||||
|
*/
|
||||||
|
private Long companyId;
|
||||||
|
/**
|
||||||
|
* 业务实体
|
||||||
|
*/
|
||||||
|
private String company;
|
||||||
|
/**
|
||||||
|
* 细分类型
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
/**
|
||||||
|
* 账套编号
|
||||||
|
*/
|
||||||
|
private String bookCode;
|
||||||
|
/**
|
||||||
|
* 会计年度
|
||||||
|
*/
|
||||||
|
private String year;
|
||||||
|
/**
|
||||||
|
* 会计期间
|
||||||
|
*/
|
||||||
|
private String period;
|
||||||
|
/**
|
||||||
|
* 加密
|
||||||
|
*/
|
||||||
|
private String encrypt;
|
||||||
|
/**
|
||||||
|
* 归档id
|
||||||
|
*/
|
||||||
|
private Long archiveId;
|
||||||
|
/**
|
||||||
|
* 归档状态
|
||||||
|
*/
|
||||||
|
private String archiveState;
|
||||||
|
/**
|
||||||
|
* 部门id
|
||||||
|
*/
|
||||||
|
private Long deptId;
|
||||||
|
/**
|
||||||
|
* 所属部门
|
||||||
|
*/
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.dal.mysql.accountingreport;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.module.accounting.controller.admin.accountingreport.vo.AccountingReportExportReqVO;
|
||||||
|
import cn.iocoder.yudao.module.accounting.controller.admin.accountingreport.vo.AccountingReportPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.accounting.dal.dataobject.accountingreport.AccountingReportDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会计报表 Mapper
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface AccountingReportMapper extends BaseMapperX<AccountingReportDO> {
|
||||||
|
|
||||||
|
default PageResult<AccountingReportDO> selectPage(AccountingReportPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<AccountingReportDO>()
|
||||||
|
.likeIfPresent(AccountingReportDO::getName, reqVO.getName())
|
||||||
|
.eqIfPresent(AccountingReportDO::getUrl, reqVO.getUrl())
|
||||||
|
.eqIfPresent(AccountingReportDO::getCompanyId, reqVO.getCompanyId())
|
||||||
|
.eqIfPresent(AccountingReportDO::getCompany, reqVO.getCompany())
|
||||||
|
.eqIfPresent(AccountingReportDO::getType, reqVO.getType())
|
||||||
|
.eqIfPresent(AccountingReportDO::getBookCode, reqVO.getBookCode())
|
||||||
|
.eqIfPresent(AccountingReportDO::getYear, reqVO.getYear())
|
||||||
|
.eqIfPresent(AccountingReportDO::getPeriod, reqVO.getPeriod())
|
||||||
|
.betweenIfPresent(AccountingReportDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.eqIfPresent(AccountingReportDO::getEncrypt, reqVO.getEncrypt())
|
||||||
|
.eqIfPresent(AccountingReportDO::getArchiveId, reqVO.getArchiveId())
|
||||||
|
.eqIfPresent(AccountingReportDO::getArchiveState, reqVO.getArchiveState())
|
||||||
|
.eqIfPresent(AccountingReportDO::getDeptId, reqVO.getDeptId())
|
||||||
|
.likeIfPresent(AccountingReportDO::getDeptName, reqVO.getDeptName())
|
||||||
|
.orderByDesc(AccountingReportDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
default List<AccountingReportDO> selectList(AccountingReportExportReqVO reqVO) {
|
||||||
|
return selectList(new LambdaQueryWrapperX<AccountingReportDO>()
|
||||||
|
.likeIfPresent(AccountingReportDO::getName, reqVO.getName())
|
||||||
|
.eqIfPresent(AccountingReportDO::getUrl, reqVO.getUrl())
|
||||||
|
.eqIfPresent(AccountingReportDO::getCompanyId, reqVO.getCompanyId())
|
||||||
|
.eqIfPresent(AccountingReportDO::getCompany, reqVO.getCompany())
|
||||||
|
.eqIfPresent(AccountingReportDO::getType, reqVO.getType())
|
||||||
|
.eqIfPresent(AccountingReportDO::getBookCode, reqVO.getBookCode())
|
||||||
|
.eqIfPresent(AccountingReportDO::getYear, reqVO.getYear())
|
||||||
|
.eqIfPresent(AccountingReportDO::getPeriod, reqVO.getPeriod())
|
||||||
|
.betweenIfPresent(AccountingReportDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.eqIfPresent(AccountingReportDO::getEncrypt, reqVO.getEncrypt())
|
||||||
|
.eqIfPresent(AccountingReportDO::getArchiveId, reqVO.getArchiveId())
|
||||||
|
.eqIfPresent(AccountingReportDO::getArchiveState, reqVO.getArchiveState())
|
||||||
|
.eqIfPresent(AccountingReportDO::getDeptId, reqVO.getDeptId())
|
||||||
|
.likeIfPresent(AccountingReportDO::getDeptName, reqVO.getDeptName())
|
||||||
|
.orderByDesc(AccountingReportDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.service.accountingreport;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.accounting.controller.admin.accountingreport.vo.AccountingReportCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.accounting.controller.admin.accountingreport.vo.AccountingReportExportReqVO;
|
||||||
|
import cn.iocoder.yudao.module.accounting.controller.admin.accountingreport.vo.AccountingReportPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.accounting.controller.admin.accountingreport.vo.AccountingReportUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.accounting.dal.dataobject.accountingreport.AccountingReportDO;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会计报表 Service 接口
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public interface AccountingReportService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建会计报表
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createAccountingReport(@Valid AccountingReportCreateReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新会计报表
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateAccountingReport(@Valid AccountingReportUpdateReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除会计报表
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteAccountingReport(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得会计报表
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 会计报表
|
||||||
|
*/
|
||||||
|
AccountingReportDO getAccountingReport(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得会计报表列表
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
* @return 会计报表列表
|
||||||
|
*/
|
||||||
|
List<AccountingReportDO> getAccountingReportList(Collection<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得会计报表分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 会计报表分页
|
||||||
|
*/
|
||||||
|
PageResult<AccountingReportDO> getAccountingReportPage(AccountingReportPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得会计报表列表, 用于 Excel 导出
|
||||||
|
*
|
||||||
|
* @param exportReqVO 查询条件
|
||||||
|
* @return 会计报表列表
|
||||||
|
*/
|
||||||
|
List<AccountingReportDO> getAccountingReportList(AccountingReportExportReqVO exportReqVO);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,96 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.service.accountingreport;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.accounting.controller.admin.accountingreport.vo.AccountingReportCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.accounting.controller.admin.accountingreport.vo.AccountingReportExportReqVO;
|
||||||
|
import cn.iocoder.yudao.module.accounting.controller.admin.accountingreport.vo.AccountingReportPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.accounting.controller.admin.accountingreport.vo.AccountingReportUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.accounting.convert.accountingreport.AccountingReportConvert;
|
||||||
|
import cn.iocoder.yudao.module.accounting.dal.dataobject.accountingreport.AccountingReportDO;
|
||||||
|
import cn.iocoder.yudao.module.accounting.dal.mysql.accountingreport.AccountingReportMapper;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.*;
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.accounting.enums.ErrorCodeConstants.ACCOUNTING_REPORT_NOT_EXISTS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会计报表 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class AccountingReportServiceImpl implements AccountingReportService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AccountingReportMapper accountingReportMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RedisTemplate redisTemplate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createAccountingReport(AccountingReportCreateReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
AccountingReportDO accountingReport = AccountingReportConvert.INSTANCE.convert(createReqVO);
|
||||||
|
String uri =(String) redisTemplate.boundValueOps("reportFileUrlKey").get();
|
||||||
|
String name =(String) redisTemplate.boundValueOps("reportFileKeyName").get();
|
||||||
|
String type =(String) redisTemplate.boundValueOps("reportFileKeyType").get();
|
||||||
|
if (ObjectUtil.isNotNull(uri) && ObjectUtil.isNotNull(name) && ObjectUtil.isNotNull(type)){
|
||||||
|
accountingReport.setUrl(uri);
|
||||||
|
accountingReport.setName(name);
|
||||||
|
accountingReport.setType(type);
|
||||||
|
}
|
||||||
|
accountingReportMapper.insert(accountingReport);
|
||||||
|
// 返回
|
||||||
|
return accountingReport.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateAccountingReport(AccountingReportUpdateReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateAccountingReportExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
AccountingReportDO updateObj = AccountingReportConvert.INSTANCE.convert(updateReqVO);
|
||||||
|
accountingReportMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteAccountingReport(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateAccountingReportExists(id);
|
||||||
|
// 删除
|
||||||
|
accountingReportMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateAccountingReportExists(Long id) {
|
||||||
|
if (accountingReportMapper.selectById(id) == null) {
|
||||||
|
throw exception(ACCOUNTING_REPORT_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AccountingReportDO getAccountingReport(Long id) {
|
||||||
|
return accountingReportMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AccountingReportDO> getAccountingReportList(Collection<Long> ids) {
|
||||||
|
return accountingReportMapper.selectBatchIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<AccountingReportDO> getAccountingReportPage(AccountingReportPageReqVO pageReqVO) {
|
||||||
|
return accountingReportMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AccountingReportDO> getAccountingReportList(AccountingReportExportReqVO exportReqVO) {
|
||||||
|
return accountingReportMapper.selectList(exportReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue