|
@@ -6,7 +6,10 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
import com.alibaba.nacos.common.http.HttpUtils;
|
|
|
+import com.aliyun.dysmsapi20170525.models.SendBatchSmsRequest;
|
|
|
+import com.aliyun.dysmsapi20170525.models.SendBatchSmsResponse;
|
|
|
import com.aliyuncs.http.HttpRequest;
|
|
|
+import com.boman.common.core.exception.CustomException;
|
|
|
import com.boman.common.core.utils.DateUtils;
|
|
|
import com.boman.common.core.utils.IdUtils;
|
|
|
import com.boman.common.core.utils.StringUtils;
|
|
@@ -20,13 +23,11 @@ import com.boman.domain.dto.AjaxResult;
|
|
|
import com.boman.domain.dto.FormDataDto;
|
|
|
import com.boman.system.api.RemoteDeptService;
|
|
|
import com.boman.system.api.RemoteUserService;
|
|
|
-import com.boman.web.core.domain.AccountingData;
|
|
|
-import com.boman.web.core.domain.BirthRecords;
|
|
|
-import com.boman.web.core.domain.TSampling514;
|
|
|
-import com.boman.web.core.domain.ToQianshanPersonner;
|
|
|
+import com.boman.web.core.domain.*;
|
|
|
import com.boman.web.core.domain.vo.AccountingDataVo;
|
|
|
import com.boman.web.core.mapper.AccountingDataMapper;
|
|
|
import com.boman.web.core.mapper.CzrkMapper;
|
|
|
+import com.boman.web.core.mapper.FireproofDataMapper;
|
|
|
import com.boman.web.core.mapper.GridInfoMapper;
|
|
|
import com.boman.web.core.service.accounting.IAccountingDataService;
|
|
|
import com.boman.web.core.service.birth.BirthRecordsService;
|
|
@@ -35,9 +36,7 @@ import com.boman.web.core.service.czrk.CzrkServiceImpl;
|
|
|
import com.boman.web.core.service.czrk.ICzrkJzdzService;
|
|
|
import com.boman.web.core.service.ip.IpTimesService;
|
|
|
import com.boman.web.core.service.toQianShan.ToQianshanPersonnerService;
|
|
|
-import com.boman.web.core.utils.AESUtil;
|
|
|
-import com.boman.web.core.utils.AuthUtils;
|
|
|
-import com.boman.web.core.utils.HttpClientUtils;
|
|
|
+import com.boman.web.core.utils.*;
|
|
|
import lombok.SneakyThrows;
|
|
|
import org.apache.commons.lang3.BooleanUtils;
|
|
|
import org.apache.ibatis.session.ExecutorType;
|
|
@@ -107,6 +106,9 @@ public class TaskService {
|
|
|
@Resource
|
|
|
private SqlSessionFactory sqlSessionFactory;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private FireproofDataMapper fireproofDataMapper;
|
|
|
+
|
|
|
private static final String tableName = "attendance_table";
|
|
|
|
|
|
/**
|
|
@@ -154,6 +156,102 @@ public class TaskService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 数据局2024年春节防火短信下发
|
|
|
+ */
|
|
|
+ public void fireproof() {
|
|
|
+ //读取手机号
|
|
|
+ List<FireproofData> fireproofData = fireproofDataMapper.selectList();
|
|
|
+ if (fireproofData != null && fireproofData.size() > 0) {
|
|
|
+ int maxNums = 100; //每次最多发送100条,我们一次批量发100条
|
|
|
+ int times = 0;// 循环几个100 用List的长度 除 100
|
|
|
+ int size = fireproofData.size(); // 数据数量
|
|
|
+ //模板id
|
|
|
+ String templateCode = fireproofData.get(0).getTemplateCode();
|
|
|
+ //签名
|
|
|
+ String SignName = fireproofData.get(0).getSignName();
|
|
|
+ List<String> phoneList = new ArrayList<>();
|
|
|
+ //List<String> templateList = new ArrayList<>();
|
|
|
+ List<String> signNameList = new ArrayList<>();
|
|
|
+ StringBuffer signNameJson;
|
|
|
+ StringBuffer phoneNumberJson;
|
|
|
+ //StringBuffer templateParamJson;
|
|
|
+ //返回提示
|
|
|
+ String backResult = "";
|
|
|
+ if (size < maxNums) {
|
|
|
+ times = 1;
|
|
|
+ } else {
|
|
|
+ times = (size - 1) / maxNums + 1; //为什么要-1 因为如果是200的时候,理论上次数应该是2,而不是3,如果是101,那么次数也是2,这样就保证次数准确。
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int j = 0; j < times; j++) {
|
|
|
+ if (j > 0 && (j * maxNums + 1 > size)) { //边界判定,如果刚好是100条,那么times的值为2,这时候j 为1的时候 101 大于100结束循环,100条以内不生效
|
|
|
+ break;
|
|
|
+ } else {
|
|
|
+ phoneNumberJson = new StringBuffer();
|
|
|
+ signNameJson = new StringBuffer();
|
|
|
+ //templateParamJson = new StringBuffer();
|
|
|
+ phoneNumberJson.append("[");
|
|
|
+ signNameJson.append("[");
|
|
|
+ //templateParamJson.append("[");
|
|
|
+ for (int k = j * maxNums; k < size && k < (j + 1) * maxNums; k++) {
|
|
|
+ // 防止有空行,手机号是必须要有的
|
|
|
+ String phone = fireproofData.get(k).getPhone();
|
|
|
+ if (StringUtils.isEmpty(phone)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ phoneNumberJson.append("\"" + fireproofData.get(k).getPhone() + "\",");
|
|
|
+ signNameJson.append(SignName+",");
|
|
|
+ //templateParamJson.append("{\"ticketId\":\"" + smsList.get(k).getTicketId() + "\",\"name\":\"" + smsList.get(k).getName() + "\",\"result\":\"" + smsList.get(k).getResult() + "\"},");
|
|
|
+
|
|
|
+ }
|
|
|
+ phoneNumberJson.deleteCharAt(phoneNumberJson.length() - 1);//移除最后一个逗号字符,
|
|
|
+ signNameJson.deleteCharAt(signNameJson.length() - 1);
|
|
|
+ //templateParamJson.deleteCharAt(templateParamJson.length() - 1);//移除最后一个逗号字符
|
|
|
+ phoneNumberJson.append("]");
|
|
|
+ signNameJson.append("]");
|
|
|
+ //templateParamJson.append("]");
|
|
|
+ phoneList.add(phoneNumberJson.toString());
|
|
|
+ signNameList.add(signNameJson.toString());
|
|
|
+ //templateList.add(templateParamJson.toString());
|
|
|
+ }
|
|
|
+ //组装请求对象
|
|
|
+ if (times == phoneList.size()) {
|
|
|
+ for (int i = 0; i < times; i++) {
|
|
|
+ long startTimeSql = System.currentTimeMillis();
|
|
|
+ SendBatchSmsRequest sendBatchSmsRequest = new SendBatchSmsRequest();
|
|
|
+ //组装电话号码
|
|
|
+ sendBatchSmsRequest.setPhoneNumberJson(phoneList.get(i));
|
|
|
+ //签名名称
|
|
|
+ sendBatchSmsRequest.setSignNameJson(signNameList.get(i));
|
|
|
+ //替换参数
|
|
|
+ //sendBatchSmsRequest.setTemplateParamJson(templateList.get(i));
|
|
|
+ //固定的模板名称
|
|
|
+ sendBatchSmsRequest.setTemplateCode(templateCode);
|
|
|
+ long endTimeSql = System.currentTimeMillis() - startTimeSql;
|
|
|
+ System.out.println("线程" + Thread.currentThread().getId() + "执行批量下发短信通知计算:" + (i + 1) + "次,时间" + endTimeSql + "ms");
|
|
|
+ long startTimeSend = System.currentTimeMillis();
|
|
|
+ SendBatchSmsResponse sendBatchSmsResponse = SendBatchSmsUtils.sendBatchSms(sendBatchSmsRequest);
|
|
|
+ long endTimeSend = System.currentTimeMillis() - startTimeSend;
|
|
|
+ System.out.println("线程" + Thread.currentThread().getId() + "执行批量下发短信通知接口请求:" + (i + 1) + "次,时间" + endTimeSend + "ms");
|
|
|
+ SendSms sendSms = new SendSms();
|
|
|
+ if (sendBatchSmsResponse != null) {
|
|
|
+ String code = sendBatchSmsResponse.getBody().getCode();
|
|
|
+ if (sendBatchSmsResponse.getBody().getCode() != null && "OK".equals(code)) {
|
|
|
+ //批量请求发送短信成功
|
|
|
+ System.out.println("批量短信发送成功:" + phoneList.get(i).split(",").length + "条");
|
|
|
+ backResult = backResult + "第" + i + "次批量成功 ";
|
|
|
+ } else {
|
|
|
+ System.out.println("批量短信发送失败!");
|
|
|
+ backResult = backResult + "第" + i + "次批量失败 ";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/***
|
|
|
* 定时执行首页数据任务(每天凌晨1点执行)
|
|
|
* (cron = "0 0 1 * * ?")
|
|
@@ -612,8 +710,8 @@ public class TaskService {
|
|
|
//保存
|
|
|
for (BirthRecords birthRecords : birthRecordsList) {
|
|
|
//判断数据库是否存在数据
|
|
|
- int num = birthRecordsService.selectBirthRecordsByCsyxzmbh(birthRecords.getCsyxzmbh());
|
|
|
- if(num<1){
|
|
|
+ int num = birthRecordsService.selectBirthRecordsByCsyxzmbh(birthRecords.getCsyxzmbh());
|
|
|
+ if (num < 1) {
|
|
|
birthRecordsService.insertBirthRecords(birthRecords);
|
|
|
}
|
|
|
}
|
|
@@ -628,7 +726,7 @@ public class TaskService {
|
|
|
* 新生儿(手动跑数据,时间间隔一个月)
|
|
|
*
|
|
|
*/
|
|
|
- public void getNewbornS(String startTime,String endTime) {
|
|
|
+ public void getNewbornS(String startTime, String endTime) {
|
|
|
|
|
|
String token = getToken();
|
|
|
|
|
@@ -657,8 +755,8 @@ public class TaskService {
|
|
|
//保存
|
|
|
for (BirthRecords birthRecords : birthRecordsList) {
|
|
|
//判断数据库是否存在数据
|
|
|
- int num = birthRecordsService.selectBirthRecordsByCsyxzmbh(birthRecords.getCsyxzmbh());
|
|
|
- if(num<1){
|
|
|
+ int num = birthRecordsService.selectBirthRecordsByCsyxzmbh(birthRecords.getCsyxzmbh());
|
|
|
+ if (num < 1) {
|
|
|
birthRecordsService.insertBirthRecords(birthRecords);
|
|
|
}
|
|
|
}
|
|
@@ -670,8 +768,6 @@ public class TaskService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 获取政务网token
|
|
|
*/
|
|
@@ -1138,7 +1234,7 @@ public class TaskService {
|
|
|
}
|
|
|
//先查询库里是否有相同数据
|
|
|
int num = accountingDataMapper.selectRepeat(accountingData);
|
|
|
- if(num>0){
|
|
|
+ if (num > 0) {
|
|
|
continue;
|
|
|
}
|
|
|
int result = mapper.selectById(accountingData);
|