|
|
@@ -34,6 +34,8 @@ public class AdminCompanyBridgeController extends BaseController {
|
|
|
@Autowired(required = false)
|
|
|
private ICompanyVoiceApiService companyVoiceApiService;
|
|
|
@Autowired(required = false)
|
|
|
+ private ICompanyVoiceApiTenantService companyVoiceApiTenantService;
|
|
|
+ @Autowired(required = false)
|
|
|
private ICompanyVoicePackageOrderService companyVoicePackageOrderService;
|
|
|
@Autowired(required = false)
|
|
|
private ICompanySmsService companySmsService;
|
|
|
@@ -102,6 +104,74 @@ public class AdminCompanyBridgeController extends BaseController {
|
|
|
return AjaxResult.success(result);
|
|
|
}
|
|
|
|
|
|
+ // ========== [Admin] 通话接口-租户分配 & 定价管理 ==========
|
|
|
+
|
|
|
+ /** 查询接口已分配的租户列表(含定价信息) */
|
|
|
+ @GetMapping("/admin/voice-api/tenants/{apiId}")
|
|
|
+ public AjaxResult voiceApiTenants(@PathVariable Long apiId) {
|
|
|
+ List<CompanyVoiceApiTenant> list = companyVoiceApiTenantService != null ?
|
|
|
+ companyVoiceApiTenantService.selectTenantsByApiId(apiId) : new ArrayList<>();
|
|
|
+ return AjaxResult.success(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 查询租户已分配的接口列表(含定价信息) */
|
|
|
+ @GetMapping("/admin/voice-api/apis/{companyId}")
|
|
|
+ public AjaxResult voiceApiApis(@PathVariable Long companyId) {
|
|
|
+ List<CompanyVoiceApiTenant> list = companyVoiceApiTenantService != null ?
|
|
|
+ companyVoiceApiTenantService.selectEnabledApisByCompanyId(companyId) : new ArrayList<>();
|
|
|
+ return AjaxResult.success(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 分配接口给租户(批量) */
|
|
|
+ @PreAuthorize("@ss.hasPermi('company:companyVoiceApi:edit')")
|
|
|
+ @Log(title = "分配通话接口给租户", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping("/admin/voice-api/assignTenants")
|
|
|
+ public AjaxResult assignTenants(@RequestBody Map<String, Object> body) {
|
|
|
+ if (companyVoiceApiTenantService == null) return AjaxResult.error("服务未就绪");
|
|
|
+ Long apiId = Long.valueOf(body.get("apiId").toString());
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ List<Integer> companyIds = (List<Integer>) body.get("companyIds");
|
|
|
+ List<Long> ids = new ArrayList<>();
|
|
|
+ for (Integer id : companyIds) { ids.add(id.longValue()); }
|
|
|
+ companyVoiceApiTenantService.batchAssignTenants(apiId, ids);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 取消分配 */
|
|
|
+ @PreAuthorize("@ss.hasPermi('company:companyVoiceApi:edit')")
|
|
|
+ @Log(title = "取消通话接口分配", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/admin/voice-api/unassignTenant")
|
|
|
+ public AjaxResult unassignTenant(@RequestParam Long apiId, @RequestParam Long companyId) {
|
|
|
+ if (companyVoiceApiTenantService == null) return AjaxResult.error("服务未就绪");
|
|
|
+ return toAjax(companyVoiceApiTenantService.unassignTenant(apiId, companyId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 查询接口已分配租户数量 */
|
|
|
+ @GetMapping("/admin/voice-api/tenantCount/{apiId}")
|
|
|
+ public AjaxResult voiceApiTenantCount(@PathVariable Long apiId) {
|
|
|
+ Integer count = companyVoiceApiTenantService != null ?
|
|
|
+ companyVoiceApiTenantService.selectTenantCountByApiId(apiId) : 0;
|
|
|
+ return AjaxResult.success("ok", count);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 分页查询租户-接口定价列表 */
|
|
|
+ @GetMapping("/admin/voice-api/tenant/list")
|
|
|
+ public TableDataInfo voiceApiTenantList(CompanyVoiceApiTenant param) {
|
|
|
+ startPage();
|
|
|
+ List<CompanyVoiceApiTenant> list = companyVoiceApiTenantService != null ?
|
|
|
+ companyVoiceApiTenantService.selectCompanyVoiceApiTenantList(param) : new ArrayList<>();
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 更新租户定价 */
|
|
|
+ @PreAuthorize("@ss.hasPermi('company:companyVoiceApi:edit')")
|
|
|
+ @Log(title = "更新外呼租户定价", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping("/admin/voice-api/tenant/update")
|
|
|
+ public AjaxResult updateTenantPricing(@RequestBody CompanyVoiceApiTenant data) {
|
|
|
+ if (companyVoiceApiTenantService == null) return AjaxResult.error("服务未就绪");
|
|
|
+ return toAjax(companyVoiceApiTenantService.updateCompanyVoiceApiTenant(data));
|
|
|
+ }
|
|
|
+
|
|
|
// ========== 坐席管理 /company/companyVoiceCaller ==========
|
|
|
@PreAuthorize("@ss.hasPermi('company:companyVoiceCaller:list')")
|
|
|
@GetMapping("/company/companyVoiceCaller/list")
|