Commit 7d9c6b46 by ilal Committed by chenzg

提交

parent 32b6d957
...@@ -53,7 +53,7 @@ public class AdminAssoTxjlb extends Model<AdminAssoTxjlb> { ...@@ -53,7 +53,7 @@ public class AdminAssoTxjlb extends Model<AdminAssoTxjlb> {
private Integer orgCode; private Integer orgCode;
@ApiModelProperty(value = "生成时间 生成时间", example = "101") @ApiModelProperty(value = "生成时间 生成时间", example = "101")
private Integer addtime; private Long addtime;
@ApiModelProperty(value = "状态 0:未读 1:已读", example = "101") @ApiModelProperty(value = "状态 0:未读 1:已读", example = "101")
private Integer txstate; private Integer txstate;
......
package cn.timer.api.controller.htzz.atttimer; package cn.timer.api.controller.htzz.atttimer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -20,6 +23,7 @@ import com.aliyuncs.profile.DefaultProfile; ...@@ -20,6 +23,7 @@ import com.aliyuncs.profile.DefaultProfile;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import cn.timer.api.bean.admin.AdminAssoTxjlb;
import cn.timer.api.bean.admin.AdminMsgTemplate; import cn.timer.api.bean.admin.AdminMsgTemplate;
import cn.timer.api.bean.htzz.HtzzAdminZzda; import cn.timer.api.bean.htzz.HtzzAdminZzda;
import cn.timer.api.config.enums.PinType; import cn.timer.api.config.enums.PinType;
...@@ -54,7 +58,7 @@ public class AlicloudSMS { ...@@ -54,7 +58,7 @@ public class AlicloudSMS {
* 提醒功能 * 提醒功能
*/ */
@SuppressWarnings("deprecation") @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(); AdminMsgTemplate dxmb = AdminMsgTemplate.builder().id(zzda.getTemplateId()).build().selectById();
...@@ -110,7 +114,7 @@ public class AlicloudSMS { ...@@ -110,7 +114,7 @@ public class AlicloudSMS {
String SMSformat = String.valueOf(array).replace("[","").replace("]",""); String SMSformat = String.valueOf(array).replace("[","").replace("]","");
System.out.println(SMSformat); // System.out.println(SMSformat);
//短信模板格式 //短信模板格式
request.putQueryParameter(TEMPLATE_PARAM,SMSformat); request.putQueryParameter(TEMPLATE_PARAM,SMSformat);
...@@ -119,7 +123,7 @@ public class AlicloudSMS { ...@@ -119,7 +123,7 @@ public class AlicloudSMS {
try { try {
response = client.getCommonResponse(request); response = client.getCommonResponse(request);
a = response.getData(); a = response.getData();
System.err.println("response:"+a); // 短信服务响应内容 // System.err.println("response:"+a); // 短信服务响应内容
} catch (ServerException e) { } catch (ServerException e) {
e.printStackTrace(); e.printStackTrace();
} catch (ClientException e) { } catch (ClientException e) {
...@@ -127,6 +131,26 @@ public class AlicloudSMS { ...@@ -127,6 +131,26 @@ public class AlicloudSMS {
} }
Integer id = null; Integer id = null;
if (a != null && a.contains("OK")) { 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<Object> list = new ArrayList<Object>();
list.add(id); list.add(id);
......
...@@ -28,7 +28,7 @@ public class NewsTaskTiming { ...@@ -28,7 +28,7 @@ public class NewsTaskTiming {
@Autowired @Autowired
private AlicloudSMS sms; private AlicloudSMS sms;
@Scheduled(cron = "0 33 14 * * ?") @Scheduled(cron = "0 0 8 * * ?")//早上八点
public void MessageAlert() throws ParseException { public void MessageAlert() throws ParseException {
//当前时间 //当前时间
String nowdate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString();// String nowdate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString();//
...@@ -48,7 +48,7 @@ public class NewsTaskTiming { ...@@ -48,7 +48,7 @@ public class NewsTaskTiming {
List<HtzzAssoHtgx> txrs = HtzzAssoHtgx.builder().build().selectList(new QueryWrapper<HtzzAssoHtgx>().lambda().eq(HtzzAssoHtgx::getHtid, zz.getId())); List<HtzzAssoHtgx> txrs = HtzzAssoHtgx.builder().build().selectList(new QueryWrapper<HtzzAssoHtgx>().lambda().eq(HtzzAssoHtgx::getHtid, zz.getId()));
for(HtzzAssoHtgx rt : txrs) { 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