| | |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.trace.vo.MesTraceQrConfigRespVO; |
| | | import cn.iocoder.yudao.module.mes.framework.config.MesProperties; |
| | | import cn.iocoder.yudao.module.mes.framework.config.MesTraceConfigResolver; |
| | | import cn.iocoder.yudao.module.mes.framework.config.MesTraceConfigSnapshot; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | |
| | | * 管理后台 - MES 溯源配置 |
| | | * <p> |
| | | * 向管理端前端暴露溯源 H5 页面基础地址,用于"查看二维码"预览/下载与打印标签保持一致的二维码内容。 |
| | | * 值取自 {@link MesTraceConfigResolver} 的**生效快照**而非配置文件——追溯网址可在字典 |
| | | * {@code mes_trace_config} 中修改,若此处直读配置文件,管理端预览的二维码就会与实际打印的标签不一致。 |
| | | */ |
| | | @Tag(name = "管理后台 - MES 溯源配置") |
| | | @RestController |
| | |
| | | public class MesTraceConfigController { |
| | | |
| | | @Resource |
| | | private MesProperties mesProperties; |
| | | private MesTraceConfigResolver mesTraceConfigResolver; |
| | | |
| | | @GetMapping("/qr-config") |
| | | @Operation(summary = "获得溯源 H5 页面基础地址(二维码内容前缀)") |
| | | public CommonResult<MesTraceQrConfigRespVO> getQrConfig() { |
| | | MesTraceConfigSnapshot snapshot = mesTraceConfigResolver.resolveSnapshot(); |
| | | MesTraceQrConfigRespVO respVO = new MesTraceQrConfigRespVO(); |
| | | respVO.setTraceBaseUrl(mesProperties.getTraceBaseUrl()); |
| | | respVO.setTraceBaseUrl(snapshot.traceUrl()); |
| | | respVO.setTraceUrlSource(snapshot.traceUrlSource().name()); |
| | | return success(respVO); |
| | | } |
| | | |