短信回调
This commit is contained in:
parent
0fe1363b6d
commit
50cb52feb2
@ -16,5 +16,10 @@
|
|||||||
<option name="name" value="JBoss Community repository" />
|
<option name="name" value="JBoss Community repository" />
|
||||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||||
</remote-repository>
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Central Repository" />
|
||||||
|
<option name="url" value="https://maven.aliyun.com/repository/public" />
|
||||||
|
</remote-repository>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package org.example.controller;
|
package org.example.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@ -10,6 +11,7 @@ import org.example.core.api.controller.BaseController;
|
|||||||
import org.example.dto.TaskCallbackDto;
|
import org.example.dto.TaskCallbackDto;
|
||||||
import org.example.dto.TaskCallbackUpdateDto;
|
import org.example.dto.TaskCallbackUpdateDto;
|
||||||
import org.example.entity.AIOBCallbackEntity;
|
import org.example.entity.AIOBCallbackEntity;
|
||||||
|
import org.example.entity.TaskMessageBackEntity;
|
||||||
import org.example.service.IAIOBCallbackService;
|
import org.example.service.IAIOBCallbackService;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|||||||
@ -0,0 +1,50 @@
|
|||||||
|
package org.example.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.example.core.api.ApiRest;
|
||||||
|
import org.example.core.api.controller.BaseController;
|
||||||
|
import org.example.entity.TaskMessageBackEntity;
|
||||||
|
import org.example.service.IAIOBCallbackService;
|
||||||
|
import org.example.service.TaskMessageBackService;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 短信回调接口
|
||||||
|
* @author: zh
|
||||||
|
* @create: 2026-04-29
|
||||||
|
**/
|
||||||
|
@Api(tags={"短信回调接口"})
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api")
|
||||||
|
public class TaskMessageBackController extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TaskMessageBackService taskMessageBackService;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("短信任务回调")
|
||||||
|
@PostMapping("/taskMessageBack")
|
||||||
|
public JSONObject taskMessageBack(@RequestBody JSONArray array) {
|
||||||
|
return taskMessageBackService.taskMessageBack(array);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询列表")
|
||||||
|
@PostMapping("/getMessageBackList")
|
||||||
|
public ApiRest getMessageBackList(@RequestBody TaskMessageBackEntity taskMessageBackEntity) {
|
||||||
|
return super.success(taskMessageBackService.getMessageBackList(taskMessageBackEntity));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改已读状态")
|
||||||
|
@PostMapping("/updateMessageBackReadState")
|
||||||
|
public ApiRest updateMessageBackReadState(@RequestBody TaskMessageBackEntity taskMessageBackEntity) {
|
||||||
|
return super.success(taskMessageBackService.updateMessageBackReadState(taskMessageBackEntity));
|
||||||
|
}
|
||||||
|
}
|
||||||
52
src/main/java/org/example/dto/SendSmsDto.java
Normal file
52
src/main/java/org/example/dto/SendSmsDto.java
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
package org.example.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SendSmsDto {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号码
|
||||||
|
*/
|
||||||
|
private String phone_number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送时间。
|
||||||
|
*/
|
||||||
|
private String send_time;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态报告时间。
|
||||||
|
*/
|
||||||
|
private String report_time;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否接收成功。取值: true:接收成功 false:接收失败
|
||||||
|
*/
|
||||||
|
private String success;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态报告编码。
|
||||||
|
*/
|
||||||
|
private String err_code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态报告说明。
|
||||||
|
*/
|
||||||
|
private String err_msg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信长度。短信内容长度计算规则。
|
||||||
|
*/
|
||||||
|
private String sms_size;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送回执ID,即发送流水号
|
||||||
|
*/
|
||||||
|
private String biz_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户序列号。
|
||||||
|
*/
|
||||||
|
private String out_id;
|
||||||
|
}
|
||||||
40
src/main/java/org/example/entity/TaskMessageBackEntity.java
Normal file
40
src/main/java/org/example/entity/TaskMessageBackEntity.java
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package org.example.entity;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("message_back_data")
|
||||||
|
public class TaskMessageBackEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回调数据
|
||||||
|
*/
|
||||||
|
private JSONArray messageBackData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已读状态,0:未读,1:已读
|
||||||
|
*/
|
||||||
|
private Integer readState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private Date updateDate;
|
||||||
|
}
|
||||||
13
src/main/java/org/example/mapper/TaskMessageBackMapper.java
Normal file
13
src/main/java/org/example/mapper/TaskMessageBackMapper.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package org.example.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.example.entity.TaskMessageBackEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface TaskMessageBackMapper extends BaseMapper<TaskMessageBackEntity> {
|
||||||
|
|
||||||
|
List<TaskMessageBackEntity> getMessageBackList(TaskMessageBackEntity taskMessageBackEntity);
|
||||||
|
|
||||||
|
Integer updateMessageBackReadState(TaskMessageBackEntity taskMessageBackEntity);
|
||||||
|
}
|
||||||
@ -1,11 +1,13 @@
|
|||||||
package org.example.service;
|
package org.example.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.example.dto.TaskCallbackDataDto;
|
import org.example.dto.TaskCallbackDataDto;
|
||||||
import org.example.dto.TaskCallbackUpdateDto;
|
import org.example.dto.TaskCallbackUpdateDto;
|
||||||
import org.example.entity.AIOBCallbackEntity;
|
import org.example.entity.AIOBCallbackEntity;
|
||||||
|
import org.example.entity.TaskMessageBackEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 百度外呼回调service
|
* @description: 百度外呼回调service
|
||||||
|
|||||||
@ -0,0 +1,17 @@
|
|||||||
|
package org.example.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.example.entity.TaskMessageBackEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface TaskMessageBackService extends IService<TaskMessageBackEntity> {
|
||||||
|
|
||||||
|
JSONObject taskMessageBack(JSONArray array);
|
||||||
|
|
||||||
|
List<TaskMessageBackEntity> getMessageBackList(TaskMessageBackEntity taskMessageBackEntity);
|
||||||
|
|
||||||
|
Integer updateMessageBackReadState(TaskMessageBackEntity taskMessageBackEntity);
|
||||||
|
}
|
||||||
@ -1,6 +1,7 @@
|
|||||||
package org.example.service.impl;
|
package org.example.service.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -9,7 +10,9 @@ import javax.annotation.Resource;
|
|||||||
import org.example.dto.TaskCallbackDataDto;
|
import org.example.dto.TaskCallbackDataDto;
|
||||||
import org.example.dto.TaskCallbackUpdateDto;
|
import org.example.dto.TaskCallbackUpdateDto;
|
||||||
import org.example.entity.AIOBCallbackEntity;
|
import org.example.entity.AIOBCallbackEntity;
|
||||||
|
import org.example.entity.TaskMessageBackEntity;
|
||||||
import org.example.mapper.AIOBCallbackMapper;
|
import org.example.mapper.AIOBCallbackMapper;
|
||||||
|
import org.example.mapper.TaskMessageBackMapper;
|
||||||
import org.example.service.IAIOBCallbackService;
|
import org.example.service.IAIOBCallbackService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@ -24,6 +27,7 @@ public class AIOBCallbackServiceImpl extends ServiceImpl<AIOBCallbackMapper, AIO
|
|||||||
@Resource
|
@Resource
|
||||||
private AIOBCallbackMapper aiobCallbackMapper;
|
private AIOBCallbackMapper aiobCallbackMapper;
|
||||||
|
|
||||||
|
|
||||||
@Override public JSONObject taskCallBack(Integer callbackType, TaskCallbackDataDto data) {
|
@Override public JSONObject taskCallBack(Integer callbackType, TaskCallbackDataDto data) {
|
||||||
JSONObject retObj = new JSONObject();
|
JSONObject retObj = new JSONObject();
|
||||||
retObj.fluentPut("code", 200).fluentPut("msg", "success");
|
retObj.fluentPut("code", 200).fluentPut("msg", "success");
|
||||||
|
|||||||
@ -0,0 +1,43 @@
|
|||||||
|
package org.example.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.example.entity.TaskMessageBackEntity;
|
||||||
|
import org.example.mapper.TaskMessageBackMapper;
|
||||||
|
import org.example.service.TaskMessageBackService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class TaskMessageBackServiceImpl extends ServiceImpl<TaskMessageBackMapper, TaskMessageBackEntity> implements TaskMessageBackService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TaskMessageBackMapper taskMessageBackMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject taskMessageBack(JSONArray array) {
|
||||||
|
TaskMessageBackEntity taskMessageBackEntity = new TaskMessageBackEntity();
|
||||||
|
taskMessageBackEntity.setMessageBackData(array);
|
||||||
|
taskMessageBackEntity.setReadState(0);
|
||||||
|
taskMessageBackEntity.setCreateDate(new Date());
|
||||||
|
taskMessageBackMapper.insert(taskMessageBackEntity);
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("code", 0);
|
||||||
|
json.put("msg", "接收成功");
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TaskMessageBackEntity> getMessageBackList(TaskMessageBackEntity taskMessageBackEntity) {
|
||||||
|
return taskMessageBackMapper.getMessageBackList(taskMessageBackEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer updateMessageBackReadState(TaskMessageBackEntity taskMessageBackEntity) {
|
||||||
|
return taskMessageBackMapper.updateMessageBackReadState(taskMessageBackEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
32
src/main/resources/mapper/TaskMessageBackMapper.xml
Normal file
32
src/main/resources/mapper/TaskMessageBackMapper.xml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.example.mapper.TaskMessageBackMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultMap" type="org.example.entity.TaskMessageBackEntity">
|
||||||
|
<id column="id" property="id" />
|
||||||
|
<result column="message_back_data" property="messageBackData" />
|
||||||
|
<result column="read_state" property="readState" />
|
||||||
|
<result column="create_date" property="createDate" />
|
||||||
|
<result column="update_date" property="updateDate" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 通用查询结果列 -->
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, message_back_data, read_state, create_date, update_date
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="getMessageBackList" resultType="org.example.entity.TaskMessageBackEntity">
|
||||||
|
select * from message_back_data
|
||||||
|
<where>
|
||||||
|
<if test="readState != null">
|
||||||
|
and read_state = #{readState}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateMessageBackReadState">
|
||||||
|
update message_back_data set read_state = #{readState}, update_date = sysdate()
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue
Block a user