【update】bpm回调新增记录审批状态逻辑

This commit is contained in:
nixj 2024-05-10 15:25:01 +08:00
parent 421bf09ac7
commit 6a945c3b84
5 changed files with 30 additions and 9 deletions

View File

@ -113,21 +113,22 @@ public class BPMOrderDomainService {
Leg leg = jdbcLegRepository.findByLegId(legId); Leg leg = jdbcLegRepository.findByLegId(legId);
anExceedStandardDto.setApplyNo(routeOrder.getApproveOrderNo().getFakeOrderNo())//申请单号 anExceedStandardDto.setApplyNo(routeOrder.getApproveOrderNo().getFakeOrderNo())//申请单号
.setLegNo(leg == null ? "" : leg.getLegNo());//行程编号 .setLegNo(leg == null ? "" : leg.getLegNo());//行程编号
//审批结果
boolean success=bpmRequest.ANExceedStandard(anExceedStandardDto).getSuccess(); boolean success=bpmRequest.ANExceedStandard(anExceedStandardDto).getSuccess();
DelayDispatch.attemptToSend(() -> success, DelayDispatch.attemptToSend(() -> success,
0); 0);
//保存超标报表 //保存超标报表
OrderExceedStandard orderExceedStandard = OrderExceedStandard.builder() OrderExceedStandard orderExceedStandard = OrderExceedStandard.builder()
.applicant(anExceedStandardDto.getApplicant()) .applicant(orderDetail.getSupplierName())
.companyName(user.getCompanyName()) .companyName(user.getCompanyName())
.deptName(user.getDepartmentInfo().getDepartmentNameOne()) .deptName(user.getDepartmentInfo().getDepartmentNameOne())
.standardType(getProductTypeName(command.getProductType())) .standardType(getProductTypeName(command.getProductType()))
.sourceName(anExceedStandardDto.getSourceSystem()) .sourceName(anExceedStandardDto.getSourceSystem())
.reason(anExceedStandardDto.getOrderType()) .reason(anExceedStandardDto.getOrderType())
.approvalStatus(success?"通过":"拒绝") .approvalStatus("未审批")
.standardAmount(anExceedStandardDto.getOrderMoney()) .standardAmount(anExceedStandardDto.getOrderMoney())
.employeeNo(employeeNo) .employeeNo(employeeNo)
.actualOrderNo(routeOrder.getApproveOrderNo().getActualOrderNo())
.orderNo(anExceedStandardDto.getOrderNo())
.build(); .build();
jdbcOrderExceedStandardRepository.save(orderExceedStandard); jdbcOrderExceedStandardRepository.save(orderExceedStandard);
} else { } else {
@ -148,15 +149,17 @@ public class BPMOrderDomainService {
0); 0);
//保存超标报表 //保存超标报表
OrderExceedStandard orderExceedStandard = OrderExceedStandard.builder() OrderExceedStandard orderExceedStandard = OrderExceedStandard.builder()
.applicant(exceedStandardDto.getOccupant()) .applicant(orderDetail.getSupplierName())
.companyName(user.getCompanyName()) .companyName(user.getCompanyName())
.deptName(user.getDepartmentInfo().getDepartmentNameOne()) .deptName(user.getDepartmentInfo().getDepartmentNameOne())
.standardType(getProductTypeName(command.getProductType())) .standardType(getProductTypeName(command.getProductType()))
.sourceName(exceedStandardDto.getOrderSource()) .sourceName(exceedStandardDto.getOrderSource())
.reason(exceedStandardDto.getOrderType()) .reason(exceedStandardDto.getOrderType())
.approvalStatus(success?"通过":"拒绝") .approvalStatus("未审批")
.standardAmount(exceedStandardDto.getExcessAmount()) .standardAmount(exceedStandardDto.getExcessAmount())
.employeeNo(employeeNo) .employeeNo(employeeNo)
.actualOrderNo(routeOrder.getApproveOrderNo().getActualOrderNo())
.orderNo(exceedStandardDto.getOrderNo())
.build(); .build();
jdbcOrderExceedStandardRepository.save(orderExceedStandard); jdbcOrderExceedStandardRepository.save(orderExceedStandard);
} }

View File

@ -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.Param;
import com.chint.interfaces.rest.ly.dto.strokepush.StrokeController; import com.chint.interfaces.rest.ly.dto.strokepush.StrokeController;
import com.chint.interfaces.rest.ly.dto.strokepush.StrokePushDTO; import com.chint.interfaces.rest.ly.dto.strokepush.StrokePushDTO;
import com.chint.manage.mapper.JdbcOrderExceedStandardRepository;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -52,6 +53,9 @@ public class BPMController {
@Autowired @Autowired
private LyApprovalRequest lyApprovalRequest; private LyApprovalRequest lyApprovalRequest;
@Autowired
private JdbcOrderExceedStandardRepository jdbcOrderExceedStandardRepository;
//超标 //超标
@ApiOperation("BPM超标审批结果回传") @ApiOperation("BPM超标审批结果回传")
@PostMapping("/exceedStandard/back") @PostMapping("/exceedStandard/back")
@ -101,6 +105,8 @@ public class BPMController {
} }
} }
//记录审批状态
jdbcOrderExceedStandardRepository.updateApprovalStatusById(bpmBack.getResult(),bpmBack.getOrderNo());
return Result.Success(CommonMessageConstant.SUCCESS); return Result.Success(CommonMessageConstant.SUCCESS);
} }

View File

@ -45,4 +45,8 @@ public class OrderExceedStandard implements Serializable {
private BigDecimal standardAmount; // 超标金额 private BigDecimal standardAmount; // 超标金额
private String employeeNo; // 用户ID private String employeeNo; // 用户ID
private String orderNo; //订单号
private String actualOrderNo; //申请单号
} }

View File

@ -1,11 +1,16 @@
package com.chint.manage.mapper; package com.chint.manage.mapper;
import com.chint.manage.entity.OrderExceedStandard; 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.data.repository.CrudRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository
public interface JdbcOrderExceedStandardRepository extends CrudRepository<OrderExceedStandard, Long> { public interface JdbcOrderExceedStandardRepository extends CrudRepository<OrderExceedStandard, Long> {
@Modifying
@Query("UPDATE order_exceed_standard SET approval_status = :status WHERE order_no = :orderNo")
void updateApprovalStatusById(@Param("status") String status, @Param("orderNo") String orderNo);
} }

View File

@ -1,13 +1,11 @@
package com.chint; package com.chint;
import com.chint.domain.aggregates.order.OrderDetail; import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.domain.repository.OrderDetailRepository;
import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository; import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository;
import com.chint.infrastructure.util.PageResult; import com.chint.infrastructure.util.PageResult;
import com.chint.manage.entity.OrderExceedStandard; 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.dto.ConsumptionDetailDto;
import com.chint.manage.entity.excel.BaseExcel;
import com.chint.manage.mapper.JdbcOrderExceedStandardRepository; import com.chint.manage.mapper.JdbcOrderExceedStandardRepository;
import com.chint.manage.service.ManageService; import com.chint.manage.service.ManageService;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -25,6 +23,11 @@ public class ManageTest {
private JdbcOrderExceedStandardRepository jdbcOrderExceedStandardRepository; private JdbcOrderExceedStandardRepository jdbcOrderExceedStandardRepository;
@Test
void update(){
jdbcOrderExceedStandardRepository.updateApprovalStatusById("拒绝",null);
}
@Test @Test
void getOrderDetail() { void getOrderDetail() {
boolean success = false; boolean success = false;