短信接口调整
This commit is contained in:
parent
e28dab5dde
commit
4a03235fe1
@ -56,6 +56,16 @@ public class Aes {
|
|||||||
return encrypt(content, KEY);
|
return encrypt(content, KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 惠州加密
|
||||||
|
*
|
||||||
|
* @param content
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String hzEncrypt(String content) {
|
||||||
|
return encrypt(content, "ssologin66!@#$%^").replace("+", "-").replace("/", "_");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解密
|
* 解密
|
||||||
*
|
*
|
||||||
@ -66,6 +76,7 @@ public class Aes {
|
|||||||
return decrypt(content, KEY);
|
return decrypt(content, KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加密
|
* 加密
|
||||||
*
|
*
|
||||||
@ -115,9 +126,11 @@ public class Aes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String content = "RaxMRsBUfFDjz_U_7LB_TJHqPNDVlpiOtkdqhZMTDoW3bHbfHnQ8_wuKIcVJemVn".replace("-", "+").replace("_", "/");
|
// String content = "RaxMRsBUfFDjz_U_7LB_TJHqPNDVlpiOtkdqhZMTDoW3bHbfHnQ8_wuKIcVJemVn".replace("-", "+").replace("_", "/");
|
||||||
// System.out.println("RaxMRsBUfFDjz/U/7LB/TBRIDE/1I6ZZ9kmQFWqgLCID42evqzeC8kpDSd3GM7YB".replace("+", "-").replace("/", "_"));
|
// System.out.println("RaxMRsBUfFDjz/U/7LB/TBRIDE/1I6ZZ9kmQFWqgLCID42evqzeC8kpDSd3GM7YB".replace("+", "-").replace("/", "_"));
|
||||||
// System.out.println(encrypt("{\"uid\":\"test\",\"exp\":1686559180478}", "ssologin66!@#$%^"));
|
// System.out.println(encrypt("{\"uid\":\"test\",\"exp\":1686559180478}", "ssologin66!@#$%^"));
|
||||||
System.out.println(decrypt(content, "ssologin66!@#$%^"));
|
// System.out.println(decrypt(content, "ssologin66!@#$%^"));
|
||||||
|
System.out.println(hzEncrypt("123456"));
|
||||||
|
System.out.println(decrypt(hzEncrypt("123456"), "ssologin66!@#$%^"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.zhgd.mybatis.Aes;
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.Engineering;
|
import com.zhgd.xmgl.modules.basicdata.entity.Engineering;
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.EngineeringMain;
|
import com.zhgd.xmgl.modules.basicdata.entity.EngineeringMain;
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||||
@ -58,6 +59,8 @@ public class SlippageTask {
|
|||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 0 1 * * ?")
|
@Scheduled(cron = "0 0 1 * * ?")
|
||||||
private void projectSubItem() {
|
private void projectSubItem() {
|
||||||
|
List<String> phone = new ArrayList<>();
|
||||||
|
String desc = "施工进度逾期";
|
||||||
List<Integer> states = Arrays.asList(3, 6, 7);
|
List<Integer> states = Arrays.asList(3, 6, 7);
|
||||||
List<ProjectSubItem> change = new ArrayList<>();
|
List<ProjectSubItem> change = new ArrayList<>();
|
||||||
List<ProjectSubItem> list = projectSubItemService.list();
|
List<ProjectSubItem> list = projectSubItemService.list();
|
||||||
@ -69,16 +72,23 @@ public class SlippageTask {
|
|||||||
if (!states.contains(l.getState()) && DateUtil.between(l.getPlanEndTime(), new Date(), DateUnit.DAY, false) > 0) {
|
if (!states.contains(l.getState()) && DateUtil.between(l.getPlanEndTime(), new Date(), DateUnit.DAY, false) > 0) {
|
||||||
l.setState(5);
|
l.setState(5);
|
||||||
change.add(l);
|
change.add(l);
|
||||||
saveRemind(1, "施工进度逾期", l.getEngineeringSn());
|
saveRemind(1, desc, l.getEngineeringSn(), phone);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (change.size() > 0) {
|
if (change.size() > 0) {
|
||||||
projectSubItemService.updateBatchById(change);
|
projectSubItemService.updateBatchById(change);
|
||||||
}
|
}
|
||||||
|
if (phone.size() > 0) {
|
||||||
|
JSONObject params = new JSONObject();
|
||||||
|
params.put("phone", Aes.hzEncrypt(phone.toString()));
|
||||||
|
params.put("project", Aes.hzEncrypt("项目管理子系统"));
|
||||||
|
params.put("alarm", Aes.hzEncrypt(desc));
|
||||||
|
SMS.sendToPhone(params);
|
||||||
|
}
|
||||||
log.info("=========定时修改项目进度状态任务执行成功========");
|
log.info("=========定时修改项目进度状态任务执行成功========");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveRemind(Integer type, String desc, String engineeringSn) {
|
private void saveRemind(Integer type, String desc, String engineeringSn, List<String> phone) {
|
||||||
Remind remind = new Remind();
|
Remind remind = new Remind();
|
||||||
EngineeringMain jsUser = engineeringMainService.getOne(Wrappers.<EngineeringMain>lambdaQuery()
|
EngineeringMain jsUser = engineeringMainService.getOne(Wrappers.<EngineeringMain>lambdaQuery()
|
||||||
.eq(EngineeringMain::getEngineeringSn, engineeringSn).eq(EngineeringMain::getType, 1));
|
.eq(EngineeringMain::getEngineeringSn, engineeringSn).eq(EngineeringMain::getType, 1));
|
||||||
@ -92,11 +102,7 @@ public class SlippageTask {
|
|||||||
remind.setUserPhone(manager.getUserTel());
|
remind.setUserPhone(manager.getUserTel());
|
||||||
remindService.save(remind);
|
remindService.save(remind);
|
||||||
if (StringUtils.isNotBlank(manager.getUserTel())) {
|
if (StringUtils.isNotBlank(manager.getUserTel())) {
|
||||||
JSONObject params = new JSONObject();
|
phone.add(manager.getUserTel());
|
||||||
params.put("phone", manager.getUserTel());
|
|
||||||
params.put("project", engineering.getEngineeringName());
|
|
||||||
params.put("alarmInfo", desc);
|
|
||||||
SMS.sendToPhone(params);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.zhgd.xmgl.util;
|
package com.zhgd.xmgl.util;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.zhgd.mybatis.Aes;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -8,6 +9,8 @@ import java.io.InputStreamReader;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信发送工具类
|
* 短信发送工具类
|
||||||
@ -16,7 +19,7 @@ public class SMS {
|
|||||||
|
|
||||||
private static String session_value;
|
private static String session_value;
|
||||||
|
|
||||||
private static String host = "47.106.214.54:8080";
|
private static String host = "192.168.121.148:80";
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
//updateRoadCheckData("20221026");
|
//updateRoadCheckData("20221026");
|
||||||
@ -24,9 +27,12 @@ public class SMS {
|
|||||||
|
|
||||||
//发送短信
|
//发送短信
|
||||||
JSONObject params = new JSONObject();
|
JSONObject params = new JSONObject();
|
||||||
params.put("phone", "17373303529");
|
List<String> phone = new ArrayList<>();
|
||||||
params.put("project", "sms测试项目1");
|
phone.add("17373303529");
|
||||||
params.put("alarmInfo", "预警类型1");
|
params.put("phone", Aes.hzEncrypt(phone.toString()));
|
||||||
|
// params.put("code", Aes.hzEncrypt("123456"));
|
||||||
|
params.put("project", Aes.hzEncrypt("项目管理系统"));
|
||||||
|
params.put("alarm", Aes.hzEncrypt("施工进度逾期"));
|
||||||
SMS.sendToPhone(params);
|
SMS.sendToPhone(params);
|
||||||
|
|
||||||
//发送验证码
|
//发送验证码
|
||||||
@ -42,27 +48,27 @@ public class SMS {
|
|||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
public static void sendToPhone(JSONObject params) {
|
public static void sendToPhone(JSONObject params) {
|
||||||
JSONObject jo = new JSONObject();
|
// JSONObject jo = new JSONObject();
|
||||||
jo.put("user", "smsUser");
|
// jo.put("user", "smsUser");
|
||||||
jo.put("passwd", "sjhA86JDFH$2356_sdfAj123");
|
// jo.put("passwd", "sjhA86JDFH$2356_sdfAj123");
|
||||||
String ret = SMS.login("http://"+host+"/SmsServer/UI/login", jo.toJSONString());
|
// String ret = SMS.login("http://"+host+"/SmsServer/UI/login", jo.toJSONString());
|
||||||
System.out.println(ret);
|
// System.out.println(ret);
|
||||||
|
|
||||||
|
try {
|
||||||
ret = SMS.post("http://"+host+"/SmsServer/api/sendSms", params);
|
String result = HttpUtil.doPost("http://"+host+"/sms/message/informAlarm", params.toJSONString());
|
||||||
System.out.println(ret);
|
System.out.println(result);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendToPhone_YZM(JSONObject params) {
|
public static void sendToPhone_YZM(JSONObject params) {
|
||||||
JSONObject jo = new JSONObject();
|
try {
|
||||||
jo.put("user", "smsUser");
|
String result = HttpUtil.doPost("http://" + host + "/sms/message/code", params.toJSONString());
|
||||||
jo.put("passwd", "sjhA86JDFH$2356_sdfAj123");
|
System.out.println(result);
|
||||||
String ret = SMS.login("http://"+host+"/SmsServer/UI/login", jo.toJSONString());
|
} catch (Exception e) {
|
||||||
System.out.println(ret);
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
ret = SMS.post("http://"+host+"/SmsServer/api/sendSms_YZM", params);
|
|
||||||
System.out.println(ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String login(String urlPath, String sendStr) {
|
private static String login(String urlPath, String sendStr) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user