其他会计资料
parent
f5362b5c19
commit
228f2f91e0
@ -0,0 +1,58 @@
|
|||||||
|
-- ----------------------------
|
||||||
|
-- 其他会计资料 structure for accounting_other
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `accounting_other`;
|
||||||
|
CREATE TABLE `accounting_other` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '表名',
|
||||||
|
`flow_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'OA/ERP流程编号',
|
||||||
|
`source` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件来源',
|
||||||
|
`year` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '年度',
|
||||||
|
`period` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '会计期间',
|
||||||
|
`business_type` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务类型',
|
||||||
|
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者',
|
||||||
|
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
|
||||||
|
`create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '制单人',
|
||||||
|
`creator` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||||
|
`company_id` bigint(20) NULL DEFAULT NULL COMMENT '业务实体id',
|
||||||
|
`company` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务实体',
|
||||||
|
`suffix` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件后缀',
|
||||||
|
`file_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件地址',
|
||||||
|
`file_ap` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '绝对路径',
|
||||||
|
`flow_id` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '流程号',
|
||||||
|
`note` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '摘要',
|
||||||
|
`dept_id` bigint(20) NULL DEFAULT NULL COMMENT '所属部门id',
|
||||||
|
`dept_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属部门',
|
||||||
|
`record_id` bigint(20) NULL DEFAULT NULL COMMENT '归档id',
|
||||||
|
`user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id',
|
||||||
|
`deleted` bit(1) NULL DEFAULT b'0' COMMENT '是否删除',
|
||||||
|
`archive_state` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '归档状态',
|
||||||
|
`tenant_id` bigint(20) NOT NULL COMMENT '租户编号 一个集团/总公司对应一个租户',
|
||||||
|
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
|
||||||
|
`attr1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段1',
|
||||||
|
`attr2` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预留字段2',
|
||||||
|
`attr3` int(11) NULL DEFAULT NULL COMMENT '预留字段3',
|
||||||
|
`attr4` int(11) NULL DEFAULT NULL COMMENT '预留字段4',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '其他资料' ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
|
|
||||||
|
-- 其他会计资料菜单
|
||||||
|
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, 0, @menuId, 'other', '', 'accounting/other/index', 'Other', 0, b'1', b'1', b'1', '', '2023-09-25 13:37:12', '', '2023-09-25 13:37:12', b'0');
|
||||||
|
SET @menuId2 = LAST_INSERT_ID();
|
||||||
|
INSERT INTO `lyr-one`.`system_menu`(`id`, `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 (NULL, '其他资料查询', 'accounting:other:query', 3, 1, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-25 13:37:12', '', '2023-09-25 13:37:12', b'0');
|
||||||
|
INSERT INTO `lyr-one`.`system_menu`(`id`, `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 (NULL, '其他资料创建', 'accounting:other:create', 3, 2, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-25 13:37:12', '', '2023-09-25 13:37:12', b'0');
|
||||||
|
INSERT INTO `lyr-one`.`system_menu`(`id`, `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 (NULL, '其他资料更新', 'accounting:other:update', 3, 3, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-25 13:37:12', '', '2023-09-25 13:37:12', b'0');
|
||||||
|
INSERT INTO `lyr-one`.`system_menu`(`id`, `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 (NULL, '其他资料删除', 'accounting:other:delete', 3, 4, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-25 13:37:12', '', '2023-09-25 13:37:12', b'0');
|
||||||
|
INSERT INTO `lyr-one`.`system_menu`(`id`, `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 (NULL, '其他资料导出', 'accounting:other:export', 3, 5, @menuId2, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-09-25 13:37:12', '', '2023-09-25 13:37:12', b'0');
|
||||||
|
|
||||||
|
-- 其他会计资料类型字典
|
||||||
|
INSERT INTO `lyr-one`.`system_dict_type`(`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (NULL, '会计其他资料', 'accounting_other_type', 0, NULL, '', '2023-09-25 13:29:05', '', '2023-09-25 13:29:05', b'0', '1970-01-01 00:00:00');
|
||||||
|
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '存款余额调节表', 'bank_reconciliation', 'accounting_other_type', 0, 'default', '', NULL, '', '2023-09-25 13:30:08', '', '2023-09-25 13:30:08', b'0');
|
||||||
|
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '银行对账单', 'bank_statement', 'accounting_other_type', 0, 'default', '', NULL, '', '2023-09-25 13:31:05', '', '2023-09-25 13:31:05', b'0');
|
||||||
|
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '纳税申报表', 'tax_return', 'accounting_other_type', 0, 'default', '', NULL, '', '2023-09-25 13:31:41', '', '2023-09-25 13:31:41', b'0');
|
||||||
|
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '认证抵扣', 'certification_credit', 'accounting_other_type', 0, 'default', '', NULL, '', '2023-09-25 13:32:30', '', '2023-09-25 13:32:30', b'0');
|
||||||
|
INSERT INTO `lyr-one`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (NULL, 0, '其他资料', 'other_details', 'accounting_other_type', 0, 'default', '', NULL, '', '2023-09-25 13:32:57', '', '2023-09-25 13:32:57', b'0');
|
@ -0,0 +1,122 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.controller.admin.other;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.IoUtil;
|
||||||
|
import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
||||||
|
import cn.iocoder.yudao.module.infra.service.file.FileService;
|
||||||
|
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.constraints.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import javax.servlet.http.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
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 static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.accounting.controller.admin.other.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.accounting.dal.dataobject.other.OtherDO;
|
||||||
|
import cn.iocoder.yudao.module.accounting.convert.other.OtherConvert;
|
||||||
|
import cn.iocoder.yudao.module.accounting.service.other.OtherService;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 其他资料")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/accounting/other")
|
||||||
|
@Validated
|
||||||
|
public class OtherController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OtherService otherService;
|
||||||
|
@Resource
|
||||||
|
private FileService fileService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建其他资料")
|
||||||
|
@PreAuthorize("@ss.hasPermission('accounting:other:create')")
|
||||||
|
public CommonResult<Long> createOther(@Valid @RequestBody OtherCreateReqVO createReqVO) {
|
||||||
|
return success(otherService.createOther(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新其他资料")
|
||||||
|
@PreAuthorize("@ss.hasPermission('accounting:other:update')")
|
||||||
|
public CommonResult<Boolean> updateOther(@Valid @RequestBody OtherUpdateReqVO updateReqVO) {
|
||||||
|
otherService.updateOther(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除其他资料")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('accounting:other:delete')")
|
||||||
|
public CommonResult<Boolean> deleteOther(@RequestParam("id") Long id) {
|
||||||
|
otherService.deleteOther(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得其他资料")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('accounting:other:query')")
|
||||||
|
public CommonResult<OtherRespVO> getOther(@RequestParam("id") Long id) {
|
||||||
|
OtherDO other = otherService.getOther(id);
|
||||||
|
return success(OtherConvert.INSTANCE.convert(other));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/upload")
|
||||||
|
@Operation(summary = "上传其他资料")
|
||||||
|
@Parameter(name = "multipartFile", description = "文件", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('accounting:other:create')")
|
||||||
|
public CommonResult<FileDO> upload(@RequestParam("multipartFile") MultipartFile multipartFile) throws IOException {
|
||||||
|
String fileUrl = fileService.createFile(multipartFile.getOriginalFilename(), null, IoUtil.readBytes(multipartFile.getInputStream()));
|
||||||
|
FilePageReqVO pageReqVO = new FilePageReqVO();
|
||||||
|
String lastSegment = fileUrl.substring(fileUrl.lastIndexOf("/") + 1);
|
||||||
|
pageReqVO.setPath(lastSegment);
|
||||||
|
PageResult<FileDO> filePage = fileService.getFilePage(pageReqVO);
|
||||||
|
return success(filePage.getList().get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Operation(summary = "获得其他资料列表")
|
||||||
|
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||||
|
@PreAuthorize("@ss.hasPermission('accounting:other:query')")
|
||||||
|
public CommonResult<List<OtherRespVO>> getOtherList(@RequestParam("ids") Collection<Long> ids) {
|
||||||
|
List<OtherDO> list = otherService.getOtherList(ids);
|
||||||
|
return success(OtherConvert.INSTANCE.convertList(list));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得其他资料分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('accounting:other:query')")
|
||||||
|
public CommonResult<PageResult<OtherRespVO>> getOtherPage(@Valid OtherPageReqVO pageVO) {
|
||||||
|
PageResult<OtherDO> pageResult = otherService.getOtherPage(pageVO);
|
||||||
|
return success(OtherConvert.INSTANCE.convertPage(pageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出其他资料 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('accounting:other:export')")
|
||||||
|
@OperateLog(type = EXPORT)
|
||||||
|
public void exportOtherExcel(@Valid OtherExportReqVO exportReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
List<OtherDO> list = otherService.getOtherList(exportReqVO);
|
||||||
|
// 导出 Excel
|
||||||
|
List<OtherExcelVO> datas = OtherConvert.INSTANCE.convertList02(list);
|
||||||
|
ExcelUtils.write(response, "其他资料.xls", "数据", OtherExcelVO.class, datas);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.controller.admin.other.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 OtherCreateReqVO extends OtherBaseVO {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,89 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.controller.admin.other.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 其他资料 Excel VO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class OtherExcelVO {
|
||||||
|
|
||||||
|
@ExcelProperty("主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ExcelProperty("表名")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ExcelProperty("OA/ERP流程编号")
|
||||||
|
private String flowCode;
|
||||||
|
|
||||||
|
@ExcelProperty("文件来源")
|
||||||
|
private String source;
|
||||||
|
|
||||||
|
@ExcelProperty("年度")
|
||||||
|
private String year;
|
||||||
|
|
||||||
|
@ExcelProperty("会计期间")
|
||||||
|
private String period;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "业务类型", converter = DictConvert.class)
|
||||||
|
@DictFormat("accounting_other_type") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中
|
||||||
|
private String businessType;
|
||||||
|
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@ExcelProperty("制单人")
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
@ExcelProperty("业务实体id")
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
@ExcelProperty("业务实体")
|
||||||
|
private String company;
|
||||||
|
|
||||||
|
@ExcelProperty("文件后缀")
|
||||||
|
private String suffix;
|
||||||
|
|
||||||
|
@ExcelProperty("文件地址")
|
||||||
|
private String fileUrl;
|
||||||
|
|
||||||
|
@ExcelProperty("绝对路径")
|
||||||
|
private String fileAp;
|
||||||
|
|
||||||
|
@ExcelProperty("流程号")
|
||||||
|
private String flowId;
|
||||||
|
|
||||||
|
@ExcelProperty("摘要")
|
||||||
|
private String note;
|
||||||
|
|
||||||
|
@ExcelProperty("所属部门id")
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
@ExcelProperty("所属部门")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
@ExcelProperty("归档id")
|
||||||
|
private Long recordId;
|
||||||
|
|
||||||
|
@ExcelProperty("用户id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@ExcelProperty("归档状态")
|
||||||
|
private String archiveState;
|
||||||
|
|
||||||
|
@ExcelProperty("备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,82 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.controller.admin.other.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 OtherPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "表名", example = "赵六")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "OA/ERP流程编号")
|
||||||
|
private String flowCode;
|
||||||
|
|
||||||
|
@Schema(description = "文件来源")
|
||||||
|
private String source;
|
||||||
|
|
||||||
|
@Schema(description = "年度")
|
||||||
|
private String year;
|
||||||
|
|
||||||
|
@Schema(description = "会计期间")
|
||||||
|
private String period;
|
||||||
|
|
||||||
|
@Schema(description = "业务类型", example = "1")
|
||||||
|
private String businessType;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
@Schema(description = "制单人")
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
@Schema(description = "业务实体id", example = "22433")
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
@Schema(description = "业务实体")
|
||||||
|
private String company;
|
||||||
|
|
||||||
|
@Schema(description = "文件后缀")
|
||||||
|
private String suffix;
|
||||||
|
|
||||||
|
@Schema(description = "文件地址", example = "https://www.iocoder.cn")
|
||||||
|
private String fileUrl;
|
||||||
|
|
||||||
|
@Schema(description = "绝对路径")
|
||||||
|
private String fileAp;
|
||||||
|
|
||||||
|
@Schema(description = "流程号", example = "29101")
|
||||||
|
private String flowId;
|
||||||
|
|
||||||
|
@Schema(description = "摘要")
|
||||||
|
private String note;
|
||||||
|
|
||||||
|
@Schema(description = "所属部门id", example = "29666")
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
@Schema(description = "所属部门", example = "王五")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
@Schema(description = "归档id", example = "15741")
|
||||||
|
private Long recordId;
|
||||||
|
|
||||||
|
@Schema(description = "用户id", example = "24359")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "归档状态")
|
||||||
|
private String archiveState;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "你猜")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.controller.admin.other.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 OtherRespVO extends OtherBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "24570")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "文件后缀")
|
||||||
|
private String suffix;
|
||||||
|
|
||||||
|
@Schema(description = "文件地址", example = "https://www.iocoder.cn")
|
||||||
|
private String fileUrl;
|
||||||
|
|
||||||
|
@Schema(description = "绝对路径")
|
||||||
|
private String fileAp;
|
||||||
|
|
||||||
|
@Schema(description = "流程号", example = "29101")
|
||||||
|
private String flowId;
|
||||||
|
|
||||||
|
@Schema(description = "所属部门id", example = "29666")
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
@Schema(description = "所属部门", example = "王五")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
@Schema(description = "归档id", example = "15741")
|
||||||
|
private Long recordId;
|
||||||
|
|
||||||
|
@Schema(description = "用户id", example = "24359")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "归档状态")
|
||||||
|
private String archiveState;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.controller.admin.other.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 OtherUpdateReqVO extends OtherBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "24570")
|
||||||
|
@NotNull(message = "主键不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.convert.other;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
import cn.iocoder.yudao.module.accounting.controller.admin.other.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.accounting.dal.dataobject.other.OtherDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 其他资料 Convert
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface OtherConvert {
|
||||||
|
|
||||||
|
OtherConvert INSTANCE = Mappers.getMapper(OtherConvert.class);
|
||||||
|
|
||||||
|
OtherDO convert(OtherCreateReqVO bean);
|
||||||
|
|
||||||
|
OtherDO convert(OtherUpdateReqVO bean);
|
||||||
|
|
||||||
|
OtherRespVO convert(OtherDO bean);
|
||||||
|
|
||||||
|
List<OtherRespVO> convertList(List<OtherDO> list);
|
||||||
|
|
||||||
|
PageResult<OtherRespVO> convertPage(PageResult<OtherDO> page);
|
||||||
|
|
||||||
|
List<OtherExcelVO> convertList02(List<OtherDO> list);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,129 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.dal.dataobject.other;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
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("accounting_other")
|
||||||
|
@KeySequence("accounting_other_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class OtherDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 表名
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* OA/ERP流程编号
|
||||||
|
*/
|
||||||
|
private String flowCode;
|
||||||
|
/**
|
||||||
|
* 文件来源
|
||||||
|
*/
|
||||||
|
private String source;
|
||||||
|
/**
|
||||||
|
* 年度
|
||||||
|
*/
|
||||||
|
private String year;
|
||||||
|
/**
|
||||||
|
* 会计期间
|
||||||
|
*/
|
||||||
|
private String period;
|
||||||
|
/**
|
||||||
|
* 业务类型
|
||||||
|
*
|
||||||
|
* 枚举 {@link TODO accounting_other_type 对应的类}
|
||||||
|
*/
|
||||||
|
private String businessType;
|
||||||
|
/**
|
||||||
|
* 制单人
|
||||||
|
*/
|
||||||
|
private String createBy;
|
||||||
|
/**
|
||||||
|
* 业务实体id
|
||||||
|
*/
|
||||||
|
private Long companyId;
|
||||||
|
/**
|
||||||
|
* 业务实体
|
||||||
|
*/
|
||||||
|
private String company;
|
||||||
|
/**
|
||||||
|
* 文件后缀
|
||||||
|
*/
|
||||||
|
private String suffix;
|
||||||
|
/**
|
||||||
|
* 文件地址
|
||||||
|
*/
|
||||||
|
private String fileUrl;
|
||||||
|
/**
|
||||||
|
* 绝对路径
|
||||||
|
*/
|
||||||
|
private String fileAp;
|
||||||
|
/**
|
||||||
|
* 流程号
|
||||||
|
*/
|
||||||
|
private String flowId;
|
||||||
|
/**
|
||||||
|
* 摘要
|
||||||
|
*/
|
||||||
|
private String note;
|
||||||
|
/**
|
||||||
|
* 所属部门id
|
||||||
|
*/
|
||||||
|
private Long deptId;
|
||||||
|
/**
|
||||||
|
* 所属部门
|
||||||
|
*/
|
||||||
|
private String deptName;
|
||||||
|
/**
|
||||||
|
* 归档id
|
||||||
|
*/
|
||||||
|
private Long recordId;
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 归档状态
|
||||||
|
*/
|
||||||
|
private String archiveState;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 预留字段1
|
||||||
|
*/
|
||||||
|
private String attr1;
|
||||||
|
/**
|
||||||
|
* 预留字段2
|
||||||
|
*/
|
||||||
|
private String attr2;
|
||||||
|
/**
|
||||||
|
* 预留字段3
|
||||||
|
*/
|
||||||
|
private Integer attr3;
|
||||||
|
/**
|
||||||
|
* 预留字段4
|
||||||
|
*/
|
||||||
|
private Integer attr4;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,72 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.dal.mysql.other;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.accounting.dal.dataobject.other.OtherDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.accounting.controller.admin.other.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 其他资料 Mapper
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface OtherMapper extends BaseMapperX<OtherDO> {
|
||||||
|
|
||||||
|
default PageResult<OtherDO> selectPage(OtherPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<OtherDO>()
|
||||||
|
.likeIfPresent(OtherDO::getName, reqVO.getName())
|
||||||
|
.eqIfPresent(OtherDO::getFlowCode, reqVO.getFlowCode())
|
||||||
|
.eqIfPresent(OtherDO::getSource, reqVO.getSource())
|
||||||
|
.eqIfPresent(OtherDO::getYear, reqVO.getYear())
|
||||||
|
.eqIfPresent(OtherDO::getPeriod, reqVO.getPeriod())
|
||||||
|
.eqIfPresent(OtherDO::getBusinessType, reqVO.getBusinessType())
|
||||||
|
.betweenIfPresent(OtherDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.eqIfPresent(OtherDO::getCreateBy, reqVO.getCreateBy())
|
||||||
|
.eqIfPresent(OtherDO::getCompanyId, reqVO.getCompanyId())
|
||||||
|
.eqIfPresent(OtherDO::getCompany, reqVO.getCompany())
|
||||||
|
.eqIfPresent(OtherDO::getSuffix, reqVO.getSuffix())
|
||||||
|
.eqIfPresent(OtherDO::getFileUrl, reqVO.getFileUrl())
|
||||||
|
.eqIfPresent(OtherDO::getFileAp, reqVO.getFileAp())
|
||||||
|
.eqIfPresent(OtherDO::getFlowId, reqVO.getFlowId())
|
||||||
|
.eqIfPresent(OtherDO::getNote, reqVO.getNote())
|
||||||
|
.eqIfPresent(OtherDO::getDeptId, reqVO.getDeptId())
|
||||||
|
.likeIfPresent(OtherDO::getDeptName, reqVO.getDeptName())
|
||||||
|
.eqIfPresent(OtherDO::getRecordId, reqVO.getRecordId())
|
||||||
|
.eqIfPresent(OtherDO::getUserId, reqVO.getUserId())
|
||||||
|
.eqIfPresent(OtherDO::getArchiveState, reqVO.getArchiveState())
|
||||||
|
.eqIfPresent(OtherDO::getRemark, reqVO.getRemark())
|
||||||
|
.orderByDesc(OtherDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
default List<OtherDO> selectList(OtherExportReqVO reqVO) {
|
||||||
|
return selectList(new LambdaQueryWrapperX<OtherDO>()
|
||||||
|
.likeIfPresent(OtherDO::getName, reqVO.getName())
|
||||||
|
.eqIfPresent(OtherDO::getFlowCode, reqVO.getFlowCode())
|
||||||
|
.eqIfPresent(OtherDO::getSource, reqVO.getSource())
|
||||||
|
.eqIfPresent(OtherDO::getYear, reqVO.getYear())
|
||||||
|
.eqIfPresent(OtherDO::getPeriod, reqVO.getPeriod())
|
||||||
|
.eqIfPresent(OtherDO::getBusinessType, reqVO.getBusinessType())
|
||||||
|
.betweenIfPresent(OtherDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.eqIfPresent(OtherDO::getCreateBy, reqVO.getCreateBy())
|
||||||
|
.eqIfPresent(OtherDO::getCompanyId, reqVO.getCompanyId())
|
||||||
|
.eqIfPresent(OtherDO::getCompany, reqVO.getCompany())
|
||||||
|
.eqIfPresent(OtherDO::getSuffix, reqVO.getSuffix())
|
||||||
|
.eqIfPresent(OtherDO::getFileUrl, reqVO.getFileUrl())
|
||||||
|
.eqIfPresent(OtherDO::getFileAp, reqVO.getFileAp())
|
||||||
|
.eqIfPresent(OtherDO::getFlowId, reqVO.getFlowId())
|
||||||
|
.eqIfPresent(OtherDO::getNote, reqVO.getNote())
|
||||||
|
.eqIfPresent(OtherDO::getDeptId, reqVO.getDeptId())
|
||||||
|
.likeIfPresent(OtherDO::getDeptName, reqVO.getDeptName())
|
||||||
|
.eqIfPresent(OtherDO::getRecordId, reqVO.getRecordId())
|
||||||
|
.eqIfPresent(OtherDO::getUserId, reqVO.getUserId())
|
||||||
|
.eqIfPresent(OtherDO::getArchiveState, reqVO.getArchiveState())
|
||||||
|
.eqIfPresent(OtherDO::getRemark, reqVO.getRemark())
|
||||||
|
.orderByDesc(OtherDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.service.other;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.accounting.controller.admin.other.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.accounting.dal.dataobject.other.OtherDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 其他资料 Service 接口
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public interface OtherService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建其他资料
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createOther(@Valid OtherCreateReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新其他资料
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateOther(@Valid OtherUpdateReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除其他资料
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteOther(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得其他资料
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 其他资料
|
||||||
|
*/
|
||||||
|
OtherDO getOther(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得其他资料列表
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
* @return 其他资料列表
|
||||||
|
*/
|
||||||
|
List<OtherDO> getOtherList(Collection<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得其他资料分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 其他资料分页
|
||||||
|
*/
|
||||||
|
PageResult<OtherDO> getOtherPage(OtherPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得其他资料列表, 用于 Excel 导出
|
||||||
|
*
|
||||||
|
* @param exportReqVO 查询条件
|
||||||
|
* @return 其他资料列表
|
||||||
|
*/
|
||||||
|
List<OtherDO> getOtherList(OtherExportReqVO exportReqVO);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,82 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.service.other;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.accounting.controller.admin.other.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.accounting.dal.dataobject.other.OtherDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.accounting.convert.other.OtherConvert;
|
||||||
|
import cn.iocoder.yudao.module.accounting.dal.mysql.other.OtherMapper;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.accounting.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 其他资料 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class OtherServiceImpl implements OtherService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OtherMapper otherMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createOther(OtherCreateReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
OtherDO other = OtherConvert.INSTANCE.convert(createReqVO);
|
||||||
|
otherMapper.insert(other);
|
||||||
|
// 返回
|
||||||
|
return other.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateOther(OtherUpdateReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateOtherExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
OtherDO updateObj = OtherConvert.INSTANCE.convert(updateReqVO);
|
||||||
|
otherMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteOther(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateOtherExists(id);
|
||||||
|
// 删除
|
||||||
|
otherMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateOtherExists(Long id) {
|
||||||
|
if (otherMapper.selectById(id) == null) {
|
||||||
|
throw exception(OTHER_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OtherDO getOther(Long id) {
|
||||||
|
return otherMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<OtherDO> getOtherList(Collection<Long> ids) {
|
||||||
|
return otherMapper.selectBatchIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<OtherDO> getOtherPage(OtherPageReqVO pageReqVO) {
|
||||||
|
return otherMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<OtherDO> getOtherList(OtherExportReqVO exportReqVO) {
|
||||||
|
return otherMapper.selectList(exportReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,311 @@
|
|||||||
|
package cn.iocoder.yudao.module.accounting.service.other;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Disabled;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.accounting.controller.admin.other.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.accounting.dal.dataobject.other.OtherDO;
|
||||||
|
import cn.iocoder.yudao.module.accounting.dal.mysql.other.OtherMapper;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.hutool.core.util.RandomUtil.*;
|
||||||
|
import static cn.iocoder.yudao.module.accounting.enums.ErrorCodeConstants.*;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link OtherServiceImpl} 的单元测试类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Import(OtherServiceImpl.class)
|
||||||
|
public class OtherServiceImplTest extends BaseDbUnitTest {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OtherServiceImpl otherService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OtherMapper otherMapper;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateOther_success() {
|
||||||
|
// 准备参数
|
||||||
|
OtherCreateReqVO reqVO = randomPojo(OtherCreateReqVO.class);
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
Long otherId = otherService.createOther(reqVO);
|
||||||
|
// 断言
|
||||||
|
assertNotNull(otherId);
|
||||||
|
// 校验记录的属性是否正确
|
||||||
|
OtherDO other = otherMapper.selectById(otherId);
|
||||||
|
assertPojoEquals(reqVO, other);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateOther_success() {
|
||||||
|
// mock 数据
|
||||||
|
OtherDO dbOther = randomPojo(OtherDO.class);
|
||||||
|
otherMapper.insert(dbOther);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
OtherUpdateReqVO reqVO = randomPojo(OtherUpdateReqVO.class, o -> {
|
||||||
|
o.setId(dbOther.getId()); // 设置更新的 ID
|
||||||
|
});
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
otherService.updateOther(reqVO);
|
||||||
|
// 校验是否更新正确
|
||||||
|
OtherDO other = otherMapper.selectById(reqVO.getId()); // 获取最新的
|
||||||
|
assertPojoEquals(reqVO, other);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateOther_notExists() {
|
||||||
|
// 准备参数
|
||||||
|
OtherUpdateReqVO reqVO = randomPojo(OtherUpdateReqVO.class);
|
||||||
|
|
||||||
|
// 调用, 并断言异常
|
||||||
|
assertServiceException(() -> otherService.updateOther(reqVO), OTHER_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteOther_success() {
|
||||||
|
// mock 数据
|
||||||
|
OtherDO dbOther = randomPojo(OtherDO.class);
|
||||||
|
otherMapper.insert(dbOther);// @Sql: 先插入出一条存在的数据
|
||||||
|
// 准备参数
|
||||||
|
Long id = dbOther.getId();
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
otherService.deleteOther(id);
|
||||||
|
// 校验数据不存在了
|
||||||
|
assertNull(otherMapper.selectById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteOther_notExists() {
|
||||||
|
// 准备参数
|
||||||
|
Long id = randomLongId();
|
||||||
|
|
||||||
|
// 调用, 并断言异常
|
||||||
|
assertServiceException(() -> otherService.deleteOther(id), OTHER_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||||
|
public void testGetOtherPage() {
|
||||||
|
// mock 数据
|
||||||
|
OtherDO dbOther = randomPojo(OtherDO.class, o -> { // 等会查询到
|
||||||
|
o.setName(null);
|
||||||
|
o.setFlowCode(null);
|
||||||
|
o.setSource(null);
|
||||||
|
o.setYear(null);
|
||||||
|
o.setPeriod(null);
|
||||||
|
o.setBusinessType(null);
|
||||||
|
o.setCreateTime(null);
|
||||||
|
o.setCreateBy(null);
|
||||||
|
o.setCompanyId(null);
|
||||||
|
o.setCompany(null);
|
||||||
|
o.setSuffix(null);
|
||||||
|
o.setFileUrl(null);
|
||||||
|
o.setFileAp(null);
|
||||||
|
o.setFlowId(null);
|
||||||
|
o.setNote(null);
|
||||||
|
o.setDeptId(null);
|
||||||
|
o.setDeptName(null);
|
||||||
|
o.setRecordId(null);
|
||||||
|
o.setUserId(null);
|
||||||
|
o.setArchiveState(null);
|
||||||
|
o.setRemark(null);
|
||||||
|
});
|
||||||
|
otherMapper.insert(dbOther);
|
||||||
|
// 测试 name 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setName(null)));
|
||||||
|
// 测试 flowCode 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFlowCode(null)));
|
||||||
|
// 测试 source 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setSource(null)));
|
||||||
|
// 测试 year 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setYear(null)));
|
||||||
|
// 测试 period 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setPeriod(null)));
|
||||||
|
// 测试 businessType 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setBusinessType(null)));
|
||||||
|
// 测试 createTime 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCreateTime(null)));
|
||||||
|
// 测试 createBy 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCreateBy(null)));
|
||||||
|
// 测试 companyId 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCompanyId(null)));
|
||||||
|
// 测试 company 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCompany(null)));
|
||||||
|
// 测试 suffix 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setSuffix(null)));
|
||||||
|
// 测试 fileUrl 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFileUrl(null)));
|
||||||
|
// 测试 fileAp 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFileAp(null)));
|
||||||
|
// 测试 flowId 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFlowId(null)));
|
||||||
|
// 测试 note 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setNote(null)));
|
||||||
|
// 测试 deptId 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setDeptId(null)));
|
||||||
|
// 测试 deptName 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setDeptName(null)));
|
||||||
|
// 测试 recordId 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setRecordId(null)));
|
||||||
|
// 测试 userId 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setUserId(null)));
|
||||||
|
// 测试 archiveState 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setArchiveState(null)));
|
||||||
|
// 测试 remark 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setRemark(null)));
|
||||||
|
// 准备参数
|
||||||
|
OtherPageReqVO reqVO = new OtherPageReqVO();
|
||||||
|
reqVO.setName(null);
|
||||||
|
reqVO.setFlowCode(null);
|
||||||
|
reqVO.setSource(null);
|
||||||
|
reqVO.setYear(null);
|
||||||
|
reqVO.setPeriod(null);
|
||||||
|
reqVO.setBusinessType(null);
|
||||||
|
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||||
|
reqVO.setCreateBy(null);
|
||||||
|
reqVO.setCompanyId(null);
|
||||||
|
reqVO.setCompany(null);
|
||||||
|
reqVO.setSuffix(null);
|
||||||
|
reqVO.setFileUrl(null);
|
||||||
|
reqVO.setFileAp(null);
|
||||||
|
reqVO.setFlowId(null);
|
||||||
|
reqVO.setNote(null);
|
||||||
|
reqVO.setDeptId(null);
|
||||||
|
reqVO.setDeptName(null);
|
||||||
|
reqVO.setRecordId(null);
|
||||||
|
reqVO.setUserId(null);
|
||||||
|
reqVO.setArchiveState(null);
|
||||||
|
reqVO.setRemark(null);
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
PageResult<OtherDO> pageResult = otherService.getOtherPage(reqVO);
|
||||||
|
// 断言
|
||||||
|
assertEquals(1, pageResult.getTotal());
|
||||||
|
assertEquals(1, pageResult.getList().size());
|
||||||
|
assertPojoEquals(dbOther, pageResult.getList().get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||||
|
public void testGetOtherList() {
|
||||||
|
// mock 数据
|
||||||
|
OtherDO dbOther = randomPojo(OtherDO.class, o -> { // 等会查询到
|
||||||
|
o.setName(null);
|
||||||
|
o.setFlowCode(null);
|
||||||
|
o.setSource(null);
|
||||||
|
o.setYear(null);
|
||||||
|
o.setPeriod(null);
|
||||||
|
o.setBusinessType(null);
|
||||||
|
o.setCreateTime(null);
|
||||||
|
o.setCreateBy(null);
|
||||||
|
o.setCompanyId(null);
|
||||||
|
o.setCompany(null);
|
||||||
|
o.setSuffix(null);
|
||||||
|
o.setFileUrl(null);
|
||||||
|
o.setFileAp(null);
|
||||||
|
o.setFlowId(null);
|
||||||
|
o.setNote(null);
|
||||||
|
o.setDeptId(null);
|
||||||
|
o.setDeptName(null);
|
||||||
|
o.setRecordId(null);
|
||||||
|
o.setUserId(null);
|
||||||
|
o.setArchiveState(null);
|
||||||
|
o.setRemark(null);
|
||||||
|
});
|
||||||
|
otherMapper.insert(dbOther);
|
||||||
|
// 测试 name 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setName(null)));
|
||||||
|
// 测试 flowCode 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFlowCode(null)));
|
||||||
|
// 测试 source 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setSource(null)));
|
||||||
|
// 测试 year 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setYear(null)));
|
||||||
|
// 测试 period 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setPeriod(null)));
|
||||||
|
// 测试 businessType 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setBusinessType(null)));
|
||||||
|
// 测试 createTime 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCreateTime(null)));
|
||||||
|
// 测试 createBy 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCreateBy(null)));
|
||||||
|
// 测试 companyId 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCompanyId(null)));
|
||||||
|
// 测试 company 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setCompany(null)));
|
||||||
|
// 测试 suffix 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setSuffix(null)));
|
||||||
|
// 测试 fileUrl 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFileUrl(null)));
|
||||||
|
// 测试 fileAp 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFileAp(null)));
|
||||||
|
// 测试 flowId 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setFlowId(null)));
|
||||||
|
// 测试 note 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setNote(null)));
|
||||||
|
// 测试 deptId 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setDeptId(null)));
|
||||||
|
// 测试 deptName 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setDeptName(null)));
|
||||||
|
// 测试 recordId 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setRecordId(null)));
|
||||||
|
// 测试 userId 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setUserId(null)));
|
||||||
|
// 测试 archiveState 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setArchiveState(null)));
|
||||||
|
// 测试 remark 不匹配
|
||||||
|
otherMapper.insert(cloneIgnoreId(dbOther, o -> o.setRemark(null)));
|
||||||
|
// 准备参数
|
||||||
|
OtherExportReqVO reqVO = new OtherExportReqVO();
|
||||||
|
reqVO.setName(null);
|
||||||
|
reqVO.setFlowCode(null);
|
||||||
|
reqVO.setSource(null);
|
||||||
|
reqVO.setYear(null);
|
||||||
|
reqVO.setPeriod(null);
|
||||||
|
reqVO.setBusinessType(null);
|
||||||
|
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||||
|
reqVO.setCreateBy(null);
|
||||||
|
reqVO.setCompanyId(null);
|
||||||
|
reqVO.setCompany(null);
|
||||||
|
reqVO.setSuffix(null);
|
||||||
|
reqVO.setFileUrl(null);
|
||||||
|
reqVO.setFileAp(null);
|
||||||
|
reqVO.setFlowId(null);
|
||||||
|
reqVO.setNote(null);
|
||||||
|
reqVO.setDeptId(null);
|
||||||
|
reqVO.setDeptName(null);
|
||||||
|
reqVO.setRecordId(null);
|
||||||
|
reqVO.setUserId(null);
|
||||||
|
reqVO.setArchiveState(null);
|
||||||
|
reqVO.setRemark(null);
|
||||||
|
|
||||||
|
// 调用
|
||||||
|
List<OtherDO> list = otherService.getOtherList(reqVO);
|
||||||
|
// 断言
|
||||||
|
assertEquals(1, list.size());
|
||||||
|
assertPojoEquals(dbOther, list.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue