459242451@qq.com 3 years ago
parent
commit
f9b8467a4b

+ 26 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/gas/GasCommonController.java

@@ -4,6 +4,7 @@ import cn.hutool.core.convert.Convert;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONObject;
 import com.ruoyi.common.constant.ElasticConstants;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.framework.config.ElasticSearchClient;
@@ -16,11 +17,13 @@ import com.ruoyi.system.service.IAisDatabase;
 import com.ruoyi.system.service.IAisShipService;
 import com.ruoyi.system.service.IHeiYanService;
 import com.ruoyi.system.service.ISo2Service;
+import com.ruoyi.web.controller.tool.SMSUtil;
 import com.ruoyi.web.service.IGasCommonService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -275,7 +278,7 @@ public class GasCommonController {
 
     @GetMapping("/queryData")
     @ApiOperation("查询ES数据")
-    public Object queryData(@RequestParam(required = false) String id, @RequestParam(required = false) Integer size, @RequestParam String... index) {
+    public Object queryData(@RequestParam(required = false) String id, @RequestParam(required = false) Integer size, @RequestParam(required = false) String orderKey, @RequestParam String... index) {
         if (size == null) {
             size = 200;
         }
@@ -284,7 +287,9 @@ public class GasCommonController {
             equalsCondition.put("id", id);
         }
         List<String> orderBy = new ArrayList<>();
-        orderBy.add("-createTime");
+        if (StrUtil.isNotBlank(orderKey)) {
+            orderBy.add("-" + orderKey);
+        }
         Map<String, Object> map = client.searchDocument(equalsCondition,
                 null,
                 orderBy,
@@ -294,4 +299,23 @@ public class GasCommonController {
         return map.get("pageList");
     }
 
+    @DeleteMapping("/deleteIndexOneData")
+    @ApiOperation("删除ES中某个数据")
+    public void deleteIndexData(@RequestParam String index, @RequestParam String id) {
+        client.deleteDocument(index, id);
+    }
+
+    @PostMapping("/sendSms")
+    @ApiOperation("发送短信")
+    public AjaxResult sendSms(@RequestBody JSONObject jsonObject) {
+        String content = jsonObject.getString("content");
+        String phone = jsonObject.getString("phone");
+        if (StrUtil.hasBlank(content, phone)) {
+            return AjaxResult.error("存在参数为空");
+        }
+        SMSUtil smsUtil = new SMSUtil();
+        smsUtil.sendMessage(content, phone);
+        return AjaxResult.success();
+    }
+
 }

+ 86 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/MessageService.java

@@ -0,0 +1,86 @@
+package com.ruoyi.web.controller.tool;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.WebServiceFeature;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.2.9-b130926.1035
+ * Generated source version: 2.2
+ */
+@WebServiceClient(name = "MessageService", targetNamespace = "http://tempuri.org/", wsdlLocation = "http://198.17.1.157:9013/sms/messageservice.asmx?wsdl")
+public class MessageService
+        extends Service {
+
+    private final static URL MESSAGESERVICE_WSDL_LOCATION;
+    private final static WebServiceException MESSAGESERVICE_EXCEPTION;
+    private final static QName MESSAGESERVICE_QNAME = new QName("http://tempuri.org/", "MessageService");
+
+    static {
+        URL url = null;
+        WebServiceException e = null;
+        try {
+            url = new URL("http://198.17.1.157:9013/sms/messageservice.asmx?wsdl");
+        } catch (MalformedURLException ex) {
+            e = new WebServiceException(ex);
+        }
+        MESSAGESERVICE_WSDL_LOCATION = url;
+        MESSAGESERVICE_EXCEPTION = e;
+    }
+
+    public MessageService() {
+        super(__getWsdlLocation(), MESSAGESERVICE_QNAME);
+    }
+
+    public MessageService(WebServiceFeature... features) {
+        super(__getWsdlLocation(), MESSAGESERVICE_QNAME, features);
+    }
+
+    public MessageService(URL wsdlLocation) {
+        super(wsdlLocation, MESSAGESERVICE_QNAME);
+    }
+
+    public MessageService(URL wsdlLocation, WebServiceFeature... features) {
+        super(wsdlLocation, MESSAGESERVICE_QNAME, features);
+    }
+
+    public MessageService(URL wsdlLocation, QName serviceName) {
+        super(wsdlLocation, serviceName);
+    }
+
+    public MessageService(URL wsdlLocation, QName serviceName, WebServiceFeature... features) {
+        super(wsdlLocation, serviceName, features);
+    }
+
+    /**
+     * @return returns MessageServiceSoap
+     */
+    @WebEndpoint(name = "MessageServiceSoap")
+    public com.ruoyi.web.controller.tool.MessageServiceSoap getMessageServiceSoap() {
+        return super.getPort(new QName("http://tempuri.org/", "MessageServiceSoap"), com.ruoyi.web.controller.tool.MessageServiceSoap.class);
+    }
+
+    /**
+     * @param features A list of {@link WebServiceFeature} to configure on the proxy.  Supported features not in the <code>features</code> parameter will have their default values.
+     * @return returns MessageServiceSoap
+     */
+    @WebEndpoint(name = "MessageServiceSoap")
+    public com.ruoyi.web.controller.tool.MessageServiceSoap getMessageServiceSoap(WebServiceFeature... features) {
+        return super.getPort(new QName("http://tempuri.org/", "MessageServiceSoap"), com.ruoyi.web.controller.tool.MessageServiceSoap.class, features);
+    }
+
+    private static URL __getWsdlLocation() {
+        if (MESSAGESERVICE_EXCEPTION != null) {
+            throw MESSAGESERVICE_EXCEPTION;
+        }
+        return MESSAGESERVICE_WSDL_LOCATION;
+    }
+
+}

+ 39 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/MessageServiceSoap.java

@@ -0,0 +1,39 @@
+package com.ruoyi.web.controller.tool;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.2.9-b130926.1035
+ * Generated source version: 2.2
+ */
+@WebService(name = "MessageServiceSoap", targetNamespace = "http://tempuri.org/")
+@XmlSeeAlso({
+        ObjectFactory.class
+})
+public interface MessageServiceSoap {
+
+
+    /**
+     * @param mobiles
+     * @param content
+     * @return returns int
+     */
+    @WebMethod(operationName = "SendMessage", action = "http://tempuri.org/SendMessage")
+    @WebResult(name = "SendMessageResult", targetNamespace = "http://tempuri.org/")
+    @RequestWrapper(localName = "SendMessage", targetNamespace = "http://tempuri.org/", className = "com.hqiqi.jmles.webservice.sms.SendMessage")
+    @ResponseWrapper(localName = "SendMessageResponse", targetNamespace = "http://tempuri.org/", className = "com.hqiqi.jmles.webservice.sms.SendMessageResponse")
+    public int sendMessage(
+            @WebParam(name = "mobiles", targetNamespace = "http://tempuri.org/")
+                    String mobiles,
+            @WebParam(name = "content", targetNamespace = "http://tempuri.org/")
+                    String content);
+
+}

+ 43 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/ObjectFactory.java

@@ -0,0 +1,43 @@
+package com.ruoyi.web.controller.tool;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the com.heeexy.example.webservice.sms package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups.  Factory methods for each of these are
+ * provided in this class.
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+
+    /**
+     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.hqiqi.jmles.webservice.sms
+     */
+    public ObjectFactory() {
+    }
+
+    /**
+     * Create an instance of {@link SendMessageResponse }
+     */
+    public SendMessageResponse createSendMessageResponse() {
+        return new SendMessageResponse();
+    }
+
+    /**
+     * Create an instance of {@link SendMessage }
+     */
+    public SendMessage createSendMessage() {
+        return new SendMessage();
+    }
+
+}

+ 25 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SMSUtil.java

@@ -0,0 +1,25 @@
+package com.ruoyi.web.controller.tool;
+
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+@Component
+@Data
+@Slf4j
+public class SMSUtil {
+
+    /**
+     * 最新发送短信工具
+     *
+     * @param content
+     * @param phone
+     */
+    public void sendMessage(String content, String phone) {
+        MessageService messageService = new MessageService();
+        MessageServiceSoap messageServiceSoap = messageService.getMessageServiceSoap();
+        int result = messageServiceSoap.sendMessage(phone, content);
+        log.info("手机号:{},内容:{},短信返回码:{}", phone, content, result);
+    }
+
+}

+ 78 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SendMessage.java

@@ -0,0 +1,78 @@
+package com.ruoyi.web.controller.tool;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>anonymous complex type�� Java �ࡣ
+ *
+ * <p>����ģʽƬ��ָ�������ڴ����е�Ԥ�����ݡ�
+ *
+ * <pre>
+ * &lt;complexType>
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="mobiles" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         &lt;element name="content" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+        "mobiles",
+        "content"
+})
+@XmlRootElement(name = "SendMessage")
+public class SendMessage {
+
+    protected String mobiles;
+    protected String content;
+
+    /**
+     * ��ȡmobiles���Ե�ֵ��
+     *
+     * @return possible object is
+     * {@link String }
+     */
+    public String getMobiles() {
+        return mobiles;
+    }
+
+    /**
+     * ����mobiles���Ե�ֵ��
+     *
+     * @param value allowed object is
+     *              {@link String }
+     */
+    public void setMobiles(String value) {
+        this.mobiles = value;
+    }
+
+    /**
+     * ��ȡcontent���Ե�ֵ��
+     *
+     * @return possible object is
+     * {@link String }
+     */
+    public String getContent() {
+        return content;
+    }
+
+    /**
+     * ����content���Ե�ֵ��
+     *
+     * @param value allowed object is
+     *              {@link String }
+     */
+    public void setContent(String value) {
+        this.content = value;
+    }
+
+}

+ 51 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SendMessageResponse.java

@@ -0,0 +1,51 @@
+package com.ruoyi.web.controller.tool;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>anonymous complex type�� Java �ࡣ
+ *
+ * <p>����ģʽƬ��ָ�������ڴ����е�Ԥ�����ݡ�
+ *
+ * <pre>
+ * &lt;complexType>
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="SendMessageResult" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+        "sendMessageResult"
+})
+@XmlRootElement(name = "SendMessageResponse")
+public class SendMessageResponse {
+
+    @XmlElement(name = "SendMessageResult")
+    protected int sendMessageResult;
+
+    /**
+     * ��ȡsendMessageResult���Ե�ֵ��
+     */
+    public int getSendMessageResult() {
+        return sendMessageResult;
+    }
+
+    /**
+     * ����sendMessageResult���Ե�ֵ��
+     */
+    public void setSendMessageResult(int value) {
+        this.sendMessageResult = value;
+    }
+
+}

+ 3 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/job/CanalScheduling.java

@@ -314,8 +314,8 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
                     // 嗅探系统-违规船舶
                     if ("prod".equals(env)) {
                         // 查询检测点和船舶信息、船舶进出港记录
-                        if (ObjectUtil.isNotEmpty(afterDataMap.get("mmsi"))) {
-                            AisShipInfo shipInfo = aisInfoService.getShipInfo("", Convert.toStr(afterDataMap.get("mmsi")), "", "");
+                        if (ObjectUtil.isNotEmpty(afterDataMap.get("shipMmsi"))) {
+                            AisShipInfo shipInfo = aisInfoService.getShipInfo("", Convert.toStr(afterDataMap.get("shipMmsi")), "", "");
                             if (shipInfo != null) {
                                 afterDataMap.put("shipName", shipInfo.getShipName());
                                 afterDataMap.put("shipRegionType", shipInfo.getShipRegionType());
@@ -340,7 +340,7 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
                             Map<String, String> data = Convert.toMap(String.class, String.class, sem.get("data"));
                             afterDataMap.put("semName", data.get("name"));
                             afterDataMap.put("monitorPointName", data.get("category"));
-                            afterDataMap.put("orgName", orgMap.get(data.get("name")));
+                            afterDataMap.put("orgName", orgMap.get(data.get("category")));
                         }
 
                         // 嫌疑船舶

+ 13 - 17
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

@@ -1,5 +1,8 @@
 package com.ruoyi.framework.config;
 
+import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter;
+import com.ruoyi.framework.security.handle.AuthenticationEntryPointImpl;
+import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
 import org.springframework.http.HttpMethod;
@@ -14,24 +17,20 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
 import org.springframework.security.web.authentication.logout.LogoutFilter;
 import org.springframework.web.filter.CorsFilter;
-import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter;
-import com.ruoyi.framework.security.handle.AuthenticationEntryPointImpl;
-import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl;
 
 /**
  * spring security配置
- * 
+ *
  * @author ruoyi
  */
 @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
-public class SecurityConfig extends WebSecurityConfigurerAdapter
-{
+public class SecurityConfig extends WebSecurityConfigurerAdapter {
     /**
      * 自定义用户认证逻辑
      */
     @Autowired
     private UserDetailsService userDetailsService;
-    
+
     /**
      * 认证失败处理类
      */
@@ -55,7 +54,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
      */
     @Autowired
     private CorsFilter corsFilter;
-    
+
     /**
      * 解决 无法直接注入 AuthenticationManager
      *
@@ -64,8 +63,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
      */
     @Bean
     @Override
-    public AuthenticationManager authenticationManagerBean() throws Exception
-    {
+    public AuthenticationManager authenticationManagerBean() throws Exception {
         return super.authenticationManagerBean();
     }
 
@@ -85,8 +83,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
      * authenticated       |   用户登录后可访问
      */
     @Override
-    protected void configure(HttpSecurity httpSecurity) throws Exception
-    {
+    protected void configure(HttpSecurity httpSecurity) throws Exception {
         httpSecurity
                 // CSRF禁用,因为不使用session
                 .csrf().disable()
@@ -114,6 +111,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 .antMatchers("/webjars/**").anonymous()
                 .antMatchers("/*/api-docs").anonymous()
                 .antMatchers("/druid/**").anonymous()
+                .antMatchers("/gas/common/sendSms").anonymous()
                 // 除上面外的所有请求全部需要鉴权认证
                 .anyRequest().authenticated()
                 .and()
@@ -126,13 +124,12 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
         httpSecurity.addFilterBefore(corsFilter, LogoutFilter.class);
     }
 
-    
+
     /**
      * 强散列哈希加密实现
      */
     @Bean
-    public BCryptPasswordEncoder bCryptPasswordEncoder()
-    {
+    public BCryptPasswordEncoder bCryptPasswordEncoder() {
         return new BCryptPasswordEncoder();
     }
 
@@ -140,8 +137,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
      * 身份认证接口
      */
     @Override
-    protected void configure(AuthenticationManagerBuilder auth) throws Exception
-    {
+    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
         auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder());
     }
 }