d0d4b0dd by 肖初晴

【DAOP-1.0】企业认证

【功能点】认证方式改为定时任务
1 parent 379d490a
......@@ -96,14 +96,6 @@ public class EnterpriseController {
return CommonRes.success(true);
}
@PostMapping("/last-approve")
@SystemLog(value = "企业认证审批")
@Operation(summary = "企业认证审批-最后一个节点时调用")
public CommonRes<Boolean> lastApprove(@RequestBody FlowUpdateStateDTO dto) {
Boolean vo = enterpriseService.lastApprove(dto);
return CommonRes.success(vo);
}
@PostMapping("/move-old-data")
@SystemLog(value = "将此账号提交的数据需求迁移到新的企业")
@Operation(summary = "将此账号提交的数据需求迁移到新的企业", hidden = true)
......
......@@ -218,7 +218,7 @@ public class DemandRSVO {
private String processCompanyGuid;
@Schema(description = "加工单位名称")
private String productAcceptName;
private String processCompanyName;
@Schema(description = "发起人")
private String createUserName;
......
......@@ -154,6 +154,9 @@ public class TenantRQVO extends CsbrBaseVO {
@Schema(description = "token后台赋值")
private String token;
@Schema(description = "业务唯一标识")
private String bizGuid;
/********字典类*****/
/********实体类、用户单选、组织机构单选*****/
......
......@@ -79,5 +79,4 @@ public interface EnterpriseService {
/** 将此账号提交的数据需求迁移到新的企业 */
void moveOldData(TenantRQVO vo);
Boolean lastApprove(FlowUpdateStateDTO dto);
}
......
......@@ -353,6 +353,7 @@ public class DemandServiceImpl extends FlowAbstractImpl implements DemandService
AddApprovalDTO approvalDTO = new AddApprovalDTO(FLOW_TYPE, entity.getGuid());
// todo
approvalDTO.setFuncCode("SJXQ");
approvalDTO.setUrlParam(String.format("guid=%s&name=%s",entity.getGuid(),entity.getDataDemandName()));
// 流程消息中的变量替换参数
approvalDTO.setFlowMessageBody(String.format("%s,%s", CommonUtil.getUserInfo().getUserName(),entity.getDataDemandName()));
// 流程列表数据核心param参数处理
......
......@@ -409,50 +409,6 @@ public class EnterpriseServiceImpl extends FlowAbstractImpl implements Enterpris
approvalFlowUtil.removeApproveByBizGuids(guids);
}
/** ***企业认证*** */
@GlobalTransactional
@Override
public Boolean lastApprove(FlowUpdateStateDTO dto) {
//如果是非认证会员认证审批通过了 则需要走kafka生成新会员
dto.setBackEndInvoke(true);
KafkaApproveDTO approveDTO = new KafkaApproveDTO();
approveDTO.setHeader(getHeader());
approveDTO.setUpdateStateDTO(dto);
kafkaStdService.stdSendMsgWithPrefix("tenant.enterprise", JSON.toJSONString(approveDTO));
return true;
}
private MultiValueMap<String, String> getHeader(){
ServletRequestAttributes servletRequestAttributes = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes());
Enumeration<String> headerNames = servletRequestAttributes.getRequest().getHeaderNames();
MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
List<String> names = List.of("AUTHORIZATION", "X-USERINFO", "TENANT", "TOKEN");
while (null != headerNames && headerNames.hasMoreElements()) {
String name = headerNames.nextElement();
String value = servletRequestAttributes.getRequest().getHeader(name);
if (names.contains(name.toUpperCase())) {
headers.put(name, List.of(value));
}
}
return headers;
}
@KafkaListener(containerFactory = "kafkaListenerContainerFactory", groupId = "scm.notify", topics = "${csbr.kafka.topic-prefix:}_"+"tenant.enterprise",
errorHandler = "consumerAwareErrorHandler")
public void addUserListener(List<ConsumerRecord<String, String>> records, Acknowledgment ack) {
ack.acknowledge();
for (ConsumerRecord<String, String> record : records) {
try {
KafkaApproveDTO approveDTO = JSON.parseObject(record.value(),KafkaApproveDTO.class);
workflowFeign.allowFlowCore(approveDTO.getUpdateStateDTO(),approveDTO.getHeader()).getData();
} catch (Exception e) {
log.error("企业认证出现异常: " + e.getMessage() + ";\nRecord Info: " + record.toString());
e.printStackTrace();
return;
}
}
}
/**
* 流程结束后进行业务回调
* @author xcq
......@@ -479,17 +435,10 @@ public class EnterpriseServiceImpl extends FlowAbstractImpl implements Enterpris
//删除原帐号并新增正式会员
TenantRQVO vo = csbrBeanUtil.convert(entity,TenantRQVO.class);
vo.setTenantType(null);
vo.setGuid(CommonUtil.newGuid());
vo.setBizGuid(dto.getBizGuid());
vo.setPersonIncharge(entity.getJuridicalPerson());
vo.setBizState("Y");
try{
vo = personelFeign.authTenant(vo).getData();
}catch (Exception e){
if(!e.getMessage().contains("Read timed out")){
throw e;
}
}
personelFeign.authTenant(vo).getData();
}
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!