【DAOP-1.0】企业认证
【功能点】认证方式改为定时任务
Showing
6 changed files
with
7 additions
and
63 deletions
| ... | @@ -96,14 +96,6 @@ public class EnterpriseController { | ... | @@ -96,14 +96,6 @@ public class EnterpriseController { | 
| 96 | return CommonRes.success(true); | 96 | return CommonRes.success(true); | 
| 97 | } | 97 | } | 
| 98 | 98 | ||
| 99 | @PostMapping("/last-approve") | ||
| 100 | @SystemLog(value = "企业认证审批") | ||
| 101 | @Operation(summary = "企业认证审批-最后一个节点时调用") | ||
| 102 | public CommonRes<Boolean> lastApprove(@RequestBody FlowUpdateStateDTO dto) { | ||
| 103 | Boolean vo = enterpriseService.lastApprove(dto); | ||
| 104 | return CommonRes.success(vo); | ||
| 105 | } | ||
| 106 | |||
| 107 | @PostMapping("/move-old-data") | 99 | @PostMapping("/move-old-data") | 
| 108 | @SystemLog(value = "将此账号提交的数据需求迁移到新的企业") | 100 | @SystemLog(value = "将此账号提交的数据需求迁移到新的企业") | 
| 109 | @Operation(summary = "将此账号提交的数据需求迁移到新的企业", hidden = true) | 101 | @Operation(summary = "将此账号提交的数据需求迁移到新的企业", hidden = true) | ... | ... | 
| ... | @@ -218,7 +218,7 @@ public class DemandRSVO { | ... | @@ -218,7 +218,7 @@ public class DemandRSVO { | 
| 218 | private String processCompanyGuid; | 218 | private String processCompanyGuid; | 
| 219 | 219 | ||
| 220 | @Schema(description = "加工单位名称") | 220 | @Schema(description = "加工单位名称") | 
| 221 | private String productAcceptName; | 221 | private String processCompanyName; | 
| 222 | 222 | ||
| 223 | @Schema(description = "发起人") | 223 | @Schema(description = "发起人") | 
| 224 | private String createUserName; | 224 | private String createUserName; | ... | ... | 
| ... | @@ -154,6 +154,9 @@ public class TenantRQVO extends CsbrBaseVO { | ... | @@ -154,6 +154,9 @@ public class TenantRQVO extends CsbrBaseVO { | 
| 154 | @Schema(description = "token后台赋值") | 154 | @Schema(description = "token后台赋值") | 
| 155 | private String token; | 155 | private String token; | 
| 156 | 156 | ||
| 157 | @Schema(description = "业务唯一标识") | ||
| 158 | private String bizGuid; | ||
| 159 | |||
| 157 | /********字典类*****/ | 160 | /********字典类*****/ | 
| 158 | 161 | ||
| 159 | /********实体类、用户单选、组织机构单选*****/ | 162 | /********实体类、用户单选、组织机构单选*****/ | ... | ... | 
| ... | @@ -79,5 +79,4 @@ public interface EnterpriseService { | ... | @@ -79,5 +79,4 @@ public interface EnterpriseService { | 
| 79 | /** 将此账号提交的数据需求迁移到新的企业 */ | 79 | /** 将此账号提交的数据需求迁移到新的企业 */ | 
| 80 | void moveOldData(TenantRQVO vo); | 80 | void moveOldData(TenantRQVO vo); | 
| 81 | 81 | ||
| 82 | Boolean lastApprove(FlowUpdateStateDTO dto); | ||
| 83 | } | 82 | } | ... | ... | 
| ... | @@ -353,6 +353,7 @@ public class DemandServiceImpl extends FlowAbstractImpl implements DemandService | ... | @@ -353,6 +353,7 @@ public class DemandServiceImpl extends FlowAbstractImpl implements DemandService | 
| 353 | AddApprovalDTO approvalDTO = new AddApprovalDTO(FLOW_TYPE, entity.getGuid()); | 353 | AddApprovalDTO approvalDTO = new AddApprovalDTO(FLOW_TYPE, entity.getGuid()); | 
| 354 | // todo | 354 | // todo | 
| 355 | approvalDTO.setFuncCode("SJXQ"); | 355 | approvalDTO.setFuncCode("SJXQ"); | 
| 356 | approvalDTO.setUrlParam(String.format("guid=%s&name=%s",entity.getGuid(),entity.getDataDemandName())); | ||
| 356 | // 流程消息中的变量替换参数 | 357 | // 流程消息中的变量替换参数 | 
| 357 | approvalDTO.setFlowMessageBody(String.format("%s,%s", CommonUtil.getUserInfo().getUserName(),entity.getDataDemandName())); | 358 | approvalDTO.setFlowMessageBody(String.format("%s,%s", CommonUtil.getUserInfo().getUserName(),entity.getDataDemandName())); | 
| 358 | // 流程列表数据核心param参数处理 | 359 | // 流程列表数据核心param参数处理 | ... | ... | 
| ... | @@ -408,50 +408,6 @@ public class EnterpriseServiceImpl extends FlowAbstractImpl implements Enterpris | ... | @@ -408,50 +408,6 @@ public class EnterpriseServiceImpl extends FlowAbstractImpl implements Enterpris | 
| 408 | // 删除流程数据 | 408 | // 删除流程数据 | 
| 409 | approvalFlowUtil.removeApproveByBizGuids(guids); | 409 | approvalFlowUtil.removeApproveByBizGuids(guids); | 
| 410 | } | 410 | } | 
| 411 | |||
| 412 | /** ***企业认证*** */ | ||
| 413 | @GlobalTransactional | ||
| 414 | @Override | ||
| 415 | public Boolean lastApprove(FlowUpdateStateDTO dto) { | ||
| 416 | //如果是非认证会员认证审批通过了 则需要走kafka生成新会员 | ||
| 417 | dto.setBackEndInvoke(true); | ||
| 418 | KafkaApproveDTO approveDTO = new KafkaApproveDTO(); | ||
| 419 | approveDTO.setHeader(getHeader()); | ||
| 420 | approveDTO.setUpdateStateDTO(dto); | ||
| 421 | kafkaStdService.stdSendMsgWithPrefix("tenant.enterprise", JSON.toJSONString(approveDTO)); | ||
| 422 | return true; | ||
| 423 | } | ||
| 424 | |||
| 425 | private MultiValueMap<String, String> getHeader(){ | ||
| 426 | ServletRequestAttributes servletRequestAttributes = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()); | ||
| 427 | Enumeration<String> headerNames = servletRequestAttributes.getRequest().getHeaderNames(); | ||
| 428 | MultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); | ||
| 429 | List<String> names = List.of("AUTHORIZATION", "X-USERINFO", "TENANT", "TOKEN"); | ||
| 430 | while (null != headerNames && headerNames.hasMoreElements()) { | ||
| 431 | String name = headerNames.nextElement(); | ||
| 432 | String value = servletRequestAttributes.getRequest().getHeader(name); | ||
| 433 | if (names.contains(name.toUpperCase())) { | ||
| 434 | headers.put(name, List.of(value)); | ||
| 435 | } | ||
| 436 | } | ||
| 437 | return headers; | ||
| 438 | } | ||
| 439 | |||
| 440 | @KafkaListener(containerFactory = "kafkaListenerContainerFactory", groupId = "scm.notify", topics = "${csbr.kafka.topic-prefix:}_"+"tenant.enterprise", | ||
| 441 | errorHandler = "consumerAwareErrorHandler") | ||
| 442 | public void addUserListener(List<ConsumerRecord<String, String>> records, Acknowledgment ack) { | ||
| 443 | ack.acknowledge(); | ||
| 444 | for (ConsumerRecord<String, String> record : records) { | ||
| 445 | try { | ||
| 446 | KafkaApproveDTO approveDTO = JSON.parseObject(record.value(),KafkaApproveDTO.class); | ||
| 447 | workflowFeign.allowFlowCore(approveDTO.getUpdateStateDTO(),approveDTO.getHeader()).getData(); | ||
| 448 | } catch (Exception e) { | ||
| 449 | log.error("企业认证出现异常: " + e.getMessage() + ";\nRecord Info: " + record.toString()); | ||
| 450 | e.printStackTrace(); | ||
| 451 | return; | ||
| 452 | } | ||
| 453 | } | ||
| 454 | } | ||
| 455 | 411 | ||
| 456 | /** | 412 | /** | 
| 457 | * 流程结束后进行业务回调 | 413 | * 流程结束后进行业务回调 | 
| ... | @@ -479,17 +435,10 @@ public class EnterpriseServiceImpl extends FlowAbstractImpl implements Enterpris | ... | @@ -479,17 +435,10 @@ public class EnterpriseServiceImpl extends FlowAbstractImpl implements Enterpris | 
| 479 | //删除原帐号并新增正式会员 | 435 | //删除原帐号并新增正式会员 | 
| 480 | TenantRQVO vo = csbrBeanUtil.convert(entity,TenantRQVO.class); | 436 | TenantRQVO vo = csbrBeanUtil.convert(entity,TenantRQVO.class); | 
| 481 | vo.setTenantType(null); | 437 | vo.setTenantType(null); | 
| 482 | vo.setGuid(CommonUtil.newGuid()); | 438 | vo.setBizGuid(dto.getBizGuid()); | 
| 483 | vo.setPersonIncharge(entity.getJuridicalPerson()); | 439 | vo.setPersonIncharge(entity.getJuridicalPerson()); | 
| 484 | vo.setBizState("Y"); | 440 | vo.setBizState("Y"); | 
| 485 | try{ | 441 | personelFeign.authTenant(vo).getData(); | 
| 486 | vo = personelFeign.authTenant(vo).getData(); | ||
| 487 | }catch (Exception e){ | ||
| 488 | if(!e.getMessage().contains("Read timed out")){ | ||
| 489 | throw e; | ||
| 490 | } | ||
| 491 | } | ||
| 492 | |||
| 493 | } | 442 | } | 
| 494 | 443 | ||
| 495 | } | 444 | } | ... | ... | 
- 
Please register or sign in to post a comment
