| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("上传文件图片报错:", e); |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | } |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("上传文件图片报错:", e); |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | import com.ruoyi.system.service.ISysVisitorConfigService; |
| | | import com.ruoyi.system.vo.SysVisitorConfigVO; |
| | | import okhttp3.FormBody; |
| | | import okhttp3.HttpUrl; |
| | | import okhttp3.MediaType; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 目的:统一解析中台基础地址,优先使用系统属性,其次环境变量,最后使用默认地址。 |
| | | * 目的:统一解析中台基础地址,优先使用数据库访客配置中的 centerPath, |
| | | * 其次使用系统属性和环境变量,最后使用默认地址。 |
| | | */ |
| | | public static String getDefaultBaseUrl() { |
| | | try { |
| | | ISysVisitorConfigService service = SpringUtils.getBean(ISysVisitorConfigService.class); |
| | | SysVisitorConfigVO config = service == null ? null : service.selectConfig(); |
| | | if (config != null && isNotBlank(config.getCenterPath())) { |
| | | return config.getCenterPath().trim(); |
| | | } |
| | | } catch (Exception ignored) { |
| | | // Spring 容器尚未初始化或配置查询失败时继续使用本地覆盖配置。 |
| | | } |
| | | String propertyUrl = System.getProperty(BASE_URL_PROPERTY); |
| | | if (isNotBlank(propertyUrl)) { |
| | | return propertyUrl.trim(); |
| New file |
| | |
| | | alter table t_visitor_config add column center_path varchar(255) default null comment '中台地址'; |
| | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.nio.file.Paths; |
| | | import java.nio.file.Files; |
| | | import java.util.Objects; |
| | | import org.apache.commons.io.FilenameUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | |
| | | public static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException |
| | | { |
| | | File desc = new File(uploadDir + File.separator + fileName); |
| | | |
| | | if (!desc.exists()) |
| | | if (StringUtils.isEmpty(uploadDir)) |
| | | { |
| | | if (!desc.getParentFile().exists()) |
| | | { |
| | | desc.getParentFile().mkdirs(); |
| | | throw new IOException("上传目录未配置"); |
| | | } |
| | | File desc = new File(uploadDir, fileName); |
| | | File parent = desc.getParentFile(); |
| | | if (parent == null) |
| | | { |
| | | throw new IOException("上传目录无效: " + uploadDir); |
| | | } |
| | | try |
| | | { |
| | | Files.createDirectories(parent.toPath()); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | throw new IOException("无法创建上传目录: " + parent.getAbsolutePath(), e); |
| | | } |
| | | if (!parent.isDirectory() || !parent.canWrite()) |
| | | { |
| | | throw new IOException("上传目录不可写: " + parent.getAbsolutePath()); |
| | | } |
| | | return desc; |
| | | } |
| | |
| | | |
| | | /** 删除标志:0正常 1删除 */ |
| | | private String delFlag; |
| | | |
| | | /** |
| | | * 中台地址 |
| | | */ |
| | | private String centerPath; |
| | | } |
| | |
| | | /** 是否显示访客机管理入口 */ |
| | | @ApiModelProperty("是否显示访客机管理入口") |
| | | private Boolean visitorMachineEntryEnabled; |
| | | |
| | | /** |
| | | * 中台地址 |
| | | */ |
| | | private String centerPath; |
| | | } |
| | |
| | | { |
| | | config.setVisitorMachineEntryEnabled(request.getVisitorMachineEntryEnabled()); |
| | | } |
| | | if (StringUtils.isNotEmpty(request.getCenterPath())) |
| | | { |
| | | config.setCenterPath(request.getCenterPath()); |
| | | } |
| | | } |
| | | |
| | | private String joinPrintFields(List<String> printFields) |
| | |
| | | vo.setServiceProvider(config.getServiceProvider()); |
| | | vo.setSupportPhone(config.getSupportPhone()); |
| | | vo.setVisitorMachineEntryEnabled(config.getVisitorMachineEntryEnabled()); |
| | | vo.setCenterPath(config.getCenterPath()); |
| | | return vo; |
| | | } |
| | | |
| | |
| | | |
| | | @ApiModelProperty(value = "访客机管理入口开关", example = "true", allowableValues = "true,false") |
| | | private Boolean visitorMachineEntryEnabled; |
| | | |
| | | @ApiModelProperty(value = "中台地址", example = "http://192.168.1.146:18888") |
| | | private String centerPath; |
| | | } |
| | |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="centerPath" column="center_path" /> |
| | | <result property="remark" column="remark" /> |
| | | </resultMap> |
| | | |
| | |
| | | create_time, |
| | | update_by, |
| | | update_time, |
| | | center_path, |
| | | remark |
| | | from t_visitor_config |
| | | </sql> |
| | |
| | | visitor_machine_entry_enabled, |
| | | create_by, |
| | | create_time, |
| | | center_path, |
| | | remark |
| | | ) values ( |
| | | #{onsiteRegistrationEnabled}, |
| | |
| | | #{visitorMachineEntryEnabled}, |
| | | #{createBy}, |
| | | sysdate(), |
| | | #{centerPath}, |
| | | #{remark} |
| | | ) |
| | | </insert> |
| | |
| | | document.getElementById("systemName").value = data.systemName || "自主访客登记管理平台"; |
| | | document.getElementById("serviceProvider").value = data.serviceProvider || "XXX"; |
| | | document.getElementById("supportPhone").value = data.supportPhone || "XXX"; |
| | | document.getElementById("centerPath").value = data.centerPath || ""; |
| | | |
| | | state.logoUrl = data.logoUrl || ""; |
| | | state.logoFile = null; |
| | |
| | | logoUrl: state.logoUrl, |
| | | serviceProvider: valueOf("serviceProvider"), |
| | | supportPhone: valueOf("supportPhone"), |
| | | visitorMachineEntryEnabled: checkedOf("visitorMachineEntryEnabled") |
| | | visitorMachineEntryEnabled: checkedOf("visitorMachineEntryEnabled"), |
| | | centerPath: valueOf("centerPath") |
| | | }; |
| | | } |
| | | |
| | |
| | | <input id="visitorMachineEntryEnabled" type="checkbox"> |
| | | <span class="switch-control"></span> |
| | | </label> |
| | | <label class="input-field entry-center-path"> |
| | | <span>中台地址</span> |
| | | <input id="centerPath" type="text" placeholder="请输入中台地址(可为空)"> |
| | | </label> |
| | | </div> |
| | | </div> |
| | | </section> |