|
|
@@ -28,6 +28,7 @@ import com.fs.fastgptApi.util.AudioUtils;
|
|
|
import com.fs.fastgptApi.vo.AudioVO;
|
|
|
import com.fs.his.param.*;
|
|
|
import com.fs.his.service.IFsPrescribeService;
|
|
|
+import com.fs.his.service.IFsUserService;
|
|
|
import com.fs.his.vo.FsPrescribeListDVO;
|
|
|
import com.fs.his.vo.FsUserVO;
|
|
|
import com.fs.his.vo.MyMemberVO;
|
|
|
@@ -59,8 +60,8 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
@Api("销售接口")
|
|
|
@RestController
|
|
|
-@RequestMapping(value="/app/companyUser")
|
|
|
-public class CompanyUserController extends AppBaseController {
|
|
|
+@RequestMapping(value = "/app/companyUser")
|
|
|
+public class CompanyUserController extends AppBaseController {
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
@@ -80,25 +81,30 @@ public class CompanyUserController extends AppBaseController {
|
|
|
@Autowired
|
|
|
AiHostProper aiHostProper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IFsUserService fsUserService;
|
|
|
+
|
|
|
+
|
|
|
public static final String SOP_TEMP_VOICE_KEY = "sop:tempVoice";
|
|
|
+
|
|
|
@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(),100, TimeUnit.DAYS);
|
|
|
- return R.ok().put("companyUserToken", Md5Utils.hash(companyUser.getUserId().toString())).put("user",companyUser);
|
|
|
- } catch (Exception e){
|
|
|
+ redisCache.setCacheObject("company-user-token:" + Md5Utils.hash(companyUser.getUserId().toString()), companyUser.getUserId(), 100, TimeUnit.DAYS);
|
|
|
+ return R.ok().put("companyUserToken", Md5Utils.hash(companyUser.getUserId().toString())).put("user", companyUser);
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
|
return R.error("操作异常");
|
|
|
}
|
|
|
@@ -106,33 +112,33 @@ public class CompanyUserController extends AppBaseController {
|
|
|
|
|
|
@ApiOperation("获取销售信息")
|
|
|
@GetMapping("/getUserInfo")
|
|
|
- public R getUserInfo(HttpServletRequest request){
|
|
|
+ public R getUserInfo(HttpServletRequest request) {
|
|
|
|
|
|
- Long userId=getCompanyUserId();
|
|
|
- if(userId==null){
|
|
|
- return R.error(403,"用户失效");
|
|
|
+ Long userId = getCompanyUserId();
|
|
|
+ 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);
|
|
|
}
|
|
|
|
|
|
@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);
|
|
|
}
|
|
|
@@ -145,9 +151,9 @@ public class CompanyUserController extends AppBaseController {
|
|
|
@ApiOperation("上传声纹")
|
|
|
@PostMapping("/addVoicePrintUrl")
|
|
|
public R addVoicePrintUrl(@RequestBody companyUserAddPrintParam param) throws Exception {
|
|
|
- Long userId=getCompanyUserId();
|
|
|
- if(userId==null){
|
|
|
- return R.error(403,"用户失效");
|
|
|
+ Long userId = getCompanyUserId();
|
|
|
+ if (userId == null) {
|
|
|
+ return R.error(403, "用户失效");
|
|
|
}
|
|
|
CompanyUser companyUser = new CompanyUser();
|
|
|
companyUser.setUserId(userId);
|
|
|
@@ -169,8 +175,8 @@ public class CompanyUserController 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");
|
|
|
@@ -179,8 +185,8 @@ public class CompanyUserController 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();
|
|
|
}
|
|
|
@@ -196,37 +202,40 @@ public class CompanyUserController extends AppBaseController {
|
|
|
return R.error();
|
|
|
|
|
|
}
|
|
|
+
|
|
|
@ApiOperation("小程序销售绑定医生")
|
|
|
@Log(title = "小程序销售绑定医生", businessType = BusinessType.UPDATE)
|
|
|
@PostMapping("/bindDoctorId")
|
|
|
- public R binDoctor(@RequestBody CompanyUser companyUser){
|
|
|
+ public R binDoctor(@RequestBody CompanyUser companyUser) {
|
|
|
return companyUserService.bindDoctor(companyUser);
|
|
|
}
|
|
|
+
|
|
|
@ApiOperation("小程序销售解除绑定医生")
|
|
|
@Log(title = "小程序销售解除绑定医生", businessType = BusinessType.UPDATE)
|
|
|
@GetMapping("/unBindDoctorId/{userId}")
|
|
|
- public R unBinDoctor(@PathVariable("userId") Long userId){
|
|
|
+ public R unBinDoctor(@PathVariable("userId") Long userId) {
|
|
|
return companyUserService.unBindDoctor(userId);
|
|
|
}
|
|
|
|
|
|
@ApiOperation("获取公司收款码")
|
|
|
@GetMapping("/getCompanyWxaCodeByPayment")
|
|
|
- public R getCompanyWxaCodeByPayment(@RequestParam("companyId")Long companyId,@RequestParam("appId")String appId,HttpServletRequest request){
|
|
|
+ public R getCompanyWxaCodeByPayment(@RequestParam("companyId") Long companyId, @RequestParam("appId") String appId, HttpServletRequest request) {
|
|
|
//获取用户码
|
|
|
- String WxaCode = redisCache.getCacheObject("company-wxa-code:"+companyId+":"+appId);
|
|
|
- return R.ok().put("data",WxaCode);
|
|
|
+ String WxaCode = redisCache.getCacheObject("company-wxa-code:" + companyId + ":" + appId);
|
|
|
+ return R.ok().put("data", WxaCode);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 生成绑定连接或者绑定码
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
@Login
|
|
|
@ApiOperation("获取绑定链接或者绑定码(唯一绑定)")
|
|
|
@GetMapping("/getBindInfo")
|
|
|
- public R getBindInfo(){
|
|
|
+ public R getBindInfo() {
|
|
|
Long companyUserId = getCompanyUserId();
|
|
|
- if(companyUserId==null){
|
|
|
+ if (companyUserId == null) {
|
|
|
return R.error("该销售不存在");
|
|
|
}
|
|
|
return companyUserService.getBindInfo(companyUserId);
|
|
|
@@ -235,33 +244,34 @@ public class CompanyUserController extends AppBaseController {
|
|
|
|
|
|
/**
|
|
|
* 当只有模板文字text时,生成表中对应条的voice_url和user_voice_url
|
|
|
- * @param id qw_sop_temp_voice的id
|
|
|
+ *
|
|
|
+ * @param id qw_sop_temp_voice的id
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/companyUserVoice")
|
|
|
- public R companyUserVoice(@RequestParam("id") Long id){
|
|
|
+ public R companyUserVoice(@RequestParam("id") Long id) {
|
|
|
AudioVO audioVO = new AudioVO();
|
|
|
Long companyUserId = getCompanyUserId();
|
|
|
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());
|
|
|
@@ -274,27 +284,28 @@ public class CompanyUserController 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("id") Long id,@RequestParam("userVoiceUrl") String userVoiceUrl){
|
|
|
+ public R companyUserVoiceNew(@RequestParam("id") Long id, @RequestParam("userVoiceUrl") String userVoiceUrl) {
|
|
|
|
|
|
AudioVO audioVO = new AudioVO();
|
|
|
Long companyUserId = getCompanyUserId();
|
|
|
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());
|
|
|
@@ -306,12 +317,11 @@ public class CompanyUserController extends AppBaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@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());
|
|
|
@@ -323,7 +333,7 @@ public class CompanyUserController extends AppBaseController {
|
|
|
}
|
|
|
|
|
|
@GetMapping("/querySopVoiceList")
|
|
|
- public TableDataInfo querySopVoiceList(@RequestParam("recordType") Integer recordType){
|
|
|
+ public TableDataInfo querySopVoiceList(@RequestParam("recordType") Integer recordType) {
|
|
|
startPage();
|
|
|
QwSopTempVoice sopTempVoice = new QwSopTempVoice();
|
|
|
sopTempVoice.setRecordType(recordType);
|
|
|
@@ -334,47 +344,48 @@ public class CompanyUserController extends AppBaseController {
|
|
|
|
|
|
/**
|
|
|
* 一键转换
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/createUserAllVoice")
|
|
|
- public R createUserAllVoice(){
|
|
|
+ public R createUserAllVoice() {
|
|
|
QwSopTempVoice sopTempVoice = new QwSopTempVoice();
|
|
|
sopTempVoice.setRecordType(0);
|
|
|
Long companyUserId = getCompanyUserId();
|
|
|
|
|
|
|
|
|
- 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;
|
|
|
}
|
|
|
+
|
|
|
@Login
|
|
|
@GetMapping("/getPrescribeList")
|
|
|
- public R getPrescribeList(FsPrescribeListDCompanyParam param)
|
|
|
- {
|
|
|
+ public R getPrescribeList(FsPrescribeListDCompanyParam param) {
|
|
|
PageHelper.startPage(param.getPageNum(), param.getPageSize());
|
|
|
param.setCompanyUserId(getCompanyUserId());
|
|
|
param.setStatus(1);
|
|
|
- List<FsPrescribeListDVO> list=fsPrescribeService.selectFsPrescribeListDVOByCompanyUser(param);
|
|
|
- PageInfo<FsPrescribeListDVO> listPageInfo=new PageInfo<>(list);
|
|
|
- return R.ok().put("data",listPageInfo);
|
|
|
+ List<FsPrescribeListDVO> list = fsPrescribeService.selectFsPrescribeListDVOByCompanyUser(param);
|
|
|
+ PageInfo<FsPrescribeListDVO> listPageInfo = new PageInfo<>(list);
|
|
|
+ return R.ok().put("data", listPageInfo);
|
|
|
}
|
|
|
|
|
|
@Login
|
|
|
@@ -403,4 +414,18 @@ public class CompanyUserController extends AppBaseController {
|
|
|
return R.ok().put("data", companyUserService.getHelpPatientAndAddress(getCompanyUserId(), userId));
|
|
|
}
|
|
|
|
|
|
+ @Login
|
|
|
+ @PostMapping("/syncCompanyUser")
|
|
|
+ public R syncCompanyUser() {
|
|
|
+ Long companyUserId = getCompanyUserId();
|
|
|
+ long companyId = 0;
|
|
|
+ if (companyUserId != null) {
|
|
|
+ CompanyUser companyUser = companyUserMapper.selectCompanyUserByCompanyUserId(companyUserId);
|
|
|
+ if (companyUser != null) {
|
|
|
+ companyId = companyUser.getCompanyId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.ok(fsUserService.syncCompanyUser(companyUserId, companyId));
|
|
|
+ }
|
|
|
+
|
|
|
}
|