b481e3f8 by 肖初晴

【DAOP-1.0】服务商维护

【功能点】功能开发
1 parent 93798d0e
package com.csbr.qingcloud.portal.domain.vo;
import com.csbr.cloud.mybatis.annotations.LikeQuery;
import com.csbr.cloud.mybatis.enums.LikeQueryEnum;
import com.csbr.cloud.workflow.domain.dto.appove.FlowBizGuidQueryDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode;
......@@ -18,6 +20,10 @@ import java.util.List;
@Schema(title = "服务商维护查询参数")
public class ServicerMaintainQueryVO extends FlowBizGuidQueryDTO {
@Schema(description = "公司名称")
@LikeQuery(type = LikeQueryEnum.ALL)
private String tenantName;
/**
* 业务审批状态【N 草稿中,A 审批中,Y 已通过,R 驳回,C 已撤销,D 已废弃】
*/
......
......@@ -56,7 +56,7 @@ public class ServicerMaintainRQVO extends FlowRQBaseVO {
/**
* 业务审批状态【N 草稿中,A 审批中,Y 已通过,R 驳回,C 已撤销,D 已废弃; 默认 N】
*/
@Schema(description = "业务审批状态【N 草稿中,A 审批中,Y 已通过,R 驳回,C 已撤销,D 已废弃; 默认 N】")
@Schema(description = "业务审批状态(传Y表示不走审批流)【N 草稿中,A 审批中,Y 已通过,R 驳回,C 已撤销,D 已废弃; 默认 N】")
private String bizApproveState;
/**
......
package com.csbr.qingcloud.portal.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.csbr.cloud.common.enums.SystemError;
import com.csbr.cloud.common.enums.WorkFlowBizEnum;
import com.csbr.qingcloud.portal.mybatis.entity.MfServicerMaintainDetail;
import com.csbr.qingcloud.portal.mybatis.service.MfServicerMaintainDetailService;
import csbr.cloud.entity.enums.ApprovalStateEnum;
import com.csbr.cloud.common.exception.CsbrSystemException;
import com.csbr.cloud.common.util.CommonUtil;
......@@ -57,6 +60,9 @@ public class ServicerMaintainServiceImpl extends FlowAbstractImpl implements Ser
private MfServicerMaintainService mfServicerMaintainService;
@Resource
private MfServicerMaintainDetailService mfServicerMaintainDetailService;
@Resource
private CsbrBeanUtil csbrBeanUtil;
@Resource
......@@ -123,9 +129,11 @@ public class ServicerMaintainServiceImpl extends FlowAbstractImpl implements Ser
ServicerMaintainRQVO rqVO = (ServicerMaintainRQVO) flowBaseVO;
beforeSave(rqVO);
MfServicerMaintain entity = convertToEntity(rqVO);
if(!"Y".equals(rqVO.getBizApproveState())){
// 发起审批流程或保存草稿
AddApprovalDTO approvalDTO = getAddApprovalDTO(entity);
super.startWorkFlow(rqVO, approvalDTO, entity::setBizApproveState);
}
// 业务数据保存
boolean flag = mfServicerMaintainService.save(entity);
if (!flag) {
......@@ -151,6 +159,16 @@ public class ServicerMaintainServiceImpl extends FlowAbstractImpl implements Ser
// MfServicerMaintain oldEntity = mfServicerMaintainService.getById(rqVO.getGuid());
beforeUpdate(rqVO);
MfServicerMaintain entity = convertToEntity(rqVO);
if("Y".equals(rqVO.getBizApproveState())){
// 修改业务数据
boolean flag = mfServicerMaintainService.updateById(entity);
if (!flag) {
throw new CsbrSystemException(SystemError.DATA_UPDATE_ERROR, rqVO.getImmediateApprove() ?
messageSourceUtil.submitMessage(FUNCTION_NAME) : messageSourceUtil.updateMessage(FUNCTION_NAME));
}
afterUpdate(entity, rqVO);
}
else{
// 发起审批流程或保存草稿
AddApprovalDTO approvalDTO = getAddApprovalDTO(entity);
super.startOrRestartWorkFlow(rqVO, rqVO.getBizApproveState(), approvalDTO, entity::setBizApproveState);
......@@ -167,6 +185,7 @@ public class ServicerMaintainServiceImpl extends FlowAbstractImpl implements Ser
afterUpdate(entity, rqVO);
}
}
}
/**
* 重新提交服务商维护
......@@ -321,12 +340,13 @@ public class ServicerMaintainServiceImpl extends FlowAbstractImpl implements Ser
* @return void
*/
private void afterSave(MfServicerMaintain entity, ServicerMaintainRQVO rqVO) {
//region 1.输出特殊转换
//region 1.1.输出过滤与补充处理
//endregion 1.1.输出过滤与补充处理
//endregion 1.输出特殊转换
List<MfServicerMaintainDetail> details = JSON.parseArray(entity.getMaintainJson(),MfServicerMaintainDetail.class);
for(MfServicerMaintainDetail item : details){
item.setGuid(CommonUtil.newGuid());
item.setTenantGuid(entity.getTenantGuid());
item.setParentGuid(entity.getGuid());
}
mfServicerMaintainDetailService.saveBatch(details);
}
/**
......@@ -391,12 +411,17 @@ public class ServicerMaintainServiceImpl extends FlowAbstractImpl implements Ser
* @return void
*/
protected void afterUpdate(MfServicerMaintain entity, ServicerMaintainRQVO rqVO) {
//region 1.输出特殊转换
LambdaUpdateWrapper<MfServicerMaintainDetail> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(MfServicerMaintainDetail::getParentGuid,entity.getGuid());
mfServicerMaintainDetailService.remove(updateWrapper);
//region 1.1.输出过滤与补充处理
//endregion 1.1.输出过滤与补充处理
//endregion 1.输出特殊转换
List<MfServicerMaintainDetail> details = JSON.parseArray(entity.getMaintainJson(),MfServicerMaintainDetail.class);
for(MfServicerMaintainDetail item : details){
item.setGuid(CommonUtil.newGuid());
item.setTenantGuid(entity.getTenantGuid());
item.setParentGuid(entity.getGuid());
}
mfServicerMaintainDetailService.saveBatch(details);
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!