合同档案
parent
e5b1df08da
commit
fd0d459595
@ -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,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,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,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);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue