JilingLee 1 year ago
commit 19950dbaa9

@ -22,3 +22,11 @@ CREATE TABLE `lyr-one`.`archives_authenticate` (
`deleted` bit(1) NULL DEFAULT b'0' COMMENT '',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '' ROW_FORMAT = Dynamic;
-- ,
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 ( '', '', 1, 1, 0, '/fileAuth', 'checkbox', NULL, NULL, 0, b'1', b'1', b'1', '', '2023-09-14 13:45:31', '', '2023-09-14 15:26:21', b'0');
SET @menuId = 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 ('', 'fileAuth:authenticate:list', 2, 1, @menuId, 'authenticate', 'clipboard', 'fileAuth/authenticate/index', 'authenticate', 0, b'1', b'1', b'1', '', '2023-09-14 13:57:30', '', '2023-09-14 13:57:30', 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 ( '', 'fileAuth:authRecord:list', 2, 2, @menuId, 'authRecord', 'build', 'fileAuth/authRecord/index', 'authRecord', 0, b'1', b'1', b'1', '', '2023-09-14 13:59:15', '', '2023-09-14 13:59:38', b'0');

@ -78,6 +78,12 @@
<artifactId>yudao-spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

@ -5,6 +5,7 @@ import cn.hutool.core.util.IdUtil;
import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Validation;
@ -12,23 +13,23 @@ public class S3FileClientTest {
@Test
@Disabled // MinIO如果要集成测试可以注释本行
public void testMinIO() throws Exception {
public void testMinIO(MultipartFile file) throws Exception {
S3FileClientConfig config = new S3FileClientConfig();
// 配置成你自己的
config.setAccessKey("admin");
config.setAccessSecret("password");
config.setBucket("yudaoyuanma");
config.setAccessKey("minioadmin");
config.setAccessSecret("minioadmin");
config.setBucket("ktg-mes");
config.setDomain(null);
// 默认 9000 endpoint
config.setEndpoint("http://127.0.0.1:9000");
config.setEndpoint("https://www.lyrfp.com");
// 执行上传
testExecuteUpload(config);
testExecuteUpload(config,file);
}
@Test
@Disabled // 阿里云 OSS如果要集成测试可以注释本行
public void testAliyun() throws Exception {
public void testAliyun(MultipartFile file) throws Exception {
S3FileClientConfig config = new S3FileClientConfig();
// 配置成你自己的
config.setAccessKey(System.getenv("ALIYUN_ACCESS_KEY"));
@ -39,12 +40,12 @@ public class S3FileClientTest {
config.setEndpoint("oss-cn-beijing.aliyuncs.com");
// 执行上传
testExecuteUpload(config);
testExecuteUpload(config,file);
}
@Test
@Disabled // 腾讯云 COS如果要集成测试可以注释本行
public void testQCloud() throws Exception {
public void testQCloud(MultipartFile file) throws Exception {
S3FileClientConfig config = new S3FileClientConfig();
// 配置成你自己的
config.setAccessKey(System.getenv("QCLOUD_ACCESS_KEY"));
@ -55,12 +56,12 @@ public class S3FileClientTest {
config.setEndpoint("cos.ap-shanghai.myqcloud.com");
// 执行上传
testExecuteUpload(config);
testExecuteUpload(config,file);
}
@Test
@Disabled // 七牛云存储,如果要集成测试,可以注释本行
public void testQiniu() throws Exception {
public void testQiniu(MultipartFile file) throws Exception {
S3FileClientConfig config = new S3FileClientConfig();
// 配置成你自己的
// config.setAccessKey(System.getenv("QINIU_ACCESS_KEY"));
@ -73,12 +74,12 @@ public class S3FileClientTest {
config.setEndpoint("s3-cn-south-1.qiniucs.com");
// 执行上传
testExecuteUpload(config);
testExecuteUpload(config,file);
}
@Test
@Disabled // 华为云存储,如果要集成测试,可以注释本行
public void testHuaweiCloud() throws Exception {
public void testHuaweiCloud(MultipartFile file) throws Exception {
S3FileClientConfig config = new S3FileClientConfig();
// 配置成你自己的
// config.setAccessKey(System.getenv("HUAWEI_CLOUD_ACCESS_KEY"));
@ -89,19 +90,19 @@ public class S3FileClientTest {
config.setEndpoint("obs.cn-east-3.myhuaweicloud.com");
// 执行上传
testExecuteUpload(config);
testExecuteUpload(config,file);
}
private void testExecuteUpload(S3FileClientConfig config) throws Exception {
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 = IdUtil.fastSimpleUUID() + ".jpg";
byte[] content = ResourceUtil.readBytes("file/erweima.jpg");
String fullPath = client.upload(content, path, "image/jpeg");
String path = IdUtil.fastSimpleUUID() + ".xlsx";
// byte[] content = ResourceUtil.readBytes(file);
String fullPath = client.upload(file.getBytes(), path, "xlsx");
System.out.println("访问地址:" + fullPath);
// 读取文件
if (true) {
@ -112,6 +113,7 @@ public class S3FileClientTest {
if (false) {
client.delete(path);
}
return fullPath;
}
}

@ -68,9 +68,11 @@ public class AuthenticateController {
@PostMapping("/create/apply")
@Operation(summary = "创建档案鉴定申请")
@PreAuthorize("@ss.hasPermission('archives:authenticate:create')")
public CommonResult<Long> createApply(@Valid @RequestBody AuthenticateCreateReqVO createReqVO) {
public CommonResult<Long> createApply(@Valid @RequestBody List<AuthenticateCreateReqVO> createReqVO) {
return success(authenticateService.createApply(createReqVO));
}
@Operation(summary = "创建档案鉴定历史")
@PreAuthorize("@ss.hasPermission('archives:authenticate:create')")
@PostMapping("/create")

@ -72,5 +72,5 @@ public interface AuthenticateService {
* @param createReqVO
* @return
*/
Long createApply(AuthenticateCreateReqVO createReqVO);
Long createApply(List<AuthenticateCreateReqVO> createReqVO);
}

@ -97,17 +97,21 @@ public class AuthenticateServiceImpl implements AuthenticateService {
*/
@Override
@Transactional
public Long createApply(AuthenticateCreateReqVO createReqVO) {
AuthenticateDO authenticate = AuthenticateConvert.INSTANCE.convert(createReqVO);
public Long createApply(List<AuthenticateCreateReqVO> createReqVO) {
for (AuthenticateCreateReqVO vo: createReqVO) {
RecordDO record = recordMapper.selectById(vo.getRecordId());
//修改档案状态为已鉴定
RecordDO recordDO = new RecordDO();
LambdaUpdateWrapper<RecordDO> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(RecordDO::getIdentifyStatus,1).eq(RecordDO::getId,createReqVO.getRecordId());
recordMapper.update(recordDO,wrapper);
record.setIdentifyStatus("1");
recordMapper.updateById(record);
//设置档案类型和档案位置
vo.setType(record.getFileType());
vo.setPosition(record.getSite());
AuthenticateDO authenticate = AuthenticateConvert.INSTANCE.convert(vo);
//新增鉴定申请记录
authenticateMapper.insert(authenticate);
return authenticate.getId();
}
return 200L;
}
}

@ -4,5 +4,5 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
public interface ErrorCodeConstants {
ErrorCode ELECTRONIC_ASSETS_NOT_EXISTS = new ErrorCode(300010, "资产档案不存在");
ErrorCode ELECTRONIC_CONTRACTS_NOT_EXISTS = new ErrorCode(300011, "合同档案不存在");
}

@ -0,0 +1,102 @@
package cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts;
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.ea.controller.admin.electroniccontracts.vo.*;
import cn.iocoder.yudao.module.ea.dal.dataobject.electroniccontracts.ElectronicContractsDO;
import cn.iocoder.yudao.module.ea.convert.electroniccontracts.ElectronicContractsConvert;
import cn.iocoder.yudao.module.ea.service.electroniccontracts.ElectronicContractsService;
@Tag(name = "管理后台 - 合同档案")
@RestController
@RequestMapping("/ea/electronic-contracts")
@Validated
public class ElectronicContractsController {
@Resource
private ElectronicContractsService electronicContractsService;
@PostMapping("/create")
@Operation(summary = "创建合同档案")
@PreAuthorize("@ss.hasPermission('ea:electronic-contracts:create')")
public CommonResult<Long> createElectronicContracts(@Valid @RequestBody ElectronicContractsCreateReqVO createReqVO) {
return success(electronicContractsService.createElectronicContracts(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新合同档案")
@PreAuthorize("@ss.hasPermission('ea:electronic-contracts:update')")
public CommonResult<Boolean> updateElectronicContracts(@Valid @RequestBody ElectronicContractsUpdateReqVO updateReqVO) {
electronicContractsService.updateElectronicContracts(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除合同档案")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('ea:electronic-contracts:delete')")
public CommonResult<Boolean> deleteElectronicContracts(@RequestParam("id") Long id) {
electronicContractsService.deleteElectronicContracts(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得合同档案")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('ea:electronic-contracts:query')")
public CommonResult<ElectronicContractsRespVO> getElectronicContracts(@RequestParam("id") Long id) {
ElectronicContractsDO electronicContracts = electronicContractsService.getElectronicContracts(id);
return success(ElectronicContractsConvert.INSTANCE.convert(electronicContracts));
}
@GetMapping("/list")
@Operation(summary = "获得合同档案列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('ea:electronic-contracts:query')")
public CommonResult<List<ElectronicContractsRespVO>> getElectronicContractsList(@RequestParam("ids") Collection<Long> ids) {
List<ElectronicContractsDO> list = electronicContractsService.getElectronicContractsList(ids);
return success(ElectronicContractsConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得合同档案分页")
@PreAuthorize("@ss.hasPermission('ea:electronic-contracts:query')")
public CommonResult<PageResult<ElectronicContractsRespVO>> getElectronicContractsPage(@Valid ElectronicContractsPageReqVO pageVO) {
PageResult<ElectronicContractsDO> pageResult = electronicContractsService.getElectronicContractsPage(pageVO);
return success(ElectronicContractsConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出合同档案 Excel")
@PreAuthorize("@ss.hasPermission('ea:electronic-contracts:export')")
@OperateLog(type = EXPORT)
public void exportElectronicContractsExcel(@Valid ElectronicContractsExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<ElectronicContractsDO> list = electronicContractsService.getElectronicContractsList(exportReqVO);
// 导出 Excel
List<ElectronicContractsExcelVO> datas = ElectronicContractsConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "合同档案.xls", "数据", ElectronicContractsExcelVO.class, datas);
}
}

@ -0,0 +1,94 @@
package cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDate;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import javax.validation.constraints.*;
/**
* Base VO VO 使
* VO Swagger
*/
@Data
public class ElectronicContractsBaseVO {
@Schema(description = "制单人")
private String createBy;
@Schema(description = "业务实体id", example = "15565")
private Long companyId;
@Schema(description = "业务实体")
private String company;
@Schema(description = "所属部门id", example = "10629")
private Long deptId;
@Schema(description = "所属部门", example = "赵六")
private String deptName;
@Schema(description = "合同编号")
private String contractCode;
@Schema(description = "合同名称")
private String contractTitle;
@Schema(description = "合同类型", example = "2")
private String contractType;
@Schema(description = "签署方")
private String signatory;
@Schema(description = "签署日期")
private LocalDate signDate;
@Schema(description = "生效日期")
private LocalDate effectiveDate;
@Schema(description = "截止日期")
private LocalDate expiryDate;
@Schema(description = "状态", example = "1")
private String contractStatus;
@Schema(description = "金额")
private Long contractAmount;
@Schema(description = "附件")
private String contractAttachment;
@Schema(description = "处理结果")
private String handleResult;
@Schema(description = "年度")
private String year;
@Schema(description = "月份")
private String period;
@Schema(description = "借阅状态", example = "1")
private String borrowStatus;
@Schema(description = "归档时间")
private String recordTime;
@Schema(description = "纸档位置")
private String position;
@Schema(description = "完整性")
private Integer cherks;
@Schema(description = "归档id一个归档id对应多个合同档案", example = "26409")
private Long recordId;
@Schema(description = "用户id", example = "7723")
private Long userId;
@Schema(description = "归档状态", example = "1")
private String fileStatus;
}

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts.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 ElectronicContractsCreateReqVO extends ElectronicContractsBaseVO {
}

@ -0,0 +1,102 @@
package cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDate;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.ExcelProperty;
/**
* Excel VO
*
* @author
*/
@Data
public class ElectronicContractsExcelVO {
@ExcelProperty("主键")
private Long id;
@ExcelProperty("制单人")
private String createBy;
@ExcelProperty("创建日期")
private LocalDateTime createTime;
@ExcelProperty("业务实体id")
private Long companyId;
@ExcelProperty("业务实体")
private String company;
@ExcelProperty("所属部门id")
private Long deptId;
@ExcelProperty("所属部门")
private String deptName;
@ExcelProperty("合同编号")
private String contractCode;
@ExcelProperty("合同名称")
private String contractTitle;
@ExcelProperty("合同类型")
private String contractType;
@ExcelProperty("签署方")
private String signatory;
@ExcelProperty("签署日期")
private LocalDate signDate;
@ExcelProperty("生效日期")
private LocalDate effectiveDate;
@ExcelProperty("截止日期")
private LocalDate expiryDate;
@ExcelProperty("状态")
private String contractStatus;
@ExcelProperty("金额")
private Long contractAmount;
@ExcelProperty("附件")
private String contractAttachment;
@ExcelProperty("处理结果")
private String handleResult;
@ExcelProperty("年度")
private String year;
@ExcelProperty("月份")
private String period;
@ExcelProperty("借阅状态")
private String borrowStatus;
@ExcelProperty("归档时间")
private String recordTime;
@ExcelProperty("纸档位置")
private String position;
@ExcelProperty("完整性")
private Integer cherks;
@ExcelProperty("归档id一个归档id对应多个合同档案")
private Long recordId;
@ExcelProperty("用户id")
private Long userId;
@ExcelProperty("归档状态")
private String fileStatus;
}

@ -0,0 +1,101 @@
package cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts.vo;
import lombok.*;
import java.time.LocalDate;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import java.time.LocalDateTime;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 合同档案 Excel 导出 Request VO参数和 ElectronicContractsPageReqVO 是一致的")
@Data
public class ElectronicContractsExportReqVO {
@Schema(description = "制单人")
private String createBy;
@Schema(description = "创建日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "业务实体id", example = "15565")
private Long companyId;
@Schema(description = "业务实体")
private String company;
@Schema(description = "所属部门id", example = "10629")
private Long deptId;
@Schema(description = "所属部门", example = "赵六")
private String deptName;
@Schema(description = "合同编号")
private String contractCode;
@Schema(description = "合同名称")
private String contractTitle;
@Schema(description = "合同类型", example = "2")
private String contractType;
@Schema(description = "签署方")
private String signatory;
@Schema(description = "签署日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDate[] signDate;
@Schema(description = "生效日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDate[] effectiveDate;
@Schema(description = "截止日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDate[] expiryDate;
@Schema(description = "状态", example = "1")
private String contractStatus;
@Schema(description = "金额")
private Long contractAmount;
@Schema(description = "附件")
private String contractAttachment;
@Schema(description = "处理结果")
private String handleResult;
@Schema(description = "年度")
private String year;
@Schema(description = "月份")
private String period;
@Schema(description = "借阅状态", example = "1")
private String borrowStatus;
@Schema(description = "归档时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String[] recordTime;
@Schema(description = "纸档位置")
private String position;
@Schema(description = "完整性")
private Integer cherks;
@Schema(description = "归档id一个归档id对应多个合同档案", example = "26409")
private Long recordId;
@Schema(description = "用户id", example = "7723")
private Long userId;
@Schema(description = "归档状态", example = "1")
private String fileStatus;
}

@ -0,0 +1,103 @@
package cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts.vo;
import lombok.*;
import java.time.LocalDate;
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 ElectronicContractsPageReqVO extends PageParam {
@Schema(description = "制单人")
private String createBy;
@Schema(description = "创建日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "业务实体id", example = "15565")
private Long companyId;
@Schema(description = "业务实体")
private String company;
@Schema(description = "所属部门id", example = "10629")
private Long deptId;
@Schema(description = "所属部门", example = "赵六")
private String deptName;
@Schema(description = "合同编号")
private String contractCode;
@Schema(description = "合同名称")
private String contractTitle;
@Schema(description = "合同类型", example = "2")
private String contractType;
@Schema(description = "签署方")
private String signatory;
@Schema(description = "签署日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDate[] signDate;
@Schema(description = "生效日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDate[] effectiveDate;
@Schema(description = "截止日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDate[] expiryDate;
@Schema(description = "状态", example = "1")
private String contractStatus;
@Schema(description = "金额")
private Long contractAmount;
@Schema(description = "附件")
private String contractAttachment;
@Schema(description = "处理结果")
private String handleResult;
@Schema(description = "年度")
private String year;
@Schema(description = "月份")
private String period;
@Schema(description = "借阅状态", example = "1")
private String borrowStatus;
@Schema(description = "归档时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String[] recordTime;
@Schema(description = "纸档位置")
private String position;
@Schema(description = "完整性")
private Integer cherks;
@Schema(description = "归档id一个归档id对应多个合同档案", example = "26409")
private Long recordId;
@Schema(description = "用户id", example = "7723")
private Long userId;
@Schema(description = "归档状态", example = "1")
private String fileStatus;
}

@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts.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 ElectronicContractsRespVO extends ElectronicContractsBaseVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32308")
private Long id;
@Schema(description = "创建日期")
private LocalDateTime createTime;
}

@ -0,0 +1,18 @@
package cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts.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 ElectronicContractsUpdateReqVO extends ElectronicContractsBaseVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32308")
@NotNull(message = "主键不能为空")
private Long id;
}

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.ea.convert.electroniccontracts;
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.ea.controller.admin.electroniccontracts.vo.*;
import cn.iocoder.yudao.module.ea.dal.dataobject.electroniccontracts.ElectronicContractsDO;
/**
* Convert
*
* @author
*/
@Mapper
public interface ElectronicContractsConvert {
ElectronicContractsConvert INSTANCE = Mappers.getMapper(ElectronicContractsConvert.class);
ElectronicContractsDO convert(ElectronicContractsCreateReqVO bean);
ElectronicContractsDO convert(ElectronicContractsUpdateReqVO bean);
ElectronicContractsRespVO convert(ElectronicContractsDO bean);
List<ElectronicContractsRespVO> convertList(List<ElectronicContractsDO> list);
PageResult<ElectronicContractsRespVO> convertPage(PageResult<ElectronicContractsDO> page);
List<ElectronicContractsExcelVO> convertList02(List<ElectronicContractsDO> list);
}

@ -0,0 +1,132 @@
package cn.iocoder.yudao.module.ea.dal.dataobject.electroniccontracts;
import lombok.*;
import java.time.LocalDate;
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("ea_electronic_contracts")
@KeySequence("ea_electronic_contracts_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ElectronicContractsDO extends BaseDO {
/**
*
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
*
*/
private String createBy;
/**
* id
*/
private Long companyId;
/**
*
*/
private String company;
/**
* id
*/
private Long deptId;
/**
*
*/
private String deptName;
/**
*
*/
private String contractCode;
/**
*
*/
private String contractTitle;
/**
*
*/
private String contractType;
/**
*
*/
private String signatory;
/**
*
*/
private LocalDate signDate;
/**
*
*/
private LocalDate effectiveDate;
/**
*
*/
private LocalDate expiryDate;
/**
*
*/
private String contractStatus;
/**
*
*/
private Long contractAmount;
/**
*
*/
private String contractAttachment;
/**
*
*/
private String handleResult;
/**
*
*/
private String year;
/**
*
*/
private String period;
/**
*
*/
private String borrowStatus;
/**
*
*/
private String recordTime;
/**
*
*/
private String position;
/**
*
*/
private Integer cherks;
/**
* idid
*/
private Long recordId;
/**
* id
*/
private Long userId;
/**
*
*/
private String fileStatus;
}

@ -0,0 +1,82 @@
package cn.iocoder.yudao.module.ea.dal.mysql.electroniccontracts;
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.ea.dal.dataobject.electroniccontracts.ElectronicContractsDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts.vo.*;
/**
* Mapper
*
* @author
*/
@Mapper
public interface ElectronicContractsMapper extends BaseMapperX<ElectronicContractsDO> {
default PageResult<ElectronicContractsDO> selectPage(ElectronicContractsPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ElectronicContractsDO>()
.eqIfPresent(ElectronicContractsDO::getCreateBy, reqVO.getCreateBy())
.betweenIfPresent(ElectronicContractsDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(ElectronicContractsDO::getCompanyId, reqVO.getCompanyId())
.eqIfPresent(ElectronicContractsDO::getCompany, reqVO.getCompany())
.eqIfPresent(ElectronicContractsDO::getDeptId, reqVO.getDeptId())
.likeIfPresent(ElectronicContractsDO::getDeptName, reqVO.getDeptName())
.eqIfPresent(ElectronicContractsDO::getContractCode, reqVO.getContractCode())
.eqIfPresent(ElectronicContractsDO::getContractTitle, reqVO.getContractTitle())
.eqIfPresent(ElectronicContractsDO::getContractType, reqVO.getContractType())
.eqIfPresent(ElectronicContractsDO::getSignatory, reqVO.getSignatory())
.betweenIfPresent(ElectronicContractsDO::getSignDate, reqVO.getSignDate())
.betweenIfPresent(ElectronicContractsDO::getEffectiveDate, reqVO.getEffectiveDate())
.betweenIfPresent(ElectronicContractsDO::getExpiryDate, reqVO.getExpiryDate())
.eqIfPresent(ElectronicContractsDO::getContractStatus, reqVO.getContractStatus())
.eqIfPresent(ElectronicContractsDO::getContractAmount, reqVO.getContractAmount())
.eqIfPresent(ElectronicContractsDO::getContractAttachment, reqVO.getContractAttachment())
.eqIfPresent(ElectronicContractsDO::getHandleResult, reqVO.getHandleResult())
.eqIfPresent(ElectronicContractsDO::getYear, reqVO.getYear())
.eqIfPresent(ElectronicContractsDO::getPeriod, reqVO.getPeriod())
.eqIfPresent(ElectronicContractsDO::getBorrowStatus, reqVO.getBorrowStatus())
.betweenIfPresent(ElectronicContractsDO::getRecordTime, reqVO.getRecordTime())
.eqIfPresent(ElectronicContractsDO::getPosition, reqVO.getPosition())
.eqIfPresent(ElectronicContractsDO::getCherks, reqVO.getCherks())
.eqIfPresent(ElectronicContractsDO::getRecordId, reqVO.getRecordId())
.eqIfPresent(ElectronicContractsDO::getUserId, reqVO.getUserId())
.eqIfPresent(ElectronicContractsDO::getFileStatus, reqVO.getFileStatus())
.orderByDesc(ElectronicContractsDO::getId));
}
default List<ElectronicContractsDO> selectList(ElectronicContractsExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<ElectronicContractsDO>()
.eqIfPresent(ElectronicContractsDO::getCreateBy, reqVO.getCreateBy())
.betweenIfPresent(ElectronicContractsDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(ElectronicContractsDO::getCompanyId, reqVO.getCompanyId())
.eqIfPresent(ElectronicContractsDO::getCompany, reqVO.getCompany())
.eqIfPresent(ElectronicContractsDO::getDeptId, reqVO.getDeptId())
.likeIfPresent(ElectronicContractsDO::getDeptName, reqVO.getDeptName())
.eqIfPresent(ElectronicContractsDO::getContractCode, reqVO.getContractCode())
.eqIfPresent(ElectronicContractsDO::getContractTitle, reqVO.getContractTitle())
.eqIfPresent(ElectronicContractsDO::getContractType, reqVO.getContractType())
.eqIfPresent(ElectronicContractsDO::getSignatory, reqVO.getSignatory())
.betweenIfPresent(ElectronicContractsDO::getSignDate, reqVO.getSignDate())
.betweenIfPresent(ElectronicContractsDO::getEffectiveDate, reqVO.getEffectiveDate())
.betweenIfPresent(ElectronicContractsDO::getExpiryDate, reqVO.getExpiryDate())
.eqIfPresent(ElectronicContractsDO::getContractStatus, reqVO.getContractStatus())
.eqIfPresent(ElectronicContractsDO::getContractAmount, reqVO.getContractAmount())
.eqIfPresent(ElectronicContractsDO::getContractAttachment, reqVO.getContractAttachment())
.eqIfPresent(ElectronicContractsDO::getHandleResult, reqVO.getHandleResult())
.eqIfPresent(ElectronicContractsDO::getYear, reqVO.getYear())
.eqIfPresent(ElectronicContractsDO::getPeriod, reqVO.getPeriod())
.eqIfPresent(ElectronicContractsDO::getBorrowStatus, reqVO.getBorrowStatus())
.betweenIfPresent(ElectronicContractsDO::getRecordTime, reqVO.getRecordTime())
.eqIfPresent(ElectronicContractsDO::getPosition, reqVO.getPosition())
.eqIfPresent(ElectronicContractsDO::getCherks, reqVO.getCherks())
.eqIfPresent(ElectronicContractsDO::getRecordId, reqVO.getRecordId())
.eqIfPresent(ElectronicContractsDO::getUserId, reqVO.getUserId())
.eqIfPresent(ElectronicContractsDO::getFileStatus, reqVO.getFileStatus())
.orderByDesc(ElectronicContractsDO::getId));
}
}

@ -0,0 +1,70 @@
package cn.iocoder.yudao.module.ea.service.electroniccontracts;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts.vo.*;
import cn.iocoder.yudao.module.ea.dal.dataobject.electroniccontracts.ElectronicContractsDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
/**
* Service
*
* @author
*/
public interface ElectronicContractsService {
/**
*
*
* @param createReqVO
* @return
*/
Long createElectronicContracts(@Valid ElectronicContractsCreateReqVO createReqVO);
/**
*
*
* @param updateReqVO
*/
void updateElectronicContracts(@Valid ElectronicContractsUpdateReqVO updateReqVO);
/**
*
*
* @param id
*/
void deleteElectronicContracts(Long id);
/**
*
*
* @param id
* @return
*/
ElectronicContractsDO getElectronicContracts(Long id);
/**
*
*
* @param ids
* @return
*/
List<ElectronicContractsDO> getElectronicContractsList(Collection<Long> ids);
/**
*
*
* @param pageReqVO
* @return
*/
PageResult<ElectronicContractsDO> getElectronicContractsPage(ElectronicContractsPageReqVO pageReqVO);
/**
* , Excel
*
* @param exportReqVO
* @return
*/
List<ElectronicContractsDO> getElectronicContractsList(ElectronicContractsExportReqVO exportReqVO);
}

@ -0,0 +1,82 @@
package cn.iocoder.yudao.module.ea.service.electroniccontracts;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import cn.iocoder.yudao.module.ea.controller.admin.electroniccontracts.vo.*;
import cn.iocoder.yudao.module.ea.dal.dataobject.electroniccontracts.ElectronicContractsDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.ea.convert.electroniccontracts.ElectronicContractsConvert;
import cn.iocoder.yudao.module.ea.dal.mysql.electroniccontracts.ElectronicContractsMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.ea.enums.ErrorCodeConstants.*;
/**
* Service
*
* @author
*/
@Service
@Validated
public class ElectronicContractsServiceImpl implements ElectronicContractsService {
@Resource
private ElectronicContractsMapper electronicContractsMapper;
@Override
public Long createElectronicContracts(ElectronicContractsCreateReqVO createReqVO) {
// 插入
ElectronicContractsDO electronicContracts = ElectronicContractsConvert.INSTANCE.convert(createReqVO);
electronicContractsMapper.insert(electronicContracts);
// 返回
return electronicContracts.getId();
}
@Override
public void updateElectronicContracts(ElectronicContractsUpdateReqVO updateReqVO) {
// 校验存在
validateElectronicContractsExists(updateReqVO.getId());
// 更新
ElectronicContractsDO updateObj = ElectronicContractsConvert.INSTANCE.convert(updateReqVO);
electronicContractsMapper.updateById(updateObj);
}
@Override
public void deleteElectronicContracts(Long id) {
// 校验存在
validateElectronicContractsExists(id);
// 删除
electronicContractsMapper.deleteById(id);
}
private void validateElectronicContractsExists(Long id) {
if (electronicContractsMapper.selectById(id) == null) {
throw exception(ELECTRONIC_CONTRACTS_NOT_EXISTS);
}
}
@Override
public ElectronicContractsDO getElectronicContracts(Long id) {
return electronicContractsMapper.selectById(id);
}
@Override
public List<ElectronicContractsDO> getElectronicContractsList(Collection<Long> ids) {
return electronicContractsMapper.selectBatchIds(ids);
}
@Override
public PageResult<ElectronicContractsDO> getElectronicContractsPage(ElectronicContractsPageReqVO pageReqVO) {
return electronicContractsMapper.selectPage(pageReqVO);
}
@Override
public List<ElectronicContractsDO> getElectronicContractsList(ElectronicContractsExportReqVO exportReqVO) {
return electronicContractsMapper.selectList(exportReqVO);
}
}

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.ea.dal.mysql.electroniccontracts.ElectronicContractsMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>
Loading…
Cancel
Save