package com.prolog.rdc.tms.service.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.codingapi.tx.annotation.TxTransaction;
import com.google.common.collect.Lists;
import com.prolog.common.util.DateUtils;
import com.prolog.common.util.ToolKits;
import com.prolog.framework.common.message.RestMessage;
import com.prolog.framework.core.exception.BizException;
import com.prolog.framework.core.exception.PrologException;
import com.prolog.framework.core.restriction.Criteria;
import com.prolog.framework.core.restriction.Order;
import com.prolog.framework.core.restriction.Restriction;
import com.prolog.framework.core.restriction.Restrictions;
import com.prolog.product.core.framework.entity.UserEntity;
import com.prolog.product.core.framework.util.PlgFxUsrUtils;
import com.prolog.rdc.tms.constant.DataDictionaryConstant;
import com.prolog.rdc.tms.constant.enums.EventFeedbackStatusEnum;
import com.prolog.rdc.tms.constant.enums.EventFeedbackTypeEnum;
import com.prolog.rdc.tms.constant.enums.EventTypeEnum;
import com.prolog.rdc.tms.dao.mapper.TmsLoadingBillDetailMapper;
import com.prolog.rdc.tms.dao.mapper.TmsShipbillDetailMapper;
import com.prolog.rdc.tms.dao.mapper.TmsShipbillEventFeedbackMapper;
import com.prolog.rdc.tms.dao.mapper.TmsShipbillHeaderMapper;
import com.prolog.rdc.tms.model.dto.ApprovalInfoDTO;
import com.prolog.rdc.tms.model.dto.ShipbillDetailViewDTO;
import com.prolog.rdc.tms.model.dto.ShipbillViewDTO;
import com.prolog.rdc.tms.model.dto.basicData.ApprovalLogDTO;
import com.prolog.rdc.tms.model.dto.basicData.ApprovalNodeSelDTO;
import com.prolog.rdc.tms.model.entity.SysRefdatadModel;
import com.prolog.rdc.tms.model.entity.TmsLoadingBillDetailModel;
import com.prolog.rdc.tms.model.entity.TmsShipbillDetailModel;
import com.prolog.rdc.tms.model.entity.TmsShipbillEventFeedback;
import com.prolog.rdc.tms.model.entity.TmsShipbillHeaderModel;
import com.prolog.rdc.tms.model.vo.ApprovalVO;
import com.prolog.rdc.tms.model.vo.ShipbillNodeTrackingSaveVO;
import com.prolog.rdc.tms.model.vo.ShipbillOperateLogSaveVO;
import com.prolog.rdc.tms.model.vo.UpdateLatitudeAndLongitudeVO;
import com.prolog.rdc.tms.model.vo.basicConfigure.ApprovalBusinessNodeVO;
import com.prolog.rdc.tms.rmi.feign.MaindataFeign;
import com.prolog.rdc.tms.service.ShipbillEventFeedbackService;
import com.prolog.rdc.tms.service.ShipbillNodeTrackingService;
import com.prolog.rdc.tms.service.ShipbillOperateLogService;
import com.prolog.rdc.tms.util.ConvertorUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author hongbo.pan
 * @since 2023-01-31 15:01:18
 */
@Service
public class ShipbillEventFeedbackServiceImpl implements ShipbillEventFeedbackService {

    @Autowired
    private TmsShipbillEventFeedbackMapper tmsShipbillEventFeedbackMapper;

    @Autowired
    private MaindataFeign maindataTmsResource;

    @Autowired
    private TmsShipbillHeaderMapper tmsShipbillHeaderMapper;

    @Autowired
    private TmsShipbillDetailMapper tmsShipbillDetailMapper;

    @Autowired
    private ConvertorUtil convertorUtil;

    @Autowired
    private ShipbillOperateLogService shipbillOperateLogService;

    @Autowired
    private ShipbillNodeTrackingService shipbillNodeTrackingService;

    @Autowired
    private TmsLoadingBillDetailMapper tmsLoadingBillDetailMapper;

    /**
     * 审核信息查询
     * @param vo
     * @return
     */
    @Override
    public ApprovalInfoDTO getApprovalInfo(ApprovalVO vo) {
        ToolKits.isParamNull(vo.getApprovalObjectId(), "审批对象Id不为空");
        ToolKits.isParamNull(vo.getApprovalBusinessId(), "审批业务Id不为空");
        String eventFeedbackId = vo.getApprovalObjectId();
        TmsShipbillEventFeedback tmsShipbillEventFeedback = tmsShipbillEventFeedbackMapper.findById(eventFeedbackId, TmsShipbillEventFeedback.class);
        List<TmsShipbillHeaderModel> tmsShipbillHeaderModelList = tmsShipbillHeaderMapper.findByIds(TmsShipbillHeaderModel.class, tmsShipbillEventFeedback.getShipbillId().split(","), null);
        Criteria criteria = Criteria.forClass(TmsShipbillDetailModel.class);
        Restriction r1 = Restrictions.in("shipbillId", tmsShipbillEventFeedback.getShipbillId().split(","));
        criteria.setRestriction(r1);
        List<TmsShipbillDetailModel> tmsShipbillDetailModelList = tmsShipbillDetailMapper.findByCriteria(criteria);
        Map<String, List<TmsShipbillDetailModel>> listMap = tmsShipbillDetailModelList.stream().collect(Collectors.groupingBy(TmsShipbillDetailModel::getShipbillId));
        List<SysRefdatadModel> dicData = convertorUtil.getDictionary(new String[] { DataDictionaryConstant.SHIPBILL_STATUS, // 运单状态
                DataDictionaryConstant.TRANSPORT_STATUS, // 运输状态
                DataDictionaryConstant.ABNORMAL_STATUS, // 异常状态
                DataDictionaryConstant.SCAN_STATUS, // 扫描状态
                DataDictionaryConstant.LINE_CARRIER_TYPE, // 承运方类型
                DataDictionaryConstant.DELIVERY_METHOD_TYPE, // 配送方式
                DataDictionaryConstant.TRANSPORT_TYPE, // 运输类型(运输模式)
                DataDictionaryConstant.TEMPERATURE_REQUIREMENT, // 温度要求
                DataDictionaryConstant.SHIPPER_TYPE, // 发货方类型
                DataDictionaryConstant.CONSIGNEE_TYPE, // 收货方类型
                DataDictionaryConstant.ORDER_TYPE, // 订单类型
                DataDictionaryConstant.ORDER_BUSINESS_TYPE // 订单业务类型
        });
        List<ShipbillViewDTO> shipbillInfoDTOList = tmsShipbillHeaderModelList.stream().map(tmsShipbillHeaderModel -> {
            ShipbillViewDTO shipbillViewDTO = BeanUtil.copyProperties(tmsShipbillHeaderModel, ShipbillViewDTO.class);
            shipbillViewDTO.setOrderTypeName(ConvertorUtil.getName(dicData, DataDictionaryConstant.ORDER_TYPE, String.valueOf(shipbillViewDTO.getOrderType())));
            shipbillViewDTO.setOrderBusinessTypeName(ConvertorUtil.getName(dicData, DataDictionaryConstant.ORDER_BUSINESS_TYPE, String.valueOf(shipbillViewDTO.getOrderBusinessType())));
            shipbillViewDTO.setDeliveryMethodTypeName(ConvertorUtil.getName(dicData, DataDictionaryConstant.DELIVERY_METHOD_TYPE, String.valueOf(shipbillViewDTO.getDeliveryMethodType())));
            shipbillViewDTO.setTransportTypeName(ConvertorUtil.getName(dicData, DataDictionaryConstant.TRANSPORT_TYPE, String.valueOf(shipbillViewDTO.getTransportType())));
            shipbillViewDTO.setTemperatureRequirementName(ConvertorUtil.getName(dicData, DataDictionaryConstant.TEMPERATURE_REQUIREMENT, String.valueOf(shipbillViewDTO.getTemperatureRequirement())));
            shipbillViewDTO.setShipperTypeName(ConvertorUtil.getName(dicData, DataDictionaryConstant.SHIPPER_TYPE, String.valueOf(shipbillViewDTO.getShipperType())));
            shipbillViewDTO.setConsigneeTypeName(ConvertorUtil.getName(dicData, DataDictionaryConstant.CONSIGNEE_TYPE, String.valueOf(shipbillViewDTO.getConsigneeType())));
            List<TmsShipbillDetailModel> detailModelList = listMap.get(tmsShipbillHeaderModel.getShipbillId());
            if (CollectionUtil.isNotEmpty(detailModelList)) {
                shipbillViewDTO.setShipbillDetailViewDTOS(detailModelList.stream().map(detailModel -> BeanUtil.copyProperties(detailModel, ShipbillDetailViewDTO.class)).collect(Collectors.toList()));
            }
            return shipbillViewDTO;
        }).collect(Collectors.toList());

        ApprovalInfoDTO dto = new ApprovalInfoDTO();
        dto.setShipbillInfoDTOList(shipbillInfoDTOList);
        RestMessage<List<ApprovalLogDTO>> resourceBusLog = maindataTmsResource.getBusLog(vo.getApprovalBusinessId().toString());
        if (!resourceBusLog.isSuccess()) {
            throw new PrologException("调用审批日志服务失败!");
        }
        dto.setShipbillApprovalLogDTOList(resourceBusLog.getData());

        RestMessage<List<ApprovalNodeSelDTO>> resourceBusDetail = maindataTmsResource.getBusDetail(vo.getApprovalBusinessId().toString());
        if (!resourceBusLog.isSuccess()) {
            throw new PrologException("调用审批节点服务失败!");
        }
        dto.setShipbillApprovalNodeDTOList(resourceBusDetail.getData());
        return dto;
    }

    /**
     * 审批作废
     * @param vo
     */
    @Override
    public void invalidApproval(ApprovalVO vo) {
        ToolKits.isParamNull(vo.getApprovalObjectId(), "审批对象Id不为空");
        ToolKits.isParamNull(vo.getApprovalBusinessId(), "审批业务ID不为空");
        UserEntity user = PlgFxUsrUtils.getUserEntity();
        ToolKits.isParamNull(user, "当前人员没有操作权限");
        String eventFeedbackId = vo.getApprovalObjectId();
        TmsShipbillEventFeedback tmsShipbillEventFeedback = tmsShipbillEventFeedbackMapper.findById(eventFeedbackId, TmsShipbillEventFeedback.class);
        tmsShipbillEventFeedback.setStatus(EventFeedbackStatusEnum.INVALID.getCode());
        tmsShipbillEventFeedback.setUpdatetime(new Date());
        tmsShipbillEventFeedback.setUpdateperson(user.getNickname());
        tmsShipbillEventFeedbackMapper.update(tmsShipbillEventFeedback);
        // 审核业务作废
        RestMessage<Object> restMessage = maindataTmsResource.approvalInvalidExecute(vo.getApprovalBusinessId().toString());
        if (!restMessage.isSuccess()) {
            throw new BizException("调用审核作废失败");
        }
    }

    /**
     * 审批流撤回
     * @param vo
     */
    @Override
    public void retractApproval(ApprovalVO vo) {
        ToolKits.isParamNull(vo.getApprovalBusinessId(), "审批业务ID不为空");
        // 提交当前审批
        RestMessage<Object> restMessage1 = maindataTmsResource.approvalRetractExecute(vo.getApprovalBusinessId().toString());
        if (!restMessage1.isSuccess()) {
            throw new BizException("调用审核撤回失败");
        }
    }

    /**
     * 审批流提交
     * @param vo
     */
    @Override
    public void submitApproval(ApprovalVO vo) {
        ToolKits.isParamNull(vo.getApprovalBusinessId(), "审批业务ID不为空");
        // 提交当前审批
        RestMessage<Object> restMessage1 = maindataTmsResource.approvalSubmitExecute(vo.getApprovalBusinessId().toString());
        if (!restMessage1.isSuccess()) {
            throw new BizException("调用审批提交失败");
        }
    }

    /**
     * 审批流审核
     * @param vo
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void reviewApproval(ApprovalVO vo) {
        Boolean finish = nodeApprovalExecute(vo);
        if (finish) {
            UserEntity user = PlgFxUsrUtils.getUserEntity();
            String eventFeedbackId = vo.getApprovalObjectId();
            TmsShipbillEventFeedback tmsShipbillEventFeedback = tmsShipbillEventFeedbackMapper.findById(eventFeedbackId, TmsShipbillEventFeedback.class);
            tmsShipbillEventFeedback.setStatus(EventFeedbackStatusEnum.CHECKED.getCode());
            tmsShipbillEventFeedback.setUpdatetime(new Date());
            tmsShipbillEventFeedback.setUpdateperson(user.getNickname());
            tmsShipbillEventFeedbackMapper.update(tmsShipbillEventFeedback);
            String memo = generateMemo(tmsShipbillEventFeedback);
            List<TmsShipbillHeaderModel> tmsShipbillHeaderModelList = tmsShipbillHeaderMapper.findByIds(TmsShipbillHeaderModel.class, tmsShipbillEventFeedback.getShipbillId().split(","), null);
            List<Long> branchIdList = Lists.newArrayList();
            List<Long> shipperIdList = Lists.newArrayList();
            List<Long> consigneeIdList = Lists.newArrayList();
            tmsShipbillHeaderModelList.forEach(tmsShipbillHeaderModel -> {
                // 运单节点保存
                ShipbillNodeTrackingSaveVO shipbillNodeTrackingSaveVO = new ShipbillNodeTrackingSaveVO();
                shipbillNodeTrackingSaveVO.setNodeEvent(DataDictionaryConstant.SHIPBILL_EVENT_FEEDBACK + " " + memo);
                shipbillNodeTrackingSaveVO.setStatus(tmsShipbillHeaderModel.getStatus());
                shipbillNodeTrackingSaveVO.setShipbillId(tmsShipbillHeaderModel.getShipbillId());
                shipbillNodeTrackingSaveVO.setShipbillNo(tmsShipbillHeaderModel.getShipbillNo());
                shipbillNodeTrackingSaveVO.setPicUrl(tmsShipbillEventFeedback.getEventPic());
                shipbillNodeTrackingSaveVO.setNodeDate(new Date());
                shipbillNodeTrackingService.addShipbillNodeTrackingData(shipbillNodeTrackingSaveVO);
                // 运单日志保存
                ShipbillOperateLogSaveVO shipbillOperateLogSaveVO = new ShipbillOperateLogSaveVO();
                shipbillOperateLogSaveVO.setShipbillId(tmsShipbillHeaderModel.getShipbillId());
                shipbillOperateLogSaveVO.setShipbillNo(tmsShipbillHeaderModel.getShipbillId());
                shipbillOperateLogSaveVO.setOperateEvent(DataDictionaryConstant.SHIPBILL_EVENT_FEEDBACK + " " + memo);
                shipbillOperateLogSaveVO.setOldStatus(tmsShipbillHeaderModel.getStatus());
                shipbillOperateLogSaveVO.setNewStatus(tmsShipbillHeaderModel.getStatus());
                shipbillOperateLogService.addShipbillOperateLogData(shipbillOperateLogSaveVO);
                if (tmsShipbillEventFeedback.getEventType().contains(EventFeedbackTypeEnum.POSITION.getCode())) {
                    Criteria criteriaDetail = Criteria.forClass(TmsLoadingBillDetailModel.class);
                    Restriction r1 = Restrictions.eq("shipbillId", tmsShipbillHeaderModel.getShipbillId());
                    Restriction r2 = Restrictions.eq(TmsLoadingBillDetailModel::getEnterpriseId, user.getEnterpriseId());
                    criteriaDetail.setRestriction(Restrictions.and(r1, r2));
                    criteriaDetail.setOrder(Order.newInstance().desc(new String[] { "createtime" }));
                    List<TmsLoadingBillDetailModel> tmsLoadingBillDetails = tmsLoadingBillDetailMapper.findByCriteria(criteriaDetail);
                    if (ToolKits.isEmpty(tmsLoadingBillDetails)) {
                        throw new BizException("装车单明细【" + tmsShipbillHeaderModel.getShipbillId() + "】查询失败");
                    }
                    TmsLoadingBillDetailModel tmsLoadingBillDetail = tmsLoadingBillDetails.get(0);
                    if (EventTypeEnum.SHIP.getCode().equals(tmsShipbillEventFeedback.getType())) {
                        tmsShipbillHeaderModel.setShipperLatitude(tmsShipbillEventFeedback.getLatitude());
                        tmsShipbillHeaderModel.setShipperLongitude(tmsShipbillEventFeedback.getLongitude());
                        tmsLoadingBillDetail.setShipperLatitude(tmsShipbillEventFeedback.getLatitude());
                        tmsLoadingBillDetail.setShipperLongitude(tmsShipbillEventFeedback.getLongitude());
                        if (DataDictionaryConstant.SHIPPER_TYPE_KH.equals(tmsShipbillHeaderModel.getShipperType())) {
                            consigneeIdList.add(tmsShipbillHeaderModel.getShipperId());
                        } else if (DataDictionaryConstant.SHIPPER_TYPE_CK.equals(tmsShipbillHeaderModel.getShipperType())){
                            branchIdList.add(tmsShipbillHeaderModel.getShipperId());
                        } else if (DataDictionaryConstant.SHIPPER_TYPE_GYS.equals(tmsShipbillHeaderModel.getShipperType())){
                            shipperIdList.add(tmsShipbillHeaderModel.getShipperId());
                        }
                    } else {
                        tmsShipbillHeaderModel.setConsigneeLatitude(tmsShipbillEventFeedback.getLatitude());
                        tmsShipbillHeaderModel.setConsigneeLongitude(tmsShipbillEventFeedback.getLongitude());
                        tmsLoadingBillDetail.setConsigneeLatitude(tmsShipbillEventFeedback.getLatitude());
                        tmsLoadingBillDetail.setConsigneeLongitude(tmsShipbillEventFeedback.getLongitude());
                        if (DataDictionaryConstant.CONSIGNEE_TYPE_KH.equals(tmsShipbillHeaderModel.getConsigneeType())) {
                            consigneeIdList.add(tmsShipbillHeaderModel.getConsigneeId());
                        } else if (DataDictionaryConstant.CONSIGNEE_TYPE_CK.equals(tmsShipbillHeaderModel.getConsigneeType())){
                            branchIdList.add(tmsShipbillHeaderModel.getConsigneeId());
                        } else if (DataDictionaryConstant.CONSIGNEE_TYPE_GYS.equals(tmsShipbillHeaderModel.getConsigneeType())){
                            shipperIdList.add(tmsShipbillHeaderModel.getConsigneeId());
                        }
                    }
                    tmsLoadingBillDetail.setUpdatetime(new Date());
                    tmsLoadingBillDetail.setUpdateperson(user.getNickname());
                    tmsLoadingBillDetailMapper.update(tmsLoadingBillDetail);
                    tmsShipbillHeaderModel.setUpdatetime(new Date());
                    tmsShipbillHeaderModel.setUpdateperson(user.getNickname());
                    tmsShipbillHeaderMapper.update(tmsShipbillHeaderModel);
                }
            });
            UpdateLatitudeAndLongitudeVO updateLatitudeAndLongitudeVO = new UpdateLatitudeAndLongitudeVO();
            updateLatitudeAndLongitudeVO.setLongitude(tmsShipbillEventFeedback.getLongitude());
            updateLatitudeAndLongitudeVO.setLatitude(tmsShipbillEventFeedback.getLatitude());
            if (CollectionUtil.isNotEmpty(branchIdList)) {
                updateLatitudeAndLongitudeVO.setIdList(branchIdList);
                maindataTmsResource.updateBranchLatitudeAndLongitude(updateLatitudeAndLongitudeVO);
            }
            if (CollectionUtil.isNotEmpty(consigneeIdList)) {
                updateLatitudeAndLongitudeVO.setIdList(consigneeIdList);
                maindataTmsResource.updateConsigneeLatitudeAndLongitude(updateLatitudeAndLongitudeVO);
            }
            if (CollectionUtil.isNotEmpty(shipperIdList)) {
                updateLatitudeAndLongitudeVO.setIdList(shipperIdList);
                maindataTmsResource.updateShipperLatitudeAndLongitude(updateLatitudeAndLongitudeVO);
            }
        }
    }

    /**
     * generateMemo
     * @param tmsShipbillEventFeedback
     * @return
     */
    private String generateMemo(TmsShipbillEventFeedback tmsShipbillEventFeedback) {
        String[] eventTypeArray = tmsShipbillEventFeedback.getEventType().split(",");
        return "事件内容:" + (StrUtil.isBlank(tmsShipbillEventFeedback.getEventContent()) ? "" : tmsShipbillEventFeedback.getEventContent()) + " " + Arrays.stream(eventTypeArray).map(eventType -> {
            if (EventFeedbackTypeEnum.MILEAGE.getCode().equals(eventType)) {
                return EventFeedbackTypeEnum.MILEAGE.getDesc() + ":" + (ObjectUtil.isNull(tmsShipbillEventFeedback.getMileage())  ? "" : tmsShipbillEventFeedback.getMileage());
            } else {
                return EventFeedbackTypeEnum.POSITION.getDesc() + ":经度=" + (ObjectUtil.isNull(tmsShipbillEventFeedback.getLongitude())  ? "" : tmsShipbillEventFeedback.getLongitude()) + "，纬度=" + (ObjectUtil.isNull(tmsShipbillEventFeedback.getLatitude())  ? "" : tmsShipbillEventFeedback.getLatitude());
            }
        }).collect(Collectors.joining(" "));
    }

    /**
     * nodeApprovalExecute
     * @param vo
     * @return
     */
    private Boolean nodeApprovalExecute(ApprovalVO vo) {
        ToolKits.isParamNull(vo.getApprovalObjectId(), "运单ID不为空");
        ToolKits.isParamNull(vo.getApprovalBusinessId(), "审批业务ID不为空");
        ToolKits.isParamNull(vo.getApprovalObjectName(), "审批对象名称不为空");
        ToolKits.isParamNull(vo.getApprovalId(), "审批流程ID不为空");
        ToolKits.isParamNull(vo.getNextApproverNodeId(), "下一审批节点ID不为空");
        ToolKits.isParamNull(vo.getNextApprovalOrder(), "下一节点顺序不为空");
        ToolKits.isParamNull(vo.getResult(), "审批结果不为空");
        if (!vo.getResult().equals(DataDictionaryConstant.NODE_APPROVAL_RESULT_PASS)) {
            ToolKits.isParamNull(vo.getApprovalOpinion(), "驳回意见不为空");
        }
        UserEntity user = PlgFxUsrUtils.getUserEntity();
        ToolKits.isParamNull(user, "当前人员没有操作权限");
        // 当前时间
        Date date = DateUtils.nowDate();
        // 封装审核所需数据
        ApprovalBusinessNodeVO approvalBusinessNodeVO = new ApprovalBusinessNodeVO();
        approvalBusinessNodeVO.setApprovalObjectName(vo.getApprovalObjectName());
        approvalBusinessNodeVO.setApprovalBusinessId(vo.getApprovalBusinessId());
        approvalBusinessNodeVO.setApprovalId(vo.getApprovalId());
        approvalBusinessNodeVO.setNextApprovalNodeId(vo.getNextApproverNodeId());
        approvalBusinessNodeVO.setNextApprovalOrder(vo.getNextApprovalOrder());
        approvalBusinessNodeVO.setNextApproverRoleId(vo.getNextApproverRoleId());
        approvalBusinessNodeVO.setNextApproverRoleName(vo.getNextApproverRoleName());
        approvalBusinessNodeVO.setNextApproverUserId(vo.getNextApproverUserId());
        approvalBusinessNodeVO.setNextApproverUserName(vo.getNextApproverUserName());
        approvalBusinessNodeVO.setApproverPersonId(user.getUserid());
        approvalBusinessNodeVO.setApproverPersonName(user.getNickname());
        approvalBusinessNodeVO.setApprovalOpinion(ToolKits.isEmpty(vo.getApprovalOpinion()) ? "" : vo.getApprovalOpinion());
        approvalBusinessNodeVO.setApprovalTime(date);
        approvalBusinessNodeVO.setResult(vo.getResult());
        if (CollectionUtil.isNotEmpty(user.getRoles())) {
            approvalBusinessNodeVO.setApproverPersonRoleId(user.getRoles().stream().map(role -> String.valueOf(role)).collect(Collectors.joining(",")));
        }
        approvalBusinessNodeVO.setApproverPersonRoleName("");
        // 节点审批者类型 数据字典 NODE_APPROVER_TYPE 1 角色 2 用户
        approvalBusinessNodeVO.setNodeApproverType(vo.getNodeApproverType());
        // 审批方式 数据字典 NODE_APPROVAL_TYPE: 1 会签 2 或签
        approvalBusinessNodeVO.setNodeApprovalType(vo.getNodeApprovalType());
        // 流程节点审批
        RestMessage<Boolean> restMessage1 = maindataTmsResource.nodeApprovalExecute(approvalBusinessNodeVO);
        if (!restMessage1.isSuccess()) {
            throw new BizException("调用审核失败");
        }
        return restMessage1.getData();
    }
}
