|
@@ -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();
|
|
|
+ }
|
|
|
+
|
|
|
}
|