From 6a945c3b847a75b1192f393fcbe9c9ecdaca3229 Mon Sep 17 00:00:00 2001 From: nixj Date: Fri, 10 May 2024 15:25:01 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90update=E3=80=91bpm=E5=9B=9E=E8=B0=83?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=AE=B0=E5=BD=95=E5=AE=A1=E6=89=B9=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chint/domain/service/BPMOrderDomainService.java | 13 ++++++++----- .../chint/interfaces/rest/bpm/BPMController.java | 6 ++++++ .../chint/manage/entity/OrderExceedStandard.java | 4 ++++ .../mapper/JdbcOrderExceedStandardRepository.java | 7 ++++++- src/test/java/com/chint/ManageTest.java | 9 ++++++--- 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/chint/domain/service/BPMOrderDomainService.java b/src/main/java/com/chint/domain/service/BPMOrderDomainService.java index 266dd21a..82388995 100644 --- a/src/main/java/com/chint/domain/service/BPMOrderDomainService.java +++ b/src/main/java/com/chint/domain/service/BPMOrderDomainService.java @@ -113,21 +113,22 @@ public class BPMOrderDomainService { Leg leg = jdbcLegRepository.findByLegId(legId); anExceedStandardDto.setApplyNo(routeOrder.getApproveOrderNo().getFakeOrderNo())//申请单号 .setLegNo(leg == null ? "" : leg.getLegNo());//行程编号 - //审批结果 boolean success=bpmRequest.ANExceedStandard(anExceedStandardDto).getSuccess(); DelayDispatch.attemptToSend(() -> success, 0); //保存超标报表 OrderExceedStandard orderExceedStandard = OrderExceedStandard.builder() - .applicant(anExceedStandardDto.getApplicant()) + .applicant(orderDetail.getSupplierName()) .companyName(user.getCompanyName()) .deptName(user.getDepartmentInfo().getDepartmentNameOne()) .standardType(getProductTypeName(command.getProductType())) .sourceName(anExceedStandardDto.getSourceSystem()) .reason(anExceedStandardDto.getOrderType()) - .approvalStatus(success?"通过":"拒绝") + .approvalStatus("未审批") .standardAmount(anExceedStandardDto.getOrderMoney()) .employeeNo(employeeNo) + .actualOrderNo(routeOrder.getApproveOrderNo().getActualOrderNo()) + .orderNo(anExceedStandardDto.getOrderNo()) .build(); jdbcOrderExceedStandardRepository.save(orderExceedStandard); } else { @@ -148,15 +149,17 @@ public class BPMOrderDomainService { 0); //保存超标报表 OrderExceedStandard orderExceedStandard = OrderExceedStandard.builder() - .applicant(exceedStandardDto.getOccupant()) + .applicant(orderDetail.getSupplierName()) .companyName(user.getCompanyName()) .deptName(user.getDepartmentInfo().getDepartmentNameOne()) .standardType(getProductTypeName(command.getProductType())) .sourceName(exceedStandardDto.getOrderSource()) .reason(exceedStandardDto.getOrderType()) - .approvalStatus(success?"通过":"拒绝") + .approvalStatus("未审批") .standardAmount(exceedStandardDto.getExcessAmount()) .employeeNo(employeeNo) + .actualOrderNo(routeOrder.getApproveOrderNo().getActualOrderNo()) + .orderNo(exceedStandardDto.getOrderNo()) .build(); jdbcOrderExceedStandardRepository.save(orderExceedStandard); } diff --git a/src/main/java/com/chint/interfaces/rest/bpm/BPMController.java b/src/main/java/com/chint/interfaces/rest/bpm/BPMController.java index dd4fc93c..d5f67fce 100644 --- a/src/main/java/com/chint/interfaces/rest/bpm/BPMController.java +++ b/src/main/java/com/chint/interfaces/rest/bpm/BPMController.java @@ -16,6 +16,7 @@ import com.chint.interfaces.rest.ly.LyApprovalRequest; import com.chint.interfaces.rest.ly.dto.strokepush.Param; import com.chint.interfaces.rest.ly.dto.strokepush.StrokeController; import com.chint.interfaces.rest.ly.dto.strokepush.StrokePushDTO; +import com.chint.manage.mapper.JdbcOrderExceedStandardRepository; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; @@ -52,6 +53,9 @@ public class BPMController { @Autowired private LyApprovalRequest lyApprovalRequest; + @Autowired + private JdbcOrderExceedStandardRepository jdbcOrderExceedStandardRepository; + //超标 @ApiOperation("BPM超标审批结果回传") @PostMapping("/exceedStandard/back") @@ -101,6 +105,8 @@ public class BPMController { } } + //记录审批状态 + jdbcOrderExceedStandardRepository.updateApprovalStatusById(bpmBack.getResult(),bpmBack.getOrderNo()); return Result.Success(CommonMessageConstant.SUCCESS); } diff --git a/src/main/java/com/chint/manage/entity/OrderExceedStandard.java b/src/main/java/com/chint/manage/entity/OrderExceedStandard.java index 3814cb31..9aee228d 100644 --- a/src/main/java/com/chint/manage/entity/OrderExceedStandard.java +++ b/src/main/java/com/chint/manage/entity/OrderExceedStandard.java @@ -45,4 +45,8 @@ public class OrderExceedStandard implements Serializable { private BigDecimal standardAmount; // 超标金额 private String employeeNo; // 用户ID + + private String orderNo; //订单号 + + private String actualOrderNo; //申请单号 } diff --git a/src/main/java/com/chint/manage/mapper/JdbcOrderExceedStandardRepository.java b/src/main/java/com/chint/manage/mapper/JdbcOrderExceedStandardRepository.java index 4bef335e..59bfe27c 100644 --- a/src/main/java/com/chint/manage/mapper/JdbcOrderExceedStandardRepository.java +++ b/src/main/java/com/chint/manage/mapper/JdbcOrderExceedStandardRepository.java @@ -1,11 +1,16 @@ package com.chint.manage.mapper; import com.chint.manage.entity.OrderExceedStandard; +import io.lettuce.core.dynamic.annotation.Param; +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; @Repository public interface JdbcOrderExceedStandardRepository extends CrudRepository { - + @Modifying + @Query("UPDATE order_exceed_standard SET approval_status = :status WHERE order_no = :orderNo") + void updateApprovalStatusById(@Param("status") String status, @Param("orderNo") String orderNo); } diff --git a/src/test/java/com/chint/ManageTest.java b/src/test/java/com/chint/ManageTest.java index 9682e5b9..cfbad8b0 100644 --- a/src/test/java/com/chint/ManageTest.java +++ b/src/test/java/com/chint/ManageTest.java @@ -1,13 +1,11 @@ package com.chint; import com.chint.domain.aggregates.order.OrderDetail; -import com.chint.domain.repository.OrderDetailRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository; import com.chint.infrastructure.util.PageResult; import com.chint.manage.entity.OrderExceedStandard; -import com.chint.manage.entity.excel.BaseExcel; -import com.chint.manage.entity.excel.TrainOrderDetailExcel; import com.chint.manage.entity.dto.ConsumptionDetailDto; +import com.chint.manage.entity.excel.BaseExcel; import com.chint.manage.mapper.JdbcOrderExceedStandardRepository; import com.chint.manage.service.ManageService; import org.junit.jupiter.api.Test; @@ -25,6 +23,11 @@ public class ManageTest { private JdbcOrderExceedStandardRepository jdbcOrderExceedStandardRepository; + @Test + void update(){ + jdbcOrderExceedStandardRepository.updateApprovalStatusById("拒绝",null); + } + @Test void getOrderDetail() { boolean success = false;