发短信功能改成不往数据库记日志,改成log输出了

This commit is contained in:
zhangyx
2021-11-08 16:56:50 +08:00
parent 21cb9310c1
commit f253e8d0cb
4 changed files with 83 additions and 5 deletions

View File

@ -13,8 +13,7 @@ import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.*;
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.service.BizSendMsgLogService;
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.service.BizSendMsgTemplateService;
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.service.BizSmsEmailService;
import com.chinaunicom.mall.ebtp.extend.crypconfigure.entity.CrypConfigure;
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.entity.BizBidTemplateWarehouse;
import com.chinaunicom.mall.ebtp.extend.funcswitch.dao.BizFuncSwitchConfigMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
@ -23,11 +22,9 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* 对数据表 biz_send_msg_template 操作的 serviceImpl
@ -44,6 +41,8 @@ public class BizSendMsgTemplateServiceImpl extends ServiceImpl<BizSendMsgTemplat
private IBaseCacheUserService cacheUserService;
@Autowired
private BizSendMsgLogService msgLogService;
@Autowired
private BizFuncSwitchConfigMapper funcSwitchConfigMapper;
@Override
public Boolean sendMsg(BizSendMsgInfoVO msgInfoVO) {
@ -160,7 +159,11 @@ public class BizSendMsgTemplateServiceImpl extends ServiceImpl<BizSendMsgTemplat
.setSenderUserId(userId)
.setSenderUserName(userName);
log.info("sendMsgLog传入数据"+ JsonUtils.objectToJson(msgLog));
msgLogService.save(msgLog);
//active使能10
int active =funcSwitchConfigMapper.selectByType("send-sms-record-log");
if (active==1) {
msgLogService.save(msgLog);
}
}
private String generateMsgFromTemplete(String msg, Map<String, String> params) {

View File

@ -0,0 +1,12 @@
package com.chinaunicom.mall.ebtp.extend.funcswitch.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chinaunicom.mall.ebtp.process.funcswitch.entity.BizFuncSwitchConfig;
import org.springframework.stereotype.Repository;
@Repository
public interface BizFuncSwitchConfigMapper extends BaseMapper<BizFuncSwitchConfig> {
Integer selectByType(String type);
}

View File

@ -0,0 +1,16 @@
<?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="com.chinaunicom.mall.ebtp.process.funcswitch.dao.BizFuncSwitchConfigMapper">
<resultMap id="BaseResultMap"
type="com.chinaunicom.mall.ebtp.process.funcswitch.entity.BizFuncSwitchConfig">
<result column="id" jdbcType="BIGINT" property="id"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
<result column="active" jdbcType="VARCHAR" property="active"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
</resultMap>
<select id="selectByType"
resultType="java.lang.Integer">
SELECT active FROM biz_func_switch_config WHERE `type` = #{type}
</select>
</mapper>

View File

@ -0,0 +1,47 @@
package com.chinaunicom.mall.ebtp.extend.funcswitch.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* 实体类 BizSendMsgLog
*
* @auto.generated
*/
@Data
@Accessors(chain = true)
@ApiModel
@TableName(value = "biz_func_switch_config", autoResultMap = true)
public class BizFuncSwitchConfig implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
@ApiModelProperty(value = "主键ID")
private String id;
/**
* 唯一标签
*/
@ApiModelProperty(value = "唯一标签")
private String type;
/**
* 使能10
*/
@ApiModelProperty(value = "使能10")
private Integer active;
/**
* 说明
*/
@ApiModelProperty(value = "说明")
private String remarks;
}