建模回调代码
parent
9531bfd7aa
commit
72b1eb2a56
@ -0,0 +1,35 @@
|
|||||||
|
package com.baiye.modules.distribute.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.baiye.modules.distribute.dto.PushClueDTO;
|
||||||
|
import com.baiye.modules.distribute.service.BuildModelService;
|
||||||
|
import com.baiye.modules.distribute.service.TripartiteService;
|
||||||
|
import com.baiye.result.R;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Enzo
|
||||||
|
* @date 2023-12-6
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/v1/build")
|
||||||
|
public class ModelCallbackController {
|
||||||
|
|
||||||
|
private final BuildModelService buildModelService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送资源
|
||||||
|
*/
|
||||||
|
@PostMapping("/model/callback")
|
||||||
|
public R<String> pushClue( @RequestBody String body) {
|
||||||
|
log.info("=============== the body {} ==============", JSONUtil.toJsonStr(body));
|
||||||
|
PushClueDTO clueDTO = BeanUtil.toBean(body, PushClueDTO.class);
|
||||||
|
return Boolean.TRUE.equals(buildModelService.callbackByNid(clueDTO)) ? R.ok("success") : R.failed("message callback failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.baiye.modules.distribute.service;
|
||||||
|
|
||||||
|
import com.baiye.modules.distribute.dto.PushClueDTO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Enzo
|
||||||
|
* @date 2023-12-6
|
||||||
|
*/
|
||||||
|
public interface BuildModelService {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存信息
|
||||||
|
* @param body
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean callbackByNid(PushClueDTO body);
|
||||||
|
}
|
@ -0,0 +1,82 @@
|
|||||||
|
package com.baiye.modules.distribute.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.codec.Base64;
|
||||||
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baiye.constant.DefaultNumberConstants;
|
||||||
|
import com.baiye.enums.ClueSourceEnum;
|
||||||
|
import com.baiye.modules.distribute.dto.CallbackCustomDTO;
|
||||||
|
import com.baiye.modules.distribute.dto.ClueDTO;
|
||||||
|
import com.baiye.modules.distribute.dto.PushClueDTO;
|
||||||
|
import com.baiye.modules.distribute.entity.PushLinkEntity;
|
||||||
|
import com.baiye.modules.distribute.service.*;
|
||||||
|
import com.baiye.notify.model.entity.Announcement;
|
||||||
|
import com.baiye.polling.QueueBalance;
|
||||||
|
import com.baiye.system.enums.RoleCodeEnum;
|
||||||
|
import com.baiye.system.model.entity.SysUser;
|
||||||
|
import com.baiye.system.model.entity.SysUserRolePromise;
|
||||||
|
import com.baiye.system.service.SysUserRolePromiseService;
|
||||||
|
import com.baiye.system.service.SysUserRoleService;
|
||||||
|
import com.baiye.system.service.SysUserService;
|
||||||
|
import com.baiye.util.AESUtils;
|
||||||
|
import com.baiye.util.DecryptPnoUtil;
|
||||||
|
import com.baiye.util.RedisUtils;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.ballcat.security.properties.SecurityProperties;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Enzo
|
||||||
|
* @date : 2023/12/6
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class BuildModelServiceImpl implements BuildModelService {
|
||||||
|
|
||||||
|
|
||||||
|
@Value("${snowflake.workerId}")
|
||||||
|
private int workerId;
|
||||||
|
|
||||||
|
@Value("${snowflake.datacenterId}")
|
||||||
|
private int datacenterId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean callbackByNid(PushClueDTO dto) {
|
||||||
|
String recId = dto.getRecId();
|
||||||
|
String called = dto.getCalled();
|
||||||
|
String remark = dto.getRemark();
|
||||||
|
String phone = CharSequenceUtil.EMPTY;
|
||||||
|
|
||||||
|
String typeName = dto.getEmpClientTypeName();
|
||||||
|
if (StringUtils.isNotBlank(dto.getMobile())) {
|
||||||
|
phone = Base64.decodeStr(dto.getMobile());
|
||||||
|
}
|
||||||
|
// 格式校验
|
||||||
|
if (StringUtils.isNotBlank(called) && StringUtils.isNotBlank(typeName)
|
||||||
|
&& Announcement.TABLE_ALIAS.equalsIgnoreCase(typeName)) {
|
||||||
|
phone = called.length() > DefaultNumberConstants.ELEVEN_NUMBER
|
||||||
|
? DecryptPnoUtil.decryptPno(called) : called;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(phone) ) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue