|
|
@@ -283,37 +283,38 @@ public class CompanyConfigServiceImpl implements ICompanyConfigService
|
|
|
if (companyId == null) {
|
|
|
return R.error("公司ID不能为空");
|
|
|
}
|
|
|
- CompanyConfig config = companyConfigMapper.selectCompanyConfigByKey(companyId, CONFIG_KEY_MINI_APP);
|
|
|
- if (config == null) {
|
|
|
- return R.error("未找到本公司的小程序配置,请先维护小程序配置");
|
|
|
- }
|
|
|
- if (!companyId.equals(config.getCompanyId())) {
|
|
|
- return R.error("无权修改其他公司配置");
|
|
|
- }
|
|
|
- String configValue = config.getConfigValue();
|
|
|
- JSONObject json = StringUtils.isNotEmpty(configValue) ? JSON.parseObject(configValue) : new JSONObject();
|
|
|
- // 填充 companyId,避免前端看到为 null
|
|
|
- json.put("companyId", companyId);
|
|
|
- if (param.getMiniAppMaster() != null) {
|
|
|
- json.put("miniAppMaster", param.getMiniAppMaster());
|
|
|
+ List<CompanyMiniAppVO> playSourceMiniApps = companyConfigMapper.getCompanyMiniAppListByCompany(companyId);
|
|
|
+ if (playSourceMiniApps == null || playSourceMiniApps.isEmpty()) {
|
|
|
+ return R.error("未找到本公司的小程序配置,请先在点播播放源配置中维护本公司小程序");
|
|
|
}
|
|
|
- if (param.getMiniAppServer() != null) {
|
|
|
- json.put("miniAppServer", param.getMiniAppServer());
|
|
|
+ CompanyConfig config = companyConfigMapper.selectCompanyConfigByKey(companyId, CONFIG_KEY_MINI_APP);
|
|
|
+ if (config != null) {
|
|
|
+ if (!companyId.equals(config.getCompanyId())) {
|
|
|
+ return R.error("无权修改其他公司配置");
|
|
|
+ }
|
|
|
+ String configValue = config.getConfigValue();
|
|
|
+ JSONObject json = StringUtils.isNotEmpty(configValue) ? JSON.parseObject(configValue) : new JSONObject();
|
|
|
+ json.put("companyId", companyId);
|
|
|
+ if (param.getMiniAppMaster() != null) {
|
|
|
+ json.put("miniAppMaster", param.getMiniAppMaster());
|
|
|
+ }
|
|
|
+ if (param.getMiniAppServer() != null) {
|
|
|
+ json.put("miniAppServer", param.getMiniAppServer());
|
|
|
+ }
|
|
|
+ config.setConfigValue(json.toJSONString());
|
|
|
+ companyConfigMapper.updateCompanyConfig(config);
|
|
|
}
|
|
|
- config.setConfigValue(json.toJSONString());
|
|
|
- companyConfigMapper.updateCompanyConfig(config);
|
|
|
|
|
|
- // 同步更新 company_miniapp 表,沿用 saveCompanyMiniApp 的逻辑
|
|
|
SaveCompanyMiniAppParam saveParam = new SaveCompanyMiniAppParam();
|
|
|
saveParam.setCompanyId(companyId);
|
|
|
- // 目前前端是单选下拉,取数组第一个元素作为主/备小程序
|
|
|
+
|
|
|
if (param.getMiniAppMaster() != null && !param.getMiniAppMaster().isEmpty()) {
|
|
|
saveParam.setMainMiniAppId(param.getMiniAppMaster().get(0));
|
|
|
}
|
|
|
if (param.getMiniAppServer() != null && !param.getMiniAppServer().isEmpty()) {
|
|
|
saveParam.setBackupMiniAppId(param.getMiniAppServer().get(0));
|
|
|
}
|
|
|
- // 这里不强制 updateBy,由调用方在需要时补充;目前公司端只按公司维度更新
|
|
|
+
|
|
|
saveCompanyMiniApp(saveParam);
|
|
|
|
|
|
return R.ok("操作成功");
|