From f0250d96d976033f0b079517d6f66082d744e22b Mon Sep 17 00:00:00 2001 From: chenqp <965586934@qq.com> Date: Tue, 1 Aug 2023 00:01:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=94=B3=E8=AF=B7=E5=8D=95=E5=BC=80?= =?UTF-8?q?=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task/BpmProcessInstanceResultEnum.java | 4 +- .../expenseapply/ExpenseApplyController.java | 19 +- .../expenseapply/ExpenseApplyService.java | 3 +- .../expenseapply/ExpenseApplyServiceImpl.java | 58 +++- .../ExpenseApplyTripService.java | 2 +- .../ExpenseApplyTripServiceImpl.java | 2 +- .../listener/ExpenseApplyResultListener.java | 31 +++ .../bs/enums/ExpenseApplyStatusEnum.java | 6 +- .../vo/ExpenseApplyCreateReqVO.java | 8 +- .../vo/ExpenseApplyExportReqVO.java | 4 +- .../vo/ExpenseApplyPageReqVO.java | 4 +- .../vo/ExpenseApplyTripBaseVO.java | 6 +- .../admin/invoice/vo/InvoiceExcelVO.java | 4 +- .../admin/invoice/vo/InvoiceExportReqVO.java | 4 +- .../admin/invoice/vo/InvoicePageReqVO.java | 4 +- .../admin/invoice/vo/InvoiceRespVO.java | 4 +- .../admin/invoice/vo/InvoiceUpdateReqVO.java | 4 +- .../expenseapply/ExpenseApplyDO.java | 9 + .../expenseapplytrip/ExpenseApplyTripDO.java | 9 +- .../bs/dal/dataobject/invoice/InvoiceDO.java | 8 +- .../ExpenseApplyServiceImplTest.java | 259 ----------------- .../invoice/InvoiceServiceImplTest.java | 263 ------------------ .../src/main/resources/application-local.yaml | 1 + 23 files changed, 149 insertions(+), 567 deletions(-) rename {yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs => yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm}/service/expenseapply/ExpenseApplyService.java (94%) rename {yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs => yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm}/service/expenseapply/ExpenseApplyServiceImpl.java (70%) rename {yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs => yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm}/service/expenseapplytrip/ExpenseApplyTripService.java (90%) rename {yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs => yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm}/service/expenseapplytrip/ExpenseApplyTripServiceImpl.java (90%) create mode 100644 yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/listener/ExpenseApplyResultListener.java delete mode 100644 yudao-module-bs/yudao-module-bs-biz/src/test/java/cn/iocoder/yudao/module/bs/service/expenseapply/ExpenseApplyServiceImplTest.java delete mode 100644 yudao-module-bs/yudao-module-bs-biz/src/test/java/cn/iocoder/yudao/module/bs/service/invoice/InvoiceServiceImplTest.java diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmProcessInstanceResultEnum.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmProcessInstanceResultEnum.java index 3b57554c..01c82999 100644 --- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmProcessInstanceResultEnum.java +++ b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/task/BpmProcessInstanceResultEnum.java @@ -15,8 +15,8 @@ public enum BpmProcessInstanceResultEnum { PROCESS(1, "处理中"), APPROVE(2, "通过"), - REJECT(3, "不通过"), - CANCEL(4, "已取消"), + REJECT(3, "驳回"), + CANCEL(4, "取消"), // ========== 流程任务独有的状态 ========== diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/expenseapply/ExpenseApplyController.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/expenseapply/ExpenseApplyController.java index efe1dab8..9a39031f 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/expenseapply/ExpenseApplyController.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/expenseapply/ExpenseApplyController.java @@ -3,11 +3,15 @@ package cn.iocoder.yudao.module.bpm.controller.admin.expenseapply; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import cn.iocoder.yudao.module.bpm.service.expenseapplytrip.ExpenseApplyTripService; import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.*; import cn.iocoder.yudao.module.bs.convert.expenseapply.ExpenseApplyConvert; import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapply.ExpenseApplyDO; -import cn.iocoder.yudao.module.bs.service.expenseapply.ExpenseApplyService; +import cn.iocoder.yudao.module.bpm.service.expenseapply.ExpenseApplyService; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapplytrip.ExpenseApplyTripDO; +import cn.iocoder.yudao.module.bs.enums.BillTypeEnum; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; @@ -33,7 +37,8 @@ public class ExpenseApplyController { @Resource private ExpenseApplyService expenseApplyService; - + @Resource + private ExpenseApplyTripService expenseApplyTripService; @PostMapping("/create") @Operation(summary = "创建申请单") @PreAuthorize("@ss.hasPermission('bs:expense-apply:create')") @@ -55,9 +60,15 @@ public class ExpenseApplyController { @Operation(summary = "获得申请单") @Parameter(name = "id", description = "编号", required = true, example = "1024") @PreAuthorize("@ss.hasPermission('bs:expense-apply:query')") - public CommonResult getExpenseApply(@RequestParam("id") Long id) { + public CommonResult getExpenseApply(@RequestParam("id") Long id) { ExpenseApplyDO expenseApply = expenseApplyService.getExpenseApply(id); - return success(ExpenseApplyConvert.INSTANCE.convert(expenseApply)); + if (expenseApply.getBillType().equals(BillTypeEnum.CLSQ.getValue())) { + LambdaQueryWrapperX queryWrapper = new LambdaQueryWrapperX<>(); + queryWrapper.eq(ExpenseApplyTripDO::getApplyId, expenseApply.getId()); + List list = expenseApplyTripService.list(queryWrapper); + expenseApply.setExpenseApplyTrips(list); + } + return success(expenseApply); } @GetMapping("/list") diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/expenseapply/ExpenseApplyService.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseapply/ExpenseApplyService.java similarity index 94% rename from yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/expenseapply/ExpenseApplyService.java rename to yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseapply/ExpenseApplyService.java index 87e6fe96..93b16e24 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/expenseapply/ExpenseApplyService.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseapply/ExpenseApplyService.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.bs.service.expenseapply; +package cn.iocoder.yudao.module.bpm.service.expenseapply; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -70,4 +70,5 @@ public interface ExpenseApplyService extends IService { */ List getExpenseApplyList(ExpenseApplyExportReqVO exportReqVO); + void processInstanceCallBack(long id, Integer result); } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/expenseapply/ExpenseApplyServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseapply/ExpenseApplyServiceImpl.java similarity index 70% rename from yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/expenseapply/ExpenseApplyServiceImpl.java rename to yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseapply/ExpenseApplyServiceImpl.java index 556ea8d2..a4f3d574 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/expenseapply/ExpenseApplyServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/expenseapply/ExpenseApplyServiceImpl.java @@ -1,15 +1,18 @@ -package cn.iocoder.yudao.module.bs.service.expenseapply; +package cn.iocoder.yudao.module.bpm.service.expenseapply; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.RandomUtil; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; import cn.iocoder.yudao.framework.security.core.LoginUser; +import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi; +import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; +import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum; import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyCreateReqVO; import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyExportReqVO; import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyPageReqVO; -import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyUpdateReqVO; import cn.iocoder.yudao.module.bs.controller.admin.expenseapplytrip.vo.ExpenseApplyTripCreateReqVO; import cn.iocoder.yudao.module.bs.convert.expenseapply.ExpenseApplyConvert; import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapply.ExpenseApplyDO; @@ -17,7 +20,7 @@ import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapplytrip.ExpenseApplyTr import cn.iocoder.yudao.module.bs.dal.mysql.expenseapply.ExpenseApplyMapper; import cn.iocoder.yudao.module.bs.enums.BillTypeEnum; import cn.iocoder.yudao.module.bs.enums.ExpenseApplyStatusEnum; -import cn.iocoder.yudao.module.bs.service.expenseapplytrip.ExpenseApplyTripService; +import cn.iocoder.yudao.module.bpm.service.expenseapplytrip.ExpenseApplyTripService; import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -30,10 +33,10 @@ import javax.validation.Validator; import java.math.BigDecimal; import java.util.Collection; import java.util.List; +import java.util.Map; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser; -import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; import static cn.iocoder.yudao.module.bs.enums.ErrorCodeConstants.EXPENSE_APPLY_NOT_EXISTS; /** @@ -56,7 +59,7 @@ public class ExpenseApplyServiceImpl extends ServiceImpl variables = BeanUtil.beanToMap(expenseApply); //cqptodo 提交单据,创建工作流 -// String processInstanceId = processInstanceApi.createProcessInstance(userId, -// new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY) -// .setVariables(processInstanceVariables).setBusinessKey(String.valueOf(leave.getId()))); + String processInstanceId = processInstanceApi.createProcessInstance(expenseApply.getUserId(), + new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY) + .setVariables(variables).setBusinessKey(String.valueOf(expenseApply.getId()))); + //cqptodo 待测试是否会更新其它字段 将工作流的编号,更新到单据中 + updateById(new ExpenseApplyDO().setId(expenseApply.getId()).setProcessInstanceId(processInstanceId)); } // 返回 return CommonResult.success(); @@ -113,7 +119,11 @@ public class ExpenseApplyServiceImpl extends ServiceImpl files; @Schema(description = "创建者") private String createBy; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyPageReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyPageReqVO.java index b88f555e..3e00921a 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyPageReqVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapply/vo/ExpenseApplyPageReqVO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo; +import cn.iocoder.yudao.framework.common.pojo.ImageVo; import cn.iocoder.yudao.framework.common.pojo.PageParam; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -9,6 +10,7 @@ import org.springframework.format.annotation.DateTimeFormat; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.List; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -52,7 +54,7 @@ public class ExpenseApplyPageReqVO extends PageParam { private String remark; @Schema(description = "附件") - private String files; + private List files; @Schema(description = "创建者") private String createBy; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapplytrip/vo/ExpenseApplyTripBaseVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapplytrip/vo/ExpenseApplyTripBaseVO.java index f4c8d309..ba881b44 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapplytrip/vo/ExpenseApplyTripBaseVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/expenseapplytrip/vo/ExpenseApplyTripBaseVO.java @@ -45,11 +45,11 @@ public class ExpenseApplyTripBaseVO { @NotNull(message = "出差天数不能为空") private BigDecimal tripDay; - @Schema(description = "出差类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @Schema(description = "出差类型") private String tripType; - @Schema(description = "出差同行人", requiredMode = Schema.RequiredMode.REQUIRED) - private String tripPartners; + @Schema(description = "出差同行人") + private Set tripPartners; @Schema(description = "预计费用") private BigDecimal amount; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceExcelVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceExcelVO.java index 29a42281..ae2236ed 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceExcelVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceExcelVO.java @@ -1,10 +1,12 @@ package cn.iocoder.yudao.module.bs.controller.admin.invoice.vo; +import cn.iocoder.yudao.framework.common.pojo.ImageVo; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.List; /** * 我的发票 Excel VO @@ -18,7 +20,7 @@ public class InvoiceExcelVO { private Long id; @ExcelProperty("附件") - private String files; + private List files; @ExcelProperty("创建者") private String createBy; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceExportReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceExportReqVO.java index 3dca983f..ee833ceb 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceExportReqVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceExportReqVO.java @@ -1,11 +1,13 @@ package cn.iocoder.yudao.module.bs.controller.admin.invoice.vo; +import cn.iocoder.yudao.framework.common.pojo.ImageVo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.List; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -14,7 +16,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ public class InvoiceExportReqVO { @Schema(description = "附件") - private String files; + private List files; @Schema(description = "创建者") private String createBy; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoicePageReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoicePageReqVO.java index 0ed3dfdf..d3084c2b 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoicePageReqVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoicePageReqVO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.bs.controller.admin.invoice.vo; +import cn.iocoder.yudao.framework.common.pojo.ImageVo; import cn.iocoder.yudao.framework.common.pojo.PageParam; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -9,6 +10,7 @@ import org.springframework.format.annotation.DateTimeFormat; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.List; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -19,7 +21,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ public class InvoicePageReqVO extends PageParam { @Schema(description = "附件") - private String files; + private List files; @Schema(description = "创建者") private String createBy; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceRespVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceRespVO.java index 1d975252..09c20542 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceRespVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceRespVO.java @@ -1,11 +1,13 @@ package cn.iocoder.yudao.module.bs.controller.admin.invoice.vo; +import cn.iocoder.yudao.framework.common.pojo.ImageVo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; import java.time.LocalDateTime; +import java.util.List; @Schema(description = "管理后台 - 我的发票 Response VO") @Data @@ -17,7 +19,7 @@ public class InvoiceRespVO extends InvoiceBaseVO { private Long id; @Schema(description = "附件", requiredMode = Schema.RequiredMode.REQUIRED) - private String files; + private List files; @Schema(description = "创建者") private String createBy; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceUpdateReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceUpdateReqVO.java index 999922ee..0ab5ce1c 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceUpdateReqVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/invoice/vo/InvoiceUpdateReqVO.java @@ -1,11 +1,13 @@ package cn.iocoder.yudao.module.bs.controller.admin.invoice.vo; +import cn.iocoder.yudao.framework.common.pojo.ImageVo; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; import javax.validation.constraints.NotNull; +import java.util.List; @Schema(description = "管理后台 - 我的发票更新 Request VO") @Data @@ -19,6 +21,6 @@ public class InvoiceUpdateReqVO extends InvoiceBaseVO { @Schema(description = "附件", requiredMode = Schema.RequiredMode.REQUIRED) @NotNull(message = "附件不能为空") - private String files; + private List files; } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/expenseapply/ExpenseApplyDO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/expenseapply/ExpenseApplyDO.java index 313ca8e7..d9b87f50 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/expenseapply/ExpenseApplyDO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/expenseapply/ExpenseApplyDO.java @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.bs.dal.dataobject.expenseapply; import cn.iocoder.yudao.framework.common.pojo.ImageVo; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; +import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapplytrip.ExpenseApplyTripDO; import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; @@ -81,5 +82,13 @@ public class ExpenseApplyDO extends TenantBaseDO { @TableField(typeHandler = JacksonTypeHandler.class) private List files; + /** + * 对应的流程编号 + * + * 关联 ProcessInstance 的 id 属性 + */ + private String processInstanceId; + @TableField(exist = false) + private List expenseApplyTrips; } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/expenseapplytrip/ExpenseApplyTripDO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/expenseapplytrip/ExpenseApplyTripDO.java index 33b00ba8..969500de 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/expenseapplytrip/ExpenseApplyTripDO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/expenseapplytrip/ExpenseApplyTripDO.java @@ -1,5 +1,7 @@ package cn.iocoder.yudao.module.bs.dal.dataobject.expenseapplytrip; +import cn.iocoder.yudao.framework.common.pojo.ImageVo; +import cn.iocoder.yudao.framework.mybatis.core.type.JsonLongSetTypeHandler; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import lombok.*; @@ -40,7 +42,8 @@ public class ExpenseApplyTripDO extends TenantBaseDO { /** * 附件 */ - private String files; + @TableField(typeHandler = JacksonTypeHandler.class) + private List files; /** * 创建者 */ @@ -82,8 +85,8 @@ public class ExpenseApplyTripDO extends TenantBaseDO { /** * 出差同行人 */ - @TableField(typeHandler = JacksonTypeHandler.class) - private String tripPartners; + @TableField(typeHandler = JsonLongSetTypeHandler.class) + private Set tripPartners; /** * 预计费用 */ diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/invoice/InvoiceDO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/invoice/InvoiceDO.java index 8541f69b..6ee973c0 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/invoice/InvoiceDO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/invoice/InvoiceDO.java @@ -1,19 +1,22 @@ package cn.iocoder.yudao.module.bs.dal.dataobject.invoice; +import cn.iocoder.yudao.framework.common.pojo.ImageVo; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import lombok.*; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.List; /** * 我的发票 DO * * @author chenqp */ -@TableName("bs_invoice") +@TableName(value = "bs_invoice", autoResultMap = true) @KeySequence("bs_invoice_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 @Data @EqualsAndHashCode(callSuper = true) @@ -31,7 +34,8 @@ public class InvoiceDO extends TenantBaseDO { /** * 附件 */ - private String files; + @TableField(typeHandler = JacksonTypeHandler.class) + private List files; /** * 发票类型 diff --git a/yudao-module-bs/yudao-module-bs-biz/src/test/java/cn/iocoder/yudao/module/bs/service/expenseapply/ExpenseApplyServiceImplTest.java b/yudao-module-bs/yudao-module-bs-biz/src/test/java/cn/iocoder/yudao/module/bs/service/expenseapply/ExpenseApplyServiceImplTest.java deleted file mode 100644 index d2afffaf..00000000 --- a/yudao-module-bs/yudao-module-bs-biz/src/test/java/cn/iocoder/yudao/module/bs/service/expenseapply/ExpenseApplyServiceImplTest.java +++ /dev/null @@ -1,259 +0,0 @@ -package cn.iocoder.yudao.module.bs.service.expenseapply; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; -import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyCreateReqVO; -import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyExportReqVO; -import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyPageReqVO; -import cn.iocoder.yudao.module.bs.controller.admin.expenseapply.vo.ExpenseApplyUpdateReqVO; -import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapply.ExpenseApplyDO; -import cn.iocoder.yudao.module.bs.dal.mysql.expenseapply.ExpenseApplyMapper; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.springframework.context.annotation.Import; - -import javax.annotation.Resource; -import java.util.List; - -import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; -import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId; -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; -import static cn.iocoder.yudao.module.bs.enums.ErrorCodeConstants.EXPENSE_APPLY_NOT_EXISTS; -import static org.junit.jupiter.api.Assertions.*; - -/** - * {@link ExpenseApplyServiceImpl} 的单元测试类 - * - * @author 芋道源码 - */ -@Import(ExpenseApplyServiceImpl.class) -public class ExpenseApplyServiceImplTest extends BaseDbUnitTest { - - @Resource - private ExpenseApplyServiceImpl expenseApplyService; - - @Resource - private ExpenseApplyMapper expenseApplyMapper; - - @Test - public void testCreateExpenseApply_success() { - // 准备参数 - ExpenseApplyCreateReqVO reqVO = randomPojo(ExpenseApplyCreateReqVO.class); - - // 调用 -// Long expenseApplyId = expenseApplyService.createExpenseApply(reqVO); -// // 断言 -// assertNotNull(expenseApplyId); -// // 校验记录的属性是否正确 -// ExpenseApplyDO expenseApply = expenseApplyMapper.selectById(expenseApplyId); -// assertPojoEquals(reqVO, expenseApply); - } - - @Test - public void testUpdateExpenseApply_success() { - // mock 数据 - ExpenseApplyDO dbExpenseApply = randomPojo(ExpenseApplyDO.class); - expenseApplyMapper.insert(dbExpenseApply);// @Sql: 先插入出一条存在的数据 - // 准备参数 - ExpenseApplyUpdateReqVO reqVO = randomPojo(ExpenseApplyUpdateReqVO.class, o -> { - o.setId(dbExpenseApply.getId()); // 设置更新的 ID - }); - - // 调用 - expenseApplyService.updateExpenseApply(reqVO); - // 校验是否更新正确 - ExpenseApplyDO expenseApply = expenseApplyMapper.selectById(reqVO.getId()); // 获取最新的 - assertPojoEquals(reqVO, expenseApply); - } - - @Test - public void testUpdateExpenseApply_notExists() { - // 准备参数 - ExpenseApplyUpdateReqVO reqVO = randomPojo(ExpenseApplyUpdateReqVO.class); - - // 调用, 并断言异常 - assertServiceException(() -> expenseApplyService.updateExpenseApply(reqVO), EXPENSE_APPLY_NOT_EXISTS); - } - - @Test - public void testDeleteExpenseApply_success() { - // mock 数据 - ExpenseApplyDO dbExpenseApply = randomPojo(ExpenseApplyDO.class); - expenseApplyMapper.insert(dbExpenseApply);// @Sql: 先插入出一条存在的数据 - // 准备参数 - Long id = dbExpenseApply.getId(); - - // 调用 - expenseApplyService.deleteExpenseApply(id); - // 校验数据不存在了 - assertNull(expenseApplyMapper.selectById(id)); - } - - @Test - public void testDeleteExpenseApply_notExists() { - // 准备参数 - Long id = randomLongId(); - - // 调用, 并断言异常 - assertServiceException(() -> expenseApplyService.deleteExpenseApply(id), EXPENSE_APPLY_NOT_EXISTS); - } - - @Test - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 - public void testGetExpenseApplyPage() { - // mock 数据 - ExpenseApplyDO dbExpenseApply = randomPojo(ExpenseApplyDO.class, o -> { // 等会查询到 - o.setBillType(null); - o.setApplyNo(null); - o.setUserId(null); - o.setNickname(null); - o.setDeptId(null); - o.setDeptName(null); - o.setProjectName(null); - o.setReason(null); - o.setAmount(null); - o.setStatus(null); - o.setRemark(null); - o.setFiles(null); - o.setCreateBy(null); - o.setCreateTime(null); - o.setUpdateBy(null); - }); - expenseApplyMapper.insert(dbExpenseApply); - // 测试 billType 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setBillType(null))); - // 测试 applyNo 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setApplyNo(null))); - // 测试 userId 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setUserId(null))); - // 测试 nickname 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setNickname(null))); - // 测试 deptId 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setDeptId(null))); - // 测试 deptName 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setDeptName(null))); - // 测试 projectName 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setProjectName(null))); - // 测试 reason 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setReason(null))); - // 测试 amount 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setAmount(null))); - // 测试 status 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setStatus(null))); - // 测试 remark 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setRemark(null))); - // 测试 files 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setFiles(null))); - // 测试 createBy 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setCreateBy(null))); - // 测试 createTime 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setCreateTime(null))); - // 测试 updateBy 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setUpdateBy(null))); - // 准备参数 - ExpenseApplyPageReqVO reqVO = new ExpenseApplyPageReqVO(); - reqVO.setBillType(null); - reqVO.setApplyNo(null); - reqVO.setUserId(null); - reqVO.setNickname(null); - reqVO.setDeptId(null); - reqVO.setDeptName(null); - reqVO.setProjectName(null); - reqVO.setReason(null); - reqVO.setAmount(null); - reqVO.setStatus(null); - reqVO.setRemark(null); - reqVO.setFiles(null); - reqVO.setCreateBy(null); - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); - reqVO.setUpdateBy(null); - - // 调用 - PageResult pageResult = expenseApplyService.getExpenseApplyPage(reqVO); - // 断言 - assertEquals(1, pageResult.getTotal()); - assertEquals(1, pageResult.getList().size()); - assertPojoEquals(dbExpenseApply, pageResult.getList().get(0)); - } - - @Test - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 - public void testGetExpenseApplyList() { - // mock 数据 - ExpenseApplyDO dbExpenseApply = randomPojo(ExpenseApplyDO.class, o -> { // 等会查询到 - o.setBillType(null); - o.setApplyNo(null); - o.setUserId(null); - o.setNickname(null); - o.setDeptId(null); - o.setDeptName(null); - o.setProjectName(null); - o.setReason(null); - o.setAmount(null); - o.setStatus(null); - o.setRemark(null); - o.setFiles(null); - o.setCreateBy(null); - o.setCreateTime(null); - o.setUpdateBy(null); - }); - expenseApplyMapper.insert(dbExpenseApply); - // 测试 billType 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setBillType(null))); - // 测试 applyNo 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setApplyNo(null))); - // 测试 userId 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setUserId(null))); - // 测试 nickname 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setNickname(null))); - // 测试 deptId 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setDeptId(null))); - // 测试 deptName 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setDeptName(null))); - // 测试 projectName 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setProjectName(null))); - // 测试 reason 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setReason(null))); - // 测试 amount 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setAmount(null))); - // 测试 status 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setStatus(null))); - // 测试 remark 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setRemark(null))); - // 测试 files 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setFiles(null))); - // 测试 createBy 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setCreateBy(null))); - // 测试 createTime 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setCreateTime(null))); - // 测试 updateBy 不匹配 - expenseApplyMapper.insert(cloneIgnoreId(dbExpenseApply, o -> o.setUpdateBy(null))); - // 准备参数 - ExpenseApplyExportReqVO reqVO = new ExpenseApplyExportReqVO(); - reqVO.setBillType(null); - reqVO.setApplyNo(null); - reqVO.setUserId(null); - reqVO.setNickname(null); - reqVO.setDeptId(null); - reqVO.setDeptName(null); - reqVO.setProjectName(null); - reqVO.setReason(null); - reqVO.setAmount(null); - reqVO.setStatus(null); - reqVO.setRemark(null); - reqVO.setFiles(null); - reqVO.setCreateBy(null); - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); - reqVO.setUpdateBy(null); - - // 调用 - List list = expenseApplyService.getExpenseApplyList(reqVO); - // 断言 - assertEquals(1, list.size()); - assertPojoEquals(dbExpenseApply, list.get(0)); - } - -} diff --git a/yudao-module-bs/yudao-module-bs-biz/src/test/java/cn/iocoder/yudao/module/bs/service/invoice/InvoiceServiceImplTest.java b/yudao-module-bs/yudao-module-bs-biz/src/test/java/cn/iocoder/yudao/module/bs/service/invoice/InvoiceServiceImplTest.java deleted file mode 100644 index 71d5c516..00000000 --- a/yudao-module-bs/yudao-module-bs-biz/src/test/java/cn/iocoder/yudao/module/bs/service/invoice/InvoiceServiceImplTest.java +++ /dev/null @@ -1,263 +0,0 @@ -package cn.iocoder.yudao.module.bs.service.invoice; - -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.bs.controller.admin.invoice.vo.*; -import cn.iocoder.yudao.module.bs.dal.dataobject.invoice.InvoiceDO; -import cn.iocoder.yudao.module.bs.dal.mysql.invoice.InvoiceMapper; -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.bs.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 InvoiceServiceImpl} 的单元测试类 - * - * @author chenqp - */ -@Import(InvoiceServiceImpl.class) -public class InvoiceServiceImplTest extends BaseDbUnitTest { - - @Resource - private InvoiceServiceImpl invoiceService; - - @Resource - private InvoiceMapper invoiceMapper; - - @Test - public void testCreateInvoice_success() { - // 准备参数 - InvoiceCreateReqVO reqVO = randomPojo(InvoiceCreateReqVO.class); - - // 调用 - Long invoiceId = invoiceService.createInvoice(reqVO); - // 断言 - assertNotNull(invoiceId); - // 校验记录的属性是否正确 - InvoiceDO invoice = invoiceMapper.selectById(invoiceId); - assertPojoEquals(reqVO, invoice); - } - - @Test - public void testUpdateInvoice_success() { - // mock 数据 - InvoiceDO dbInvoice = randomPojo(InvoiceDO.class); - invoiceMapper.insert(dbInvoice);// @Sql: 先插入出一条存在的数据 - // 准备参数 - InvoiceUpdateReqVO reqVO = randomPojo(InvoiceUpdateReqVO.class, o -> { - o.setId(dbInvoice.getId()); // 设置更新的 ID - }); - - // 调用 - invoiceService.updateInvoice(reqVO); - // 校验是否更新正确 - InvoiceDO invoice = invoiceMapper.selectById(reqVO.getId()); // 获取最新的 - assertPojoEquals(reqVO, invoice); - } - - @Test - public void testUpdateInvoice_notExists() { - // 准备参数 - InvoiceUpdateReqVO reqVO = randomPojo(InvoiceUpdateReqVO.class); - - // 调用, 并断言异常 - assertServiceException(() -> invoiceService.updateInvoice(reqVO), INVOICE_NOT_EXISTS); - } - - @Test - public void testDeleteInvoice_success() { - // mock 数据 - InvoiceDO dbInvoice = randomPojo(InvoiceDO.class); - invoiceMapper.insert(dbInvoice);// @Sql: 先插入出一条存在的数据 - // 准备参数 - Long id = dbInvoice.getId(); - - // 调用 - invoiceService.deleteInvoice(id); - // 校验数据不存在了 - assertNull(invoiceMapper.selectById(id)); - } - - @Test - public void testDeleteInvoice_notExists() { - // 准备参数 - Long id = randomLongId(); - - // 调用, 并断言异常 - assertServiceException(() -> invoiceService.deleteInvoice(id), INVOICE_NOT_EXISTS); - } - - @Test - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 - public void testGetInvoicePage() { - // mock 数据 - InvoiceDO dbInvoice = randomPojo(InvoiceDO.class, o -> { // 等会查询到 - o.setFiles(null); - o.setCreateBy(null); - o.setCreateTime(null); - o.setUpdateBy(null); - o.setInvoiceType(null); - o.setInvoiceCode(null); - o.setInvoiceNum(null); - o.setInvoiceDate(null); - o.setSeller(null); - o.setTaxAmount(null); - o.setExcludingTaxAmount(null); - o.setTotalAmount(null); - o.setDeptId(null); - o.setDeptName(null); - o.setRemark(null); - }); - invoiceMapper.insert(dbInvoice); - // 测试 files 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setFiles(null))); - // 测试 createBy 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setCreateBy(null))); - // 测试 createTime 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setCreateTime(null))); - // 测试 updateBy 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setUpdateBy(null))); - // 测试 invoiceType 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setInvoiceType(null))); - // 测试 invoiceCode 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setInvoiceCode(null))); - // 测试 invoiceNum 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setInvoiceNum(null))); - // 测试 invoiceDate 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setInvoiceDate(null))); - // 测试 seller 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setSeller(null))); - // 测试 taxAmount 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setTaxAmount(null))); - // 测试 excludingTaxAmount 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setExcludingTaxAmount(null))); - // 测试 totalAmount 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setTotalAmount(null))); - // 测试 deptId 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setDeptId(null))); - // 测试 deptName 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setDeptName(null))); - // 测试 remark 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setRemark(null))); - // 准备参数 - InvoicePageReqVO reqVO = new InvoicePageReqVO(); - reqVO.setFiles(null); - reqVO.setCreateBy(null); - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); - reqVO.setUpdateBy(null); - reqVO.setInvoiceType(null); - reqVO.setInvoiceCode(null); - reqVO.setInvoiceNum(null); - reqVO.setInvoiceDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); - reqVO.setSeller(null); - reqVO.setTaxAmount(null); - reqVO.setExcludingTaxAmount(null); - reqVO.setTotalAmount(null); - reqVO.setDeptId(null); - reqVO.setDeptName(null); - reqVO.setRemark(null); - - // 调用 - PageResult pageResult = invoiceService.getInvoicePage(reqVO); - // 断言 - assertEquals(1, pageResult.getTotal()); - assertEquals(1, pageResult.getList().size()); - assertPojoEquals(dbInvoice, pageResult.getList().get(0)); - } - - @Test - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 - public void testGetInvoiceList() { - // mock 数据 - InvoiceDO dbInvoice = randomPojo(InvoiceDO.class, o -> { // 等会查询到 - o.setFiles(null); - o.setCreateBy(null); - o.setCreateTime(null); - o.setUpdateBy(null); - o.setInvoiceType(null); - o.setInvoiceCode(null); - o.setInvoiceNum(null); - o.setInvoiceDate(null); - o.setSeller(null); - o.setTaxAmount(null); - o.setExcludingTaxAmount(null); - o.setTotalAmount(null); - o.setDeptId(null); - o.setDeptName(null); - o.setRemark(null); - }); - invoiceMapper.insert(dbInvoice); - // 测试 files 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setFiles(null))); - // 测试 createBy 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setCreateBy(null))); - // 测试 createTime 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setCreateTime(null))); - // 测试 updateBy 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setUpdateBy(null))); - // 测试 invoiceType 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setInvoiceType(null))); - // 测试 invoiceCode 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setInvoiceCode(null))); - // 测试 invoiceNum 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setInvoiceNum(null))); - // 测试 invoiceDate 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setInvoiceDate(null))); - // 测试 seller 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setSeller(null))); - // 测试 taxAmount 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setTaxAmount(null))); - // 测试 excludingTaxAmount 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setExcludingTaxAmount(null))); - // 测试 totalAmount 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setTotalAmount(null))); - // 测试 deptId 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setDeptId(null))); - // 测试 deptName 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setDeptName(null))); - // 测试 remark 不匹配 - invoiceMapper.insert(cloneIgnoreId(dbInvoice, o -> o.setRemark(null))); - // 准备参数 - InvoiceExportReqVO reqVO = new InvoiceExportReqVO(); - reqVO.setFiles(null); - reqVO.setCreateBy(null); - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); - reqVO.setUpdateBy(null); - reqVO.setInvoiceType(null); - reqVO.setInvoiceCode(null); - reqVO.setInvoiceNum(null); - reqVO.setInvoiceDate(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); - reqVO.setSeller(null); - reqVO.setTaxAmount(null); - reqVO.setExcludingTaxAmount(null); - reqVO.setTotalAmount(null); - reqVO.setDeptId(null); - reqVO.setDeptName(null); - reqVO.setRemark(null); - - // 调用 - List list = invoiceService.getInvoiceList(reqVO); - // 断言 - assertEquals(1, list.size()); - assertPojoEquals(dbInvoice, list.get(0)); - } - -} diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index 04fd67c7..9c506d42 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -150,6 +150,7 @@ logging: level: # 配置自己写的 MyBatis Mapper 打印日志 cn.iocoder.yudao.module.bpm.dal.mysql: debug + cn.iocoder.yudao.module.bs.dal.mysql: debug cn.iocoder.yudao.module.infra.dal.mysql: debug cn.iocoder.yudao.module.infra.dal.mysql.job.JobLogMapper: INFO # 配置 JobLogMapper 的日志级别为 info cn.iocoder.yudao.module.pay.dal.mysql: debug