Merge remote-tracking branch 'origin/main'
commit
1d5ff3f1c5
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.archives.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 申请状态枚举
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum ArchivesStatusEnum {
|
||||
|
||||
NOSUBMIT("0", "未提交"),
|
||||
PROCESS("1", "待审核"),
|
||||
APPROVE("2", "通过"),
|
||||
REJECT("3", "驳回"),
|
||||
CANCEL("4", "取消");
|
||||
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final String value;
|
||||
/**
|
||||
* 类型名
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.archives.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 单据类型枚举
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum BillTypeEnum {
|
||||
|
||||
DAYJ("DAYJ", "档案移交申请单"),
|
||||
;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final String value;
|
||||
/**
|
||||
* 类型名
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
public static String getNameByValue(String targetValue) {
|
||||
for (BillTypeEnum billTypeEnum : BillTypeEnum.values()) {
|
||||
if (billTypeEnum.getValue().equals(targetValue)) {
|
||||
return billTypeEnum.getName();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
package cn.iocoder.yudao.module.archives.controller.admin.turnover;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService;
|
||||
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.archives.controller.admin.turnover.vo.*;
|
||||
import cn.iocoder.yudao.module.archives.dal.dataobject.turnover.TurnOverDO;
|
||||
import cn.iocoder.yudao.module.archives.convert.turnover.TurnOverConvert;
|
||||
import cn.iocoder.yudao.module.archives.service.turnover.TurnOverService;
|
||||
|
||||
@Tag(name = "管理后台 - 移交")
|
||||
@RestController
|
||||
@RequestMapping("/archives/turn-over")
|
||||
@Validated
|
||||
public class TurnOverController {
|
||||
|
||||
@Resource
|
||||
private TurnOverService turnOverService;
|
||||
|
||||
@Resource
|
||||
private BpmTaskService taskService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建移交")
|
||||
@PreAuthorize("@ss.hasPermission('archives:turn-over:create')")
|
||||
public CommonResult createTurnOver(@Valid @RequestBody TurnOverCreateReqVO createReqVO) {
|
||||
return turnOverService.createTurnOver(createReqVO);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新移交")
|
||||
@PreAuthorize("@ss.hasPermission('archives:turn-over:update')")
|
||||
public CommonResult<Boolean> updateTurnOver(@Valid @RequestBody TurnOverUpdateReqVO updateReqVO) {
|
||||
turnOverService.updateTurnOver(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除移交")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('archives:turn-over:delete')")
|
||||
public CommonResult<Boolean> deleteTurnOver(@RequestParam("id") Long id) {
|
||||
turnOverService.deleteTurnOver(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得移交")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('archives:turn-over:query')")
|
||||
public CommonResult<TurnOverRespVO> getTurnOver(@RequestParam("id") Long id) {
|
||||
TurnOverDO turnOver = turnOverService.getTurnOver(id);
|
||||
return success(TurnOverConvert.INSTANCE.convert(turnOver));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得移交列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('archives:turn-over:query')")
|
||||
public CommonResult<List<TurnOverRespVO>> getTurnOverList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<TurnOverDO> list = turnOverService.getTurnOverList(ids);
|
||||
return success(TurnOverConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得移交分页")
|
||||
@PreAuthorize("@ss.hasPermission('archives:turn-over:query')")
|
||||
public CommonResult<PageResult<TurnOverRespVO>> getTurnOverPage(@Valid TurnOverPageReqVO pageVO) {
|
||||
PageResult<TurnOverDO> pageResult = turnOverService.getTurnOverPage(pageVO);
|
||||
List<TurnOverDO> list = pageResult.getList();
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
for (TurnOverDO t : list) {
|
||||
if (t.getProcessInstanceId() != null) {
|
||||
List<BpmTaskRespVO> taskListByProcessInstanceId = taskService.getTaskListByProcessInstanceId(t.getProcessInstanceId());
|
||||
Optional<BpmTaskRespVO> latestTask = taskListByProcessInstanceId.stream()
|
||||
.filter(task -> task.getEndTime() != null)
|
||||
.sorted(Comparator.comparing(BpmTaskRespVO::getEndTime).reversed())
|
||||
.findFirst();
|
||||
|
||||
if (latestTask.isPresent()) {
|
||||
BpmTaskRespVO latest = latestTask.get();
|
||||
// 找到了endTime最新的任务
|
||||
TurnOverUpdateReqVO updateReqVO = new TurnOverUpdateReqVO();
|
||||
updateReqVO.setId(t.getId());
|
||||
if (!latest.getResult().toString().equals(t.getStatus())) {
|
||||
updateReqVO.setStatus(latest.getResult().toString());
|
||||
turnOverService.updateTurnOver(updateReqVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
PageResult<TurnOverDO> pageResult2 = turnOverService.getTurnOverPage(pageVO);
|
||||
return success(TurnOverConvert.INSTANCE.convertPage(pageResult2));
|
||||
}
|
||||
return success(TurnOverConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出移交 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('archives:turn-over:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportTurnOverExcel(@Valid TurnOverExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<TurnOverDO> list = turnOverService.getTurnOverList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<TurnOverExcelVO> datas = TurnOverConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "移交.xls", "数据", TurnOverExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.archives.controller.admin.turnover.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.archives.enums.ArchivesStatusEnum;
|
||||
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 TurnOverCreateReqVO extends TurnOverBaseVO {
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
@AssertTrue(message = "状态只能是0或者1提交")
|
||||
public boolean isStatusValid() {
|
||||
//只能传未提交和待审核
|
||||
return getStatus().equals(ArchivesStatusEnum.NOSUBMIT.getValue()) || getStatus().equals(ArchivesStatusEnum.PROCESS.getValue());
|
||||
}
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
package cn.iocoder.yudao.module.archives.controller.admin.turnover.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
/**
|
||||
* 移交 Excel VO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class TurnOverExcelVO {
|
||||
|
||||
@ExcelProperty("主键ID")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("移交单号")
|
||||
private String applyNo;
|
||||
|
||||
@ExcelProperty("移交日期")
|
||||
private LocalDateTime turnDate;
|
||||
|
||||
@ExcelProperty("移交说明")
|
||||
private String turnExplain;
|
||||
|
||||
@ExcelProperty("移交人")
|
||||
private String outputName;
|
||||
|
||||
@ExcelProperty("移交人ID")
|
||||
private Long outputNameId;
|
||||
|
||||
@ExcelProperty("签收人")
|
||||
private String inputName;
|
||||
|
||||
@ExcelProperty("签收人ID")
|
||||
private Long inputNameId;
|
||||
|
||||
@ExcelProperty("用户ID")
|
||||
private Long userId;
|
||||
|
||||
@ExcelProperty("所属部门ID")
|
||||
private Long deptId;
|
||||
|
||||
@ExcelProperty("所属部门")
|
||||
private String deptName;
|
||||
|
||||
@ExcelProperty("业务实体ID")
|
||||
private Long companyId;
|
||||
|
||||
@ExcelProperty("业务实体")
|
||||
private String company;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("制单人")
|
||||
private String createBy;
|
||||
|
||||
@ExcelProperty("从立档单位ID")
|
||||
private Long fromOrganizationId;
|
||||
|
||||
@ExcelProperty("从库房ID")
|
||||
private Long fromDepotId;
|
||||
|
||||
@ExcelProperty("从档案柜ID")
|
||||
private Long fromCabinetId;
|
||||
|
||||
@ExcelProperty("到立档单位ID")
|
||||
private Long toOrganizationId;
|
||||
|
||||
@ExcelProperty("到库房ID")
|
||||
private Long toDepotId;
|
||||
|
||||
@ExcelProperty("到档案柜ID")
|
||||
private Long toCabinetId;
|
||||
|
||||
@ExcelProperty("制单人id")
|
||||
private Long createById;
|
||||
|
||||
@ExcelProperty("案卷数量")
|
||||
private Integer amount;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ExcelProperty("流程实例的编号")
|
||||
private String processInstanceId;
|
||||
|
||||
@ExcelProperty("申请类型")
|
||||
private String billType;
|
||||
|
||||
@ExcelProperty("状态")
|
||||
private String status;
|
||||
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package cn.iocoder.yudao.module.archives.controller.admin.turnover.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 TurnOverPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "移交单号")
|
||||
private String applyNo;
|
||||
|
||||
@Schema(description = "移交日期")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] turnDate;
|
||||
|
||||
@Schema(description = "移交说明")
|
||||
private String turnExplain;
|
||||
|
||||
@Schema(description = "移交人", example = "张三")
|
||||
private String outputName;
|
||||
|
||||
@Schema(description = "移交人ID", example = "24105")
|
||||
private Long outputNameId;
|
||||
|
||||
@Schema(description = "签收人", example = "李四")
|
||||
private String inputName;
|
||||
|
||||
@Schema(description = "签收人ID", example = "28017")
|
||||
private Long inputNameId;
|
||||
|
||||
@Schema(description = "用户ID", example = "23669")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "所属部门ID", example = "27304")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "所属部门", example = "张三")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "业务实体ID", example = "13936")
|
||||
private Long companyId;
|
||||
|
||||
@Schema(description = "业务实体")
|
||||
private String company;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "制单人")
|
||||
private String createBy;
|
||||
|
||||
@Schema(description = "从立档单位ID", example = "12461")
|
||||
private Long fromOrganizationId;
|
||||
|
||||
@Schema(description = "从库房ID", example = "31262")
|
||||
private Long fromDepotId;
|
||||
|
||||
@Schema(description = "从档案柜ID", example = "19367")
|
||||
private Long fromCabinetId;
|
||||
|
||||
@Schema(description = "到立档单位ID", example = "18409")
|
||||
private Long toOrganizationId;
|
||||
|
||||
@Schema(description = "到库房ID", example = "17779")
|
||||
private Long toDepotId;
|
||||
|
||||
@Schema(description = "到档案柜ID", example = "24097")
|
||||
private Long toCabinetId;
|
||||
|
||||
@Schema(description = "制单人id", example = "24299")
|
||||
private Long createById;
|
||||
|
||||
@Schema(description = "案卷数量")
|
||||
private Integer amount;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "流程实例的编号", example = "705")
|
||||
private String processInstanceId;
|
||||
|
||||
@Schema(description = "申请类型", example = "2")
|
||||
private String billType;
|
||||
|
||||
@Schema(description = "状态", example = "1")
|
||||
private String status;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.archives.controller.admin.turnover.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 TurnOverRespVO extends TurnOverBaseVO {
|
||||
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "17036")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package cn.iocoder.yudao.module.archives.controller.admin.turnover.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 TurnOverUpdateReqVO extends TurnOverBaseVO {
|
||||
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "17036")
|
||||
@NotNull(message = "主键ID不能为空")
|
||||
private Long id;
|
||||
|
||||
private String status;
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.archives.convert.turnover;
|
||||
|
||||
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.archives.controller.admin.turnover.vo.*;
|
||||
import cn.iocoder.yudao.module.archives.dal.dataobject.turnover.TurnOverDO;
|
||||
|
||||
/**
|
||||
* 移交 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface TurnOverConvert {
|
||||
|
||||
TurnOverConvert INSTANCE = Mappers.getMapper(TurnOverConvert.class);
|
||||
|
||||
TurnOverDO convert(TurnOverCreateReqVO bean);
|
||||
|
||||
TurnOverDO convert(TurnOverUpdateReqVO bean);
|
||||
|
||||
TurnOverRespVO convert(TurnOverDO bean);
|
||||
|
||||
List<TurnOverRespVO> convertList(List<TurnOverDO> list);
|
||||
|
||||
PageResult<TurnOverRespVO> convertPage(PageResult<TurnOverDO> page);
|
||||
|
||||
List<TurnOverExcelVO> convertList02(List<TurnOverDO> list);
|
||||
|
||||
}
|
@ -0,0 +1,148 @@
|
||||
package cn.iocoder.yudao.module.archives.dal.dataobject.turnover;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 移交 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("archives_turn_over")
|
||||
@KeySequence("archives_turn_over_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TurnOverDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 移交单号
|
||||
*/
|
||||
private String applyNo;
|
||||
/**
|
||||
* 移交日期
|
||||
*/
|
||||
private LocalDateTime turnDate;
|
||||
/**
|
||||
* 移交说明
|
||||
*/
|
||||
private String turnExplain;
|
||||
/**
|
||||
* 移交人
|
||||
*/
|
||||
private String outputName;
|
||||
/**
|
||||
* 移交人ID
|
||||
*/
|
||||
private Long outputNameId;
|
||||
/**
|
||||
* 签收人
|
||||
*/
|
||||
private String inputName;
|
||||
/**
|
||||
* 签收人ID
|
||||
*/
|
||||
private Long inputNameId;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 所属部门ID
|
||||
*/
|
||||
private Long deptId;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
private String deptName;
|
||||
/**
|
||||
* 业务实体ID
|
||||
*/
|
||||
private Long companyId;
|
||||
/**
|
||||
* 业务实体
|
||||
*/
|
||||
private String company;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 制单人
|
||||
*/
|
||||
private String createBy;
|
||||
/**
|
||||
* 从立档单位ID
|
||||
*/
|
||||
private Long fromOrganizationId;
|
||||
/**
|
||||
* 从库房ID
|
||||
*/
|
||||
private Long fromDepotId;
|
||||
/**
|
||||
* 从档案柜ID
|
||||
*/
|
||||
private Long fromCabinetId;
|
||||
/**
|
||||
* 到立档单位ID
|
||||
*/
|
||||
private Long toOrganizationId;
|
||||
/**
|
||||
* 到库房ID
|
||||
*/
|
||||
private Long toDepotId;
|
||||
/**
|
||||
* 到档案柜ID
|
||||
*/
|
||||
private Long toCabinetId;
|
||||
/**
|
||||
* 预留字段1
|
||||
*/
|
||||
private String attr1;
|
||||
/**
|
||||
* 预留字段2
|
||||
*/
|
||||
private String attr2;
|
||||
/**
|
||||
* 预留字段3
|
||||
*/
|
||||
private Integer attr3;
|
||||
/**
|
||||
* 预留字段4
|
||||
*/
|
||||
private Integer attr4;
|
||||
/**
|
||||
* 制单人id
|
||||
*/
|
||||
private Long createById;
|
||||
/**
|
||||
* 案卷数量
|
||||
*/
|
||||
private Integer amount;
|
||||
/**
|
||||
* 流程实例的编号
|
||||
*/
|
||||
private String processInstanceId;
|
||||
/**
|
||||
* 申请类型
|
||||
*/
|
||||
private String billType;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package cn.iocoder.yudao.module.archives.dal.mysql.turnover;
|
||||
|
||||
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.archives.dal.dataobject.turnover.TurnOverDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.archives.controller.admin.turnover.vo.*;
|
||||
|
||||
/**
|
||||
* 移交 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface TurnOverMapper extends BaseMapperX<TurnOverDO> {
|
||||
|
||||
default PageResult<TurnOverDO> selectPage(TurnOverPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<TurnOverDO>()
|
||||
.eqIfPresent(TurnOverDO::getApplyNo, reqVO.getApplyNo())
|
||||
.betweenIfPresent(TurnOverDO::getTurnDate, reqVO.getTurnDate())
|
||||
.eqIfPresent(TurnOverDO::getTurnExplain, reqVO.getTurnExplain())
|
||||
.likeIfPresent(TurnOverDO::getOutputName, reqVO.getOutputName())
|
||||
.eqIfPresent(TurnOverDO::getOutputNameId, reqVO.getOutputNameId())
|
||||
.likeIfPresent(TurnOverDO::getInputName, reqVO.getInputName())
|
||||
.eqIfPresent(TurnOverDO::getInputNameId, reqVO.getInputNameId())
|
||||
.eqIfPresent(TurnOverDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(TurnOverDO::getDeptId, reqVO.getDeptId())
|
||||
.likeIfPresent(TurnOverDO::getDeptName, reqVO.getDeptName())
|
||||
.eqIfPresent(TurnOverDO::getCompanyId, reqVO.getCompanyId())
|
||||
.eqIfPresent(TurnOverDO::getCompany, reqVO.getCompany())
|
||||
.eqIfPresent(TurnOverDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(TurnOverDO::getCreateBy, reqVO.getCreateBy())
|
||||
.eqIfPresent(TurnOverDO::getFromOrganizationId, reqVO.getFromOrganizationId())
|
||||
.eqIfPresent(TurnOverDO::getFromDepotId, reqVO.getFromDepotId())
|
||||
.eqIfPresent(TurnOverDO::getFromCabinetId, reqVO.getFromCabinetId())
|
||||
.eqIfPresent(TurnOverDO::getToOrganizationId, reqVO.getToOrganizationId())
|
||||
.eqIfPresent(TurnOverDO::getToDepotId, reqVO.getToDepotId())
|
||||
.eqIfPresent(TurnOverDO::getToCabinetId, reqVO.getToCabinetId())
|
||||
.eqIfPresent(TurnOverDO::getCreateById, reqVO.getCreateById())
|
||||
.eqIfPresent(TurnOverDO::getAmount, reqVO.getAmount())
|
||||
.betweenIfPresent(TurnOverDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(TurnOverDO::getProcessInstanceId, reqVO.getProcessInstanceId())
|
||||
.eqIfPresent(TurnOverDO::getBillType, reqVO.getBillType())
|
||||
.eqIfPresent(TurnOverDO::getStatus, reqVO.getStatus())
|
||||
.orderByDesc(TurnOverDO::getId));
|
||||
}
|
||||
|
||||
default List<TurnOverDO> selectList(TurnOverExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<TurnOverDO>()
|
||||
.eqIfPresent(TurnOverDO::getApplyNo, reqVO.getApplyNo())
|
||||
.betweenIfPresent(TurnOverDO::getTurnDate, reqVO.getTurnDate())
|
||||
.eqIfPresent(TurnOverDO::getTurnExplain, reqVO.getTurnExplain())
|
||||
.likeIfPresent(TurnOverDO::getOutputName, reqVO.getOutputName())
|
||||
.eqIfPresent(TurnOverDO::getOutputNameId, reqVO.getOutputNameId())
|
||||
.likeIfPresent(TurnOverDO::getInputName, reqVO.getInputName())
|
||||
.eqIfPresent(TurnOverDO::getInputNameId, reqVO.getInputNameId())
|
||||
.eqIfPresent(TurnOverDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(TurnOverDO::getDeptId, reqVO.getDeptId())
|
||||
.likeIfPresent(TurnOverDO::getDeptName, reqVO.getDeptName())
|
||||
.eqIfPresent(TurnOverDO::getCompanyId, reqVO.getCompanyId())
|
||||
.eqIfPresent(TurnOverDO::getCompany, reqVO.getCompany())
|
||||
.eqIfPresent(TurnOverDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(TurnOverDO::getCreateBy, reqVO.getCreateBy())
|
||||
.eqIfPresent(TurnOverDO::getFromOrganizationId, reqVO.getFromOrganizationId())
|
||||
.eqIfPresent(TurnOverDO::getFromDepotId, reqVO.getFromDepotId())
|
||||
.eqIfPresent(TurnOverDO::getFromCabinetId, reqVO.getFromCabinetId())
|
||||
.eqIfPresent(TurnOverDO::getToOrganizationId, reqVO.getToOrganizationId())
|
||||
.eqIfPresent(TurnOverDO::getToDepotId, reqVO.getToDepotId())
|
||||
.eqIfPresent(TurnOverDO::getToCabinetId, reqVO.getToCabinetId())
|
||||
.eqIfPresent(TurnOverDO::getCreateById, reqVO.getCreateById())
|
||||
.eqIfPresent(TurnOverDO::getAmount, reqVO.getAmount())
|
||||
.betweenIfPresent(TurnOverDO::getCreateTime, reqVO.getCreateTime())
|
||||
.eqIfPresent(TurnOverDO::getProcessInstanceId, reqVO.getProcessInstanceId())
|
||||
.eqIfPresent(TurnOverDO::getBillType, reqVO.getBillType())
|
||||
.eqIfPresent(TurnOverDO::getStatus, reqVO.getStatus())
|
||||
.orderByDesc(TurnOverDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package cn.iocoder.yudao.module.archives.service.turnover;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.archives.controller.admin.turnover.vo.*;
|
||||
import cn.iocoder.yudao.module.archives.dal.dataobject.turnover.TurnOverDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 移交 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface TurnOverService {
|
||||
|
||||
/**
|
||||
* 创建移交
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
CommonResult createTurnOver(@Valid TurnOverCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新移交
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateTurnOver(@Valid TurnOverUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除移交
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteTurnOver(Long id);
|
||||
|
||||
/**
|
||||
* 获得移交
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 移交
|
||||
*/
|
||||
TurnOverDO getTurnOver(Long id);
|
||||
|
||||
/**
|
||||
* 获得移交列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 移交列表
|
||||
*/
|
||||
List<TurnOverDO> getTurnOverList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得移交分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 移交分页
|
||||
*/
|
||||
PageResult<TurnOverDO> getTurnOverPage(TurnOverPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得移交列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 移交列表
|
||||
*/
|
||||
List<TurnOverDO> getTurnOverList(TurnOverExportReqVO exportReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
package cn.iocoder.yudao.module.archives.service.turnover;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.archives.convert.record.RecordConvert;
|
||||
import cn.iocoder.yudao.module.archives.dal.dataobject.record.RecordDO;
|
||||
import cn.iocoder.yudao.module.archives.enums.ArchivesStatusEnum;
|
||||
import cn.iocoder.yudao.module.archives.enums.BillTypeEnum;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
|
||||
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Validator;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.archives.controller.admin.turnover.vo.*;
|
||||
import cn.iocoder.yudao.module.archives.dal.dataobject.turnover.TurnOverDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import cn.iocoder.yudao.module.archives.convert.turnover.TurnOverConvert;
|
||||
import cn.iocoder.yudao.module.archives.dal.mysql.turnover.TurnOverMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.archives.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 移交 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class TurnOverServiceImpl extends MPJBaseServiceImpl<TurnOverMapper, TurnOverDO> implements TurnOverService {
|
||||
public static final String PROCESS_KEY = "archives_turn_over";
|
||||
|
||||
@Resource
|
||||
private TurnOverMapper turnOverMapper;
|
||||
@Resource
|
||||
private Validator validator;
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
@Resource
|
||||
private DeptApi deptApi;
|
||||
@Resource
|
||||
private BpmProcessInstanceApi processInstanceApi;
|
||||
|
||||
@Override
|
||||
public CommonResult createTurnOver(TurnOverCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
TurnOverDO turnOver = TurnOverConvert.INSTANCE.convert(createReqVO);
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
turnOver.setDeleted(false);
|
||||
turnOver.setBillType("DAYJ");
|
||||
//添加数据userid
|
||||
turnOver.setUserId(loginUser.getId());
|
||||
turnOverMapper.insert(turnOver);
|
||||
|
||||
if (turnOver.getStatus().equals(ArchivesStatusEnum.PROCESS.getValue())) {
|
||||
Map<String, Object> variables = new HashMap<>();
|
||||
variables.put("billType", turnOver.getBillType());
|
||||
variables.put("billId", turnOver.getId());
|
||||
variables.put("billName", BillTypeEnum.getNameByValue(turnOver.getBillType()));
|
||||
variables.put("amount", turnOver.getAmount());
|
||||
variables.put("deptId", turnOver.getDeptId());
|
||||
String processInstanceId = processInstanceApi.createProcessInstance(turnOver.getUserId(),
|
||||
new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY)
|
||||
.setVariables(variables).setBusinessKey(String.valueOf(turnOver.getId())));
|
||||
updateById(new TurnOverDO().setId(turnOver.getId()).setProcessInstanceId(processInstanceId));
|
||||
}
|
||||
|
||||
// 返回
|
||||
return CommonResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTurnOver(TurnOverUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateTurnOverExists(updateReqVO.getId());
|
||||
// 更新
|
||||
TurnOverDO updateObj = TurnOverConvert.INSTANCE.convert(updateReqVO);
|
||||
turnOverMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTurnOver(Long id) {
|
||||
// 校验存在
|
||||
validateTurnOverExists(id);
|
||||
// 删除
|
||||
turnOverMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateTurnOverExists(Long id) {
|
||||
if (turnOverMapper.selectById(id) == null) {
|
||||
throw exception(TURN_OVER_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TurnOverDO getTurnOver(Long id) {
|
||||
return turnOverMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TurnOverDO> getTurnOverList(Collection<Long> ids) {
|
||||
return turnOverMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<TurnOverDO> getTurnOverPage(TurnOverPageReqVO pageReqVO) {
|
||||
return turnOverMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TurnOverDO> getTurnOverList(TurnOverExportReqVO exportReqVO) {
|
||||
return turnOverMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,352 @@
|
||||
package cn.iocoder.yudao.module.archives.service.turnover;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
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.archives.controller.admin.turnover.vo.*;
|
||||
import cn.iocoder.yudao.module.archives.dal.dataobject.turnover.TurnOverDO;
|
||||
import cn.iocoder.yudao.module.archives.dal.mysql.turnover.TurnOverMapper;
|
||||
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.archives.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 TurnOverServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Import(TurnOverServiceImpl.class)
|
||||
public class TurnOverServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private TurnOverServiceImpl turnOverService;
|
||||
|
||||
@Resource
|
||||
private TurnOverMapper turnOverMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateTurnOver_success() {
|
||||
// 准备参数
|
||||
TurnOverCreateReqVO reqVO = randomPojo(TurnOverCreateReqVO.class);
|
||||
|
||||
// 调用
|
||||
CommonResult turnOverId = turnOverService.createTurnOver(reqVO);
|
||||
// 断言
|
||||
assertNotNull(turnOverId);
|
||||
// 校验记录的属性是否正确
|
||||
TurnOverDO turnOver = turnOverMapper.selectById(turnOverId);
|
||||
assertPojoEquals(reqVO, turnOver);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateTurnOver_success() {
|
||||
// mock 数据
|
||||
TurnOverDO dbTurnOver = randomPojo(TurnOverDO.class);
|
||||
turnOverMapper.insert(dbTurnOver);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
TurnOverUpdateReqVO reqVO = randomPojo(TurnOverUpdateReqVO.class, o -> {
|
||||
o.setId(dbTurnOver.getId()); // 设置更新的 ID
|
||||
});
|
||||
|
||||
// 调用
|
||||
turnOverService.updateTurnOver(reqVO);
|
||||
// 校验是否更新正确
|
||||
TurnOverDO turnOver = turnOverMapper.selectById(reqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(reqVO, turnOver);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateTurnOver_notExists() {
|
||||
// 准备参数
|
||||
TurnOverUpdateReqVO reqVO = randomPojo(TurnOverUpdateReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> turnOverService.updateTurnOver(reqVO), TURN_OVER_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteTurnOver_success() {
|
||||
// mock 数据
|
||||
TurnOverDO dbTurnOver = randomPojo(TurnOverDO.class);
|
||||
turnOverMapper.insert(dbTurnOver);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbTurnOver.getId();
|
||||
|
||||
// 调用
|
||||
turnOverService.deleteTurnOver(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(turnOverMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteTurnOver_notExists() {
|
||||
// 准备参数
|
||||
Long id = randomLongId();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> turnOverService.deleteTurnOver(id), TURN_OVER_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetTurnOverPage() {
|
||||
// mock 数据
|
||||
TurnOverDO dbTurnOver = randomPojo(TurnOverDO.class, o -> { // 等会查询到
|
||||
o.setApplyNo(null);
|
||||
o.setTurnDate(null);
|
||||
o.setTurnExplain(null);
|
||||
o.setOutputName(null);
|
||||
o.setOutputNameId(null);
|
||||
o.setInputName(null);
|
||||
o.setInputNameId(null);
|
||||
o.setUserId(null);
|
||||
o.setDeptId(null);
|
||||
o.setDeptName(null);
|
||||
o.setCompanyId(null);
|
||||
o.setCompany(null);
|
||||
o.setRemark(null);
|
||||
o.setCreateBy(null);
|
||||
o.setFromOrganizationId(null);
|
||||
o.setFromDepotId(null);
|
||||
o.setFromCabinetId(null);
|
||||
o.setToOrganizationId(null);
|
||||
o.setToDepotId(null);
|
||||
o.setToCabinetId(null);
|
||||
o.setCreateById(null);
|
||||
o.setAmount(null);
|
||||
o.setCreateTime(null);
|
||||
o.setProcessInstanceId(null);
|
||||
o.setBillType(null);
|
||||
o.setStatus(null);
|
||||
});
|
||||
turnOverMapper.insert(dbTurnOver);
|
||||
// 测试 applyNo 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setApplyNo(null)));
|
||||
// 测试 turnDate 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setTurnDate(null)));
|
||||
// 测试 turnExplain 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setTurnExplain(null)));
|
||||
// 测试 outputName 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setOutputName(null)));
|
||||
// 测试 outputNameId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setOutputNameId(null)));
|
||||
// 测试 inputName 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setInputName(null)));
|
||||
// 测试 inputNameId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setInputNameId(null)));
|
||||
// 测试 userId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setUserId(null)));
|
||||
// 测试 deptId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setDeptId(null)));
|
||||
// 测试 deptName 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setDeptName(null)));
|
||||
// 测试 companyId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setCompanyId(null)));
|
||||
// 测试 company 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setCompany(null)));
|
||||
// 测试 remark 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setRemark(null)));
|
||||
// 测试 createBy 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setCreateBy(null)));
|
||||
// 测试 fromOrganizationId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setFromOrganizationId(null)));
|
||||
// 测试 fromDepotId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setFromDepotId(null)));
|
||||
// 测试 fromCabinetId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setFromCabinetId(null)));
|
||||
// 测试 toOrganizationId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setToOrganizationId(null)));
|
||||
// 测试 toDepotId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setToDepotId(null)));
|
||||
// 测试 toCabinetId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setToCabinetId(null)));
|
||||
// 测试 createById 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setCreateById(null)));
|
||||
// 测试 amount 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setAmount(null)));
|
||||
// 测试 createTime 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setCreateTime(null)));
|
||||
// 测试 processInstanceId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setProcessInstanceId(null)));
|
||||
// 测试 billType 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setBillType(null)));
|
||||
// 测试 status 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setStatus(null)));
|
||||
// 准备参数
|
||||
TurnOverPageReqVO reqVO = new TurnOverPageReqVO();
|
||||
reqVO.setApplyNo(null);
|
||||
reqVO.setTurnDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setTurnExplain(null);
|
||||
reqVO.setOutputName(null);
|
||||
reqVO.setOutputNameId(null);
|
||||
reqVO.setInputName(null);
|
||||
reqVO.setInputNameId(null);
|
||||
reqVO.setUserId(null);
|
||||
reqVO.setDeptId(null);
|
||||
reqVO.setDeptName(null);
|
||||
reqVO.setCompanyId(null);
|
||||
reqVO.setCompany(null);
|
||||
reqVO.setRemark(null);
|
||||
reqVO.setCreateBy(null);
|
||||
reqVO.setFromOrganizationId(null);
|
||||
reqVO.setFromDepotId(null);
|
||||
reqVO.setFromCabinetId(null);
|
||||
reqVO.setToOrganizationId(null);
|
||||
reqVO.setToDepotId(null);
|
||||
reqVO.setToCabinetId(null);
|
||||
reqVO.setCreateById(null);
|
||||
reqVO.setAmount(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setProcessInstanceId(null);
|
||||
reqVO.setBillType(null);
|
||||
reqVO.setStatus(null);
|
||||
|
||||
// 调用
|
||||
PageResult<TurnOverDO> pageResult = turnOverService.getTurnOverPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbTurnOver, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetTurnOverList() {
|
||||
// mock 数据
|
||||
TurnOverDO dbTurnOver = randomPojo(TurnOverDO.class, o -> { // 等会查询到
|
||||
o.setApplyNo(null);
|
||||
o.setTurnDate(null);
|
||||
o.setTurnExplain(null);
|
||||
o.setOutputName(null);
|
||||
o.setOutputNameId(null);
|
||||
o.setInputName(null);
|
||||
o.setInputNameId(null);
|
||||
o.setUserId(null);
|
||||
o.setDeptId(null);
|
||||
o.setDeptName(null);
|
||||
o.setCompanyId(null);
|
||||
o.setCompany(null);
|
||||
o.setRemark(null);
|
||||
o.setCreateBy(null);
|
||||
o.setFromOrganizationId(null);
|
||||
o.setFromDepotId(null);
|
||||
o.setFromCabinetId(null);
|
||||
o.setToOrganizationId(null);
|
||||
o.setToDepotId(null);
|
||||
o.setToCabinetId(null);
|
||||
o.setCreateById(null);
|
||||
o.setAmount(null);
|
||||
o.setCreateTime(null);
|
||||
o.setProcessInstanceId(null);
|
||||
o.setBillType(null);
|
||||
o.setStatus(null);
|
||||
});
|
||||
turnOverMapper.insert(dbTurnOver);
|
||||
// 测试 applyNo 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setApplyNo(null)));
|
||||
// 测试 turnDate 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setTurnDate(null)));
|
||||
// 测试 turnExplain 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setTurnExplain(null)));
|
||||
// 测试 outputName 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setOutputName(null)));
|
||||
// 测试 outputNameId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setOutputNameId(null)));
|
||||
// 测试 inputName 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setInputName(null)));
|
||||
// 测试 inputNameId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setInputNameId(null)));
|
||||
// 测试 userId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setUserId(null)));
|
||||
// 测试 deptId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setDeptId(null)));
|
||||
// 测试 deptName 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setDeptName(null)));
|
||||
// 测试 companyId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setCompanyId(null)));
|
||||
// 测试 company 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setCompany(null)));
|
||||
// 测试 remark 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setRemark(null)));
|
||||
// 测试 createBy 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setCreateBy(null)));
|
||||
// 测试 fromOrganizationId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setFromOrganizationId(null)));
|
||||
// 测试 fromDepotId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setFromDepotId(null)));
|
||||
// 测试 fromCabinetId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setFromCabinetId(null)));
|
||||
// 测试 toOrganizationId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setToOrganizationId(null)));
|
||||
// 测试 toDepotId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setToDepotId(null)));
|
||||
// 测试 toCabinetId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setToCabinetId(null)));
|
||||
// 测试 createById 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setCreateById(null)));
|
||||
// 测试 amount 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setAmount(null)));
|
||||
// 测试 createTime 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setCreateTime(null)));
|
||||
// 测试 processInstanceId 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setProcessInstanceId(null)));
|
||||
// 测试 billType 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setBillType(null)));
|
||||
// 测试 status 不匹配
|
||||
turnOverMapper.insert(cloneIgnoreId(dbTurnOver, o -> o.setStatus(null)));
|
||||
// 准备参数
|
||||
TurnOverExportReqVO reqVO = new TurnOverExportReqVO();
|
||||
reqVO.setApplyNo(null);
|
||||
reqVO.setTurnDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setTurnExplain(null);
|
||||
reqVO.setOutputName(null);
|
||||
reqVO.setOutputNameId(null);
|
||||
reqVO.setInputName(null);
|
||||
reqVO.setInputNameId(null);
|
||||
reqVO.setUserId(null);
|
||||
reqVO.setDeptId(null);
|
||||
reqVO.setDeptName(null);
|
||||
reqVO.setCompanyId(null);
|
||||
reqVO.setCompany(null);
|
||||
reqVO.setRemark(null);
|
||||
reqVO.setCreateBy(null);
|
||||
reqVO.setFromOrganizationId(null);
|
||||
reqVO.setFromDepotId(null);
|
||||
reqVO.setFromCabinetId(null);
|
||||
reqVO.setToOrganizationId(null);
|
||||
reqVO.setToDepotId(null);
|
||||
reqVO.setToCabinetId(null);
|
||||
reqVO.setCreateById(null);
|
||||
reqVO.setAmount(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
reqVO.setProcessInstanceId(null);
|
||||
reqVO.setBillType(null);
|
||||
reqVO.setStatus(null);
|
||||
|
||||
// 调用
|
||||
List<TurnOverDO> list = turnOverService.getTurnOverList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbTurnOver, list.get(0));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue