1.0.17 提交合同信息并提交流程

dev
yinq 2 months ago
parent b50e664c99
commit 0c90d0884c

@ -80,6 +80,19 @@ public class ErpContractInfoController extends BaseController {
return R.ok(erpContractInfoService.insertByBo(bo));
}
/**
*
* @param bo
* @return
*/
@SaCheckPermission("oa/erp:contractInfo:add")
@Log(title = "合同信息", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping("/contractSubmitAndFlowStart")
public R<ErpContractInfoVo> contractSubmitAndFlowStart(@Validated(AddGroup.class) @RequestBody ErpContractInfoBo bo) {
return R.ok(erpContractInfoService.contractSubmitAndFlowStart(bo));
}
/**
*
*/

@ -1,5 +1,6 @@
package org.dromara.oa.erp.domain.bo;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import org.dromara.oa.erp.domain.ErpContractInfo;
import org.dromara.common.mybatis.core.domain.BaseEntity;
@ -10,11 +11,11 @@ import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.dromara.oa.erp.domain.ErpContractMaterial;
import org.dromara.workflow.api.domain.RemoteFlowInstanceBizExt;
/**
* erp_contract_info
@ -198,4 +199,38 @@ public class ErpContractInfoBo extends BaseEntity {
*/
private String deptName;
/**
*
*/
private String flowCode;
/**
* ( )
*/
private String handler;
/**
* {'entity': {}}
*/
private Map<String, Object> variables;
/**
*
*/
private RemoteFlowInstanceBizExt bizExt;
public Map<String, Object> getVariables() {
if (variables == null) {
return new HashMap<>(16);
}
variables.entrySet().removeIf(entry -> Objects.isNull(entry.getValue()));
return variables;
}
public RemoteFlowInstanceBizExt getBizExt() {
if (ObjectUtil.isNull(bizExt)) {
bizExt = new RemoteFlowInstanceBizExt();
}
return bizExt;
}
}

@ -27,8 +27,8 @@ public interface ErpContractInfoMapper extends BaseMapperPlus<ErpContractInfo, E
* @return
*/
@DataPermission({
@DataColumn(key = "deptName", value = "dept_id"),
@DataColumn(key = "userName", value = "create_by")
@DataColumn(key = "deptName", value = "t.dept_id"),
@DataColumn(key = "userName", value = "t.create_by")
})
public Page<ErpContractInfoVo> selectCustomErpContractInfoVoList(@Param("page") Page<ErpContractInfoVo> page, @Param(Constants.WRAPPER) MPJLambdaWrapper<ErpContractInfo> queryWrapper);
@ -38,6 +38,10 @@ public interface ErpContractInfoMapper extends BaseMapperPlus<ErpContractInfo, E
* @param queryWrapper
* @return
*/
@DataPermission({
@DataColumn(key = "deptName", value = "t.dept_id"),
@DataColumn(key = "userName", value = "t.create_by")
})
public List<ErpContractInfoVo> selectCustomErpContractInfoVoList(@Param(Constants.WRAPPER) MPJLambdaWrapper<ErpContractInfo> queryWrapper);
}

@ -66,4 +66,11 @@ public interface IErpContractInfoService {
* @return
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
*
* @param bo
* @return
*/
ErpContractInfoVo contractSubmitAndFlowStart(ErpContractInfoBo bo);
}

@ -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);
}
}

Loading…
Cancel
Save