|
@@ -26,7 +26,8 @@ import com.fs.common.exception.ServiceException;
|
|
|
import com.fs.common.exception.file.OssException;
|
|
import com.fs.common.exception.file.OssException;
|
|
|
import com.fs.common.utils.SecurityUtils;
|
|
import com.fs.common.utils.SecurityUtils;
|
|
|
import com.fs.common.utils.poi.ExcelUtil;
|
|
import com.fs.common.utils.poi.ExcelUtil;
|
|
|
-import com.fs.common.utils.sign.Md5Utils;
|
|
|
|
|
|
|
+import com.fs.common.utils.security.SafeRemoteUrlUtils;
|
|
|
|
|
+import com.fs.common.utils.uuid.IdUtils;
|
|
|
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;
|
|
@@ -139,8 +140,11 @@ public class CompanyUserController extends AppBaseController {
|
|
|
if (!SecurityUtils.matchesPassword(param.getPassword(), companyUser.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(), 100, TimeUnit.DAYS);
|
|
|
|
|
- return R.ok().put("companyUserToken", Md5Utils.hash(companyUser.getUserId().toString())).put("user", companyUser);
|
|
|
|
|
|
|
+ // 随机 Token,仅写入不可推导键;不再双写 MD5(userId),避免会话被枚举劫持
|
|
|
|
|
+ String companyUserToken = IdUtils.fastSimpleUUID();
|
|
|
|
|
+ Long uid = companyUser.getUserId();
|
|
|
|
|
+ redisCache.setCacheObject("company-user-token:" + companyUserToken, uid, 100, TimeUnit.DAYS);
|
|
|
|
|
+ return R.ok().put("companyUserToken", companyUserToken).put("user", companyUser);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
return R.error("操作异常");
|
|
return R.error("操作异常");
|
|
@@ -198,6 +202,7 @@ public class CompanyUserController extends AppBaseController {
|
|
|
companyUser.setVoicePrintUrl(param.getVoicePrintUrl());
|
|
companyUser.setVoicePrintUrl(param.getVoicePrintUrl());
|
|
|
|
|
|
|
|
//转换音频格式 mp3-wav
|
|
//转换音频格式 mp3-wav
|
|
|
|
|
+ SafeRemoteUrlUtils.validateHttpUrl(param.getVoicePrintUrl());
|
|
|
String s = AudioUtils.audioWAVFromUrl(param.getVoicePrintUrl());
|
|
String s = AudioUtils.audioWAVFromUrl(param.getVoicePrintUrl());
|
|
|
//保存文件并且上传存储桶
|
|
//保存文件并且上传存储桶
|
|
|
System.out.println(s);
|
|
System.out.println(s);
|
|
@@ -254,6 +259,11 @@ public class CompanyUserController extends AppBaseController {
|
|
|
@Log(title = "小程序销售绑定医生", businessType = BusinessType.UPDATE)
|
|
@Log(title = "小程序销售绑定医生", businessType = BusinessType.UPDATE)
|
|
|
@PostMapping("/bindDoctorId")
|
|
@PostMapping("/bindDoctorId")
|
|
|
public R binDoctor(@RequestBody CompanyUser companyUser) {
|
|
public R binDoctor(@RequestBody CompanyUser companyUser) {
|
|
|
|
|
+ // 已登录销售优先绑定自身,避免误绑;未带销售 Token 时保持原 body.userId 兼容旧调用
|
|
|
|
|
+ Long loginCompanyUserId = getCompanyUserIdOrNull();
|
|
|
|
|
+ if (loginCompanyUserId != null) {
|
|
|
|
|
+ companyUser.setUserId(loginCompanyUserId);
|
|
|
|
|
+ }
|
|
|
return companyUserService.bindDoctor(companyUser);
|
|
return companyUserService.bindDoctor(companyUser);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -261,6 +271,10 @@ public class CompanyUserController extends AppBaseController {
|
|
|
@Log(title = "小程序销售解除绑定医生", businessType = BusinessType.UPDATE)
|
|
@Log(title = "小程序销售解除绑定医生", businessType = BusinessType.UPDATE)
|
|
|
@GetMapping("/unBindDoctorId/{userId}")
|
|
@GetMapping("/unBindDoctorId/{userId}")
|
|
|
public R unBinDoctor(@PathVariable("userId") Long userId) {
|
|
public R unBinDoctor(@PathVariable("userId") Long userId) {
|
|
|
|
|
+ Long loginCompanyUserId = getCompanyUserIdOrNull();
|
|
|
|
|
+ if (loginCompanyUserId != null) {
|
|
|
|
|
+ return companyUserService.unBindDoctor(loginCompanyUserId);
|
|
|
|
|
+ }
|
|
|
return companyUserService.unBindDoctor(userId);
|
|
return companyUserService.unBindDoctor(userId);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -482,8 +496,10 @@ public class CompanyUserController extends AppBaseController {
|
|
|
/**
|
|
/**
|
|
|
* 获取用户信息采集详细信息
|
|
* 获取用户信息采集详细信息
|
|
|
*/
|
|
*/
|
|
|
|
|
+ @Login
|
|
|
@GetMapping(value = "/informationCollection/{id}")
|
|
@GetMapping(value = "/informationCollection/{id}")
|
|
|
public R getInformationCollectionInfo(@PathVariable("id") Long id) {
|
|
public R getInformationCollectionInfo(@PathVariable("id") Long id) {
|
|
|
|
|
+ getCompanyUserId();
|
|
|
return R.ok().put("data", fsUserInformationCollectionService.selectFsUserInformationCollectionVoById(id));
|
|
return R.ok().put("data", fsUserInformationCollectionService.selectFsUserInformationCollectionVoById(id));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -528,12 +544,20 @@ public class CompanyUserController extends AppBaseController {
|
|
|
* 删除用户信息采集
|
|
* 删除用户信息采集
|
|
|
*/
|
|
*/
|
|
|
@DeleteMapping("/informationCollection/{ids}")
|
|
@DeleteMapping("/informationCollection/{ids}")
|
|
|
|
|
+ @Login
|
|
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
|
|
|
|
+ Long companyUserId = getCompanyUserId();
|
|
|
|
|
+ if (companyUserId == null) {
|
|
|
|
|
+ return AjaxResult.error("用户失效");
|
|
|
|
|
+ }
|
|
|
return toAjax(fsUserInformationCollectionService.deleteFsUserInformationCollectionByIds(ids));
|
|
return toAjax(fsUserInformationCollectionService.deleteFsUserInformationCollectionByIds(ids));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/informationCollection/getInfo")
|
|
@GetMapping("/informationCollection/getInfo")
|
|
|
|
|
+ @Login
|
|
|
public AjaxResult getInformationCollection(FsUserInformationCollection fsUserInformationCollection) {
|
|
public AjaxResult getInformationCollection(FsUserInformationCollection fsUserInformationCollection) {
|
|
|
|
|
+ Long companyUserId = getCompanyUserId();
|
|
|
|
|
+ fsUserInformationCollection.setCompanyUserId(companyUserId);
|
|
|
return AjaxResult.success(fsUserInformationCollectionService.getInfo(fsUserInformationCollection));
|
|
return AjaxResult.success(fsUserInformationCollectionService.getInfo(fsUserInformationCollection));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -548,7 +572,13 @@ public class CompanyUserController extends AppBaseController {
|
|
|
public AjaxResult uploadVoice(
|
|
public AjaxResult uploadVoice(
|
|
|
Long userId,
|
|
Long userId,
|
|
|
String voicePrintUrl) throws Exception {
|
|
String voicePrintUrl) throws Exception {
|
|
|
- if (userId == null) userId = 123L;
|
|
|
|
|
|
|
+ if (userId == null) {
|
|
|
|
|
+ userId = getCompanyUserIdOrNull();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (userId == null) {
|
|
|
|
|
+ return AjaxResult.error("用户失效");
|
|
|
|
|
+ }
|
|
|
|
|
+ SafeRemoteUrlUtils.validateHttpUrl(voicePrintUrl);
|
|
|
VcCompanyUser vcCompanyUser = companyUserMapper.selectVcCompanyUserByCompanyUserId(userId);
|
|
VcCompanyUser vcCompanyUser = companyUserMapper.selectVcCompanyUserByCompanyUserId(userId);
|
|
|
if (vcCompanyUser == null) {
|
|
if (vcCompanyUser == null) {
|
|
|
return AjaxResult.error("用户没有声纹槽位,请联系管理员");
|
|
return AjaxResult.error("用户没有声纹槽位,请联系管理员");
|
|
@@ -720,6 +750,7 @@ public class CompanyUserController extends AppBaseController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private File downloadFileFromUrl(String fileUrl) throws IOException {
|
|
private File downloadFileFromUrl(String fileUrl) throws IOException {
|
|
|
|
|
+ SafeRemoteUrlUtils.validateHttpUrl(fileUrl);
|
|
|
InputStream inputStream = null;
|
|
InputStream inputStream = null;
|
|
|
FileOutputStream outputStream = null;
|
|
FileOutputStream outputStream = null;
|
|
|
try {
|
|
try {
|