mirror of
https://gitee.com/elegant_wings/xiongan-meeting.git
synced 2025-06-21 04:59:36 +08:00
修改了短信服务的接口
This commit is contained in:
parent
e511aae84a
commit
cb6140a904
@ -22,6 +22,46 @@
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>dysmsapi20170525</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>tea-openapi</artifactId>
|
||||
<version>0.0.13</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>tea-console</artifactId>
|
||||
<version>0.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>darabonba-env</artifactId>
|
||||
<version>0.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>tea-util</artifactId>
|
||||
<version>0.2.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>darabonba-time</artifactId>
|
||||
<version>0.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>darabonba-string</artifactId>
|
||||
<version>0.0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>tea</artifactId>
|
||||
<version>[1.0.3, 2.0.0)</version>
|
||||
</dependency>
|
||||
<!-- SpringWeb模块 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
|
@ -0,0 +1,143 @@
|
||||
package com.ics.common.utils;
|
||||
|
||||
// This file is auto-generated, don't edit it. Thanks.
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyun.dysmsapi20170525.models.*;
|
||||
import com.aliyun.tea.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Sample {
|
||||
|
||||
public static com.aliyun.dysmsapi20170525.Client createClient() throws Exception {
|
||||
// 工程代码泄露可能会导致 AccessKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考。
|
||||
// 建议使用更安全的 STS 方式,更多鉴权访问方式请参见:https://help.aliyun.com/document_detail/378657.html。
|
||||
com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
|
||||
// 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID。
|
||||
.setAccessKeyId("LTAI5tRh6dwT5vuumQFEV7SJ")
|
||||
// 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
|
||||
.setAccessKeySecret("2Qsa1QSr9gwpyaYhoKzJ1cRc9MmCvS");
|
||||
// Endpoint 请参考 https://api.aliyun.com/product/Dysmsapi
|
||||
config.endpoint = "dysmsapi.aliyuncs.com";
|
||||
return new com.aliyun.dysmsapi20170525.Client(config);
|
||||
}
|
||||
|
||||
public static void send1(String phone, String name, Date date,String meetingName,String thing) throws Exception {
|
||||
com.aliyun.dysmsapi20170525.Client client = Sample.createClient();
|
||||
// 1.发送短信
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("name",name);
|
||||
json.put("time",DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",date));
|
||||
json.put("meeting",meetingName);
|
||||
json.put("thing",thing);
|
||||
|
||||
SendSmsRequest sendReq = new SendSmsRequest()
|
||||
.setPhoneNumbers(phone)
|
||||
.setSignName("长阳智会云控")
|
||||
.setTemplateCode("SMS_471775217")
|
||||
.setTemplateParam
|
||||
(json.toJSONString());
|
||||
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
|
||||
try {
|
||||
// 复制代码运行请自行打印 API 的返回值
|
||||
SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendReq, runtime);
|
||||
System.out.println(sendSmsResponse);
|
||||
} catch (TeaException error) {
|
||||
// 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
||||
// 错误 message
|
||||
System.out.println(error.getMessage());
|
||||
// 诊断地址
|
||||
System.out.println(error.getData().get("Recommend"));
|
||||
com.aliyun.teautil.Common.assertAsString(error.message);
|
||||
} catch (Exception _error) {
|
||||
TeaException error = new TeaException(_error.getMessage(), _error);
|
||||
// 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
||||
// 错误 message
|
||||
System.out.println(error.getMessage());
|
||||
// 诊断地址
|
||||
System.out.println(error.getData().get("Recommend"));
|
||||
com.aliyun.teautil.Common.assertAsString(error.message);
|
||||
}
|
||||
}
|
||||
public static void send2(String phone, String name, Date date,String meetingName,String thing,String place) throws Exception {
|
||||
com.aliyun.dysmsapi20170525.Client client = Sample.createClient();
|
||||
// 1.发送短信
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("name",name);
|
||||
json.put("time",DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",date));
|
||||
json.put("meeting",meetingName);
|
||||
json.put("thing",thing);
|
||||
json.put("palce",place);
|
||||
|
||||
SendSmsRequest sendReq = new SendSmsRequest()
|
||||
.setPhoneNumbers(phone)
|
||||
.setSignName("长阳智会云控")
|
||||
.setTemplateCode("SMS_471945046")
|
||||
.setTemplateParam
|
||||
(json.toJSONString());
|
||||
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
|
||||
try {
|
||||
// 复制代码运行请自行打印 API 的返回值
|
||||
SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendReq, runtime);
|
||||
System.out.println(sendSmsResponse);
|
||||
} catch (TeaException error) {
|
||||
// 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
||||
// 错误 message
|
||||
System.out.println(error.getMessage());
|
||||
// 诊断地址
|
||||
System.out.println(error.getData().get("Recommend"));
|
||||
com.aliyun.teautil.Common.assertAsString(error.message);
|
||||
} catch (Exception _error) {
|
||||
TeaException error = new TeaException(_error.getMessage(), _error);
|
||||
// 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
||||
// 错误 message
|
||||
System.out.println(error.getMessage());
|
||||
// 诊断地址
|
||||
System.out.println(error.getData().get("Recommend"));
|
||||
com.aliyun.teautil.Common.assertAsString(error.message);
|
||||
}
|
||||
}
|
||||
public static void send3(String phone, String name, Date date,String meetingName,String thing,String place,String other) throws Exception {
|
||||
com.aliyun.dysmsapi20170525.Client client = Sample.createClient();
|
||||
// 1.发送短信
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("name",name);
|
||||
json.put("time",DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",date));
|
||||
json.put("meeting",meetingName);
|
||||
json.put("thing",thing);
|
||||
json.put("place",place);
|
||||
json.put("other",other);
|
||||
|
||||
SendSmsRequest sendReq = new SendSmsRequest()
|
||||
.setPhoneNumbers(phone)
|
||||
.setSignName("长阳智会云控")
|
||||
.setTemplateCode("SMS_472025018")
|
||||
.setTemplateParam
|
||||
(json.toJSONString());
|
||||
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
|
||||
try {
|
||||
// 复制代码运行请自行打印 API 的返回值
|
||||
SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendReq, runtime);
|
||||
System.out.println(sendSmsResponse);
|
||||
} catch (TeaException error) {
|
||||
// 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
||||
// 错误 message
|
||||
System.out.println(error.getMessage());
|
||||
// 诊断地址
|
||||
System.out.println(error.getData().get("Recommend"));
|
||||
com.aliyun.teautil.Common.assertAsString(error.message);
|
||||
} catch (Exception _error) {
|
||||
TeaException error = new TeaException(_error.getMessage(), _error);
|
||||
// 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
||||
// 错误 message
|
||||
System.out.println(error.getMessage());
|
||||
// 诊断地址
|
||||
System.out.println(error.getData().get("Recommend"));
|
||||
com.aliyun.teautil.Common.assertAsString(error.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ import com.ics.common.core.domain.IcsCustomerStaff;
|
||||
import com.ics.common.core.domain.R;
|
||||
import com.ics.common.core.page.PageDomain;
|
||||
import com.ics.common.core.page.TableSupport;
|
||||
import com.ics.common.utils.Sample;
|
||||
import com.ics.controller.mobile.pay.wx.WxPayCommon;
|
||||
import com.ics.controller.mobile.pay.wx.constant.WxNotifyConstants;
|
||||
import com.ics.controller.mobile.pay.wx.dto.WxChatBasePayDto;
|
||||
@ -70,8 +71,6 @@ public class ApiRoomContentController extends BaseController {
|
||||
@Autowired
|
||||
private IParkService parkService;
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private IRoomEquipmentService roomEquipmentService;
|
||||
|
||||
@ -208,7 +207,7 @@ public class ApiRoomContentController extends BaseController {
|
||||
*/
|
||||
@RequiresPermissions("member:center:view")
|
||||
@PostMapping("/saveChangyangMeetingRecord")
|
||||
public R saveMeetingRoomRecord(@RequestBody Reservation reservation) {
|
||||
public R saveMeetingRoomRecord(@RequestBody Reservation reservation) throws Exception {
|
||||
reservation.setStauts(Reservation.Status.APPOINTMENT);
|
||||
|
||||
|
||||
@ -224,11 +223,41 @@ public class ApiRoomContentController extends BaseController {
|
||||
|
||||
//新增预约服务数据
|
||||
|
||||
List<String> serveNames = new ArrayList<>();
|
||||
|
||||
for (ReservationServe reservationServe : reservation.getReservationServes()) {
|
||||
|
||||
reservationServe.setReservationId(reservation.getId());
|
||||
reservationServe.setParkId(reservation.getParkId());
|
||||
reservationServe.setTenantId(reservation.getTenantId());
|
||||
reservationServeService.insertReservationServe(reservationServe);
|
||||
Long serveId = reservationServe.getServeId();
|
||||
RoomServe roomServe = roomServeService.selectRoomServeById(serveId);
|
||||
if (roomServe !=null && roomServe.getServeType() == 2){
|
||||
String serveName = reservationServe.getServeName();
|
||||
serveNames.add(serveName);
|
||||
}
|
||||
}
|
||||
//判断预约服务
|
||||
Long roomContentId = reservation.getRoomContentId();
|
||||
RoomContent roomContent = roomContentService.selectRoomContentById(roomContentId);
|
||||
if (roomContent !=null){
|
||||
//获取手机号
|
||||
String expandNum = roomContent.getExpandNum();
|
||||
Date startTime = reservation.getStartTime();
|
||||
String name = customerStaff.getName();
|
||||
if (serveNames.size()>3) return R.error("预约服务不能超过3个");
|
||||
if (CollUtil.isNotEmpty(serveNames)){
|
||||
if (serveNames.size() == 1){
|
||||
Sample.send1(expandNum,name,startTime, roomContent.getMeetingName(),serveNames.get(0) );
|
||||
}else if (serveNames.size() == 2){
|
||||
Sample.send2(expandNum,name,startTime, roomContent.getMeetingName(),serveNames.get(0),serveNames.get(1));
|
||||
}else if (serveNames.size() == 3){
|
||||
Sample.send3(expandNum,name,startTime, roomContent.getMeetingName(),serveNames.get(0),serveNames.get(1),serveNames.get(2));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Long id = reservation.getId();
|
||||
|
Loading…
x
Reference in New Issue
Block a user