|
|
@@ -3,6 +3,7 @@ package com.fs.app.controller.store;
|
|
|
|
|
|
import cn.hutool.core.img.ImgUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
@@ -16,7 +17,6 @@ import com.fs.common.core.page.TableDataInfo;
|
|
|
import com.fs.common.core.redis.RedisCache;
|
|
|
import com.fs.common.exception.CustomException;
|
|
|
import com.fs.common.utils.CloudHostUtils;
|
|
|
-import com.fs.common.utils.ServletUtils;
|
|
|
import com.fs.common.utils.sign.Md5Utils;
|
|
|
import com.fs.company.domain.Company;
|
|
|
import com.fs.company.domain.CompanyUser;
|
|
|
@@ -35,6 +35,12 @@ import com.fs.fastgptApi.util.AudioUtils;
|
|
|
import com.fs.fastgptApi.vo.AudioVO;
|
|
|
import com.fs.framework.security.SecurityUtils;
|
|
|
import com.fs.his.dto.PayConfigDTO;
|
|
|
+import com.fs.sop.domain.QwSopTempVoice;
|
|
|
+import com.fs.sop.service.IQwSopTempVoiceService;
|
|
|
+import com.fs.system.service.ISysConfigService;
|
|
|
+import com.fs.system.oss.CloudStorageService;
|
|
|
+import com.fs.system.oss.OSSFactory;
|
|
|
+import com.fs.his.dto.PayConfigDTO;
|
|
|
import com.fs.his.service.IFsPrescribeService;
|
|
|
import com.fs.sop.domain.QwSopTempVoice;
|
|
|
import com.fs.sop.service.IQwSopTempVoiceService;
|
|
|
@@ -64,19 +70,20 @@ import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static com.fs.app.controller.CompanyUserController.SOP_TEMP_VOICE_KEY;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@Api("销售中心")
|
|
|
@RestController
|
|
|
-@RequestMapping(value = "/store/app/companyUser")
|
|
|
+@RequestMapping(value="/store/app/companyUser")
|
|
|
public class CompanyUserScrmController extends AppBaseController {
|
|
|
- @Autowired
|
|
|
- private ISysConfigService configService;
|
|
|
+
|
|
|
+ private static final String SOP_TEMP_VOICE_KEY = "sop:temp:voice";
|
|
|
+
|
|
|
@Autowired
|
|
|
private FSConfig fsConfig;
|
|
|
@Autowired
|
|
|
- RedisCache redisCache;
|
|
|
-
|
|
|
+ private RedisCache redisCache;
|
|
|
@Autowired
|
|
|
private ICompanyUserService companyUserService;
|
|
|
@Autowired
|
|
|
@@ -84,38 +91,41 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private ICompanyUserUserService companyUserUserService;
|
|
|
-
|
|
|
-
|
|
|
@Autowired
|
|
|
- private CompanyUserMapper companyUserMapper;
|
|
|
-
|
|
|
+ private IQwSopTempVoiceService voiceService;
|
|
|
@Autowired
|
|
|
- private IFsPrescribeService fsPrescribeService;
|
|
|
+ private ISysConfigService configService;
|
|
|
@Autowired
|
|
|
- private IQwSopTempVoiceService voiceService;
|
|
|
+ private CompanyUserMapper companyUserMapper;
|
|
|
+ @Autowired
|
|
|
+ private AiHostProper aiHostProper;
|
|
|
@Autowired
|
|
|
private FastgptChatVoiceHomoMapper fastgptChatVoiceHomoMapper;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@Autowired
|
|
|
- AiHostProper aiHostProper;
|
|
|
+ private IFsPrescribeService fsPrescribeService;
|
|
|
+
|
|
|
|
|
|
@PostMapping("/login")
|
|
|
- public R Login(@RequestBody CompanyUserLoginParam param, HttpServletRequest request) {
|
|
|
+ public R Login(@RequestBody CompanyUserLoginParam param, HttpServletRequest request){
|
|
|
try {
|
|
|
- CompanyUser companyUser = companyUserService.selectUserByUserName(param.getUserName());
|
|
|
- if (companyUser == null || companyUser.getDelFlag().equals("1")) {
|
|
|
+ CompanyUser companyUser=companyUserService.selectUserByUserName(param.getUserName());
|
|
|
+ if(companyUser==null||companyUser.getDelFlag().equals("1")){
|
|
|
return R.error("用户不存在");
|
|
|
}
|
|
|
- if (!companyUser.getStatus().equals("0")) {
|
|
|
+ if(!companyUser.getStatus().equals("0")){
|
|
|
return R.error("用户已禁用");
|
|
|
|
|
|
}
|
|
|
- String pwd = SecurityUtils.encryptPassword(param.getPassword());
|
|
|
- if (!SecurityUtils.matchesPassword(param.getPassword(), companyUser.getPassword())) {
|
|
|
+ String pwd=SecurityUtils.encryptPassword(param.getPassword());
|
|
|
+ if(!SecurityUtils.matchesPassword(param.getPassword(),companyUser.getPassword())){
|
|
|
return R.error("密码不正确");
|
|
|
}
|
|
|
- redisCache.setCacheObject("company-user-token:" + Md5Utils.hash(companyUser.getUserId().toString()), companyUser.getUserId(), 5, TimeUnit.DAYS);
|
|
|
+ redisCache.setCacheObject("company-user-token:"+Md5Utils.hash(companyUser.getUserId().toString()),companyUser.getUserId(),5, TimeUnit.DAYS);
|
|
|
return R.ok().put("companyUserToken", Md5Utils.hash(companyUser.getUserId().toString()));
|
|
|
- } catch (Exception e) {
|
|
|
+ } catch (Exception e){
|
|
|
|
|
|
return R.error("操作异常");
|
|
|
}
|
|
|
@@ -124,51 +134,50 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
@Login
|
|
|
@ApiOperation("绑定销售")
|
|
|
@PostMapping("/bindCompanyUser")
|
|
|
- public R bindCompanyUser(@Validated @RequestBody FsBindCompanyUserParam param, HttpServletRequest request) {
|
|
|
- CompanyUserUser map = new CompanyUserUser();
|
|
|
+ public R bindCompanyUser(@Validated @RequestBody FsBindCompanyUserParam param, HttpServletRequest request){
|
|
|
+ CompanyUserUser map=new CompanyUserUser();
|
|
|
map.setCompanyUserId(param.getCompanyUserId());
|
|
|
map.setUserId(Long.parseLong(getUserId()));
|
|
|
- List<CompanyUserUser> list = companyUserUserService.selectCompanyUserUserList(map);
|
|
|
- if (list == null || list.size() == 0) {
|
|
|
- CompanyUser companyUser = companyUserService.selectCompanyUserById(param.getCompanyUserId());
|
|
|
- if (companyUser != null && companyUser.getStatus().equals("0")) {
|
|
|
+ List<CompanyUserUser> list= companyUserUserService.selectCompanyUserUserList(map);
|
|
|
+ if(list==null||list.size()==0){
|
|
|
+ CompanyUser companyUser=companyUserService.selectCompanyUserById(param.getCompanyUserId());
|
|
|
+ if(companyUser!=null&&companyUser.getStatus().equals("0")){
|
|
|
map.setCompanyId(companyUser.getCompanyId());
|
|
|
companyUserUserService.insertCompanyUserUser(map);
|
|
|
}
|
|
|
}
|
|
|
return R.ok();
|
|
|
}
|
|
|
-
|
|
|
@ApiOperation("获取销售信息")
|
|
|
@GetMapping("/getUserInfo")
|
|
|
- public R getUserInfo(@RequestParam("token") String token, HttpServletRequest request) {
|
|
|
- Long userId = redisCache.getCacheObject("company-user-token:" + token);
|
|
|
- if (userId == null) {
|
|
|
- return R.error(403, "用户失效");
|
|
|
+ public R getUserInfo(@RequestParam("token")String token, HttpServletRequest request){
|
|
|
+ Long userId=redisCache.getCacheObject("company-user-token:"+token);
|
|
|
+ if(userId==null){
|
|
|
+ return R.error(403,"用户失效");
|
|
|
}
|
|
|
- CompanyUser companyUser = companyUserService.selectCompanyUserById(userId);
|
|
|
- if (companyUser == null || companyUser.getDelFlag().equals("1")) {
|
|
|
+ CompanyUser companyUser=companyUserService.selectCompanyUserById(userId);
|
|
|
+ if(companyUser==null||companyUser.getDelFlag().equals("1")){
|
|
|
return R.error("用户不存在");
|
|
|
}
|
|
|
- if (!companyUser.getStatus().equals("0")) {
|
|
|
+ if(!companyUser.getStatus().equals("0")){
|
|
|
return R.error("用户已禁用");
|
|
|
}
|
|
|
- return R.ok().put("data", companyUser);
|
|
|
+ return R.ok().put("data",companyUser);
|
|
|
}
|
|
|
|
|
|
@ApiOperation("获取销售名片")
|
|
|
@GetMapping("/getCompanyUserCard")
|
|
|
- public R getCompanyUserCard(@RequestParam("cardId") Long cardId, HttpServletRequest request) {
|
|
|
+ public R getCompanyUserCard(@RequestParam("cardId")Long cardId,HttpServletRequest request){
|
|
|
//获取用户码
|
|
|
- CompanyUserCard companyUserCard = companyUserCardService.selectCompanyUserCardById(cardId);
|
|
|
- return R.ok().put("data", companyUserCard);
|
|
|
+ CompanyUserCard companyUserCard=companyUserCardService.selectCompanyUserCardById(cardId);
|
|
|
+ return R.ok().put("data",companyUserCard);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/query/{id}")
|
|
|
- public R querySopVoiceById(@PathVariable("id") Long id) {
|
|
|
+ public R querySopVoiceById(@PathVariable("id") Long id){
|
|
|
QwSopTempVoice tempVoice = voiceService.selectQwSopTempVoiceById(id);
|
|
|
AudioVO audioVO = new AudioVO();
|
|
|
- if (tempVoice != null) {
|
|
|
+ if(tempVoice != null){
|
|
|
audioVO.setId(tempVoice.getId());
|
|
|
audioVO.setVoiceTxt(tempVoice.getVoiceTxt());
|
|
|
audioVO.setUrl(tempVoice.getVoiceUrl());
|
|
|
@@ -179,23 +188,24 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
return R.ok().put("data", audioVO);
|
|
|
}
|
|
|
|
|
|
+ @Login
|
|
|
@ApiOperation("获取支付宝收款码")
|
|
|
@GetMapping("/getQrImg")
|
|
|
- public R getQrImg(@RequestParam("token") String token, HttpServletRequest request) {
|
|
|
- Long userId = redisCache.getCacheObject("company-user-token:" + token);
|
|
|
+ public R getQrImg(@RequestParam("token")String token,HttpServletRequest request){
|
|
|
+ Long userId=redisCache.getCacheObject("company-user-token:"+token);
|
|
|
try {
|
|
|
- CompanyUser companyUser = companyUserService.selectCompanyUserById(userId);
|
|
|
+ CompanyUser companyUser=companyUserService.selectCompanyUserById(userId);
|
|
|
File newFile = new File("qr.jpg");
|
|
|
File newFileT = new File("simsunb.ttf");
|
|
|
try {
|
|
|
- InputStream stream = getClass().getClassLoader().getResourceAsStream("qr.jpg");
|
|
|
+ InputStream stream = getClass().getClassLoader().getResourceAsStream("qr.jpg");
|
|
|
FileUtils.copyInputStreamToFile(stream, newFile);
|
|
|
// if(!newFile.exists()){
|
|
|
// InputStream stream = getClass().getClassLoader().getResourceAsStream("fx.jpg");
|
|
|
// FileUtils.copyInputStreamToFile(stream, newFile);
|
|
|
// }
|
|
|
- if (!newFileT.exists()) {
|
|
|
- InputStream streamT = getClass().getClassLoader()
|
|
|
+ if(!newFileT.exists()){
|
|
|
+ InputStream streamT = getClass().getClassLoader()
|
|
|
.getResourceAsStream("simsunb.ttf");
|
|
|
FileUtils.copyInputStreamToFile(streamT, newFileT);
|
|
|
}
|
|
|
@@ -205,9 +215,10 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
- String url = fsConfig.getQrPath() + "/qr-" + userId + ".jpg";
|
|
|
+ String url=fsConfig.getQrPath()+"/qr-"+userId+".jpg";
|
|
|
File outputFile = new File(url);
|
|
|
- if (!outputFile.exists()) {
|
|
|
+ if(!outputFile.exists())
|
|
|
+ {
|
|
|
try {
|
|
|
outputFile.createNewFile();
|
|
|
|
|
|
@@ -227,8 +238,9 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
// 100, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
// 0.8f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
|
|
|
// );
|
|
|
- File qr = new File(fsConfig.getQrPath() + "/qr-" + userId + ".png");
|
|
|
- if (!qr.exists()) {
|
|
|
+ File qr = new File(fsConfig.getQrPath()+"/qr-"+userId+".png");
|
|
|
+ if(!qr.exists())
|
|
|
+ {
|
|
|
try {
|
|
|
qr.createNewFile();
|
|
|
|
|
|
@@ -236,8 +248,8 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
- QrCodeUtil.generate("http://alipay.yjf.runtzh.com/#/?companyId=" + companyUser.getCompanyId() + "&companyUserId=" + companyUser.getUserId(), 200, 200,
|
|
|
- FileUtil.file(fsConfig.getQrPath() + "/qr-" + userId + ".png"));
|
|
|
+ QrCodeUtil.generate( "http://alipay.yjf.runtzh.com/#/?companyId="+companyUser.getCompanyId()+"&companyUserId="+companyUser.getUserId(), 200, 200,
|
|
|
+ FileUtil.file(fsConfig.getQrPath()+"/qr-"+userId+".png"));
|
|
|
ImgUtil.pressImage(
|
|
|
newFile,
|
|
|
outputFile,
|
|
|
@@ -246,13 +258,13 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
20, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
1f
|
|
|
);
|
|
|
- return R.ok().put("url", "profile/qr/qr-" + userId + ".jpg");
|
|
|
+ return R.ok().put("url","profile/qr/qr-"+userId+".jpg");
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return R.error("操作异常");
|
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
+ } catch (Exception e){
|
|
|
|
|
|
return R.error("操作异常");
|
|
|
}
|
|
|
@@ -260,31 +272,31 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
|
|
|
@ApiOperation("获取公司收款码")
|
|
|
@GetMapping("/getCompanyWxaCodeByPayment")
|
|
|
- public R getCompanyWxaCodeByPayment(@RequestParam("companyId") Long companyId,
|
|
|
+ public R getCompanyWxaCodeByPayment(@RequestParam("companyId")Long companyId,
|
|
|
@RequestParam(value = "appId", required = false) String appId,
|
|
|
@RequestParam(required = false) Long companyUserId,
|
|
|
- HttpServletRequest request) {
|
|
|
+ HttpServletRequest request){
|
|
|
|
|
|
String json = configService.selectConfigByKey("his.pay");
|
|
|
PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
|
|
|
- if (appId == null || appId.trim().isEmpty()) {
|
|
|
+ if (appId == null || appId.trim().isEmpty() ) {
|
|
|
appId = payConfigDTO.getAppId();
|
|
|
}
|
|
|
//获取用户码
|
|
|
String WxaCode;
|
|
|
- if (CloudHostUtils.hasCloudHostName("鸿森堂")) {
|
|
|
+ if(CloudHostUtils.hasCloudHostName("鸿森堂")) {
|
|
|
WxaCode = redisCache.getCacheObject("company-wxa-code:" + companyId + ":" + appId + ":" + companyUserId);
|
|
|
} else {
|
|
|
WxaCode = redisCache.getCacheObject("company-wxa-code:" + companyId + ":" + appId);
|
|
|
}
|
|
|
- return R.ok().put("data", WxaCode);
|
|
|
+ return R.ok().put("data",WxaCode);
|
|
|
}
|
|
|
|
|
|
|
|
|
@ApiOperation("上传声纹")
|
|
|
@PostMapping("/addVoicePrintUrl")
|
|
|
public R addVoicePrintUrl(@RequestBody companyUserAddPrintParam param) throws Exception {
|
|
|
- Long userId = param.getCompanyUserId();
|
|
|
+ Long userId=param.getCompanyUserId();
|
|
|
CompanyUser companyUser = new CompanyUser();
|
|
|
companyUser.setUserId(userId);
|
|
|
companyUser.setVoicePrintUrl(param.getVoicePrintUrl());
|
|
|
@@ -305,8 +317,8 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
|
|
|
try {
|
|
|
CloseableHttpClient httpClient = HttpClients.createDefault();
|
|
|
- HttpPost httpPost = new HttpPost(aiHostProper.getCommonApi() + "/app/common/addCompanyAudio");
|
|
|
- String json = "{\"url\":\"" + wavUrl + "\",\"id\":\"" + userId + "\"}";
|
|
|
+ HttpPost httpPost = new HttpPost(aiHostProper.getCommonApi()+"/app/common/addCompanyAudio");
|
|
|
+ String json = "{\"url\":\""+wavUrl+"\",\"id\":\""+userId+"\"}";
|
|
|
StringEntity entity = new StringEntity(json);
|
|
|
httpPost.setEntity(entity);
|
|
|
httpPost.setHeader("Content-type", "application/json");
|
|
|
@@ -315,8 +327,8 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
if (response.getStatusLine().getStatusCode() == 200) {
|
|
|
String responseBody = EntityUtils.toString(response.getEntity());
|
|
|
JSONObject jsonObject = JSON.parseObject(responseBody);
|
|
|
- Integer code = (Integer) jsonObject.get("code");
|
|
|
- if (code == 200) {
|
|
|
+ Integer code = (Integer)jsonObject.get("code");
|
|
|
+ if (code==200){
|
|
|
voiceService.insertQwSopTempVoiceModel(userId);
|
|
|
return R.ok();
|
|
|
}
|
|
|
@@ -334,44 +346,44 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
}
|
|
|
|
|
|
@GetMapping("/querySopVoiceList")
|
|
|
- public TableDataInfo querySopVoiceList(@RequestParam("companyUserId") Long companyUserId, @RequestParam("recordType") Integer recordType) {
|
|
|
+ public TableDataInfo querySopVoiceList(@RequestParam("companyUserId")Long companyUserId,@RequestParam("recordType") Integer recordType){
|
|
|
startPage();
|
|
|
QwSopTempVoice sopTempVoice = new QwSopTempVoice();
|
|
|
sopTempVoice.setRecordType(recordType);
|
|
|
|
|
|
- Long userId = companyUserId;
|
|
|
+ Long userId=companyUserId;
|
|
|
sopTempVoice.setCompanyUserId(userId);
|
|
|
List<QwSopTempVoice> sopTempVoices = voiceService.selectQwSopTempVoiceNewList(sopTempVoice);
|
|
|
return getDataTable(sopTempVoices);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/createUserAllVoice")
|
|
|
- public R createUserAllVoice(@RequestParam("companyUserId") Long companyUserId) {
|
|
|
+ public R createUserAllVoice(@RequestParam("companyUserId")Long companyUserId){
|
|
|
QwSopTempVoice sopTempVoice = new QwSopTempVoice();
|
|
|
sopTempVoice.setRecordType(0);
|
|
|
|
|
|
- if (companyUserId == null) {
|
|
|
- throw new CustomException("未登录", 403);
|
|
|
+ if(companyUserId==null){
|
|
|
+ throw new CustomException("未登录",403);
|
|
|
}
|
|
|
|
|
|
- if (companyUserId != null) {
|
|
|
+ if(companyUserId != null){
|
|
|
CompanyUser companyUser = companyUserMapper.selectCompanyUserByCompanyUserId(companyUserId);
|
|
|
- if (companyUser != null && companyUser.getVoicePrintUrl() == null) {
|
|
|
- return R.ok().put("code", 201).put("msg", "账号未录制声纹,请录制后再试!");
|
|
|
+ if(companyUser != null && companyUser.getVoicePrintUrl() == null){
|
|
|
+ return R.ok().put("code",201).put("msg","账号未录制声纹,请录制后再试!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
sopTempVoice.setCompanyUserId(companyUserId);
|
|
|
List<QwSopTempVoice> sopTempVoices = voiceService.selectQwSopTempVoiceNewList(sopTempVoice);
|
|
|
- if (sopTempVoices != null && !sopTempVoices.isEmpty()) {
|
|
|
+ if(sopTempVoices != null && !sopTempVoices.isEmpty()){
|
|
|
List<Long> newCompanyUserId = redisCache.getVoiceAllList(SOP_TEMP_VOICE_KEY);
|
|
|
- if (newCompanyUserId != null && newCompanyUserId.contains(companyUserId)) {
|
|
|
- return R.error().put("code", 202).put("msg", "语音还未转换完成,请完成后再添加!");
|
|
|
- } else {
|
|
|
- redisCache.setVoice(SOP_TEMP_VOICE_KEY, companyUserId);
|
|
|
- sopTempVoices.forEach(m -> m.setVoiceTxt(m.getVoiceTxt().replace(" ", "")));
|
|
|
+ if(newCompanyUserId != null && newCompanyUserId.contains(companyUserId)){
|
|
|
+ return R.error().put("code",202).put("msg","语音还未转换完成,请完成后再添加!");
|
|
|
+ }else{
|
|
|
+ redisCache.setVoice(SOP_TEMP_VOICE_KEY,companyUserId);
|
|
|
+ sopTempVoices.forEach(m -> m.setVoiceTxt(m.getVoiceTxt().replace(" ","")));
|
|
|
redisCache.setVoiceList(SOP_TEMP_VOICE_KEY + ":" + companyUserId, sopTempVoices);
|
|
|
- return R.ok().put("msg", "语音已加入队列进行转换,请耐心等待!");
|
|
|
+ return R.ok().put("msg","语音已加入队列进行转换,请耐心等待!");
|
|
|
}
|
|
|
}
|
|
|
return null;
|
|
|
@@ -379,30 +391,30 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
|
|
|
|
|
|
@GetMapping("/companyUserVoice")
|
|
|
- public R companyUserVoice(@RequestParam("companyUserId") Long companyUserId, @RequestParam("id") Long id) {
|
|
|
+ public R companyUserVoice(@RequestParam("companyUserId")Long companyUserId,@RequestParam("id") Long id){
|
|
|
AudioVO audioVO = new AudioVO();
|
|
|
|
|
|
|
|
|
List<QwSopTempVoice> sopTempVoices = redisCache.getVoiceAllList(SOP_TEMP_VOICE_KEY + ":" + companyUserId);
|
|
|
- if (sopTempVoices != null && !sopTempVoices.isEmpty()) {
|
|
|
+ if(sopTempVoices != null && !sopTempVoices.isEmpty()){
|
|
|
List<Long> collect = sopTempVoices.stream().map(QwSopTempVoice::getId).collect(Collectors.toList());
|
|
|
- if (collect.contains(id)) {
|
|
|
- return R.ok().put("code", 202).put("msg", "该语音已进入转换,请完成后再试。");
|
|
|
+ if (collect.contains(id)){
|
|
|
+ return R.ok().put("code",202).put("msg","该语音已进入转换,请完成后再试。");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (companyUserId != null) {
|
|
|
+ if(companyUserId != null){
|
|
|
CompanyUser companyUser = companyUserMapper.selectCompanyUserByCompanyUserId(companyUserId);
|
|
|
- if (companyUser != null && companyUser.getVoicePrintUrl() == null) {
|
|
|
- return R.ok().put("code", 201).put("msg", "账号未录制声纹,请录制后再试!");
|
|
|
+ if(companyUser != null && companyUser.getVoicePrintUrl() == null){
|
|
|
+ return R.ok().put("code",201).put("msg","账号未录制声纹,请录制后再试!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
QwSopTempVoice qwSopTempVoice = voiceService.selectQwSopTempVoiceById(id);
|
|
|
- if (qwSopTempVoice != null && qwSopTempVoice.getCompanyUserId() != null) {
|
|
|
+ if(qwSopTempVoice != null && qwSopTempVoice.getCompanyUserId() != null){
|
|
|
List<FastgptChatVoiceHomo> homos = fastgptChatVoiceHomoMapper.selectFastgptChatVoiceHomoList(new FastgptChatVoiceHomo());
|
|
|
- audioVO = AudioUtils.createUserUrlAndUrl(homos, qwSopTempVoice.getCompanyUserId(), qwSopTempVoice.getVoiceTxt().replace(" ", ""));
|
|
|
- if (audioVO != null && audioVO.getWavUrl() != null && audioVO.getUrl() != null) {
|
|
|
+ audioVO = AudioUtils.createUserUrlAndUrl(homos,qwSopTempVoice.getCompanyUserId(), qwSopTempVoice.getVoiceTxt().replace(" ",""));
|
|
|
+ if(audioVO != null && audioVO.getWavUrl() != null && audioVO.getUrl() != null){
|
|
|
qwSopTempVoice.setVoiceUrl(audioVO.getUrl());
|
|
|
qwSopTempVoice.setUserVoiceUrl(audioVO.getWavUrl());
|
|
|
qwSopTempVoice.setDuration(audioVO.getDuration());
|
|
|
@@ -415,28 +427,27 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
|
|
|
/**
|
|
|
* 当只有user_voice_url时,生成表中对应条的voice_url
|
|
|
- *
|
|
|
- * @param userVoiceUrl wav格式的语音文件
|
|
|
- * @param id qw_sop_temp_voice的id
|
|
|
+ * @param userVoiceUrl wav格式的语音文件
|
|
|
+ * @param id qw_sop_temp_voice的id
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/companyUserVoiceNew")
|
|
|
- public R companyUserVoiceNew(@RequestParam("companyUserId") Long companyUserId, @RequestParam("id") Long id, @RequestParam("userVoiceUrl") String userVoiceUrl) {
|
|
|
+ public R companyUserVoiceNew( @RequestParam("companyUserId")Long companyUserId,@RequestParam("id") Long id,@RequestParam("userVoiceUrl") String userVoiceUrl){
|
|
|
|
|
|
AudioVO audioVO = new AudioVO();
|
|
|
|
|
|
List<QwSopTempVoice> sopTempVoices = redisCache.getVoiceAllList(SOP_TEMP_VOICE_KEY + ":" + companyUserId);
|
|
|
- if (sopTempVoices != null && !sopTempVoices.isEmpty()) {
|
|
|
+ if(sopTempVoices != null && !sopTempVoices.isEmpty()){
|
|
|
List<Long> collect = sopTempVoices.stream().map(QwSopTempVoice::getId).collect(Collectors.toList());
|
|
|
- if (collect.contains(id)) {
|
|
|
- return R.ok().put("code", 202).put("msg", "该语音已进入转换,请完成后再试。");
|
|
|
+ if (collect.contains(id)){
|
|
|
+ return R.ok().put("code",202).put("msg","该语音已进入转换,请完成后再试。");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
QwSopTempVoice qwSopTempVoice = voiceService.selectQwSopTempVoiceByIdAndUserVoiceUrl(id);
|
|
|
- if (qwSopTempVoice != null && qwSopTempVoice.getId() != null) {
|
|
|
+ if(qwSopTempVoice != null && qwSopTempVoice.getId() != null){
|
|
|
audioVO = AudioUtils.createVoiceUrl(qwSopTempVoice.getCompanyUserId(), userVoiceUrl);
|
|
|
- if (audioVO != null && audioVO.getUrl() != null) {
|
|
|
+ if(audioVO != null && audioVO.getUrl() != null){
|
|
|
qwSopTempVoice.setVoiceUrl(audioVO.getUrl());
|
|
|
qwSopTempVoice.setUserVoiceUrl(userVoiceUrl);
|
|
|
qwSopTempVoice.setDuration(audioVO.getDuration());
|