Commit 987a23da by hayden

后台管理系统系统管理-日志管理-短信日志:新增筛选条件门店、房间

parent 93549a45
...@@ -21,6 +21,14 @@ public class SmsLog extends BaseEntity ...@@ -21,6 +21,14 @@ public class SmsLog extends BaseEntity
/** 主键 */ /** 主键 */
private Long id; private Long id;
/** 门店id */
@Excel(name = "门店id")
private Long storeId;
/** 房间id */
@Excel(name = "房间id")
private Long roomId;
/** 发送手机号码 */ /** 发送手机号码 */
@Excel(name = "发送手机号码") @Excel(name = "发送手机号码")
private String phone; private String phone;
...@@ -54,6 +62,8 @@ public class SmsLog extends BaseEntity ...@@ -54,6 +62,8 @@ public class SmsLog extends BaseEntity
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("storeId", getStoreId())
.append("roomId", getRoomId())
.append("phone", getPhone()) .append("phone", getPhone())
.append("templateId", getTemplateId()) .append("templateId", getTemplateId())
.append("signature", getSignature()) .append("signature", getSignature())
......
...@@ -138,6 +138,7 @@ public class SRoomVo extends BaseEntity ...@@ -138,6 +138,7 @@ public class SRoomVo extends BaseEntity
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("storeId", getStoreId()) .append("storeId", getStoreId())
.append("sort", getSort())
.append("storeName", getStoreName()) .append("storeName", getStoreName())
.append("name", getName()) .append("name", getName())
.append("roomType", getRoomType()) .append("roomType", getRoomType())
......
...@@ -71,11 +71,13 @@ public class SmsServiceImpl implements SmsService { ...@@ -71,11 +71,13 @@ public class SmsServiceImpl implements SmsService {
* 短信发送 * 短信发送
* *
* @param phone * @param phone
* @param storeId
* @param roomId
* @return * @return
*/ */
private boolean sendSms(String phone, Integer tag, String content) { private boolean sendSms(String phone, Integer tag, String content, Long storeId, Long roomId) {
try { try {
JSONObject jsonObject = sendOneSms(phone, content, String.valueOf(tag)); JSONObject jsonObject = sendOneSms(phone, content, String.valueOf(tag), storeId, roomId);
boolean isSendSuccess = Objects.nonNull(jsonObject); boolean isSendSuccess = Objects.nonNull(jsonObject);
if (tag == SmsTypeEnum.SMS_CODE_TEMP.getCode()) { if (tag == SmsTypeEnum.SMS_CODE_TEMP.getCode()) {
if (!isSendSuccess) { if (!isSendSuccess) {
...@@ -95,7 +97,7 @@ public class SmsServiceImpl implements SmsService { ...@@ -95,7 +97,7 @@ public class SmsServiceImpl implements SmsService {
public boolean sendSmsCode(String phone) { public boolean sendSmsCode(String phone) {
// redisUtil.set(sConsumerService.getValidateCodeRedisKey(phone), "123456", Long.valueOf(Constants.CONFIG_KEY_SMS_CODE_EXPIRE), TimeUnit.MINUTES); // redisUtil.set(sConsumerService.getValidateCodeRedisKey(phone), "123456", Long.valueOf(Constants.CONFIG_KEY_SMS_CODE_EXPIRE), TimeUnit.MINUTES);
String content = getSmsContent(phone, SmsTypeEnum.SMS_CODE_TEMP.getCode()); String content = getSmsContent(phone, SmsTypeEnum.SMS_CODE_TEMP.getCode());
return sendSms(phone, SmsTypeEnum.SMS_CODE_TEMP.getCode(), content); return sendSms(phone, SmsTypeEnum.SMS_CODE_TEMP.getCode(), content, null, null);
} }
@Override @Override
...@@ -104,7 +106,7 @@ public class SmsServiceImpl implements SmsService { ...@@ -104,7 +106,7 @@ public class SmsServiceImpl implements SmsService {
SysConfig config = sysConfigMapper.checkConfigKeyUnique(SmsTypeEnum.SMS_CLEAN_RECORDS_TEMP.getValue()); SysConfig config = sysConfigMapper.checkConfigKeyUnique(SmsTypeEnum.SMS_CLEAN_RECORDS_TEMP.getValue());
if (config != null) { if (config != null) {
String content = MessageFormat.format(config.getConfigValue(), store.getName(), room.getName(), store.getAddress()); String content = MessageFormat.format(config.getConfigValue(), store.getName(), room.getName(), store.getAddress());
return sendSms(phone, SmsTypeEnum.SMS_CLEAN_RECORDS_TEMP.getCode(), content); return sendSms(phone, SmsTypeEnum.SMS_CLEAN_RECORDS_TEMP.getCode(), content, store.getId(), room.getId());
} else { } else {
return Boolean.FALSE; return Boolean.FALSE;
} }
...@@ -116,7 +118,7 @@ public class SmsServiceImpl implements SmsService { ...@@ -116,7 +118,7 @@ public class SmsServiceImpl implements SmsService {
SysConfig config = sysConfigMapper.checkConfigKeyUnique(SmsTypeEnum.SMS_CLEAN_RECORDS_TEMP_15.getValue()); SysConfig config = sysConfigMapper.checkConfigKeyUnique(SmsTypeEnum.SMS_CLEAN_RECORDS_TEMP_15.getValue());
if (config != null) { if (config != null) {
String content = MessageFormat.format(config.getConfigValue(), store.getName(), room.getName(), store.getAddress()); String content = MessageFormat.format(config.getConfigValue(), store.getName(), room.getName(), store.getAddress());
return sendSms(phone, SmsTypeEnum.SMS_CLEAN_RECORDS_TEMP_15.getCode(), content); return sendSms(phone, SmsTypeEnum.SMS_CLEAN_RECORDS_TEMP_15.getCode(), content, store.getId(), room.getId());
} else { } else {
return Boolean.FALSE; return Boolean.FALSE;
} }
...@@ -128,7 +130,7 @@ public class SmsServiceImpl implements SmsService { ...@@ -128,7 +130,7 @@ public class SmsServiceImpl implements SmsService {
SysConfig config = sysConfigMapper.checkConfigKeyUnique(SmsTypeEnum.SMS_ORDER_START_TEMP.getValue()); SysConfig config = sysConfigMapper.checkConfigKeyUnique(SmsTypeEnum.SMS_ORDER_START_TEMP.getValue());
if (config != null) { if (config != null) {
String content = MessageFormat.format(config.getConfigValue(), room.getName(), store.getAddress()); String content = MessageFormat.format(config.getConfigValue(), room.getName(), store.getAddress());
return sendSms(phone, SmsTypeEnum.SMS_ORDER_START_TEMP.getCode(), content); return sendSms(phone, SmsTypeEnum.SMS_ORDER_START_TEMP.getCode(), content, store.getId(), room.getId());
} else { } else {
return Boolean.FALSE; return Boolean.FALSE;
} }
...@@ -140,7 +142,7 @@ public class SmsServiceImpl implements SmsService { ...@@ -140,7 +142,7 @@ public class SmsServiceImpl implements SmsService {
SysConfig config = sysConfigMapper.checkConfigKeyUnique(SmsTypeEnum.SMS_ORDER_END_TEMP.getValue()); SysConfig config = sysConfigMapper.checkConfigKeyUnique(SmsTypeEnum.SMS_ORDER_END_TEMP.getValue());
if (config != null) { if (config != null) {
String content = MessageFormat.format(config.getConfigValue(), room.getName()); String content = MessageFormat.format(config.getConfigValue(), room.getName());
return sendSms(phone, SmsTypeEnum.SMS_ORDER_END_TEMP.getCode(), content); return sendSms(phone, SmsTypeEnum.SMS_ORDER_END_TEMP.getCode(), content, store.getId(), room.getId());
} else { } else {
return Boolean.FALSE; return Boolean.FALSE;
} }
...@@ -152,7 +154,7 @@ public class SmsServiceImpl implements SmsService { ...@@ -152,7 +154,7 @@ public class SmsServiceImpl implements SmsService {
SysConfig config = sysConfigMapper.checkConfigKeyUnique(SmsTypeEnum.SMS_CLEAN_RECORDS_STOP_TEMP.getValue()); SysConfig config = sysConfigMapper.checkConfigKeyUnique(SmsTypeEnum.SMS_CLEAN_RECORDS_STOP_TEMP.getValue());
if (config != null) { if (config != null) {
String content = MessageFormat.format(config.getConfigValue(), store.getName(), room.getName(), store.getAddress()); String content = MessageFormat.format(config.getConfigValue(), store.getName(), room.getName(), store.getAddress());
return sendSms(phone, SmsTypeEnum.SMS_CLEAN_RECORDS_STOP_TEMP.getCode(), content); return sendSms(phone, SmsTypeEnum.SMS_CLEAN_RECORDS_STOP_TEMP.getCode(), content, store.getId(), room.getId());
} else { } else {
return Boolean.FALSE; return Boolean.FALSE;
} }
...@@ -165,7 +167,7 @@ public class SmsServiceImpl implements SmsService { ...@@ -165,7 +167,7 @@ public class SmsServiceImpl implements SmsService {
if (config != null) { if (config != null) {
String content = MessageFormat.format(config.getConfigValue(), store.getName(), room.getName(), String content = MessageFormat.format(config.getConfigValue(), store.getName(), room.getName(),
DeviceStatusEnum.getNameStr(deviceStatusLog.getStatus())); DeviceStatusEnum.getNameStr(deviceStatusLog.getStatus()));
return sendSms(phone, SmsTypeEnum.SMS_DEVICE_ABNORMAL_TEMP.getCode(), content); return sendSms(phone, SmsTypeEnum.SMS_DEVICE_ABNORMAL_TEMP.getCode(), content, store.getId(), room.getId());
} else { } else {
return Boolean.FALSE; return Boolean.FALSE;
} }
...@@ -235,11 +237,14 @@ public class SmsServiceImpl implements SmsService { ...@@ -235,11 +237,14 @@ public class SmsServiceImpl implements SmsService {
/** /**
* 单独发送 * 单独发送
*
* @param phone 手机号 * @param phone 手机号
* @param content 发送内容 * @param content 发送内容
* @param storeId 门店id
* @param roomId 房间id
* @return * @return
*/ */
private JSONObject sendOneSms(String phone, String content, String smsType) { private JSONObject sendOneSms(String phone, String content, String smsType, Long storeId, Long roomId) {
// 发送内容添加短信签名 // 发送内容添加短信签名
String smsContent = StrUtil.concat(true, signature, content); String smsContent = StrUtil.concat(true, signature, content);
JSONObject param = JSONUtil.createObj(); JSONObject param = JSONUtil.createObj();
...@@ -257,6 +262,8 @@ public class SmsServiceImpl implements SmsService { ...@@ -257,6 +262,8 @@ public class SmsServiceImpl implements SmsService {
smsLog.setContent(content); smsLog.setContent(content);
smsLog.setSignature(signature); smsLog.setSignature(signature);
smsLog.setSmsType(smsType); smsLog.setSmsType(smsType);
smsLog.setStoreId(storeId);
smsLog.setRoomId(roomId);
try { try {
JSONObject jsonObject = smsUtil.postFrom(url, param); JSONObject jsonObject = smsUtil.postFrom(url, param);
smsLog.setResultParam(JSONUtil.toJsonStr(jsonObject)); smsLog.setResultParam(JSONUtil.toJsonStr(jsonObject));
......
...@@ -6,6 +6,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -6,6 +6,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="SmsLog" id="SmsLogResult"> <resultMap type="SmsLog" id="SmsLogResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="storeId" column="store_id" />
<result property="roomId" column="room_id" />
<result property="phone" column="phone" /> <result property="phone" column="phone" />
<result property="templateId" column="template_id" /> <result property="templateId" column="template_id" />
<result property="signature" column="signature" /> <result property="signature" column="signature" />
...@@ -21,13 +23,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -21,13 +23,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectSmsLogVo"> <sql id="selectSmsLogVo">
select id, phone, template_id, signature, content, sms_type, create_by, create_time, update_by, update_time, remark, result, result_param from s_sms_log select id, store_id, room_id, phone, template_id, signature, content, sms_type, create_by, create_time, update_by, update_time, remark, result, result_param from s_sms_log
</sql> </sql>
<select id="selectSmsLogList" parameterType="SmsLog" resultMap="SmsLogResult"> <select id="selectSmsLogList" parameterType="SmsLog" resultMap="SmsLogResult">
<include refid="selectSmsLogVo"/> <include refid="selectSmsLogVo"/>
<where> <where>
<if test="phone != null and phone != ''"> and phone = #{phone}</if> <if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="storeId != null"> and store_id = #{storeId}</if>
<if test="roomId != null"> and room_id = #{roomId}</if>
<if test="templateId != null and templateId != ''"> and template_id = #{templateId}</if> <if test="templateId != null and templateId != ''"> and template_id = #{templateId}</if>
<if test="signature != null and signature != ''"> and signature = #{signature}</if> <if test="signature != null and signature != ''"> and signature = #{signature}</if>
<if test="content != null and content != ''"> and content = #{content}</if> <if test="content != null and content != ''"> and content = #{content}</if>
...@@ -46,6 +50,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -46,6 +50,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertSmsLog" parameterType="SmsLog" useGeneratedKeys="true" keyProperty="id"> <insert id="insertSmsLog" parameterType="SmsLog" useGeneratedKeys="true" keyProperty="id">
insert into s_sms_log insert into s_sms_log
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="storeId != null">store_id,</if>
<if test="roomId != null">room_id,</if>
<if test="phone != null">phone,</if> <if test="phone != null">phone,</if>
<if test="templateId != null">template_id,</if> <if test="templateId != null">template_id,</if>
<if test="signature != null">signature,</if> <if test="signature != null">signature,</if>
...@@ -60,6 +66,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -60,6 +66,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="resultParam != null">result_param,</if> <if test="resultParam != null">result_param,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="storeId != null">#{storeId},</if>
<if test="roomId != null">#{roomId},</if>
<if test="phone != null">#{phone},</if> <if test="phone != null">#{phone},</if>
<if test="templateId != null">#{templateId},</if> <if test="templateId != null">#{templateId},</if>
<if test="signature != null">#{signature},</if> <if test="signature != null">#{signature},</if>
...@@ -78,6 +86,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -78,6 +86,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateSmsLog" parameterType="SmsLog"> <update id="updateSmsLog" parameterType="SmsLog">
update s_sms_log update s_sms_log
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="storeId != null">store_id = #{storeId},</if>
<if test="roomId != null">room_id = #{roomId},</if>
<if test="phone != null">phone = #{phone},</if> <if test="phone != null">phone = #{phone},</if>
<if test="templateId != null">template_id = #{templateId},</if> <if test="templateId != null">template_id = #{templateId},</if>
<if test="signature != null">signature = #{signature},</if> <if test="signature != null">signature = #{signature},</if>
......
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