081fa014 by xiaojie

【数据资产】

1、认证审核管理:从列表打开详情和从待办打开详情的地址不一致
1 parent 9ce95786
package com.csbr.qingcloud.portal.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
......@@ -13,6 +14,8 @@ import com.csbr.qingcloud.portal.feign.ConfigureFeign;
import com.csbr.qingcloud.portal.feign.DataProcessBasicFeign;
import com.csbr.qingcloud.portal.feign.PersonelFeign;
import com.csbr.qingcloud.portal.util.DateUtil;
import com.csbr.qingcloud.portal.util.InvokeUtil;
import com.csbr.qingcloud.portal.util.ZQConfig;
import csbr.cloud.entity.domain.user.UserInfo;
import csbr.cloud.entity.enums.ApprovalStateEnum;
import com.csbr.cloud.common.exception.CsbrSystemException;
......@@ -34,6 +37,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import io.seata.spring.annotation.GlobalTransactional;
......@@ -55,11 +59,19 @@ public class DemandServiceImpl extends FlowAbstractImpl implements DemandService
* 功能名称
*/
private static final String FUNCTION_NAME = "数据需求";
private static final String SysFuncCode = "SJXQ";
/**
* 流程类型
*/
private static final String FLOW_TYPE = WorkFlowBizEnum.DATA_DEMAND.getValue();
@Autowired
private ZQConfig zqConfig;
@Autowired
private InvokeUtil invokeUtil;
@Resource
private MfDemandService mfDemandService;
......@@ -261,6 +273,7 @@ public class DemandServiceImpl extends FlowAbstractImpl implements DemandService
throw new CsbrSystemException(SystemError.DATA_INPUT_ERROR, messageSourceUtil.getMessage("W00012",
String.format("删除%s数据", FUNCTION_NAME), "数据唯一标识"));
}
String crossPlatformApproveState = "";
for (String guid : guids) {
MfDemand entity = mfDemandService.getById(guid);
beforeRemove(entity);
......@@ -269,9 +282,19 @@ public class DemandServiceImpl extends FlowAbstractImpl implements DemandService
throw new CsbrSystemException(SystemError.DATA_DEL_ERROR, messageSourceUtil.delMessage(FUNCTION_NAME));
}
afterRemove(entity);
crossPlatformApproveState = entity.getCrossPlatformApproveState();
}
// 删除流程数据
approvalFlowUtil.removeApproveByBizGuids(guids);
// 删除主平台数据
if (!zqConfig.getIsMain() && StringUtils.isNotEmpty(crossPlatformApproveState)) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("zqSystemCode", SysFuncCode);
jsonObject.put("zqBizGuids", JSON.toJSONString(guids));
jsonObject.put("isCollection", true);
invokeUtil.invokeMainDel(jsonObject, zqConfig.getAppKey(), zqConfig.getZqDelUrl());
}
}
/**
......@@ -418,7 +441,7 @@ public class DemandServiceImpl extends FlowAbstractImpl implements DemandService
private AddApprovalDTO getAddApprovalDTO(MfDemand entity, DemandRQVO rqVO) {
AddApprovalDTO approvalDTO = new AddApprovalDTO(FLOW_TYPE, entity.getGuid());
// todo
approvalDTO.setFuncCode("SJXQ");
approvalDTO.setFuncCode(SysFuncCode);
approvalDTO.setUrlParam(String.format("guid=%s&name=%s",entity.getGuid(),entity.getDataDemandName()));
// 流程消息中的变量替换参数
approvalDTO.setFlowMessageBody(String.format("%s,%s", CommonUtil.getUserInfo().getUserName(),entity.getDataDemandName()));
......
......@@ -34,6 +34,8 @@ import com.csbr.qingcloud.portal.mybatis.service.MfEnterpriseService;
import com.csbr.qingcloud.portal.service.EnterpriseService;
import com.csbr.qingcloud.portal.util.ChangeInfoUtil;
import com.csbr.qingcloud.portal.util.DateUtil;
import com.csbr.qingcloud.portal.util.InvokeUtil;
import com.csbr.qingcloud.portal.util.ZQConfig;
import csbr.cloud.entity.domain.base.vo.PageListVO;
import csbr.cloud.entity.enums.ApprovalStateEnum;
import io.seata.spring.annotation.GlobalTransactional;
......@@ -42,6 +44,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
......@@ -65,6 +68,14 @@ public class EnterpriseServiceImpl extends FlowAbstractImpl implements Enterpris
* 功能名称
*/
private static final String FUNCTION_NAME = "企业信息";
private static final String SysFuncCode = "QYRZ";
@Autowired
private ZQConfig zqConfig;
@Autowired
private InvokeUtil invokeUtil;
@Resource
private MfEnterpriseService mfEnterpriseService;
......@@ -333,6 +344,7 @@ public class EnterpriseServiceImpl extends FlowAbstractImpl implements Enterpris
throw new CsbrSystemException(SystemError.DATA_INPUT_ERROR, messageSourceUtil.getMessage("W00012",
String.format("删除%s数据", FUNCTION_NAME), "数据唯一标识"));
}
String crossPlatformApproveState = "";
for (String guid : guids) {
MfEnterprise entity = mfEnterpriseService.getById(guid);
beforeRemove(entity);
......@@ -341,9 +353,19 @@ public class EnterpriseServiceImpl extends FlowAbstractImpl implements Enterpris
throw new CsbrSystemException(SystemError.DATA_DEL_ERROR, messageSourceUtil.delMessage(FUNCTION_NAME));
}
afterRemove(entity);
crossPlatformApproveState = entity.getCrossPlatformApproveState();
}
// 删除流程数据
approvalFlowUtil.removeApproveByBizGuids(guids);
// 删除主平台数据
if (!zqConfig.getIsMain() && StringUtils.isNotEmpty(crossPlatformApproveState)) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("zqSystemCode", SysFuncCode);
jsonObject.put("zqBizGuids", JSON.toJSONString(guids));
jsonObject.put("isCollection", true);
invokeUtil.invokeMainDel(jsonObject, zqConfig.getAppKey(), zqConfig.getZqDelUrl());
}
}
/**
......@@ -535,7 +557,7 @@ public class EnterpriseServiceImpl extends FlowAbstractImpl implements Enterpris
private AddApprovalDTO getAddApprovalDTO(MfEnterprise entity, EnterpriseRQVO rqVO) {
RedisStaffPOJO staffPOJO = redisUtil.getRedisStaff();
AddApprovalDTO approvalDTO = new AddApprovalDTO(WorkFlowBizEnum.ENTERPRISE_APPLY.getValue(), entity.getGuid());
approvalDTO.setFuncCode("QYRZ");
approvalDTO.setFuncCode(SysFuncCode);
approvalDTO.setUrlParam(String.format("guid=%s&name=%s&tName=%s&fType=%s&bizGuid=%s&type=detail", entity.getGuid(), entity.getTenantName(),
entity.getTenantName(), WorkFlowBizEnum.ENTERPRISE_APPLY.getValue(), entity.getGuid()));
// 流程消息中的变量替换参数
......
package com.csbr.qingcloud.portal.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.csbr.cloud.common.enums.SystemError;
import com.csbr.cloud.common.exception.CsbrSystemException;
import com.csbr.cloud.common.response.CommonRes;
import lombok.extern.slf4j.Slf4j;
import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
import org.apache.hc.core5.util.Timeout;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
/**
* @program: daop-projects
* @description:
* @author: xiaojie
* @create: 2025-03-13 14:52
**/
@Component
@Slf4j
public class InvokeUtil {
@Autowired
private RestTemplate restTemplate;
/**
* open调用接口
* @param jsonObject
* @param appKey
* @param zqDelUrl
*/
public void invokeMainDel(JSONObject jsonObject, String appKey, String zqDelUrl) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("appKey", appKey);
HttpEntity<JSONObject> requestEntity = new HttpEntity<>(jsonObject, headers);
restTemplate.setRequestFactory(getFactory());
CommonRes commonRes = restTemplate.postForObject(zqDelUrl, requestEntity, CommonRes.class);
if (!CommonRes.success().getCode().equals(commonRes.getCode())) {
throw new CsbrSystemException(SystemError.ERROR_CODE, commonRes.getMsg());
} else {
CommonRes commonResData = JSON.parseObject(String.valueOf(commonRes.getData()), CommonRes.class);
if (!CommonRes.success().getCode().equals(commonResData.getCode())) {
throw new CsbrSystemException(SystemError.ERROR_CODE, commonResData.getMsg());
}
}
}
private ClientHttpRequestFactory getFactory() {
RequestConfig config = RequestConfig.custom()
.setConnectTimeout(Timeout.ofSeconds(5000)) // 连接超时
.setConnectionRequestTimeout(Timeout.ofSeconds(5000)) // 从连接池获取连接的超时时间
.setResponseTimeout(Timeout.ofSeconds(10000)) // 数据读取超时
.build();
CloseableHttpClient httpClient = HttpClientBuilder.create()
.setDefaultRequestConfig(config)
.build();
return new HttpComponentsClientHttpRequestFactory(httpClient);
}
}
\ No newline at end of file
package com.csbr.qingcloud.portal.util;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @program: daop-projects
* @description:
* @author: xiaojie
* @create: 2025-02-28 14:09
**/
@Data
@Component
@ConfigurationProperties(prefix = "csbr.zq")
public class ZQConfig {
private String appKey = "672c2c38e4b0cac8732a6106";
private String zqName = "";
private String zqDelUrl = "";
private Boolean isMain = false;
}
\ No newline at end of file
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!