From 0042972aa56382cc334a0ad7b3f03f46e6b48eee Mon Sep 17 00:00:00 2001 From: "youhong.ai" Date: Sat, 1 Jul 2023 13:33:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../getlog/controller/GetLogController.java | 64 +++++++++++++++++++ .../common/getlog/service/GetLogService.java | 30 +++++++++ 常用信息.md | 19 ++++++ 3 files changed, 113 insertions(+) create mode 100644 src/main/java/com/api/ebu7dev1/common/getlog/controller/GetLogController.java create mode 100644 src/main/java/com/api/ebu7dev1/common/getlog/service/GetLogService.java diff --git a/src/main/java/com/api/ebu7dev1/common/getlog/controller/GetLogController.java b/src/main/java/com/api/ebu7dev1/common/getlog/controller/GetLogController.java new file mode 100644 index 0000000..63c6b37 --- /dev/null +++ b/src/main/java/com/api/ebu7dev1/common/getlog/controller/GetLogController.java @@ -0,0 +1,64 @@ +package com.api.ebu7dev1.common.getlog.controller; + +import aiyh.utils.ApiResult; +import aiyh.utils.Util; +import com.api.ebu7dev1.common.getlog.service.GetLogService; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import org.apache.log4j.Logger; +import weaver.hrm.HrmUserVarify; +import weaver.hrm.User; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import java.util.Map; + +/** + *

获取自定义日志

+ * + *

create: 2023/7/1 10:27

+ * + * @author youHong.ai + */ +@Path("/ebu7-dev1/common/log") +public class GetLogController { + + private final Logger log = Util.getLogger(); + + private final GetLogService service = new GetLogService(); + + @GET + @Path("get") + @Produces(MediaType.APPLICATION_OCTET_STREAM) + public Response getLogger(@Context HttpServletRequest request, @Context HttpServletResponse response) { + try { + User loginUser = HrmUserVarify.getUser(request, response); + return service.get(loginUser); + } catch (Exception e) { + log.error("下载文件出错:" + Util.getErrString(e)); + return Response.ok(ApiResult.error("system error!"), MediaType.APPLICATION_JSON).build(); + } + } + + + @POST + @Path("collect") + @Produces(MediaType.APPLICATION_JSON) + public String collectLogInfo(@Context HttpServletRequest request, + @Context HttpServletResponse response, + @RequestBody Map params) { + try { + User loginUser = HrmUserVarify.getUser(request, response); + return service.collectLogInfo(loginUser, params); + } catch (Exception e) { + log.error("下载文件出错:" + Util.getErrString(e)); + return ApiResult.error("system error!"); + } + } +} diff --git a/src/main/java/com/api/ebu7dev1/common/getlog/service/GetLogService.java b/src/main/java/com/api/ebu7dev1/common/getlog/service/GetLogService.java new file mode 100644 index 0000000..58b0094 --- /dev/null +++ b/src/main/java/com/api/ebu7dev1/common/getlog/service/GetLogService.java @@ -0,0 +1,30 @@ +package com.api.ebu7dev1.common.getlog.service; + +import aiyh.utils.Util; +import aiyh.utils.excention.CustomerException; +import weaver.hrm.User; + +import javax.ws.rs.core.Response; +import java.util.Map; + +/** + *

获取日志

+ * + *

create: 2023/7/1 10:28

+ * + * @author youHong.ai + */ +public class GetLogService { + public Response get(User loginUser) { + return null; + } + + public String collectLogInfo(User loginUser, Map params) { + if (loginUser.getUID() != 1) { + throw new CustomerException("无权限查看!"); + } + String startDate = Util.null2String(params.get("startDate")); + String endDate = Util.null2String(params.get("endDate")); + return null; + } +} diff --git a/常用信息.md b/常用信息.md index 0dad4cb..f112a90 100644 --- a/常用信息.md +++ b/常用信息.md @@ -291,6 +291,25 @@ function loadJs(url, callback) { } ``` +ecode 多语言切换 + +```javascript +ecCom.WeaLocaleProvider.getLocaleLabelByCode(module).then(() => {//多语言获取成功,此处重绘页面 +}) + +WeaverMobile.Tools.getLocaleLabel(module, () => { + console.log("请求成功") +}) +// 移动端引入组件库多语言信息,放在componentDidMount执行 +WeaverMobile.Tools.getLocaleLabel("common", () => { + this.forceUpdate(); +}) + +// 使用多语言 +WeaverMobile.Tools.getLabel(i18nId, text) + +``` + ### 数据库 **备份mysql数据库**