|
|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
package org.dromara.oa.erp.service.impl;
|
|
|
|
|
|
|
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
|
|
import org.apache.seata.spring.annotation.GlobalTransactional;
|
|
|
|
|
import org.dromara.common.core.exception.ServiceException;
|
|
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
|
|
@ -11,6 +13,8 @@ import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.dromara.oa.erp.domain.ErpContractMaterial;
|
|
|
|
|
import org.dromara.oa.erp.mapper.ErpContractMaterialMapper;
|
|
|
|
|
import org.dromara.workflow.api.RemoteWorkflowService;
|
|
|
|
|
import org.dromara.workflow.api.domain.RemoteStartProcess;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.dromara.oa.erp.domain.bo.ErpContractInfoBo;
|
|
|
|
|
import org.dromara.oa.erp.domain.vo.ErpContractInfoVo;
|
|
|
|
|
@ -39,6 +43,9 @@ public class ErpContractInfoServiceImpl implements IErpContractInfoService {
|
|
|
|
|
|
|
|
|
|
private final ErpContractMaterialMapper contractMaterialMapper;
|
|
|
|
|
|
|
|
|
|
@DubboReference(timeout = 30000)
|
|
|
|
|
private RemoteWorkflowService remoteWorkflowService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询合同信息
|
|
|
|
|
*
|
|
|
|
|
@ -102,7 +109,8 @@ public class ErpContractInfoServiceImpl implements IErpContractInfoService {
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getPaymentMethod()), ErpContractInfo::getPaymentMethod, bo.getPaymentMethod())
|
|
|
|
|
.eq(bo.getSignatureAppendix() != null, ErpContractInfo::getSignatureAppendix, bo.getSignatureAppendix())
|
|
|
|
|
.eq(bo.getTaxRate() != null, ErpContractInfo::getTaxRate, bo.getTaxRate())
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), ErpContractInfo::getActiveFlag, bo.getActiveFlag());
|
|
|
|
|
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), ErpContractInfo::getActiveFlag, bo.getActiveFlag())
|
|
|
|
|
.orderByDesc(ErpContractInfo::getCreateTime);
|
|
|
|
|
return lqw;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -185,4 +193,42 @@ public class ErpContractInfoServiceImpl implements IErpContractInfoService {
|
|
|
|
|
}
|
|
|
|
|
return baseMapper.deleteByIds(ids) > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 提交合同信息并提交流程
|
|
|
|
|
*
|
|
|
|
|
* @param bo
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@GlobalTransactional(rollbackFor = Exception.class)
|
|
|
|
|
public ErpContractInfoVo contractSubmitAndFlowStart(ErpContractInfoBo bo) {
|
|
|
|
|
ErpContractInfo add = MapstructUtils.convert(bo, ErpContractInfo.class);
|
|
|
|
|
validEntityBeforeSave(add);
|
|
|
|
|
List<ErpContractMaterial> contractMaterialList = bo.getContractMaterialList();
|
|
|
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
|
|
|
if (flag && contractMaterialList != null && !contractMaterialList.isEmpty()) {
|
|
|
|
|
bo.setContractId(add.getContractId());
|
|
|
|
|
for (ErpContractMaterial erpContractMaterial : contractMaterialList) {
|
|
|
|
|
erpContractMaterial.setContractId(add.getContractId());
|
|
|
|
|
contractMaterialMapper.insert(erpContractMaterial);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (flag) {
|
|
|
|
|
// 后端发起需要忽略权限
|
|
|
|
|
bo.getVariables().put("ignore", true);
|
|
|
|
|
RemoteStartProcess startProcess = new RemoteStartProcess();
|
|
|
|
|
startProcess.setBusinessId(bo.getContractId().toString());
|
|
|
|
|
startProcess.setFlowCode(bo.getFlowCode());
|
|
|
|
|
startProcess.setVariables(bo.getVariables());
|
|
|
|
|
startProcess.setBizExt(bo.getBizExt());
|
|
|
|
|
bo.getBizExt().setBusinessId(startProcess.getBusinessId());
|
|
|
|
|
boolean flagOne = remoteWorkflowService.startCompleteTask(startProcess);
|
|
|
|
|
if (!flagOne) {
|
|
|
|
|
throw new ServiceException("流程发起异常");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return MapstructUtils.convert(add, ErpContractInfoVo.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|