|
@@ -4,48 +4,79 @@ package com.fs.app.controller.store;
|
|
|
import cn.hutool.core.img.ImgUtil;
|
|
import cn.hutool.core.img.ImgUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fs.app.annotation.Login;
|
|
import com.fs.app.annotation.Login;
|
|
|
import com.fs.app.controller.AppBaseController;
|
|
import com.fs.app.controller.AppBaseController;
|
|
|
import com.fs.app.param.FsBindCompanyUserParam;
|
|
import com.fs.app.param.FsBindCompanyUserParam;
|
|
|
import com.fs.common.config.FSConfig;
|
|
import com.fs.common.config.FSConfig;
|
|
|
import com.fs.common.core.domain.R;
|
|
import com.fs.common.core.domain.R;
|
|
|
|
|
+import com.fs.common.core.page.TableDataInfo;
|
|
|
import com.fs.common.core.redis.RedisCache;
|
|
import com.fs.common.core.redis.RedisCache;
|
|
|
import com.fs.common.exception.CustomException;
|
|
import com.fs.common.exception.CustomException;
|
|
|
import com.fs.common.utils.CloudHostUtils;
|
|
import com.fs.common.utils.CloudHostUtils;
|
|
|
import com.fs.common.utils.ServletUtils;
|
|
import com.fs.common.utils.ServletUtils;
|
|
|
import com.fs.common.utils.sign.Md5Utils;
|
|
import com.fs.common.utils.sign.Md5Utils;
|
|
|
|
|
+import com.fs.company.domain.Company;
|
|
|
import com.fs.company.domain.CompanyUser;
|
|
import com.fs.company.domain.CompanyUser;
|
|
|
import com.fs.company.domain.CompanyUserCard;
|
|
import com.fs.company.domain.CompanyUserCard;
|
|
|
import com.fs.company.domain.CompanyUserUser;
|
|
import com.fs.company.domain.CompanyUserUser;
|
|
|
|
|
+import com.fs.company.mapper.CompanyUserMapper;
|
|
|
import com.fs.company.param.CompanyUserLoginParam;
|
|
import com.fs.company.param.CompanyUserLoginParam;
|
|
|
|
|
+import com.fs.company.param.companyUserAddPrintParam;
|
|
|
import com.fs.company.service.ICompanyUserCardService;
|
|
import com.fs.company.service.ICompanyUserCardService;
|
|
|
import com.fs.company.service.ICompanyUserService;
|
|
import com.fs.company.service.ICompanyUserService;
|
|
|
import com.fs.company.service.ICompanyUserUserService;
|
|
import com.fs.company.service.ICompanyUserUserService;
|
|
|
|
|
+import com.fs.config.ai.AiHostProper;
|
|
|
|
|
+import com.fs.fastGpt.domain.FastgptChatVoiceHomo;
|
|
|
|
|
+import com.fs.fastGpt.mapper.FastgptChatVoiceHomoMapper;
|
|
|
|
|
+import com.fs.fastgptApi.util.AudioUtils;
|
|
|
|
|
+import com.fs.fastgptApi.vo.AudioVO;
|
|
|
import com.fs.framework.security.SecurityUtils;
|
|
import com.fs.framework.security.SecurityUtils;
|
|
|
|
|
+import com.fs.his.dto.PayConfigDTO;
|
|
|
|
|
+import com.fs.his.service.IFsPrescribeService;
|
|
|
|
|
+import com.fs.sop.domain.QwSopTempVoice;
|
|
|
|
|
+import com.fs.sop.service.IQwSopTempVoiceService;
|
|
|
|
|
+import com.fs.system.oss.CloudStorageService;
|
|
|
|
|
+import com.fs.system.oss.OSSFactory;
|
|
|
|
|
+import com.fs.system.service.ISysConfigService;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.commons.io.FileUtils;
|
|
|
|
|
+import org.apache.http.HttpResponse;
|
|
|
|
|
+import org.apache.http.client.methods.HttpPost;
|
|
|
|
|
+import org.apache.http.entity.StringEntity;
|
|
|
|
|
+import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
|
|
+import org.apache.http.impl.client.HttpClients;
|
|
|
|
|
+import org.apache.http.util.EntityUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
|
|
+import java.io.FileInputStream;
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
+
|
|
|
|
|
+import static com.fs.app.controller.CompanyUserController.SOP_TEMP_VOICE_KEY;
|
|
|
|
|
|
|
|
|
|
|
|
|
@Api("销售中心")
|
|
@Api("销售中心")
|
|
|
@RestController
|
|
@RestController
|
|
|
-@RequestMapping(value="/store/app/companyUser")
|
|
|
|
|
|
|
+@RequestMapping(value = "/store/app/companyUser")
|
|
|
public class CompanyUserScrmController extends AppBaseController {
|
|
public class CompanyUserScrmController extends AppBaseController {
|
|
|
-
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ISysConfigService configService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private FSConfig fsConfig;
|
|
private FSConfig fsConfig;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
RedisCache redisCache;
|
|
RedisCache redisCache;
|
|
|
|
|
+
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ICompanyUserService companyUserService;
|
|
private ICompanyUserService companyUserService;
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -54,75 +85,90 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ICompanyUserUserService companyUserUserService;
|
|
private ICompanyUserUserService companyUserUserService;
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private CompanyUserMapper companyUserMapper;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IFsPrescribeService fsPrescribeService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IQwSopTempVoiceService voiceService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private FastgptChatVoiceHomoMapper fastgptChatVoiceHomoMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ AiHostProper aiHostProper;
|
|
|
|
|
+
|
|
|
@PostMapping("/login")
|
|
@PostMapping("/login")
|
|
|
- public R Login(@RequestBody CompanyUserLoginParam param, HttpServletRequest request){
|
|
|
|
|
|
|
+ public R Login(@RequestBody CompanyUserLoginParam param, HttpServletRequest request) {
|
|
|
try {
|
|
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("用户不存在");
|
|
return R.error("用户不存在");
|
|
|
}
|
|
}
|
|
|
- if(!companyUser.getStatus().equals("0")){
|
|
|
|
|
|
|
+ if (!companyUser.getStatus().equals("0")) {
|
|
|
return R.error("用户已禁用");
|
|
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("密码不正确");
|
|
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()));
|
|
return R.ok().put("companyUserToken", Md5Utils.hash(companyUser.getUserId().toString()));
|
|
|
- } catch (Exception e){
|
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
|
|
|
return R.error("操作异常");
|
|
return R.error("操作异常");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
@Login
|
|
@Login
|
|
|
@ApiOperation("绑定销售")
|
|
@ApiOperation("绑定销售")
|
|
|
@PostMapping("/bindCompanyUser")
|
|
@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.setCompanyUserId(param.getCompanyUserId());
|
|
|
map.setUserId(Long.parseLong(getUserId()));
|
|
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());
|
|
map.setCompanyId(companyUser.getCompanyId());
|
|
|
companyUserUserService.insertCompanyUserUser(map);
|
|
companyUserUserService.insertCompanyUserUser(map);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return R.ok();
|
|
return R.ok();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
@ApiOperation("获取销售信息")
|
|
@ApiOperation("获取销售信息")
|
|
|
@GetMapping("/getUserInfo")
|
|
@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("用户不存在");
|
|
return R.error("用户不存在");
|
|
|
}
|
|
}
|
|
|
- if(!companyUser.getStatus().equals("0")){
|
|
|
|
|
|
|
+ if (!companyUser.getStatus().equals("0")) {
|
|
|
return R.error("用户已禁用");
|
|
return R.error("用户已禁用");
|
|
|
}
|
|
}
|
|
|
- return R.ok().put("data",companyUser);
|
|
|
|
|
|
|
+ return R.ok().put("data", companyUser);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation("获取销售名片")
|
|
@ApiOperation("获取销售名片")
|
|
|
@GetMapping("/getCompanyUserCard")
|
|
@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}")
|
|
@GetMapping("/query/{id}")
|
|
|
- public R querySopVoiceById(@PathVariable("id") Long id){
|
|
|
|
|
|
|
+ public R querySopVoiceById(@PathVariable("id") Long id) {
|
|
|
QwSopTempVoice tempVoice = voiceService.selectQwSopTempVoiceById(id);
|
|
QwSopTempVoice tempVoice = voiceService.selectQwSopTempVoiceById(id);
|
|
|
AudioVO audioVO = new AudioVO();
|
|
AudioVO audioVO = new AudioVO();
|
|
|
- if(tempVoice != null){
|
|
|
|
|
|
|
+ if (tempVoice != null) {
|
|
|
audioVO.setId(tempVoice.getId());
|
|
audioVO.setId(tempVoice.getId());
|
|
|
audioVO.setVoiceTxt(tempVoice.getVoiceTxt());
|
|
audioVO.setVoiceTxt(tempVoice.getVoiceTxt());
|
|
|
audioVO.setUrl(tempVoice.getVoiceUrl());
|
|
audioVO.setUrl(tempVoice.getVoiceUrl());
|
|
@@ -133,24 +179,23 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
return R.ok().put("data", audioVO);
|
|
return R.ok().put("data", audioVO);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Login
|
|
|
|
|
@ApiOperation("获取支付宝收款码")
|
|
@ApiOperation("获取支付宝收款码")
|
|
|
@GetMapping("/getQrImg")
|
|
@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 {
|
|
try {
|
|
|
- CompanyUser companyUser=companyUserService.selectCompanyUserById(userId);
|
|
|
|
|
|
|
+ CompanyUser companyUser = companyUserService.selectCompanyUserById(userId);
|
|
|
File newFile = new File("qr.jpg");
|
|
File newFile = new File("qr.jpg");
|
|
|
File newFileT = new File("simsunb.ttf");
|
|
File newFileT = new File("simsunb.ttf");
|
|
|
try {
|
|
try {
|
|
|
- InputStream stream = getClass().getClassLoader().getResourceAsStream("qr.jpg");
|
|
|
|
|
|
|
+ InputStream stream = getClass().getClassLoader().getResourceAsStream("qr.jpg");
|
|
|
FileUtils.copyInputStreamToFile(stream, newFile);
|
|
FileUtils.copyInputStreamToFile(stream, newFile);
|
|
|
// if(!newFile.exists()){
|
|
// if(!newFile.exists()){
|
|
|
// InputStream stream = getClass().getClassLoader().getResourceAsStream("fx.jpg");
|
|
// InputStream stream = getClass().getClassLoader().getResourceAsStream("fx.jpg");
|
|
|
// FileUtils.copyInputStreamToFile(stream, newFile);
|
|
// FileUtils.copyInputStreamToFile(stream, newFile);
|
|
|
// }
|
|
// }
|
|
|
- if(!newFileT.exists()){
|
|
|
|
|
- InputStream streamT = getClass().getClassLoader()
|
|
|
|
|
|
|
+ if (!newFileT.exists()) {
|
|
|
|
|
+ InputStream streamT = getClass().getClassLoader()
|
|
|
.getResourceAsStream("simsunb.ttf");
|
|
.getResourceAsStream("simsunb.ttf");
|
|
|
FileUtils.copyInputStreamToFile(streamT, newFileT);
|
|
FileUtils.copyInputStreamToFile(streamT, newFileT);
|
|
|
}
|
|
}
|
|
@@ -160,10 +205,9 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- String url=fsConfig.getQrPath()+"/qr-"+userId+".jpg";
|
|
|
|
|
|
|
+ String url = fsConfig.getQrPath() + "/qr-" + userId + ".jpg";
|
|
|
File outputFile = new File(url);
|
|
File outputFile = new File(url);
|
|
|
- if(!outputFile.exists())
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ if (!outputFile.exists()) {
|
|
|
try {
|
|
try {
|
|
|
outputFile.createNewFile();
|
|
outputFile.createNewFile();
|
|
|
|
|
|
|
@@ -183,9 +227,8 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
// 100, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
// 100, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
// 0.8f//透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
|
|
// 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 {
|
|
try {
|
|
|
qr.createNewFile();
|
|
qr.createNewFile();
|
|
|
|
|
|
|
@@ -193,8 +236,8 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
e.printStackTrace();
|
|
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(
|
|
ImgUtil.pressImage(
|
|
|
newFile,
|
|
newFile,
|
|
|
outputFile,
|
|
outputFile,
|
|
@@ -203,13 +246,13 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
20, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
20, //y坐标修正值。 默认在中间,偏移量相对于中间偏移
|
|
|
1f
|
|
1f
|
|
|
);
|
|
);
|
|
|
- return R.ok().put("url","profile/qr/qr-"+userId+".jpg");
|
|
|
|
|
|
|
+ return R.ok().put("url", "profile/qr/qr-" + userId + ".jpg");
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
return R.error("操作异常");
|
|
return R.error("操作异常");
|
|
|
}
|
|
}
|
|
|
- } catch (Exception e){
|
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
|
|
|
return R.error("操作异常");
|
|
return R.error("操作异常");
|
|
|
}
|
|
}
|
|
@@ -217,31 +260,31 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
|
|
|
|
|
@ApiOperation("获取公司收款码")
|
|
@ApiOperation("获取公司收款码")
|
|
|
@GetMapping("/getCompanyWxaCodeByPayment")
|
|
@GetMapping("/getCompanyWxaCodeByPayment")
|
|
|
- public R getCompanyWxaCodeByPayment(@RequestParam("companyId")Long companyId,
|
|
|
|
|
|
|
+ public R getCompanyWxaCodeByPayment(@RequestParam("companyId") Long companyId,
|
|
|
@RequestParam(value = "appId", required = false) String appId,
|
|
@RequestParam(value = "appId", required = false) String appId,
|
|
|
@RequestParam(required = false) Long companyUserId,
|
|
@RequestParam(required = false) Long companyUserId,
|
|
|
- HttpServletRequest request){
|
|
|
|
|
|
|
+ HttpServletRequest request) {
|
|
|
|
|
|
|
|
String json = configService.selectConfigByKey("his.pay");
|
|
String json = configService.selectConfigByKey("his.pay");
|
|
|
PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
|
|
PayConfigDTO payConfigDTO = JSONUtil.toBean(json, PayConfigDTO.class);
|
|
|
- if (appId == null || appId.trim().isEmpty() ) {
|
|
|
|
|
|
|
+ if (appId == null || appId.trim().isEmpty()) {
|
|
|
appId = payConfigDTO.getAppId();
|
|
appId = payConfigDTO.getAppId();
|
|
|
}
|
|
}
|
|
|
//获取用户码
|
|
//获取用户码
|
|
|
String WxaCode;
|
|
String WxaCode;
|
|
|
- if(CloudHostUtils.hasCloudHostName("鸿森堂")) {
|
|
|
|
|
|
|
+ if (CloudHostUtils.hasCloudHostName("鸿森堂")) {
|
|
|
WxaCode = redisCache.getCacheObject("company-wxa-code:" + companyId + ":" + appId + ":" + companyUserId);
|
|
WxaCode = redisCache.getCacheObject("company-wxa-code:" + companyId + ":" + appId + ":" + companyUserId);
|
|
|
} else {
|
|
} else {
|
|
|
WxaCode = redisCache.getCacheObject("company-wxa-code:" + companyId + ":" + appId);
|
|
WxaCode = redisCache.getCacheObject("company-wxa-code:" + companyId + ":" + appId);
|
|
|
}
|
|
}
|
|
|
- return R.ok().put("data",WxaCode);
|
|
|
|
|
|
|
+ return R.ok().put("data", WxaCode);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("上传声纹")
|
|
@ApiOperation("上传声纹")
|
|
|
@PostMapping("/addVoicePrintUrl")
|
|
@PostMapping("/addVoicePrintUrl")
|
|
|
public R addVoicePrintUrl(@RequestBody companyUserAddPrintParam param) throws Exception {
|
|
public R addVoicePrintUrl(@RequestBody companyUserAddPrintParam param) throws Exception {
|
|
|
- Long userId=param.getCompanyUserId();
|
|
|
|
|
|
|
+ Long userId = param.getCompanyUserId();
|
|
|
CompanyUser companyUser = new CompanyUser();
|
|
CompanyUser companyUser = new CompanyUser();
|
|
|
companyUser.setUserId(userId);
|
|
companyUser.setUserId(userId);
|
|
|
companyUser.setVoicePrintUrl(param.getVoicePrintUrl());
|
|
companyUser.setVoicePrintUrl(param.getVoicePrintUrl());
|
|
@@ -262,8 +305,8 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
CloseableHttpClient httpClient = HttpClients.createDefault();
|
|
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);
|
|
StringEntity entity = new StringEntity(json);
|
|
|
httpPost.setEntity(entity);
|
|
httpPost.setEntity(entity);
|
|
|
httpPost.setHeader("Content-type", "application/json");
|
|
httpPost.setHeader("Content-type", "application/json");
|
|
@@ -272,8 +315,8 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
if (response.getStatusLine().getStatusCode() == 200) {
|
|
if (response.getStatusLine().getStatusCode() == 200) {
|
|
|
String responseBody = EntityUtils.toString(response.getEntity());
|
|
String responseBody = EntityUtils.toString(response.getEntity());
|
|
|
JSONObject jsonObject = JSON.parseObject(responseBody);
|
|
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);
|
|
voiceService.insertQwSopTempVoiceModel(userId);
|
|
|
return R.ok();
|
|
return R.ok();
|
|
|
}
|
|
}
|
|
@@ -291,44 +334,44 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/querySopVoiceList")
|
|
@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();
|
|
startPage();
|
|
|
QwSopTempVoice sopTempVoice = new QwSopTempVoice();
|
|
QwSopTempVoice sopTempVoice = new QwSopTempVoice();
|
|
|
sopTempVoice.setRecordType(recordType);
|
|
sopTempVoice.setRecordType(recordType);
|
|
|
|
|
|
|
|
- Long userId=companyUserId;
|
|
|
|
|
|
|
+ Long userId = companyUserId;
|
|
|
sopTempVoice.setCompanyUserId(userId);
|
|
sopTempVoice.setCompanyUserId(userId);
|
|
|
List<QwSopTempVoice> sopTempVoices = voiceService.selectQwSopTempVoiceNewList(sopTempVoice);
|
|
List<QwSopTempVoice> sopTempVoices = voiceService.selectQwSopTempVoiceNewList(sopTempVoice);
|
|
|
return getDataTable(sopTempVoices);
|
|
return getDataTable(sopTempVoices);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/createUserAllVoice")
|
|
@GetMapping("/createUserAllVoice")
|
|
|
- public R createUserAllVoice(@RequestParam("companyUserId")Long companyUserId){
|
|
|
|
|
|
|
+ public R createUserAllVoice(@RequestParam("companyUserId") Long companyUserId) {
|
|
|
QwSopTempVoice sopTempVoice = new QwSopTempVoice();
|
|
QwSopTempVoice sopTempVoice = new QwSopTempVoice();
|
|
|
sopTempVoice.setRecordType(0);
|
|
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);
|
|
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);
|
|
sopTempVoice.setCompanyUserId(companyUserId);
|
|
|
List<QwSopTempVoice> sopTempVoices = voiceService.selectQwSopTempVoiceNewList(sopTempVoice);
|
|
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);
|
|
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);
|
|
redisCache.setVoiceList(SOP_TEMP_VOICE_KEY + ":" + companyUserId, sopTempVoices);
|
|
|
- return R.ok().put("msg","语音已加入队列进行转换,请耐心等待!");
|
|
|
|
|
|
|
+ return R.ok().put("msg", "语音已加入队列进行转换,请耐心等待!");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return null;
|
|
return null;
|
|
@@ -336,30 +379,30 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/companyUserVoice")
|
|
@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();
|
|
AudioVO audioVO = new AudioVO();
|
|
|
|
|
|
|
|
|
|
|
|
|
List<QwSopTempVoice> sopTempVoices = redisCache.getVoiceAllList(SOP_TEMP_VOICE_KEY + ":" + companyUserId);
|
|
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());
|
|
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);
|
|
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);
|
|
QwSopTempVoice qwSopTempVoice = voiceService.selectQwSopTempVoiceById(id);
|
|
|
- if(qwSopTempVoice != null && qwSopTempVoice.getCompanyUserId() != null){
|
|
|
|
|
|
|
+ if (qwSopTempVoice != null && qwSopTempVoice.getCompanyUserId() != null) {
|
|
|
List<FastgptChatVoiceHomo> homos = fastgptChatVoiceHomoMapper.selectFastgptChatVoiceHomoList(new FastgptChatVoiceHomo());
|
|
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.setVoiceUrl(audioVO.getUrl());
|
|
|
qwSopTempVoice.setUserVoiceUrl(audioVO.getWavUrl());
|
|
qwSopTempVoice.setUserVoiceUrl(audioVO.getWavUrl());
|
|
|
qwSopTempVoice.setDuration(audioVO.getDuration());
|
|
qwSopTempVoice.setDuration(audioVO.getDuration());
|
|
@@ -372,27 +415,28 @@ public class CompanyUserScrmController extends AppBaseController {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 当只有user_voice_url时,生成表中对应条的voice_url
|
|
* 当只有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
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/companyUserVoiceNew")
|
|
@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();
|
|
AudioVO audioVO = new AudioVO();
|
|
|
|
|
|
|
|
List<QwSopTempVoice> sopTempVoices = redisCache.getVoiceAllList(SOP_TEMP_VOICE_KEY + ":" + companyUserId);
|
|
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());
|
|
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);
|
|
QwSopTempVoice qwSopTempVoice = voiceService.selectQwSopTempVoiceByIdAndUserVoiceUrl(id);
|
|
|
- if(qwSopTempVoice != null && qwSopTempVoice.getId() != null){
|
|
|
|
|
|
|
+ if (qwSopTempVoice != null && qwSopTempVoice.getId() != null) {
|
|
|
audioVO = AudioUtils.createVoiceUrl(qwSopTempVoice.getCompanyUserId(), userVoiceUrl);
|
|
audioVO = AudioUtils.createVoiceUrl(qwSopTempVoice.getCompanyUserId(), userVoiceUrl);
|
|
|
- if(audioVO != null && audioVO.getUrl() != null){
|
|
|
|
|
|
|
+ if (audioVO != null && audioVO.getUrl() != null) {
|
|
|
qwSopTempVoice.setVoiceUrl(audioVO.getUrl());
|
|
qwSopTempVoice.setVoiceUrl(audioVO.getUrl());
|
|
|
qwSopTempVoice.setUserVoiceUrl(userVoiceUrl);
|
|
qwSopTempVoice.setUserVoiceUrl(userVoiceUrl);
|
|
|
qwSopTempVoice.setDuration(audioVO.getDuration());
|
|
qwSopTempVoice.setDuration(audioVO.getDuration());
|