短信服务,RPA服务
parent
aa3b836749
commit
dca909ebbb
|
|
@ -92,10 +92,10 @@
|
||||||
<artifactId>ruoyi-web</artifactId>
|
<artifactId>ruoyi-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>org.dromara</groupId>
|
<!-- <groupId>org.dromara</groupId>-->
|
||||||
<artifactId>ruoyi-job</artifactId>
|
<!-- <artifactId>ruoyi-job</artifactId>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<!-- 代码生成-->
|
<!-- 代码生成-->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ spring.data:
|
||||||
# 数据库索引
|
# 数据库索引
|
||||||
database: 0
|
database: 0
|
||||||
# redis 密码必须配置
|
# redis 密码必须配置
|
||||||
password: ruoyi123
|
# password: ruoyi123
|
||||||
# 连接超时时间
|
# 连接超时时间
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
# 是否开启ssl
|
# 是否开启ssl
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,13 @@
|
||||||
<artifactId>ruoyi-common-redis</artifactId>
|
<artifactId>ruoyi-common-redis</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>axis</groupId>
|
||||||
|
<artifactId>axis</artifactId>
|
||||||
|
<version>1.4</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
package org.dromara.common.sms.util;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import javax.xml.namespace.QName;
|
||||||
|
import java.net.URL;
|
||||||
|
import org.apache.axis.client.Call;
|
||||||
|
import org.apache.axis.client.Service;
|
||||||
|
|
||||||
|
import javax.xml.rpc.ParameterMode;
|
||||||
|
import javax.xml.rpc.encoding.XMLType;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class SmsUtils {
|
||||||
|
/**
|
||||||
|
* 发送短信
|
||||||
|
* @param phone
|
||||||
|
* @param content
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String sendSMS(String phone, String content){
|
||||||
|
return sendSingleSms("", "admin", "y4yhl9t", phone, content, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String sendSingleSms(String typeService, String authUserCode, String authPass, String phone, String content, String sendTime){
|
||||||
|
try {
|
||||||
|
URL url = new URL("http://10.128.1.96:8089/smsWebService/services/smsService?wsdl");
|
||||||
|
QName qname = new QName("http://ws.service.shanli.com/",
|
||||||
|
"sendSingleSMS");
|
||||||
|
Service service = new Service();
|
||||||
|
Call call = (Call) service.createCall();
|
||||||
|
call.setTargetEndpointAddress(url);
|
||||||
|
call.setOperationName(qname);
|
||||||
|
call.setReturnType(XMLType.XSD_STRING);
|
||||||
|
call.addParameter("authUserCode", XMLType.XSD_STRING, ParameterMode.IN);
|
||||||
|
call.addParameter("authPass", XMLType.XSD_STRING, ParameterMode.IN);
|
||||||
|
call.addParameter("typeService", XMLType.XSD_STRING, ParameterMode.IN);
|
||||||
|
// call.addParameter("name", XMLType.XSD_STRING, ParameterMode.IN);
|
||||||
|
call.addParameter("phone", XMLType.XSD_STRING, ParameterMode.IN);
|
||||||
|
call.addParameter("content", XMLType.XSD_STRING, ParameterMode.IN);
|
||||||
|
call.addParameter("subCode", XMLType.XSD_STRING, ParameterMode.IN);
|
||||||
|
call.addParameter("sendTime", XMLType.XSD_STRING, ParameterMode.IN);
|
||||||
|
Object[] obj = new String[]{ authUserCode, authPass, typeService, phone,
|
||||||
|
content, "", sendTime };
|
||||||
|
log.info("发送参数: {}", JSONUtil.toJsonStr(obj));
|
||||||
|
return (String) call.invoke(obj);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error("短信发送失败: {}", e.getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -39,6 +39,7 @@ public class SecurityConfig {
|
||||||
.authorizeHttpRequests((authorize) ->
|
.authorizeHttpRequests((authorize) ->
|
||||||
authorize.requestMatchers(
|
authorize.requestMatchers(
|
||||||
new AntPathRequestMatcher(adminContextPath + "/assets/**"),
|
new AntPathRequestMatcher(adminContextPath + "/assets/**"),
|
||||||
|
new AntPathRequestMatcher(adminContextPath + "/rpa/**"),
|
||||||
new AntPathRequestMatcher(adminContextPath + "/login")
|
new AntPathRequestMatcher(adminContextPath + "/login")
|
||||||
).permitAll()
|
).permitAll()
|
||||||
.anyRequest().authenticated())
|
.anyRequest().authenticated())
|
||||||
|
|
|
||||||
|
|
@ -1,132 +0,0 @@
|
||||||
package org.dromara.job.snailjob;
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DateField;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import cn.hutool.http.HttpUtil;
|
|
||||||
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
|
|
||||||
import com.aizuda.snailjob.client.job.core.dto.JobArgs;
|
|
||||||
import com.aizuda.snailjob.client.model.ExecuteResult;
|
|
||||||
import com.aizuda.snailjob.common.log.SnailJobLog;
|
|
||||||
import org.dromara.system.domain.SysDept;
|
|
||||||
import org.dromara.system.mapper.SysDeptMapper;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.configurationprocessor.json.JSONException;
|
|
||||||
import org.springframework.boot.configurationprocessor.json.JSONObject;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 机构抽取(合肥)
|
|
||||||
* @author Luo.J
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
@JobExecutor(name = "deptExtractionJobExecutor")
|
|
||||||
public class DeptExtractionJobExecutor {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SysDeptMapper sysDeptMapper;
|
|
||||||
|
|
||||||
public ExecuteResult jobExecute(JobArgs jobArgs) throws JSONException {
|
|
||||||
SnailJobLog.LOCAL.info("组织机构抽取任务参数. JobParams:{}", jobArgs.getJobParams());
|
|
||||||
// SnailJobLog.REMOTE.info("组织机构抽取任务参数. JobParams:{}", jobArgs.getJobParams());
|
|
||||||
String uri = "http://53.1.230.5:8159/api/UUDB/org/list";
|
|
||||||
String sysCode = "f156334885cc4fbc853a07a5bdcd8907";
|
|
||||||
String page;
|
|
||||||
String limit;
|
|
||||||
String startTime;
|
|
||||||
String endTime;
|
|
||||||
Object jobParams = jobArgs.getJobParams();
|
|
||||||
if (ObjectUtil.isNotEmpty(jobParams)){
|
|
||||||
String[] split = jobParams.toString().split(",");
|
|
||||||
page = split[0];
|
|
||||||
limit = split[1];
|
|
||||||
startTime = split[2];
|
|
||||||
endTime = split[3];
|
|
||||||
}else {
|
|
||||||
page = "1";
|
|
||||||
limit = "1000";
|
|
||||||
startTime = DateUtil.format(DateUtil.offset(new Date(), DateField.HOUR_OF_DAY,-6),"yyyy-MM-dd HH:mm:ss");
|
|
||||||
endTime = DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss");
|
|
||||||
}
|
|
||||||
Map<String,String> paramMap = new HashMap<>();
|
|
||||||
paramMap.put("orgId","340100000000");
|
|
||||||
// paramMap.put("orgType","REAL");
|
|
||||||
paramMap.put("page",page);
|
|
||||||
paramMap.put("limit",limit);
|
|
||||||
paramMap.put("startTime",startTime);
|
|
||||||
paramMap.put("endTime",endTime);
|
|
||||||
JSONObject json = new JSONObject(paramMap);
|
|
||||||
String body = json.toString();
|
|
||||||
SnailJobLog.LOCAL.info("组织机构抽取调用第三方参数. body:{}", body);
|
|
||||||
// SnailJobLog.REMOTE.info("组织机构抽取调用第三方参数. body:{}", body);
|
|
||||||
|
|
||||||
String result = HttpUtil.createPost(uri)
|
|
||||||
.header("syscode", sysCode)
|
|
||||||
.body(body)
|
|
||||||
.execute().body();
|
|
||||||
JSONObject resultObject = new JSONObject(result);
|
|
||||||
SnailJobLog.LOCAL.info("组织机构抽取调用第三方返回结果. resultObject:{}", resultObject);
|
|
||||||
// SnailJobLog.REMOTE.info("组织机构抽取调用第三方返回结果. resultObject:{}", resultObject);
|
|
||||||
List<Map<String,Object>> data = (List<Map<String,Object>>) resultObject.get("data");
|
|
||||||
if (data.isEmpty()){
|
|
||||||
return ExecuteResult.failure("返回值为空!");
|
|
||||||
}
|
|
||||||
// data里面存放若干个组织机构的信息
|
|
||||||
for (Map<String,Object> orgInfo : data) {
|
|
||||||
String deptId = (String) orgInfo.get("id");
|
|
||||||
String parentId = (String) orgInfo.get("pid");
|
|
||||||
String path = (String) orgInfo.get("path"); // /340000000000/
|
|
||||||
String replace = path.replaceAll("/", ","); // ,340000000000,
|
|
||||||
String newStr = "0" + replace; // 0,340000000000,
|
|
||||||
String ancestors = newStr.substring(0, newStr.length() - 1); // 去掉最后一个逗号 -> 0,340100000000
|
|
||||||
String newAncestors = ancestors.replace("," + deptId,"");
|
|
||||||
String deptName = (String) orgInfo.get("orgName");
|
|
||||||
String shortName = (String) orgInfo.get("shortName");
|
|
||||||
String status = (String) orgInfo.get("status");
|
|
||||||
Integer orderNum = (Integer) orgInfo.get("orderIdInt");
|
|
||||||
String createTime = (String) orgInfo.get("createTime");
|
|
||||||
String updateTime = (String) orgInfo.get("modiTime");
|
|
||||||
String type = (String) orgInfo.get("type");
|
|
||||||
SysDept sysDept = new SysDept();
|
|
||||||
// 抽取机构数据的时候过滤掉测试数据()
|
|
||||||
if (deptName.contains("测试") || !deptId.startsWith("34") || deptId.length() < 12 || deptId.length() > 14){continue;}
|
|
||||||
// 2. 将组织机构名称格式统一(有的为合肥市公安局,有的为安徽省宿州市公安局)
|
|
||||||
if (deptName.startsWith("安徽省") && !deptId.equals("340000000000")){deptName = deptName.substring(3);}
|
|
||||||
// 将抽取到的组织机构信息放入集合中
|
|
||||||
sysDept.setDeptId((deptId));
|
|
||||||
sysDept.setParentId((parentId));
|
|
||||||
sysDept.setAncestors(newAncestors);
|
|
||||||
sysDept.setDeptName(deptName);
|
|
||||||
sysDept.setShortName(shortName);
|
|
||||||
if ("1".equals(status)){
|
|
||||||
sysDept.setStatus("0");
|
|
||||||
}else if ("0".equals(status)){
|
|
||||||
sysDept.setStatus("1");
|
|
||||||
}else {
|
|
||||||
sysDept.setStatus("1");
|
|
||||||
sysDept.setDelFlag("2");
|
|
||||||
}
|
|
||||||
sysDept.setOrderNum(orderNum);
|
|
||||||
sysDept.setRemark(type);
|
|
||||||
sysDept.setCreateTime(DateUtil.parse(createTime,"yyyy-MM-dd HH:mm:ss"));
|
|
||||||
sysDept.setUpdateTime(DateUtil.parse(updateTime,"yyyy-MM-dd HH:mm:ss"));
|
|
||||||
SysDept dept = sysDeptMapper.selectById(sysDept.getDeptId());
|
|
||||||
if (dept == null){
|
|
||||||
sysDeptMapper.insert(sysDept);
|
|
||||||
SnailJobLog.LOCAL.info("组织机构. deptId:{}抽取成功!", deptId);
|
|
||||||
// SnailJobLog.REMOTE.info("组织机构. deptId:{}抽取成功!", deptId);
|
|
||||||
}else {
|
|
||||||
sysDeptMapper.updateById(sysDept);
|
|
||||||
SnailJobLog.LOCAL.info("组织机构. deptId:{}更新成功!", deptId);
|
|
||||||
// SnailJobLog.REMOTE.info("组织机构. deptId:{}更新成功!", deptId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// SnailJobLog.LOCAL.info("testJobExecutor. jobArgs:{}", JsonUtil.toJsonString(jobArgs));
|
|
||||||
// SnailJobLog.REMOTE.info("testJobExecutor. jobArgs:{}", JsonUtil.toJsonString(jobArgs));
|
|
||||||
return ExecuteResult.success("执行成功!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package org.dromara.biz.controller;
|
package org.dromara.biz.controller;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
@ -23,9 +24,15 @@ import org.dromara.common.log.annotation.Log;
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.sms.util.SmsUtils;
|
||||||
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.system.domain.vo.SysOssUploadVo;
|
||||||
|
import org.dromara.system.domain.vo.SysOssVo;
|
||||||
|
import org.dromara.system.service.ISysOssService;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -46,11 +53,40 @@ public class RPAController extends BaseController {
|
||||||
private final IBizIcdsBulletinService bizIcdsBulletinService;
|
private final IBizIcdsBulletinService bizIcdsBulletinService;
|
||||||
|
|
||||||
private final IBizIcdsDailyService bizIcdsDailyService;
|
private final IBizIcdsDailyService bizIcdsDailyService;
|
||||||
|
private final ISysOssService ossService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增通知公告
|
||||||
|
*/
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping("/smstest")
|
||||||
|
public R<Void> smstest(@Validated(AddGroup.class) @RequestBody BizIcdsNoticeBo bo) {
|
||||||
|
return R.ok(SmsUtils.sendSMS("18655101696", "您有一条新的报送信息待处理,请前往查看"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传OSS对象存储
|
||||||
|
*
|
||||||
|
* @param file 文件
|
||||||
|
*/
|
||||||
|
@Log(title = "OSS对象存储", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
|
public R<SysOssUploadVo> upload(@RequestPart("file") MultipartFile file) {
|
||||||
|
if (ObjectUtil.isNull(file)) {
|
||||||
|
return R.fail("上传文件不能为空");
|
||||||
|
}
|
||||||
|
SysOssVo oss = ossService.upload(file);
|
||||||
|
SysOssUploadVo uploadVo = new SysOssUploadVo();
|
||||||
|
uploadVo.setUrl(oss.getUrl());
|
||||||
|
uploadVo.setFileName(oss.getOriginalName());
|
||||||
|
uploadVo.setOssId(oss.getOssId().toString());
|
||||||
|
return R.ok(uploadVo);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询每日治安动态列表
|
* 查询每日治安动态列表
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("biz:icdsDaily:list")
|
|
||||||
@GetMapping("/daily/list")
|
@GetMapping("/daily/list")
|
||||||
public TableDataInfo<BizIcdsDailyVo> list(BizIcdsDailyBo bo, PageQuery pageQuery) {
|
public TableDataInfo<BizIcdsDailyVo> list(BizIcdsDailyBo bo, PageQuery pageQuery) {
|
||||||
return bizIcdsDailyService.queryPageList(bo, pageQuery);
|
return bizIcdsDailyService.queryPageList(bo, pageQuery);
|
||||||
|
|
@ -59,7 +95,6 @@ public class RPAController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 查询信息快报列表
|
* 查询信息快报列表
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("biz:icdsBulletin:list")
|
|
||||||
@GetMapping("/bulletin/list")
|
@GetMapping("/bulletin/list")
|
||||||
public TableDataInfo<BizIcdsBulletinVo> list(BizIcdsBulletinBo bo, PageQuery pageQuery) {
|
public TableDataInfo<BizIcdsBulletinVo> list(BizIcdsBulletinBo bo, PageQuery pageQuery) {
|
||||||
return bizIcdsBulletinService.queryPageList(bo, pageQuery);
|
return bizIcdsBulletinService.queryPageList(bo, pageQuery);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue