Commit 6f2875d7 by ilal

Merge branch 'lal' into develop

parents edf0762b ed9035b8
......@@ -53,7 +53,7 @@ public class AdminAssoTxjlb extends Model<AdminAssoTxjlb> {
private Integer orgCode;
@ApiModelProperty(value = "生成时间 生成时间", example = "101")
private Integer addtime;
private Long addtime;
@ApiModelProperty(value = "状态 0:未读 1:已读", example = "101")
private Integer txstate;
......
package cn.timer.api.controller.htzz.atttimer;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
......@@ -20,6 +23,7 @@ import com.aliyuncs.profile.DefaultProfile;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import cn.timer.api.bean.admin.AdminAssoTxjlb;
import cn.timer.api.bean.admin.AdminMsgTemplate;
import cn.timer.api.bean.htzz.HtzzAdminZzda;
import cn.timer.api.config.enums.PinType;
......@@ -54,7 +58,7 @@ public class AlicloudSMS {
* 提醒功能
*/
@SuppressWarnings("deprecation")
public List<Object> remind(HtzzAdminZzda zzda, String phone,String tzname) {
public List<Object> remind(HtzzAdminZzda zzda, String phone,String tzname,Integer tzrid) {
//短信模板详情
AdminMsgTemplate dxmb = AdminMsgTemplate.builder().id(zzda.getTemplateId()).build().selectById();
......@@ -110,7 +114,7 @@ public class AlicloudSMS {
String SMSformat = String.valueOf(array).replace("[","").replace("]","");
System.out.println(SMSformat);
// System.out.println(SMSformat);
//短信模板格式
request.putQueryParameter(TEMPLATE_PARAM,SMSformat);
......@@ -119,7 +123,7 @@ public class AlicloudSMS {
try {
response = client.getCommonResponse(request);
a = response.getData();
System.err.println("response:"+a); // 短信服务响应内容
// System.err.println("response:"+a); // 短信服务响应内容
} catch (ServerException e) {
e.printStackTrace();
} catch (ClientException e) {
......@@ -127,6 +131,26 @@ public class AlicloudSMS {
}
Integer id = null;
if (a != null && a.contains("OK")) {
AdminAssoTxjlb txs = AdminAssoTxjlb.builder().build();
JSONObject jsonObject = JSONObject.parseObject(SMSformat);
Map<String, Object> jsonToMap = JSONObject.parseObject(jsonObject.toJSONString());
for(Entry<String, Object> entry : jsonToMap.entrySet()){
String mapKey = entry.getKey();
String mapValue = String.valueOf(entry.getValue());
str = str.replace("${"+mapKey+"}", mapValue);
}
// System.out.println(str);
txs.setContent(str);//内容
txs.setUserName(tzname);
txs.setEmpNum(tzrid);
txs.setTxType(1);
txs.setOrgCode(zzda.getOrgCode());
txs.setAddtime(new Date().getTime());
txs.setTxstate(0);
txs.insert();
List<Object> list = new ArrayList<Object>();
list.add(id);
......
......@@ -28,7 +28,7 @@ public class NewsTaskTiming {
@Autowired
private AlicloudSMS sms;
@Scheduled(cron = "0 33 14 * * ?")
@Scheduled(cron = "0 0 8 * * ?")//早上八点
public void MessageAlert() throws ParseException {
//当前时间
String nowdate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString();//
......@@ -48,7 +48,7 @@ public class NewsTaskTiming {
List<HtzzAssoHtgx> txrs = HtzzAssoHtgx.builder().build().selectList(new QueryWrapper<HtzzAssoHtgx>().lambda().eq(HtzzAssoHtgx::getHtid, zz.getId()));
for(HtzzAssoHtgx rt : txrs) {
//发送短信
List<Object> list = sms.remind(zz, rt.getPhone(),rt.getName());
List<Object> list = sms.remind(zz, rt.getPhone(),rt.getName(),rt.getTzrid());
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment