Commit 3ea7a274 authored by 赵啸非's avatar 赵啸非

添加消息发送系统

parent 277cd703
...@@ -100,7 +100,10 @@ ...@@ -100,7 +100,10 @@
<groupId>io.micrometer</groupId> <groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId> <artifactId>micrometer-registry-prometheus</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-openfeign-core</artifactId>
</dependency>
</dependencies> </dependencies>
......
This diff is collapsed.
...@@ -189,7 +189,11 @@ ...@@ -189,7 +189,11 @@
<artifactId>DmJdbcDriver18</artifactId> <artifactId>DmJdbcDriver18</artifactId>
<version>8.1.1.193</version> <version>8.1.1.193</version>
</dependency> </dependency>
</dependencies> <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
</dependencies>
<build> <build>
<resources> <resources>
......
package com.mortals.xhx.busiz.req;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
/**
* 短信发送类
*
* @author:
* @date: 2022/9/7 14:35
*/
@Data
public class SmsThirdPartyReq {
/**
*
*/
@JSONField(serialize=false)
private Long alarmSmsSendId;
/**
* appid
*/
private String appid;
/**
* 手机号码
*/
private String phone;
/**
* 模板号
*/
private String type;
/**
* 内容
*/
private String json;
public static void main(String[] args) {
SmsThirdPartyReq smsThirdPartyReq = new SmsThirdPartyReq();
smsThirdPartyReq.setAlarmSmsSendId(0L);
smsThirdPartyReq.setAppid("12");
smsThirdPartyReq.setPhone("31");
smsThirdPartyReq.setType("123");
smsThirdPartyReq.setJson("13213");
System.out.println(JSON.toJSONString(smsThirdPartyReq));
}
}
package com.mortals.xhx.busiz.rsp;
import lombok.Data;
/**
* @author karlhoo
*/
@Data
public class ApiSmsResp<T> {
/**
* 结果编码
*/
private int code;
/**
* 结果描述
*/
private String message;
/**
* 响应数据
*/
private T data;
}
package com.mortals.xhx.busiz.rsp.wait;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import java.util.Date;
/**
* 差评信息
* @author: zxfei
* @date: 2025/4/3 16:39
*/
@Data
public class CpPersonInfo {
@JSONField(name = "id")
private Long pjId;
@JSONField(name = "siteid")
private Long siteId;
@JSONField(name = "peopleid")
private Long peopleId;
@JSONField(name = "option_id")
private String optionId;
@JSONField(name = "source")
private String source;
@JSONField(name = "queueid")
private String queueid;
@JSONField(name = "type")
private String type;
@JSONField(name = "window_name")
private String windowName;
@JSONField(name = "workman_name")
private String workmanName;
@JSONField(name = "workman_number")
private String workmanNumber;
@JSONField(name = "section")
private String section;
@JSONField(name = "business_name")
private String businessName;
@JSONField(name = "content")
private String content;
@JSONField(name = "flounum")
private String flounum;
@JSONField(name = "idcardData_PhotoFileName")
private String idcardDataPhotoFileName;
@JSONField(name = "create_time",format = "yyyy-MM-dd HH:mm:ss")
private Date cpTime;
}
\ No newline at end of file
package com.mortals.xhx.busiz.rsp.wait;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import java.util.Date;
@Data
public class EndPersonInfo {
@JSONField(name = "id")
private Long endId;
@JSONField(name = "endtime", format = "yyyy-MM-dd HH:mm:ss")
private Date endtime;
@JSONField(name = "avg_handle_time")
private Integer avgHandleTime;
}
\ No newline at end of file
package com.mortals.xhx.busiz.rsp.wait;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import java.util.Date;
@Data
public class FinPersonInfo {
@JSONField(name = "id")
private Long waitId;
@JSONField(name = "calltime", format = "yyyy-MM-dd HH:mm:ss")
private Date calltime;
/**
* 平均等待时长
*/
@JSONField(name = "avg_wait_time")
private Integer avgWaitTime;
@JSONField(name = "window_num")
private String windowNum;
@JSONField(name = "workman_name")
private String workmanName;
}
\ No newline at end of file
package com.mortals.xhx.busiz.rsp.wait;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import java.util.Date;
@Data
public class WaitPersonInfo {
@JSONField(name = "birthday")
private int birthday;
@JSONField(name = "business_name")
private String businessName;
@JSONField(name = "flownum")
private String flowNum;
@JSONField(name = "idcard_IDCardNo")
private String idcardIDCardNo;
@JSONField(name = "businessid")
private Long businessId;
@JSONField(name = "count")
private String count;
@JSONField(name = "idcard_Name")
private String idcardName;
@JSONField(name = "idcard_Address")
private String idcardAddress;
@JSONField(name = "idcard_Sex")
private String idcardSex;
@JSONField(name = "peopleid")
private String peopleId;
@JSONField(name = "phone")
private String phone;
@JSONField(name = "id")
private Long waitId;
@JSONField(name = "idcardData_PhotoFileName")
private String idcardDataPhotoFileName;
@JSONField(name = "taketime",format = "yyyy-MM-dd HH:mm:ss")
private Date takeTime;
}
\ No newline at end of file
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 消息发送渠道,SMS(短信)、EMAIL(邮件)、PUSH(推送通知)枚举类
*
* @author zxfei
*/
public enum ChannelEnum {
短信("短信", "短信");
private String value;
private String desc;
ChannelEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static ChannelEnum getByValue(String value) {
for (ChannelEnum channelEnum : ChannelEnum.values()) {
if (channelEnum.getValue() == value) {
return channelEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(String... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (ChannelEnum item : ChannelEnum.values()) {
try {
boolean hasE = false;
for (String e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 是否启用该发送服务(0.否,1.是)枚举类
*
* @author zxfei
*/
public enum EnabledEnum {
(0, "否"),
(1, "是");
private Integer value;
private String desc;
EnabledEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static EnabledEnum getByValue(Integer value) {
for (EnabledEnum enabledEnum : EnabledEnum.values()) {
if (enabledEnum.getValue() == value) {
return enabledEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (EnabledEnum item : EnabledEnum.values()) {
try {
boolean hasE = false;
for (Integer e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 消息类型(等待超时预警,办理超时预警,差评预警)枚举类
*
* @author zxfei
*/
public enum MessageTypeEnum {
等待超时预警("等待超时预警", "等待超时预警"),
办理超时预警("办理超时预警", "办理超时预警"),
差评预警("差评预警", "差评预警");
private String value;
private String desc;
MessageTypeEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static MessageTypeEnum getByValue(String value) {
for (MessageTypeEnum messageTypeEnum : MessageTypeEnum.values()) {
if (messageTypeEnum.getValue() == value) {
return messageTypeEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(String... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (MessageTypeEnum item : MessageTypeEnum.values()) {
try {
boolean hasE = false;
for (String e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 优先级 (0.普通,1.优先,2.紧急)枚举类
*
* @author zxfei
*/
public enum PriorityEnum {
普通(0, "普通"),
优先(1, "优先"),
紧急(2, "紧急");
private Integer value;
private String desc;
PriorityEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static PriorityEnum getByValue(Integer value) {
for (PriorityEnum priorityEnum : PriorityEnum.values()) {
if (priorityEnum.getValue() == value) {
return priorityEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (PriorityEnum item : PriorityEnum.values()) {
try {
boolean hasE = false;
for (Integer e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 办理状态(排队中.排队中,办理中.办理中,接件结束.接件结束)枚举类
*
* @author zxfei
*/
public enum ProcessStatusEnum {
排队中("排队中", "排队中"),
办理中("办理中", "办理中"),
办理结束("办理结束", "办理结束"),
接件结束("接件结束", "接件结束");
private String value;
private String desc;
ProcessStatusEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static ProcessStatusEnum getByValue(String value) {
for (ProcessStatusEnum processStatusEnum : ProcessStatusEnum.values()) {
if (processStatusEnum.getValue() == value) {
return processStatusEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(String... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (ProcessStatusEnum item : ProcessStatusEnum.values()) {
try {
boolean hasE = false;
for (String e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 状态 (0.待发送,1.发送中,2.成功,3.失败)枚举类
*
* @author zxfei
*/
public enum SendStatusEnum {
待发送(0, "待发送"),
发送中(1, "发送中"),
成功(2, "成功"),
失败(3, "失败");
private Integer value;
private String desc;
SendStatusEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static SendStatusEnum getByValue(Integer value) {
for (SendStatusEnum sendStatusEnum : SendStatusEnum.values()) {
if (sendStatusEnum.getValue() == value) {
return sendStatusEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (SendStatusEnum item : SendStatusEnum.values()) {
try {
boolean hasE = false;
for (Integer e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
...@@ -14,4 +14,23 @@ public class RedisKey { ...@@ -14,4 +14,23 @@ public class RedisKey {
public static final String KEY_REFERERS_CACHE = "referers"; public static final String KEY_REFERERS_CACHE = "referers";
/**
* 排队等待人群
*/
public static final String KEY_WAITNUM_LIST_CACHE = "takeData";
/**
* 完成排队人群
*/
public static final String KEY_FIN_LIST_CACHE = "callData";
/**
* 完成业务办理人群
*/
public static final String KEY_FIN_DOWORK_LIST_CACHE = "endData";
/**
* 差评人群
*/
public static final String KEY_CP_LIST_CACHE = "cpData";
} }
package com.mortals.xhx.common.utils;
import com.mortals.xhx.module.message.model.MessageTaskEntity;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicInteger;
@Slf4j
@Data
public class SmsQueueManager {
/**
* 响应队列
*/
public static Queue<MessageTaskEntity> respQueue = new ConcurrentLinkedQueue<>();
/**
* 待提交短信网关队列大小 加入队列时增加,取出队列时减少
*/
public static AtomicInteger sendQueueSize = new AtomicInteger(0);
/**
* 状态报告队列
*/
public static Queue<MessageTaskEntity> rptQueue = new ConcurrentLinkedQueue<>();
/**
* 状态报告更新队列
*/
public static Queue<MessageTaskEntity> rptUpdateQueue = new ConcurrentLinkedQueue<>();
/**
* 获取发送队列大小
*
* @return
*/
public static int getSendQueueSize() {
return sendQueueSize.get();
}
/**
* 取响应队列大小
*
* @return
*/
public static int getRespQueueSize() {
return respQueue.size();
}
/**
* 取出 响应
*
* @return
*/
public static MessageTaskEntity pollRespQueue() {
return respQueue.poll();
}
/**
* 放入响应
*
* @param SmsGateRespQueueEntity
*/
public static void offerRespQueue(MessageTaskEntity SmsGateRespQueueEntity) {
if (null == SmsGateRespQueueEntity) {
return;
}
respQueue.offer(SmsGateRespQueueEntity);
}
}
...@@ -34,6 +34,10 @@ public class ComsumerBurySaveService implements IApplicationStartedService { ...@@ -34,6 +34,10 @@ public class ComsumerBurySaveService implements IApplicationStartedService {
@Override @Override
public void start() { public void start() {
Thread sendThread = new Thread(new Runnable() { Thread sendThread = new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
......
...@@ -27,7 +27,7 @@ public class DemoStartService implements IApplicationService { ...@@ -27,7 +27,7 @@ public class DemoStartService implements IApplicationService {
@Override @Override
public void start() { public void start() {
ThreadPool.getInstance().init(6); ThreadPool.getInstance().init(10);
logger.info("开始服务..[配置已加载完成,但部分框架还未初始化,比如:Kafka]"); logger.info("开始服务..[配置已加载完成,但部分框架还未初始化,比如:Kafka]");
} }
......
...@@ -3,8 +3,12 @@ package com.mortals.xhx.daemon.applicationservice; ...@@ -3,8 +3,12 @@ package com.mortals.xhx.daemon.applicationservice;
import cn.hutool.core.lang.Validator; import cn.hutool.core.lang.Validator;
import cn.hutool.core.net.NetUtil; import cn.hutool.core.net.NetUtil;
import com.mortals.framework.service.ICacheService; import com.mortals.framework.service.ICacheService;
import com.mortals.framework.util.ThreadPool;
import com.mortals.xhx.common.key.RedisKey; import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.utils.CipherUtil; import com.mortals.xhx.common.utils.CipherUtil;
import com.mortals.xhx.common.utils.SmsQueueManager;
import com.mortals.xhx.module.message.model.MessageTaskEntity;
import com.mortals.xhx.module.message.service.MessageTaskService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
...@@ -42,6 +46,10 @@ public class DemoStartedService implements IApplicationStartedService { ...@@ -42,6 +46,10 @@ public class DemoStartedService implements IApplicationStartedService {
@Autowired @Autowired
private ICacheService cacheService; private ICacheService cacheService;
@Autowired
private MessageTaskService messageTaskService;
protected Boolean stopped = false;
@Override @Override
public void start() { public void start() {
...@@ -67,6 +75,27 @@ public class DemoStartedService implements IApplicationStartedService { ...@@ -67,6 +75,27 @@ public class DemoStartedService implements IApplicationStartedService {
} }
} }
//启动短信发送响应更新线程
ThreadPool.getInstance().execute(() -> {
int waitTime = 1000;
while (!stopped) {
try {
MessageTaskEntity message = SmsQueueManager.pollRespQueue();
if (!ObjectUtils.isEmpty(message)) {
messageTaskService.update(message, null);
}
} catch (Exception e) {
if (!stopped) {
try {
Thread.sleep(waitTime);
} catch (InterruptedException e2) {
}
}
}
}
});
log.info("开始服务..[配置已加载完成,并且所有框架都已经初始化]"); log.info("开始服务..[配置已加载完成,并且所有框架都已经初始化]");
} }
......
package com.mortals.xhx.module.cp.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.cp.model.CpRecordsEntity;
import java.util.List;
/**
* 差评差评记录Dao
* 差评差评记录 DAO接口
*
* @author zxfei
* @date 2025-04-10
*/
public interface CpRecordsDao extends ICRUDDao<CpRecordsEntity,Long>{
}
package com.mortals.xhx.module.cp.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.cp.dao.CpRecordsDao;
import com.mortals.xhx.module.cp.model.CpRecordsEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 差评差评记录DaoImpl DAO接口
*
* @author zxfei
* @date 2025-04-10
*/
@Repository("cpRecordsDao")
public class CpRecordsDaoImpl extends BaseCRUDDaoMybatis<CpRecordsEntity,Long> implements CpRecordsDao {
}
package com.mortals.xhx.module.cp.model;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import java.math.BigDecimal;
import cn.hutool.core.date.DateUtil;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.cp.model.vo.CpRecordsVo;
import lombok.Data;
/**
* 差评差评记录实体对象
*
* @author zxfei
* @date 2025-04-10
*/
@Data
public class CpRecordsEntity extends CpRecordsVo {
private static final long serialVersionUID = 1L;
/**
* 站点Id
*/
private Long siteId;
/**
* 站点名称
*/
private String siteName;
/**
* 个人信息ID
*/
private Long personId;
/**
* 评价号ID与办理号id一致
*/
private Long pjId;
/**
* 姓名
*/
private String name;
/**
* 联系方式
*/
private String contact;
/**
* 身份证号码
*/
private String idCard;
/**
* 窗口id
*/
private Long windowId;
/**
* 窗口名称
*/
private String windowName;
/**
* 部门
*/
private String section;
/**
* 编号
*/
private String flounum;
/**
* 评价选项
*/
private String assessment;
/**
* 评价类型
*/
private String type;
/**
* 评价内容
*/
private String content;
/**
* 来源
*/
private String source;
/**
* 评价时间
*/
private Date pjTime;
/**
* 业务Id
*/
private Long bussinessId;
/**
* 预约业务
*/
private String bussinessName;
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof CpRecordsEntity) {
CpRecordsEntity tmp = (CpRecordsEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.siteId = null;
this.siteName = "";
this.personId = null;
this.pjId = null;
this.name = "";
this.contact = "";
this.idCard = "";
this.windowId = null;
this.windowName = "";
this.section = "";
this.flounum = "";
this.assessment = "";
this.type = "";
this.content = "";
this.source = "";
this.pjTime = null;
this.bussinessId = null;
this.bussinessName = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.cp.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.cp.model.CpRecordsEntity;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import com.mortals.framework.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
/**
* 差评差评记录视图对象
*
* @author zxfei
* @date 2025-04-10
*/
@Data
public class CpRecordsVo extends BaseEntityLong {
/** 主键ID,主键,自增长列表 */
private List <Long> idList;
}
\ No newline at end of file
package com.mortals.xhx.module.cp.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.cp.model.CpRecordsEntity;
import com.mortals.xhx.module.cp.dao.CpRecordsDao;
/**
* CpRecordsService
*
* 差评差评记录 service接口
*
* @author zxfei
* @date 2025-04-10
*/
public interface CpRecordsService extends ICRUDService<CpRecordsEntity,Long>{
CpRecordsDao getDao();
}
\ No newline at end of file
package com.mortals.xhx.module.cp.service.impl;
import com.mortals.framework.model.PageInfo;
import org.springframework.beans.BeanUtils;
import java.util.function.Function;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.cp.dao.CpRecordsDao;
import com.mortals.xhx.module.cp.model.CpRecordsEntity;
import com.mortals.xhx.module.cp.service.CpRecordsService;
import lombok.extern.slf4j.Slf4j;
/**
* CpRecordsService
* 差评差评记录 service实现
*
* @author zxfei
* @date 2025-04-10
*/
@Service("cpRecordsService")
@Slf4j
public class CpRecordsServiceImpl extends AbstractCRUDServiceImpl<CpRecordsDao, CpRecordsEntity, Long> implements CpRecordsService {
}
\ No newline at end of file
package com.mortals.xhx.module.cp.web;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.cp.model.CpRecordsEntity;
import com.mortals.xhx.module.cp.service.CpRecordsService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
import com.mortals.xhx.common.code.*;
/**
*
* 差评差评记录
*
* @author zxfei
* @date 2025-04-10
*/
@RestController
@RequestMapping("cp/records")
public class CpRecordsController extends BaseCRUDJsonBodyMappingController<CpRecordsService,CpRecordsEntity,Long> {
@Autowired
private ParamService paramService;
public CpRecordsController(){
super.setModuleDesc( "差评差评记录");
}
@Override
protected void init(Map<String, Object> model, Context context) {
super.init(model, context);
}
}
\ No newline at end of file
package com.mortals.xhx.module.dowork.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.dowork.model.DoworkRecordsEntity;
import java.util.List;
/**
* 排号办理记录Dao
* 排号办理记录 DAO接口
*
* @author zxfei
* @date 2025-04-10
*/
public interface DoworkRecordsDao extends ICRUDDao<DoworkRecordsEntity,Long>{
}
package com.mortals.xhx.module.dowork.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.dowork.dao.DoworkRecordsDao;
import com.mortals.xhx.module.dowork.model.DoworkRecordsEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 排号办理记录DaoImpl DAO接口
*
* @author zxfei
* @date 2025-04-10
*/
@Repository("doworkRecordsDao")
public class DoworkRecordsDaoImpl extends BaseCRUDDaoMybatis<DoworkRecordsEntity,Long> implements DoworkRecordsDao {
}
package com.mortals.xhx.module.dowork.model;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import java.math.BigDecimal;
import cn.hutool.core.date.DateUtil;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.dowork.model.vo.DoworkRecordsVo;
import lombok.Data;
/**
* 排号办理记录实体对象
*
* @author zxfei
* @date 2025-04-10
*/
@Data
public class DoworkRecordsEntity extends DoworkRecordsVo {
private static final long serialVersionUID = 1L;
/**
* 站点Id
*/
private Long siteId;
/**
* 站点名称
*/
private String siteName;
/**
* 个人信息ID
*/
private Long personId;
/**
* 等待流水号ID
*/
private Long waitId;
/**
* 姓名
*/
private String name;
/**
* 联系方式
*/
private String contact;
/**
* 身份证号码
*/
private String idCard;
/**
* 业务Id
*/
private Long bussinessId;
/**
* 预约业务
*/
private String bussinessName;
/**
* 窗口编号
*/
private String windowNum;
/**
* 窗口名称
*/
private String windowName;
/**
* 工作人员名称
*/
private String workman;
/**
* 办理业务
*/
private String service;
/**
* 排队编号
*/
private String queueNo;
/**
* 排队开始时间
*/
private Date takeTime;
/**
* 排队结束时间
*/
private Date callTime;
/**
* 办理结束时间
*/
private Date endTime;
/**
* 最终等待时长,秒
*/
private Integer waitTime;
/**
* 最终办理时长,秒
*/
private Integer endDureTime;
/**
* 平均等待时间
*/
private Integer waitDureAlarmAvl;
/**
* 平均办理时间
*/
private Integer endDureAlarmAvl;
/**
* 办理状态(排队中,办理中,接件结束)
*/
private String processStatus;
/**
* 备注
*/
private String remark;
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof DoworkRecordsEntity) {
DoworkRecordsEntity tmp = (DoworkRecordsEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.siteId = null;
this.siteName = "";
this.personId = null;
this.waitId = null;
this.name = "";
this.contact = "";
this.idCard = "";
this.bussinessId = null;
this.bussinessName = "";
this.windowNum = "";
this.windowName = "";
this.workman = "";
this.service = "";
this.queueNo = "";
this.takeTime = null;
this.callTime = null;
this.endTime = null;
this.waitTime = 0;
this.endDureTime = 0;
this.waitDureAlarmAvl = 0;
this.endDureAlarmAvl = 0;
this.processStatus = "排队中";
this.remark = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.dowork.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.dowork.model.DoworkRecordsEntity;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import com.mortals.framework.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
/**
* 排号办理记录视图对象
*
* @author zxfei
* @date 2025-04-10
*/
@Data
public class DoworkRecordsVo extends BaseEntityLong {
/** 主键ID,主键,自增长列表 */
private List <Long> idList;
}
\ No newline at end of file
package com.mortals.xhx.module.dowork.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.dowork.model.DoworkRecordsEntity;
import com.mortals.xhx.module.dowork.dao.DoworkRecordsDao;
/**
* DoworkRecordsService
*
* 排号办理记录 service接口
*
* @author zxfei
* @date 2025-04-10
*/
public interface DoworkRecordsService extends ICRUDService<DoworkRecordsEntity,Long>{
DoworkRecordsDao getDao();
}
\ No newline at end of file
package com.mortals.xhx.module.dowork.service.impl;
import com.mortals.framework.model.PageInfo;
import org.springframework.beans.BeanUtils;
import java.util.function.Function;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.dowork.dao.DoworkRecordsDao;
import com.mortals.xhx.module.dowork.model.DoworkRecordsEntity;
import com.mortals.xhx.module.dowork.service.DoworkRecordsService;
import lombok.extern.slf4j.Slf4j;
/**
* DoworkRecordsService
* 排号办理记录 service实现
*
* @author zxfei
* @date 2025-04-10
*/
@Service("doworkRecordsService")
@Slf4j
public class DoworkRecordsServiceImpl extends AbstractCRUDServiceImpl<DoworkRecordsDao, DoworkRecordsEntity, Long> implements DoworkRecordsService {
}
\ No newline at end of file
package com.mortals.xhx.module.dowork.web;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.dowork.model.DoworkRecordsEntity;
import com.mortals.xhx.module.dowork.service.DoworkRecordsService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
import com.mortals.xhx.common.code.*;
/**
*
* 排号办理记录
*
* @author zxfei
* @date 2025-04-10
*/
@RestController
@RequestMapping("dowork/records")
public class DoworkRecordsController extends BaseCRUDJsonBodyMappingController<DoworkRecordsService,DoworkRecordsEntity,Long> {
@Autowired
private ParamService paramService;
public DoworkRecordsController(){
super.setModuleDesc( "排号办理记录");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "processStatus", ProcessStatusEnum.getEnumMap());
super.init(model, context);
}
}
\ No newline at end of file
package com.mortals.xhx.module.message.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.message.model.MessageConfigEntity;
import java.util.List;
/**
* 消息发送配置Dao
* 消息发送配置 DAO接口
*
* @author zxfei
* @date 2025-04-10
*/
public interface MessageConfigDao extends ICRUDDao<MessageConfigEntity,Long>{
}
package com.mortals.xhx.module.message.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.message.model.MessageTaskEntity;
import java.util.List;
/**
* 消息任务Dao
* 消息任务 DAO接口
*
* @author zxfei
* @date 2025-04-10
*/
public interface MessageTaskDao extends ICRUDDao<MessageTaskEntity,Long>{
}
package com.mortals.xhx.module.message.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.message.dao.MessageConfigDao;
import com.mortals.xhx.module.message.model.MessageConfigEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 消息发送配置DaoImpl DAO接口
*
* @author zxfei
* @date 2025-04-10
*/
@Repository("messageConfigDao")
public class MessageConfigDaoImpl extends BaseCRUDDaoMybatis<MessageConfigEntity,Long> implements MessageConfigDao {
}
package com.mortals.xhx.module.message.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.message.dao.MessageTaskDao;
import com.mortals.xhx.module.message.model.MessageTaskEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 消息任务DaoImpl DAO接口
*
* @author zxfei
* @date 2025-04-10
*/
@Repository("messageTaskDao")
public class MessageTaskDaoImpl extends BaseCRUDDaoMybatis<MessageTaskEntity,Long> implements MessageTaskDao {
}
package com.mortals.xhx.module.message.model;
import java.util.List;
import java.util.ArrayList;
import java.math.BigDecimal;
import cn.hutool.core.date.DateUtil;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.message.model.vo.MessageConfigVo;
import lombok.Data;
/**
* 消息发送配置实体对象
*
* @author zxfei
* @date 2025-04-10
*/
@Data
public class MessageConfigEntity extends MessageConfigVo {
private static final long serialVersionUID = 1L;
/**
* 站点ID
*/
private Long siteId;
/**
* 站点名称
*/
private String siteName;
/**
* 站点编码
*/
private String siteCode;
/**
* 短信消息模板ID
*/
private Long templateId;
/**
* 应用平台标识
*/
private String appName;
/**
* 消息类型(等待超时预警,办理超时预警,差评预警)
*/
private String messageType;
/**
* 接收者信息,例如手机号、邮箱或用户 ID,具体格式依据模板类型SMS 为手机号,EMAIL 为邮箱,PUSH 为用户 ID
*/
private String recipient;
/**
* 消息发送对象
*/
private String msgRecipients;
/**
* 消息发送渠道,SMS(短信)、EMAIL(邮件)、PUSH(推送通知)
*/
private String channel;
/**
* 是否启用该发送服务(0.否,1.是)
*/
private Integer enabled;
/**
* 备注
*/
private String remark;
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof MessageConfigEntity) {
MessageConfigEntity tmp = (MessageConfigEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.siteId = null;
this.siteName = "";
this.siteCode = "";
this.templateId = null;
this.appName = "";
this.messageType = "等待超时预警";
this.recipient = "";
this.msgRecipients = "";
this.channel = "SMS";
this.enabled = 1;
this.remark = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.message.model;
import java.util.List;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import java.math.BigDecimal;
import cn.hutool.core.date.DateUtil;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.message.model.vo.MessageTaskVo;
import com.mortals.xhx.module.message.model.MessageConfigEntity;
import lombok.Data;
/**
* 消息任务实体对象
*
* @author zxfei
* @date 2025-04-10
*/
@Data
public class MessageTaskEntity extends MessageTaskVo {
private static final long serialVersionUID = 1L;
/**
* 消息发送配置ID
*/
private Long msgConfId;
/**
* 站点ID
*/
private Long siteId;
/**
* 站点名称
*/
private String siteName;
/**
* 站点编码
*/
private String siteCode;
/**
* 应用平台标识
*/
private String appName;
/**
* 消息类型
*/
private String messageType;
/**
* 消息发送对象
*/
private String msgRecipients;
/**
* 消息发送渠道,SMS(短信)、EMAIL(邮件)、PUSH(推送通知)
*/
private String channel;
/**
* 是否启用该发送服务(0.否,1.是)
*/
private Integer enabled;
/**
* 提醒时间
*/
private Date alarmTime;
/**
* 接收者信息,例如手机号、邮箱或用户 ID,具体格式依据模板类型,SMS 为手机号,EMAIL 为邮箱,PUSH 为用户ID
*/
private String recipient;
/**
* 动态参数,用于替换消息模板中的占位符。例如:{“name“: “张三“, “code“: “123456“}
*/
private String parameters;
/**
* 详细内容
*/
private String content;
/**
* 优先级 (0.普通,1.优先,2.紧急)
*/
private Integer priority;
/**
* 状态 (0.待发送,1.发送中,2.成功,3.失败)
*/
private Integer sendStatus;
/**
* 发送时间
*/
private Date sendTime;
/**
* 返回的响应结果,记录发送的详细反馈信息
*/
private String response;
/**
* 错误代码,标识具体的失败原因。
*/
private String errorCode;
/**
* 错误描述信息,对 error_code 进行补充说明
*/
private String errorMsg;
/**
* 任务重试次数,默认值为 0,用于防止无限重试。
*/
private Integer retryCount;
/**
* 消息发送配置信息
*/
private MessageConfigEntity messageConfigEntity=new MessageConfigEntity();
public MessageConfigEntity getMessageConfigEntity(){
return messageConfigEntity;
}
public void setMessageConfigEntity(MessageConfigEntity messageConfigEntity){
this.messageConfigEntity = messageConfigEntity;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof MessageTaskEntity) {
MessageTaskEntity tmp = (MessageTaskEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.msgConfId = null;
this.siteId = null;
this.siteName = "";
this.siteCode = "";
this.appName = "";
this.messageType = "";
this.msgRecipients = "";
this.channel = "SMS";
this.enabled = 0;
this.alarmTime = null;
this.recipient = "";
this.parameters = "";
this.content = "";
this.priority = 0;
this.sendStatus = 0;
this.sendTime = null;
this.response = "";
this.errorCode = "";
this.errorMsg = "";
this.retryCount = 0;
}
}
\ No newline at end of file
package com.mortals.xhx.module.message.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.message.model.MessageConfigEntity;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import com.mortals.framework.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
/**
* 消息发送配置视图对象
*
* @author zxfei
* @date 2025-04-10
*/
@Data
public class MessageConfigVo extends BaseEntityLong {
/** 序号,主键,自增长列表 */
private List <Long> idList;
}
\ No newline at end of file
package com.mortals.xhx.module.message.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.message.model.MessageTaskEntity;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import com.mortals.framework.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
/**
* 消息任务视图对象
*
* @author zxfei
* @date 2025-04-10
*/
@Data
public class MessageTaskVo extends BaseEntityLong {
/** id列表 */
private List <Long> idList;
}
\ No newline at end of file
package com.mortals.xhx.module.message.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.message.model.MessageConfigEntity;
import com.mortals.xhx.module.message.dao.MessageConfigDao;
/**
* MessageConfigService
*
* 消息发送配置 service接口
*
* @author zxfei
* @date 2025-04-10
*/
public interface MessageConfigService extends ICRUDService<MessageConfigEntity,Long>{
MessageConfigDao getDao();
}
\ No newline at end of file
package com.mortals.xhx.module.message.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.message.model.MessageTaskEntity;
import com.mortals.xhx.module.message.dao.MessageTaskDao;
/**
* MessageTaskService
*
* 消息任务 service接口
*
* @author zxfei
* @date 2025-04-10
*/
public interface MessageTaskService extends ICRUDService<MessageTaskEntity,Long>{
MessageTaskDao getDao();
}
\ No newline at end of file
package com.mortals.xhx.module.message.service.impl;
import com.mortals.framework.model.PageInfo;
import org.springframework.beans.BeanUtils;
import java.util.function.Function;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.message.dao.MessageConfigDao;
import com.mortals.xhx.module.message.model.MessageConfigEntity;
import com.mortals.xhx.module.message.service.MessageConfigService;
import lombok.extern.slf4j.Slf4j;
/**
* MessageConfigService
* 消息发送配置 service实现
*
* @author zxfei
* @date 2025-04-10
*/
@Service("messageConfigService")
@Slf4j
public class MessageConfigServiceImpl extends AbstractCRUDServiceImpl<MessageConfigDao, MessageConfigEntity, Long> implements MessageConfigService {
}
\ No newline at end of file
package com.mortals.xhx.module.message.service.impl;
import com.mortals.framework.model.PageInfo;
import org.springframework.beans.BeanUtils;
import java.util.Map;
import java.util.function.Function;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.message.dao.MessageTaskDao;
import com.mortals.xhx.module.message.model.MessageTaskEntity;
import com.mortals.xhx.module.message.service.MessageTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import com.mortals.xhx.module.message.model.MessageConfigEntity;
import com.mortals.xhx.module.message.model.MessageConfigQuery;
import com.mortals.xhx.module.message.service.MessageConfigService;
import org.springframework.util.ObjectUtils;
import java.util.Date;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
/**
* MessageTaskService
* 消息任务 service实现
*
* @author zxfei
* @date 2025-04-10
*/
@Service("messageTaskService")
@Slf4j
public class MessageTaskServiceImpl extends AbstractCRUDServiceImpl<MessageTaskDao, MessageTaskEntity, Long> implements MessageTaskService {
@Autowired
private MessageConfigService messageConfigService;
@Override
protected void findAfter(MessageTaskEntity params,PageInfo pageInfo, Context context, List<MessageTaskEntity> list) throws AppException {
fillSubData(list);
super.findAfter(params,pageInfo, context, list);
}
@Override
protected void findAfter(MessageTaskEntity params, Context context, List<MessageTaskEntity> list) throws AppException {
fillSubData(list);
super.findAfter(params, context, list);
}
private void fillSubData(List<MessageTaskEntity> list) {
List<Long> idList = list.stream().map(i -> i.getMsgConfId()).collect(Collectors.toList());
if(ObjectUtils.isEmpty(idList)) return;
MessageConfigQuery messageConfigQuery = new MessageConfigQuery();
messageConfigQuery.setIdList(idList);
Map<Long, MessageConfigEntity> messageConfigMap = messageConfigService.find(messageConfigQuery).stream().collect(Collectors.toMap(MessageConfigEntity::getId, Function.identity(), (n1, n2) -> n1));
list.forEach(item -> item.setMessageConfigEntity(messageConfigMap.get(item.getId())));
}
}
\ No newline at end of file
package com.mortals.xhx.module.message.web;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.message.model.MessageConfigEntity;
import com.mortals.xhx.module.message.service.MessageConfigService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
import com.mortals.xhx.common.code.*;
/**
*
* 消息发送配置
*
* @author zxfei
* @date 2025-04-10
*/
@RestController
@RequestMapping("message/config")
public class MessageConfigController extends BaseCRUDJsonBodyMappingController<MessageConfigService,MessageConfigEntity,Long> {
@Autowired
private ParamService paramService;
public MessageConfigController(){
super.setModuleDesc( "消息发送配置");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "messageType", MessageTypeEnum.getEnumMap());
this.addDict(model, "channel", ChannelEnum.getEnumMap());
this.addDict(model, "enabled", EnabledEnum.getEnumMap());
super.init(model, context);
}
}
\ No newline at end of file
package com.mortals.xhx.module.message.web;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.message.model.MessageTaskEntity;
import com.mortals.xhx.module.message.service.MessageTaskService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
import com.mortals.xhx.common.code.*;
/**
*
* 消息任务
*
* @author zxfei
* @date 2025-04-10
*/
@RestController
@RequestMapping("message/task")
public class MessageTaskController extends BaseCRUDJsonBodyMappingController<MessageTaskService,MessageTaskEntity,Long> {
@Autowired
private ParamService paramService;
public MessageTaskController(){
super.setModuleDesc( "消息任务");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "channel", ChannelEnum.getEnumMap());
this.addDict(model, "enabled", EnabledEnum.getEnumMap());
this.addDict(model, "priority", PriorityEnum.getEnumMap());
this.addDict(model, "sendStatus", SendStatusEnum.getEnumMap());
this.addDict(model, "retryCount", RetryCountEnum.getEnumMap());
super.init(model, context);
}
}
\ No newline at end of file
package com.mortals.xhx.thread;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.util.AbstractThread;
import com.mortals.framework.util.ThreadPool;
import com.mortals.xhx.busiz.req.SmsThirdPartyReq;
import com.mortals.xhx.common.code.SendStatusEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.QueueKey;
import com.mortals.xhx.common.utils.SmsQueueManager;
import com.mortals.xhx.module.alarm.model.AlarmRecordsEntity;
import com.mortals.xhx.module.alarm.model.AlarmRecordsQuery;
import com.mortals.xhx.module.alarm.service.AlarmRecordsService;
import com.mortals.xhx.module.message.model.MessageTaskEntity;
import com.mortals.xhx.module.message.model.MessageTaskQuery;
import com.mortals.xhx.module.message.service.MessageTaskService;
import com.mortals.xhx.queue.*;
import com.mortals.xhx.utils.SpringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Value;
import java.util.Date;
import java.util.List;
/**
* 信息发送线程
*
* @author: zxfei
* @date: 2025/4/3 17:00
*/
@Slf4j
public class AlarmSendMsgThread extends AbstractThread {
private MessageTaskService messageTaskService;
private RabbitTemplate rabbitTemplate;
@Value("${sms.smsSendUrl:http://127.0.0.1:8089/api/index/index}")
private String smsSendUrl;
@Value("${sms.apiId:''}")
private String apiId;
public AlarmSendMsgThread() {
messageTaskService =SpringUtils.getBean(MessageTaskService.class);
rabbitTemplate = SpringUtils.getBean(RabbitTemplate.class);
}
@Override
protected int getSleepTime() {
return 60*1000;
}
@Override
protected void process() {
log.info("AlarmSendMsgThread process");
MessageTaskQuery messageTaskQuery = new MessageTaskQuery();
messageTaskQuery.setEnabled(YesNoEnum.YES.getValue());
messageTaskQuery.setSendStatus(SendStatusEnum.待发送.getValue());
List<MessageTaskEntity> messageTaskEntities = messageTaskService.find(messageTaskQuery);
//todo 后续添加多渠道发送 目前默认只发送短信通道
for (MessageTaskEntity messageTask : messageTaskEntities) {
SmsThirdPartyReq smsThirdPartyReq = new SmsThirdPartyReq();
smsThirdPartyReq.setAppid(apiId);
//模板号
smsThirdPartyReq.setType(messageTask.getMessageConfigEntity().getTemplateId()+"");
smsThirdPartyReq.setAlarmSmsSendId(messageTask.getId());
smsThirdPartyReq.setPhone(messageTask.getRecipient());
String[] json = new String[1];
json[0] = messageTask.getContent();
smsThirdPartyReq.setJson(JSONObject.toJSON(json).toString());
SendSmsTask sendSmsTask = new SendSmsTask(smsThirdPartyReq, smsSendUrl);
ThreadPool.getInstance().execute(sendSmsTask);
messageTask.setSendStatus(SendStatusEnum.发送中.getValue());
messageTask.setSendTime(new Date());
SmsQueueManager.offerRespQueue(messageTask);
}
/* List<AlarmRecordsEntity> alarmRecordsEntities = messageTaskService.find(new AlarmRecordsQuery().push(YesNoEnum.NO.getValue()));
for (AlarmRecordsEntity alarmRecordsEntity : alarmRecordsEntities) {
TbQueueMsgHeaders header = new DefaultTbQueueMsgHeaders();
header.put(MessageHeader.MESSAGETYPE, "alarm");
header.put(MessageHeader.TIMESTAMP, new Date().getTime() + "");
TbQueueMsg queueMsg = new DefaultTbQueueMsg(IdUtil.fastUUID(), alarmRecordsEntity.getAlarmContent(), header);
CorrelationData correlationData = new CorrelationData(IdUtil.fastSimpleUUID());
rabbitTemplate.convertAndSend(QueueKey.DEFAULT_EXCHANGE, QueueKey.ALARM_MSG_QUEUE, JSON.toJSONString(queueMsg), correlationData);
alarmRecordsEntity.setPush(YesNoEnum.YES.getValue());
alarmRecordsEntity.setUpdateTime(new Date());
messageTaskService.update(alarmRecordsEntity);
}*/
}
@Override
protected void threadClosed() {
super.close();
}
}
package com.mortals.xhx.thread;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.mortals.framework.util.HttpUtil;
import com.mortals.xhx.busiz.req.SmsThirdPartyReq;
import com.mortals.xhx.busiz.rsp.ApiSmsResp;
import com.mortals.xhx.common.code.SendStatusEnum;
import com.mortals.xhx.common.utils.SmsQueueManager;
import com.mortals.xhx.module.message.model.MessageTaskEntity;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import java.util.HashMap;
import java.util.Map;
import static com.mortals.framework.util.HttpUtil.HEADER_CONTENT_TYPE;
/**
* 短信发送任务
*
* @author: zxfei
* @date: 2022/4/28 10:56
* @description:
**/
@Slf4j
@AllArgsConstructor
public class SendSmsTask implements Runnable {
/**
* 短信消息
*/
private SmsThirdPartyReq smsThirdPartyReq;
/**
* 接口地址
*/
private String sendUrl;
@Override
public void run() {
String resp = null;
MessageTaskEntity messageTaskEntityResp = new MessageTaskEntity();
messageTaskEntityResp.setId(smsThirdPartyReq.getAlarmSmsSendId());
try {
Map<String, String> header = new HashMap<>();
header.put(HEADER_CONTENT_TYPE, "application/json");
resp = HttpUtil.doPost(sendUrl, header, JSON.toJSONString(smsThirdPartyReq));
ApiSmsResp<Void> apiSmsResp = JSON.parseObject(resp, new TypeReference<ApiSmsResp<Void>>() {
});
if (apiSmsResp.getCode() == 1) {
messageTaskEntityResp.setSendStatus(SendStatusEnum.成功.getValue());
} else {
messageTaskEntityResp.setSendStatus(SendStatusEnum.成功.getValue());
log.info("短信提交失败,req:{}, resp:{}", JSON.toJSONString(smsThirdPartyReq), resp);
}
//发送成功添加到响应队列,由线程批量更新
SmsQueueManager.offerRespQueue(messageTaskEntityResp);
log.debug("resp:{}", resp);
} catch (Exception e) {
messageTaskEntityResp.setSendStatus(SendStatusEnum.失败.getValue());
SmsQueueManager.offerRespQueue(messageTaskEntityResp); //todo
log.error("异常:", e);
}
}
}
###登录
POST {{baseUrl}}/login/login
Content-Type: application/json
{
"loginName":"admin",
"password":"admin",
"securityCode":"8888"
}
> {%
client.global.set("SmsSet_id", JSON.parse(response.body).data.id);
client.global.set("authToken", JSON.parse(response.body).data.token);
%}
###差评差评记录列表
POST {{baseUrl}}/cp/records/list
Content-Type: application/json
{
"page":1,
"size":10
}
###差评差评记录更新与保存
POST {{baseUrl}}/cp/records/save
Authorization: {{authToken}}
Content-Type: application/json
{
"siteId":243,
"siteName":"ceLNod",
"personId":519,
"pjId":939,
"name":"W91gAA",
"contact":"NDNB1S",
"idCard":"UOYSgk",
"windowId":981,
"windowName":"0fYwyA",
"section":"9GpWI4",
"flounum":"I2i6uz",
"assessment":"g7Gven",
"type":"u0UyMZ",
"content":"D3gaxG",
"source":"wIZQZt",
"pjTime":"1744214400000",
}
> {%
client.global.set("CpRecords_id", JSON.parse(response.body).data.id);
%}
###差评差评记录查看
GET {{baseUrl}}/cp/records/info?id=1
###差评差评记录编辑
GET {{baseUrl}}/cp/records/edit?id=1
Accept: application/json
###差评差评记录删除
GET {{baseUrl}}/cp/records/delete?id=1
Authorization: {{authToken}}
Accept: application/json
###登录
POST {{baseUrl}}/login/login
Content-Type: application/json
{
"loginName":"admin",
"password":"admin",
"securityCode":"8888"
}
> {%
client.global.set("SmsSet_id", JSON.parse(response.body).data.id);
client.global.set("authToken", JSON.parse(response.body).data.token);
%}
###排号办理记录列表
POST {{baseUrl}}/dowork/records/list
Content-Type: application/json
{
"page":1,
"size":10
}
###排号办理记录更新与保存
POST {{baseUrl}}/dowork/records/save
Authorization: {{authToken}}
Content-Type: application/json
{
"siteId":873,
"siteName":"qfvvmX",
"personId":340,
"waitId":628,
"name":"9pkByv",
"contact":"vvX2rq",
"idCard":"qPy4Km",
"bussinessId":640,
"bussinessName":"74HAe0",
"windowNum":"WJnySk",
"windowName":"qPrxaB",
"workman":"p6gJ4W",
"service":"Tmv7D2",
"queueNo":"WKo5ZN",
"takeTime":"1744214400000",
"callTime":"1744214400000",
"endTime":"1744214400000",
"waitTime":881,
"endDureTime":921,
"waitDureAlarmAvl":0,
"endDureAlarmAvl":0,
"processStatus":"排队中",
"remark":"nOCFck",
}
> {%
client.global.set("DoworkRecords_id", JSON.parse(response.body).data.id);
%}
###排号办理记录查看
GET {{baseUrl}}/dowork/records/info?id=1
###排号办理记录编辑
GET {{baseUrl}}/dowork/records/edit?id=1
Accept: application/json
###排号办理记录删除
GET {{baseUrl}}/dowork/records/delete?id=1
Authorization: {{authToken}}
Accept: application/json
...@@ -143,6 +143,10 @@ ...@@ -143,6 +143,10 @@
<groupId>org.springframework.data</groupId> <groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId> <artifactId>spring-data-redis</artifactId>
</dependency> </dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
</dependencies> </dependencies>
......
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