mirror of
https://gitee.com/elegant_wings/dbd-meeting.git
synced 2025-06-21 17:09:36 +08:00
打印接口,短信接口,会议预约微信推送管理员
This commit is contained in:
parent
03c2a0e5e6
commit
0530738070
@ -0,0 +1,181 @@
|
||||
package com.ics.admin.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ics.admin.service.IMeetingReservationService;
|
||||
import com.ics.admin.vo.MeetingRecordVo;
|
||||
import com.ics.common.core.domain.R;
|
||||
import com.ics.common.utils.DateUtils;
|
||||
import com.ics.common.utils.StringUtils;
|
||||
import com.ics.system.domain.DictData;
|
||||
import com.ics.system.service.IDictDataService;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.interfaces.RSAPrivateKey;
|
||||
import java.security.interfaces.RSAPublicKey;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 打印调用接口
|
||||
* created at 2025-1-13 20:13
|
||||
*
|
||||
* @author lujiang
|
||||
* @version 1.0.0
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/interface/print")
|
||||
public class MeetingPrintController {
|
||||
|
||||
private final static String PRIVATE_KEY = "MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAIQyBF4zI63LsxKknhyt+v84/FphsiQbC3UmuysLHyROqDmjigBngB/ln2SUUR0XQx2dDWDvtGbdIPHns/LoGuQ/za7+FzXpOMz5OxkyKLQ3bMMaCMMTyhCoUIZMp/tzVVu7l7+JZFQWSCP9C3sz8xZvsfiYiJiYZuSflmjGqXQHAgMBAAECgYAPHLirHCWEBLlf9DmvBaSf8J/IpUp8HitdJSRYc1kICYXpsOxhx3M6MkHaeaocLUCa7g1Ne5mf+L9/aAGGT0pjis7jjPhWBUymXNDPhsUOT+uBi4ufnW4ah1U0Oweo5EXGkEcA9+BFI7nIO7XjdeX4FrZqUZ2efZiogAoy0ZK+gQJBANm7mRNKLfj09F0afQYoLIxMdmF27DZePOBv2sgsXYsLM6bVTJO1+tGe0XaqwrOAWEC2APlMZ4VsNrCZUD2R8vcCQQCbbdp3cpV7cyYOjloIlRAtdLei7zhH+OGsRw69EmBncmFHjPcHri1k9FxQlyW3NStd6pLjcKw/s87ZcBT9WjNxAkBMxlaas6x0PcOw1LdDJYVXz1pq0alHHoGuziJCNUqizcdfy5Sd/Sw9IBhSFLJk4xu7bbH4NhXGuTqrmNPvcfhPAkBK8+rKd2NGqPzNQDCCuv+WLBbyZ9IIQyjw30NoQhhjSnFHA9+MwJ37dSufYYQ6mVVUcO5s58To41j42mgE1R7BAkBHCgGh2lyUAQvVM6D/N4YeJDIBQ4iLZEgBZ2f75bHZjfZr4O7s8lQHZWt4om4rgxVlFcy338dLLEfKrx6JS/Ip";
|
||||
|
||||
private final static String PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCEMgReMyOty7MSpJ4crfr/OPxaYbIkGwt1JrsrCx8kTqg5o4oAZ4Af5Z9klFEdF0MdnQ1g77Rm3SDx57Py6BrkP82u/hc16TjM+TsZMii0N2zDGgjDE8oQqFCGTKf7c1Vbu5e/iWRUFkgj/Qt7M/MWb7H4mIiYmGbkn5Zoxql0BwIDAQAB";
|
||||
|
||||
@Autowired
|
||||
private IDictDataService dictDataService;
|
||||
|
||||
@Autowired
|
||||
private IMeetingReservationService meetingReservationService;
|
||||
|
||||
/**
|
||||
* 获取token
|
||||
*
|
||||
* @param appId 系统分配的应用id
|
||||
*/
|
||||
@PostMapping("getAccessToekn")
|
||||
public R getToekn(String appId) {
|
||||
if (!checkAppId(appId)) return R.error().put("msg", "非法appId");
|
||||
String content = appId + "|" + System.currentTimeMillis();
|
||||
try {
|
||||
String token = encrypt(content);
|
||||
return R.ok().put("accessToken", token);
|
||||
} catch (Exception e) {
|
||||
return R.error().put("msg", "获取Token失败");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("getMeeting")
|
||||
public R getMeeting(String accessToken) {
|
||||
if (!checkToken(accessToken)) return R.error().put("msg", "accessToken无效");
|
||||
MeetingRecordVo mrv = new MeetingRecordVo();
|
||||
mrv.setRole(5);
|
||||
//mrv.setStatus(7);
|
||||
mrv.setExt1("all");
|
||||
List<MeetingRecordVo> list = meetingReservationService.selectMeetingReservationList(mrv);
|
||||
JSONArray datas = new JSONArray();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
JSONObject data = new JSONObject();
|
||||
MeetingRecordVo meetingRecordVo = list.get(i);
|
||||
data.put("id", meetingRecordVo.getId());
|
||||
data.put("room", meetingRecordVo.getRoomNum());
|
||||
data.put("start", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, meetingRecordVo.getStart()));
|
||||
data.put("end", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, meetingRecordVo.getEnd()));
|
||||
data.put("title", meetingRecordVo.getTitle());
|
||||
data.put("dept", meetingRecordVo.getUserOrg());
|
||||
data.put("status", meetingRecordVo.getStatus());
|
||||
data.put("updateTime", meetingRecordVo.getUpdateTime() == null ? "" : DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, meetingRecordVo.getUpdateTime()));
|
||||
// String operate = meetingRecordVo.getOperate();
|
||||
// JSONArray jsonArray = JSONArray.parseArray(operate);
|
||||
// if (jsonArray != null && jsonArray.size() > 0) {
|
||||
// JSONObject jsonObject = jsonArray.getJSONObject(jsonArray.size() - 1);
|
||||
// data.put("updateTime", jsonObject.getString("time"));
|
||||
// } else {
|
||||
// data.put("updateTime", "");
|
||||
// }
|
||||
datas.add(data);
|
||||
}
|
||||
return R.ok().put("data", datas);
|
||||
}
|
||||
|
||||
@PostMapping("callBack")
|
||||
public R callBack(String accessToken, String ids) {
|
||||
if (!checkToken(accessToken)) return R.error().put("msg", "accessToken无效");
|
||||
if (StringUtils.isBlank(ids)) return R.error().put("msg", "无效参数");
|
||||
try {
|
||||
meetingReservationService.updateMeetingReservationByIds(ids);
|
||||
} catch (Exception e) {
|
||||
return R.error().put("msg", "failed");
|
||||
}
|
||||
return R.ok().put("msg", "success");
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验token,appid 合法,时间在2小时以内
|
||||
*
|
||||
* @param token 待校验token
|
||||
* @return
|
||||
*/
|
||||
private boolean checkToken(String token) {
|
||||
if(StringUtils.isNotBlank(token)){
|
||||
try {
|
||||
String content = decrypt(token);
|
||||
String[] keys = content.split("\\|");
|
||||
if (keys != null && keys.length == 2) {
|
||||
if (checkAppId(keys[0])) {
|
||||
long tokenTime = Long.parseLong(keys[1]);
|
||||
if (System.currentTimeMillis() - tokenTime <= 7200000l) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检验appId 是否合法
|
||||
*
|
||||
* @param appId 带校验
|
||||
* @return true 合法 ,false 不合法
|
||||
*/
|
||||
private boolean checkAppId(String appId) {
|
||||
List<DictData> list = dictDataService.selectDictDataByType("appId");
|
||||
if (list != null && list.size() > 0) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
DictData dictData = list.get(i);
|
||||
if (dictData.getDictValue().equals(appId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* rsa 公钥加密
|
||||
*/
|
||||
private String encrypt(String token) throws Exception {
|
||||
byte[] buffer = Base64.decodeBase64(PUBLIC_KEY);
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(buffer);
|
||||
RSAPublicKey publicKey = (RSAPublicKey) keyFactory.generatePublic(keySpec);
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
|
||||
byte[] data = cipher.doFinal(token.getBytes());
|
||||
return Base64.encodeBase64URLSafeString(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* rsa 私钥解密
|
||||
*/
|
||||
private String decrypt(String token) throws Exception {
|
||||
byte[] buffer = Base64.decodeBase64(PRIVATE_KEY);
|
||||
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(buffer);
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
RSAPrivateKey privateKey = (RSAPrivateKey) keyFactory.generatePrivate(keySpec);
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.DECRYPT_MODE, privateKey);
|
||||
byte[] data = cipher.doFinal(Base64.decodeBase64(token));
|
||||
return new String(data);
|
||||
}
|
||||
}
|
@ -67,7 +67,7 @@ public class MeetingReservation extends BaseEntity<MeetingReservation> {
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 扩展1 */
|
||||
/** 扩展1 1 表示接口已经标记不在返回数据*/
|
||||
private String ext1;
|
||||
|
||||
/** 扩展2 */
|
||||
|
@ -53,7 +53,7 @@ public class RepairRemind extends BaseEntity<RepairRemind> {
|
||||
private String ext1;
|
||||
|
||||
/**
|
||||
* 扩展2
|
||||
* 扩展2 默认为空,3 短信发送成功 5 短信发送失败
|
||||
*/
|
||||
private String ext2;
|
||||
|
||||
|
@ -97,4 +97,6 @@ public interface MeetingReservationMapper {
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteMeetingReservationByIds(String[] ids);
|
||||
|
||||
int updateMeetingReservationByIds(String[] ids);
|
||||
}
|
||||
|
@ -114,4 +114,12 @@ public interface RepairRemindMapper {
|
||||
* @return
|
||||
*/
|
||||
int afterWxPush(@Param("state") String state, @Param("ids") List<Long> ids);
|
||||
|
||||
/**
|
||||
* 短信后更新提醒消息
|
||||
* @param state
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
int afterSMS(@Param("state") String state, @Param("ids") List<Long> ids);
|
||||
}
|
@ -126,5 +126,13 @@ public interface IMeetingReservationService {
|
||||
*/
|
||||
int deleteMeetingReservationByIds(String ids);
|
||||
|
||||
/**
|
||||
* 接口标记,标记后的数据不再被接口调用返回数据
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
int updateMeetingReservationByIds(String ids);
|
||||
|
||||
|
||||
}
|
||||
|
@ -89,4 +89,13 @@ public interface IRepairRemindService {
|
||||
* @return
|
||||
*/
|
||||
int afterWxPush(List<Long> success, List<Long> failed);
|
||||
|
||||
/**
|
||||
* 短信后更新提醒消息
|
||||
*
|
||||
* @param success
|
||||
* @param failed
|
||||
* @return
|
||||
*/
|
||||
int afterSMS(List<Long> success, List<Long> failed);
|
||||
}
|
||||
|
@ -315,12 +315,13 @@ public class MeetingReservationServiceImpl implements IMeetingReservationService
|
||||
p.setRoomRole(5);
|
||||
List<IcsCustomerStaff> admins = customerStaffMapper.selectIcsCustomerStaffList(p);//获取所有会议管理员
|
||||
boolean isAdmin = false;//是否管理员创建的预约
|
||||
for (IcsCustomerStaff staff : admins) {
|
||||
if (staff.getId().toString().equals(meetingReservation.getCreateBy())) {
|
||||
isAdmin = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//-- 2025-01-08 会议管理员创建的预约,在审核、审核通过环节均不会有提示。甲方提出需要有提醒。
|
||||
// for (IcsCustomerStaff staff : admins) {
|
||||
// if (staff.getId().toString().equals(meetingReservation.getCreateBy())) {
|
||||
// isAdmin = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
if (status == -1) {//提醒会务人员
|
||||
if (StringUtils.isNotBlank(voiceWaiter)) {
|
||||
String[] voices = voiceWaiter.split(",");
|
||||
@ -483,4 +484,9 @@ public class MeetingReservationServiceImpl implements IMeetingReservationService
|
||||
return meetingReservationMapper.deleteMeetingReservationByIds(idsArray);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateMeetingReservationByIds(String ids) {
|
||||
String[] idsArray = StrUtil.split(ids, ",");
|
||||
return meetingReservationMapper.updateMeetingReservationByIds(idsArray);
|
||||
}
|
||||
}
|
||||
|
@ -136,4 +136,17 @@ public class RepairRemindServiceImpl implements IRepairRemindService {
|
||||
}
|
||||
return a + b;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public int afterSMS(List<Long> success, List<Long> failed) {
|
||||
int a = 0, b = 0;
|
||||
if (success != null && success.size() > 0) {
|
||||
a = repairRemindMapper.afterSMS("3", success);
|
||||
}
|
||||
if (failed != null && failed.size() > 0) {
|
||||
b = repairRemindMapper.afterSMS("5", failed);
|
||||
}
|
||||
return a + b;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,103 @@
|
||||
package com.ics.admin.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 电信 短信发送
|
||||
* created at 2025-1-8 15:47
|
||||
*
|
||||
* @author lujiang
|
||||
* @version 1.0.0
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("smsSender")
|
||||
public class SMSUtil {
|
||||
|
||||
private RestTemplate restTemplate = new RestTemplate();
|
||||
|
||||
private final static String SIGN_NAME = "";
|
||||
private final static String SEND_URL = "https://qxtapi.js118114.com:9003/SMSController/sendSms.do";
|
||||
private final static String SPID = "";
|
||||
private final static String AUTH_CODE = "";
|
||||
private final static String AUTH_KEY = "";
|
||||
|
||||
public JSONObject sendSms(String message, String mobiles) {
|
||||
// 准备请求参数
|
||||
String content = "【" + SIGN_NAME + "】" + message;
|
||||
String timestamp = String.valueOf(System.currentTimeMillis());
|
||||
String sign = "";
|
||||
try {
|
||||
content = URLEncoder.encode(content, "utf-8");
|
||||
sign = calculateSign("", "", mobiles, "", content, timestamp);
|
||||
} catch (UnsupportedEncodingException | NoSuchAlgorithmException e) {
|
||||
log.error("短信内容编码失败:{}", e.getMessage());
|
||||
}
|
||||
// 构建请求体
|
||||
Map<String, String> requestBody = new HashMap<>();
|
||||
requestBody.put("auth_code", AUTH_CODE);
|
||||
requestBody.put("spid", SPID);
|
||||
requestBody.put("extport", "");
|
||||
requestBody.put("smsid", "");
|
||||
requestBody.put("mobiles", mobiles);
|
||||
requestBody.put("content", content);
|
||||
requestBody.put("sendtime", "");
|
||||
requestBody.put("timestamp", timestamp);
|
||||
requestBody.put("sign", sign);
|
||||
// 发送POST请求
|
||||
JSONObject response = null;
|
||||
try {
|
||||
response = restTemplate.postForObject(SEND_URL, requestBody, JSONObject.class);
|
||||
} catch (Exception e) {
|
||||
log.error("** 发送电信短信失败:{}", e.getMessage());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算签名方法
|
||||
*
|
||||
* @param extport 扩展码,暂不支持,默认""
|
||||
* @param smsid 短信任务编号,默认""
|
||||
* @param mobiles 手机号码列表,多个用英文逗号分隔
|
||||
* @param sendtime 定时发送时间,暂不支持,默认""
|
||||
* @param content 短信内容:【签名】+内容
|
||||
* @param timestamp 时间戳
|
||||
* @return 使用SHA-1算法计算后的sign值
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
private String calculateSign(String extport, String smsid, String mobiles, String sendtime, String content, String timestamp) throws NoSuchAlgorithmException {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(AUTH_CODE);
|
||||
sb.append(SPID);
|
||||
sb.append(extport);
|
||||
sb.append(smsid);
|
||||
sb.append(mobiles);
|
||||
sb.append(sendtime);
|
||||
sb.append(content);
|
||||
sb.append(timestamp);
|
||||
sb.append(AUTH_KEY);
|
||||
MessageDigest digest = MessageDigest.getInstance("SHA-1");
|
||||
byte[] hash = digest.digest(sb.toString().getBytes(StandardCharsets.UTF_8));
|
||||
StringBuilder hexString = new StringBuilder();
|
||||
for (byte b : hash) {
|
||||
String hex = Integer.toHexString(0xff & b);
|
||||
if (hex.length() == 1) {
|
||||
hexString.append('0');
|
||||
}
|
||||
hexString.append(hex);
|
||||
}
|
||||
return hexString.toString();
|
||||
}
|
||||
}
|
@ -90,6 +90,8 @@ public class MeetingRecordVo implements Serializable {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 所属楼层值
|
||||
*/
|
||||
|
@ -96,7 +96,7 @@
|
||||
|
||||
<!-- 分页列表 -->
|
||||
<select id="selectMeetingReservationList" parameterType="com.ics.admin.vo.MeetingRecordVo" resultType="com.ics.admin.vo.MeetingRecordVo">
|
||||
SELECT mr.id, sn, room_id, start, `end`, time_format, title, person_num, leader, booking_user_name, booking_user_phone, user_org_id, user_org, status, operate, mr.remark, mr.ext1, mr.ext2, mr.ext3, mr.create_time createTime,
|
||||
SELECT mr.id, sn, room_id, start, `end`, time_format, title, person_num, leader, booking_user_name, booking_user_phone, user_org_id, user_org, status, operate, mr.remark, mr.ext1, mr.ext2, mr.ext3, mr.create_time createTime,mr.update_time updateTime,
|
||||
floor_id, floor, name, type_id, type_name, device, room_num, area, capacity_num, content, enable, room.ext1 roomExt1, room.ext2 roomExt2, room.ext3 roomExt3, room.remark roomRemark
|
||||
from ics_meeting_reservation mr inner join ics_meeting_room room on mr.room_id=room.id
|
||||
<if test="role == 3">
|
||||
@ -120,6 +120,7 @@
|
||||
<if test="capacityNum != null"> AND capacity_num <= #{capacityNum}</if>
|
||||
<if test="status != null"> AND status = #{status}</if>
|
||||
<if test="filterDate != null and filterDate != ''"> AND start LIKE CONCAT(#{filterDate}, '%')</if>
|
||||
<if test="ext1 != null and ext1 != ''"> AND mr.ext1 is null</if>
|
||||
<choose>
|
||||
<when test="sort != null and sort == 'create'"> order by mr.create_time desc,status</when>
|
||||
<otherwise> order by start desc,status</otherwise>
|
||||
@ -152,13 +153,13 @@
|
||||
<!-- 审核通过的会议预约变成进行中 -->
|
||||
<update id="goMeetingReservation">
|
||||
<![CDATA[
|
||||
update ics_meeting_reservation set status=9 where delete_flag = 0 and status=7 and TIMESTAMPDIFF(MINUTE,now(),start) <= 1
|
||||
update ics_meeting_reservation set status=9,update_time=now() where delete_flag = 0 and status=7 and TIMESTAMPDIFF(MINUTE,now(),start) <= 1
|
||||
]]>
|
||||
</update>
|
||||
<!-- 进行中会议预约变成结束 -->
|
||||
<update id="endMeetingReservation">
|
||||
<![CDATA[
|
||||
update ics_meeting_reservation set status=11 where delete_flag = 0 and status=9 and TIMESTAMPDIFF(MINUTE,now(),`end`) <= 0
|
||||
update ics_meeting_reservation set status=11,update_time=now() where delete_flag = 0 and status=9 and TIMESTAMPDIFF(MINUTE,now(),`end`) <= 0
|
||||
]]>
|
||||
</update>
|
||||
|
||||
@ -257,4 +258,11 @@
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="updateMeetingReservationByIds" parameterType="String">
|
||||
update ics_meeting_reservation set ext1='1' where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
</mapper>
|
@ -147,5 +147,11 @@
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="afterSMS">
|
||||
update ics_repair_remind set ext2 = #{state} where id in
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
</mapper>
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.ics.admin.domain.RepairRemind;
|
||||
import com.ics.admin.service.IIcsCustomerStaffService;
|
||||
import com.ics.admin.service.IRepairRemindService;
|
||||
import com.ics.admin.utils.SMSUtil;
|
||||
import com.ics.common.core.domain.IcsCustomerStaff;
|
||||
import com.ics.common.utils.DateUtils;
|
||||
import com.ics.common.utils.StringUtils;
|
||||
@ -46,6 +47,9 @@ public class RepairRemindPushServiceImpl implements RepairRemindPushService {
|
||||
@Autowired
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
|
||||
@Autowired
|
||||
private SMSUtil smsSender;
|
||||
|
||||
@Value("${webchatGZH.templateRP}")
|
||||
private String templateRP;
|
||||
|
||||
@ -84,15 +88,30 @@ public class RepairRemindPushServiceImpl implements RepairRemindPushService {
|
||||
List<RepairRemind> list = repairRemindService.getWxPushRepairRemind();
|
||||
List<Long> success = new ArrayList<>();
|
||||
List<Long> failed = new ArrayList<>();
|
||||
List<Long> sms3 = new ArrayList<>();//短信成功
|
||||
List<Long> sms5 = new ArrayList<>();//短信失败
|
||||
|
||||
for (RepairRemind repairRemind : list) {
|
||||
IcsCustomerStaff customerStaff = customerStaffService.selectIcsCustomerStaffById(repairRemind.getUserId());
|
||||
if (customerStaff == null || StringUtils.isBlank(customerStaff.getGzhOpenid())) {
|
||||
failed.add(repairRemind.getId());
|
||||
if (repairRemind.getTypeId() == 1) sms5.add(repairRemind.getId());
|
||||
} else {
|
||||
String openid = customerStaff.getGzhOpenid();
|
||||
String time = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, repairRemind.getCreateTime());
|
||||
String content = repairRemind.getContent();
|
||||
//发送短信--限会议,限普通用户 --会议室预约角色(1.普通用户, 3.会议服务人员 ,5.会议管理员)
|
||||
if (StringUtils.isBlank(repairRemind.getExt2()) && repairRemind.getTypeId() == 1 && customerStaff.getRoomRole() == 1) {
|
||||
JSONObject smsResult = smsSender.sendSms(content, customerStaff.getMobile());
|
||||
System.out.println("==========短信发送结果==========" + smsResult.toString());
|
||||
int code = smsResult.getInteger("code");
|
||||
if (code == 1) {
|
||||
sms3.add(repairRemind.getId());
|
||||
} else {
|
||||
sms5.add(repairRemind.getId());
|
||||
}
|
||||
}
|
||||
//发送短信--end
|
||||
if (StringUtils.isNotBlank(content) && content.length() > 20) {
|
||||
content = content.substring(0, 19);
|
||||
}
|
||||
@ -126,9 +145,10 @@ public class RepairRemindPushServiceImpl implements RepairRemindPushService {
|
||||
}
|
||||
param.put("data", data);
|
||||
JSONObject result = send(url, JSON.toJSONString(param));
|
||||
System.out.println("==========ttt1==========");
|
||||
System.out.println("==========微信公众号推送结果==========");
|
||||
System.out.println(result.toString());
|
||||
System.out.println("==========ttt2==========");
|
||||
System.out.println("==========微信公众号推送结果end==========");
|
||||
|
||||
if (result == null || result.getInteger("errcode") == null || result.getInteger("errcode") != 0) {
|
||||
failed.add(repairRemind.getId());
|
||||
} else {
|
||||
@ -137,6 +157,7 @@ public class RepairRemindPushServiceImpl implements RepairRemindPushService {
|
||||
}
|
||||
|
||||
}
|
||||
repairRemindService.afterSMS(sms3,sms5);
|
||||
return repairRemindService.afterWxPush(success, failed);
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ jwtp:
|
||||
## 拦截路径,默认是/**
|
||||
path: /**
|
||||
## 排除拦截路径,默认无
|
||||
exclude-path: /admin/login/slide, /meeting/wxPay/**, /business/login/slide, /login/slide,/user/check_code,/captcha/check,/captcha/get,/system/sms/send,/user/register/submit,/weixin/login,/meeting/roomItemByRoom/**,/social_user_login/login,/changyang_user_login/login,/wx/**,/wx/login,/user/check_mobile,/user/send_mobile,/user/search_customer,/user/check_code,/user/register,/password/send_mobile,/password/forgot,/auth/login,/social_user_login/login
|
||||
exclude-path: /admin/login/slide, /meeting/wxPay/**, /business/login/slide, /login/slide,/user/check_code,/captcha/check,/captcha/get,/system/sms/send,/user/register/submit,/weixin/login,/meeting/roomItemByRoom/**,/social_user_login/login,/changyang_user_login/login,/wx/**,/wx/login,/user/check_mobile,/user/send_mobile,/user/search_customer,/user/check_code,/user/register,/password/send_mobile,/password/forgot,/auth/login,/social_user_login/login,/interface/print/*
|
||||
## 单个用户最大token数,默认-1不限制
|
||||
max-token: 1
|
||||
## url自动对应权限方式,0 简易模式,1 RESTful模式
|
||||
|
Loading…
x
Reference in New Issue
Block a user