From 4f775856e517a51b825d2b548a6840163de45bb2 Mon Sep 17 00:00:00 2001 From: xinfengYin <1776570748@qq.com> Date: Tue, 18 Feb 2025 11:04:25 +0800 Subject: [PATCH] =?UTF-8?q?#xinfengYin-01#=20=E8=8E=B7=E5=8F=96=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E7=99=BB=E5=BD=95=E8=80=85IP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../action/HTGD_MES_TDLApproveActivon.java | 2 - .../HTGD_IT13_GETIP_CONTROLLER.java | 53 +++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 secondev-history-action/src/main/java/com/weaver/seconddev/interfaces/workflow/controller/HTGD_IT13_GETIP_CONTROLLER.java diff --git a/secondev-history-action/src/main/java/com/weaver/seconddev/interfaces/workflow/action/HTGD_MES_TDLApproveActivon.java b/secondev-history-action/src/main/java/com/weaver/seconddev/interfaces/workflow/action/HTGD_MES_TDLApproveActivon.java index e3c3768..6f71427 100644 --- a/secondev-history-action/src/main/java/com/weaver/seconddev/interfaces/workflow/action/HTGD_MES_TDLApproveActivon.java +++ b/secondev-history-action/src/main/java/com/weaver/seconddev/interfaces/workflow/action/HTGD_MES_TDLApproveActivon.java @@ -1,7 +1,5 @@ package com.weaver.seconddev.interfaces.workflow.action; -import com.alibaba.fastjson.JSONObject; -import com.netflix.discovery.converters.Auto; import com.weaver.seconddev.interfaces.oames.ReturnMesWLPS_SYService; import com.weaver.seconddev.interfaces.oames.SI_OA_HTOAApproFlowSync_OUTServiceStub; import com.weaver.seconddev.interfaces.swfa.BillFieldUtil; diff --git a/secondev-history-action/src/main/java/com/weaver/seconddev/interfaces/workflow/controller/HTGD_IT13_GETIP_CONTROLLER.java b/secondev-history-action/src/main/java/com/weaver/seconddev/interfaces/workflow/controller/HTGD_IT13_GETIP_CONTROLLER.java new file mode 100644 index 0000000..4b4f1b3 --- /dev/null +++ b/secondev-history-action/src/main/java/com/weaver/seconddev/interfaces/workflow/controller/HTGD_IT13_GETIP_CONTROLLER.java @@ -0,0 +1,53 @@ +package com.weaver.seconddev.interfaces.workflow.controller; + + +import com.alibaba.fastjson.JSONObject; +import com.weaver.common.base.entity.result.WeaResult; +import com.weaver.verupgrade.general.Util; +import com.weaver.verupgrade.hrm.User; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.HashMap; +import java.util.Map; + +/** + * @Author: XinfengYin + * @CreateTime: 2025-02-17 + * @Description: IP地址赋值 + */ + + + +@Slf4j +@RestController +@RequestMapping({"/papi/secondev/workflow/controller" }) +public class HTGD_IT13_GETIP_CONTROLLER { + @GetMapping("/getip") + public WeaResult run(@RequestParam Map params) { + log.error("HTGD_IT13_GETIP_CONTROLLER ===> Start"); + String userid = null2String(params.get("userId")); + log.error("HTGD_IT13_GETIP_CONTROLLER ===> params",userid); + User user = new User(Util.getLongValue(userid)); + String IP = user.getLoginip(); + Map data = new HashMap<>(); + data.put("ip",IP); + return WeaResult.success(JSONObject.toJSONString(data)); + } + + + public static String null2String(String s){ + return s == null ? "" : s; + } + + public static String null2String(Object o){ + return o == null ? "" : o.toString(); + } + + public static String null2String(String s1,String s2){ + return s1 == null ? (s2 == null ? "" : s2) : s1; + } +}