65bcb534 by 肖初晴

【DAOP-1.0】数据需求

【功能点】联调问题处理
1 parent 1b980cfd
......@@ -68,16 +68,22 @@ public class DemandController {
@GetMapping("/detail")
@SystemLog(value = "数据需求-详情")
@Operation(
summary = "数据需求-详情",
parameters = {
@Parameter(name = "guid", description = "数据需求唯一标识", required = true)}
)
@Operation(summary = "数据需求-详情",parameters = {
@Parameter(name = "guid", description = "数据需求唯一标识", required = true)})
public CommonRes<DemandRSVO> getDemandDetail(@RequestParam String guid) {
DemandRSVO vo = demandService.getDemandDetail(guid);
return CommonRes.success(vo);
}
@GetMapping("/detail-by-process")
@SystemLog(value = "按加工单查数据需求详情")
@Operation(summary = "按加工单查数据需求详情",parameters = {
@Parameter(name = "guid", description = "加工单单号", required = true)})
public CommonRes<DemandRSVO> getDemandDetailByProcess(@RequestParam String processOrderNo) {
DemandRSVO vo = demandService.getDemandDetailByProcess(processOrderNo);
return CommonRes.success(vo);
}
@PostMapping("/flow-call-back")
@SystemLog(value = "数据需求-流程结束后进行业务回调")
@Operation(summary = "数据需求-流程结束后进行业务回调", hidden = true)
......
......@@ -226,6 +226,12 @@ public class DemandRSVO {
@Schema(description = "提交时间")
private Date createTime;
@Schema(description = "需求单编号")
private String requirementOrderNo;
@Schema(description = "加工单编号")
private String processOrderNo;
/******** 库表存储属性 需处理 *****/
/******** 自定义扩展 *****/
......
package com.csbr.qingcloud.portal.domain.vo;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @program: common-admin-platform-auth-service
* @description: 订单编号DTO
* @author: Huanglh
* @create: 2020-08-14 09:41
**/
@Data
@Accessors(chain = true)
public class RuleDTO {
/** 规则名称 */
private String ruleName;
/** 规则类型 */
private String ruleType;
}
......@@ -77,6 +77,9 @@ public class ServicerMaintainRSVO {
@Schema(description = "维护信息")
private String maintainJson;
@Schema(description = "创建人")
private String createUserName;
@Schema(description = "创建时间")
private Date createTime;
......
package com.csbr.qingcloud.portal.feign;
import com.csbr.cloud.common.config.FastCallFeignConfiguration;
import com.csbr.cloud.common.entity.DictModel;
import com.csbr.cloud.common.entity.DictionaryVO;
import com.csbr.cloud.common.response.CommonRes;
import com.csbr.qingcloud.portal.domain.vo.RuleDTO;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import jakarta.validation.Valid;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author Xiaocq
*/
@FeignClient(value = "ms-daop-configure-service", configuration = FastCallFeignConfiguration.class)
public interface ConfigureFeign {
/**
* 通过字典类型获取字典数据
*/
@HystrixCommand(fallbackMethod = "CommonUtil.sleepFallback", commandProperties =
{
@HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "1500")
})
@RequestMapping(value = "/dict/data/get-by-dictType", method = RequestMethod.GET)
CommonRes<List<DictModel>> getDictListByType(@RequestParam String dictType);
/**
* 获取全部字典
*/
@GetMapping(value = "/dict/data/get-all",produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
CommonRes<List<DictionaryVO>> getAll();
/**
* 编码生成
*/
@PostMapping(value = "/rule/new-code",produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
CommonRes<String> newCode(@RequestBody RuleDTO dto);
}
......@@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RequestBody;
@FeignClient(value = "ms-data-process-basic-service", configuration = FastCallFeignConfiguration.class)
public interface DataProcessBasicFeign {
@PostMapping(value = "/tenant/auth", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@PostMapping(value = "/process-order/save", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
CommonRes<Boolean> saveProcessOrder(@RequestBody @Valid ProcessOrderRQVO vo);
}
......
......@@ -215,4 +215,10 @@ public class MfDemand extends BaseShardingDO {
@Name("加工单位名称")
private String processCompanyName;
@Name("需求单编号")
private String requirementOrderNo;
@Name("加工单编号")
private String processOrderNo;
}
......
......@@ -72,4 +72,6 @@ public interface DemandService {
void flowCallBack(BizCallbackDTO dto);
Boolean lastApprove(DemandApproveVO dto);
DemandRSVO getDemandDetailByProcess(String processOrderNo);
}
......
......@@ -6,7 +6,10 @@ import com.csbr.cloud.common.enums.SystemError;
import com.csbr.cloud.common.enums.WorkFlowBizEnum;
import com.csbr.cloud.workflow.domain.dto.appove.FlowUpdateStateDTO;
import com.csbr.cloud.workflow.feign.WorkflowFeign;
import com.csbr.qingcloud.portal.domain.vo.DemandApproveVO;
import com.csbr.qingcloud.portal.domain.vo.*;
import com.csbr.qingcloud.portal.feign.ConfigureFeign;
import com.csbr.qingcloud.portal.feign.DataProcessBasicFeign;
import com.csbr.qingcloud.portal.feign.PersonelFeign;
import csbr.cloud.entity.enums.ApprovalStateEnum;
import com.csbr.cloud.common.exception.CsbrSystemException;
import com.csbr.cloud.common.util.CommonUtil;
......@@ -18,9 +21,6 @@ import csbr.cloud.entity.domain.base.vo.PageListVO;
import com.csbr.cloud.workflow.domain.vo.appove.FlowRQBaseVO;
import com.csbr.cloud.workflow.domain.dto.appove.AddApprovalDTO;
import com.csbr.cloud.workflow.domain.dto.callback.BizCallbackDTO;
import com.csbr.qingcloud.portal.domain.vo.DemandQueryVO;
import com.csbr.qingcloud.portal.domain.vo.DemandRQVO;
import com.csbr.qingcloud.portal.domain.vo.DemandRSVO;
import com.csbr.qingcloud.portal.mybatis.entity.MfDemand;
import com.csbr.qingcloud.portal.mybatis.service.MfDemandService;
import com.csbr.qingcloud.portal.service.DemandService;
......@@ -34,6 +34,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
/**
......@@ -60,6 +61,15 @@ public class DemandServiceImpl extends FlowAbstractImpl implements DemandService
private MfDemandService mfDemandService;
@Resource
private ConfigureFeign configureFeign;
@Resource
private PersonelFeign personelFeign;
@Resource
private DataProcessBasicFeign dataProcessBasicFeign;
@Resource
private CsbrBeanUtil csbrBeanUtil;
@Resource
......@@ -127,6 +137,7 @@ public class DemandServiceImpl extends FlowAbstractImpl implements DemandService
DemandRQVO rqVO = (DemandRQVO) flowBaseVO;
beforeSave(rqVO);
MfDemand entity = convertToEntity(rqVO);
entity.setRequirementOrderNo(configureFeign.newCode(new RuleDTO().setRuleName("demand-code").setRuleType("generate")).getData());
// 发起审批流程或保存草稿
AddApprovalDTO approvalDTO = getAddApprovalDTO(entity);
super.startWorkFlow(rqVO, approvalDTO, entity::setBizApproveState);
......@@ -228,22 +239,25 @@ public class DemandServiceImpl extends FlowAbstractImpl implements DemandService
* 流程结束后进行业务回调
* @author xcq
* @date 2024-12-31 18:46
* @param dto
* @return void
*/
@Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class)
@Override
public void flowCallBack(BizCallbackDTO dto) {
MfDemand entity = mfDemandService.getById(dto.getBizGuid());
if (entity == null) {
throw new CsbrSystemException(SystemError.DATA_NOT_EXISTS, messageSourceUtil.notExistsToSelectMessage(FUNCTION_NAME));
}
String orderNo = null;
if (ApprovalStateEnum.PASSED.getValue().equals(dto.getApprovalState())) {
// todo
//生成加工单
orderNo = addOrder(mfDemandService.getById(dto.getBizGuid()));
}
// 同步更新审批状态
LambdaUpdateWrapper<MfDemand> updateWrapper = mfDemandService.csbrUpdateWrapper(MfDemand.class);
updateWrapper.set(MfDemand::getBizApproveState, dto.getApprovalState());
updateWrapper.set(StringUtils.isNotBlank(orderNo),MfDemand::getProcessOrderNo, orderNo);
updateWrapper.set(StringUtils.isNotBlank(orderNo),MfDemand::getProcessingGenerateTime, new Date());
updateWrapper.eq(MfDemand::getGuid, dto.getBizGuid());
boolean flag = mfDemandService.update(updateWrapper);
if (!flag) {
......@@ -251,6 +265,23 @@ public class DemandServiceImpl extends FlowAbstractImpl implements DemandService
}
}
private String addOrder(MfDemand bean){
ProcessOrderRQVO vo = csbrBeanUtil.convert(bean,ProcessOrderRQVO.class);
vo.setGuid(null);
vo.setTenantName(personelFeign.getAllTenantGuidNameMap().getData().get(bean.getTenantGuid()));
vo.setRequirementOrderNo(bean.getRequirementOrderNo());
vo.setProcessOrderNo(configureFeign.newCode(new RuleDTO().setRuleName("process-order-code").setRuleType("generate")).getData());
vo.setRequirementOrderName(bean.getDataDemandName());
vo.setApplicationSceneDesc(bean.getSceneDescription());
vo.setProcessState("N");
vo.setContactTel(bean.getContactInformation());
vo.setLinkContractInfoJson(bean.getContractAttachJson());
vo.setFileUrl(bean.getDataDemandFieldAttachJson());
dataProcessBasicFeign.saveProcessOrder(vo);
return vo.getProcessOrderNo();
}
@GlobalTransactional
@Override
public Boolean lastApprove(DemandApproveVO dto) {
......@@ -266,6 +297,17 @@ public class DemandServiceImpl extends FlowAbstractImpl implements DemandService
return true;
}
@Override
public DemandRSVO getDemandDetailByProcess(String processOrderNo) {
LambdaQueryWrapper<MfDemand> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(MfDemand::getProcessOrderNo,processOrderNo);
List<MfDemand> list = mfDemandService.list(queryWrapper);
if(CollectionUtils.isEmpty(list)){
return null;
}
return convertToVO(list.get(0));
}
/**
* 获取发起流程参数
* @author xcq
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!