Commit a6cbe4d9 by zhanghj

V1.0.0--提交公共服务上传文件和发送短信验证码,并且保存短信发送记录

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@17408 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 3b9ce698
......@@ -37,12 +37,20 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!-- spring-boot-devtools -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
<!-- EurekaClient -->
<dependency>
<groupId>org.springframework.cloud</groupId>
......@@ -105,6 +113,19 @@
<artifactId>qrgen</artifactId>
<version>1.4</version>
</dependency>
<!-- fastdfs -->
<dependency>
<groupId>com.github.tobato</groupId>
<artifactId>fastdfs-client</artifactId>
<version>1.26.2</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
......
......@@ -9,9 +9,12 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportResource;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import com.github.tobato.fastdfs.FdfsClientConfig;
/**
*
* @Title Application.java
......@@ -29,6 +32,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableTransactionManagement
@MapperScan(basePackages={"com.glsx.publicservice.mapper"})
@ImportResource(locations = { "classpath:config/applicationContext-dubbo.xml"})
@Import(FdfsClientConfig.class)
public class Application extends SpringBootServletInitializer{
/**
......
package com.glsx.publicservice.constants;
/**
*
* @Title Constants.java
* @Package com.glsx.publicservice.constants
* @Description TODO 常量类
* @author zhanghj
* @date 2019年2月16日 下午5:46:13
* @version 1.0.0
*/
public class Constants {
/**
* 用户信息审核短信模板
*/
public static final String USER_INFO_APPROVAL_SMS_CONTENT = "您本次操作验证码为:{0},一分钟内有效。";
/**
* 短信类型
*/
/**
* 短信验证码: 1
*/
public static final int SMS_TYPE_VERIFY_CODE = 1;
/**
* 短信验证码过时时间秒数
*/
public static final int SMS_VERIFY_CODE_TIMEOUT = 360;
/**
* redis中的key值
*/
/**
* 短信验证码前缀
*/
public static final String SMS_VERIFY_CODE_PREFIX = "carService.sms.verifyCode";
}
package com.glsx.publicservice.controller;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.RedisSystemException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import com.github.pagehelper.util.StringUtil;
import com.glsx.common.annotation.AuthCheck;
import com.glsx.common.constants.ResultCodeEnum;
import com.glsx.common.constants.ResultObject;
import com.glsx.publicservice.service.CommonService;
import com.glsx.publicservice.util.fastdfs.FastDFSClientWrapper;
/**
*
* @Title CommonController.java
* @Package com.glsx.publicservice.controller
* @Description TODO
* @author zhanghj
* @date 2019年2月16日 下午5:41:40
* @version 1.0.0
*/
@RestController
@RequestMapping(value="/common")
public class CommonController
{
private static final Logger logger = LoggerFactory.getLogger(CommonController.class);
@Autowired
private CommonService commonService;
@RequestMapping(value="/sendVerificationCode", method={RequestMethod.GET, RequestMethod.POST})
public ResultObject sendVerificationCode(HttpServletRequest request, String phone){
Map<String, Object> result = new HashMap<String, Object>();
try{
if (StringUtil.isEmpty(phone)){
return new ResultObject(ResultCodeEnum.PARAM_ERROR.getCode(), ResultCodeEnum.PARAM_ERROR.getMsg());
}
String verifyCode = commonService.sendVerificationCode(phone);
logger.info("手机号:" + phone + "的短信验证码:"+ verifyCode);
//result.put("verifyCode", verifyCode);
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg(), result);
} catch(RedisSystemException e){
logger.error("获取验证码redis异常" + e.getMessage(), e);
/*
* 测试环境redis连接总被重试异常重试
*/
String verifyCode = commonService.sendVerificationCode(phone);
logger.info("手机号:" + phone + "的短信验证码:"+ verifyCode);
result.put("verifyCode", verifyCode);
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg(), result);
}catch(Exception e){
logger.error("获取验证码失败" + e.getMessage(), e);
return new ResultObject(ResultCodeEnum.ERROR.getCode(), ResultCodeEnum.ERROR.getMsg());
}
}
@AuthCheck
@RequestMapping(value="/uploadFile" , method = RequestMethod.POST)
public ResultObject uploadImage(@RequestParam("file")MultipartFile file, HttpServletRequest request) throws IOException{
String path = FastDFSClientWrapper.uploadFile(file);
logger.info("上传文件路径==" + path);
return new ResultObject(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMsg(), path);
}
@RequestMapping(value="/upload", method=RequestMethod.GET)
public ModelAndView get(ModelAndView mv){
mv.setViewName("fileUpload");
return mv;
}
}
package com.glsx.publicservice.mapper;
import com.glsx.publicservice.pojo.SMSLog;
/**
*
* @Title SMSLogMapper.java
* @Package com.qurong.mapper
* @Description TODO
* @author zhanghj
* @date 2018年10月22日 下午3:01:14
* @version
*/
public interface SMSLogMapper {
/**
* 保存短信日志
* @param smsLog
*/
void saveSMSLog(SMSLog smsLog);
}
package com.glsx.publicservice.pojo;
import java.io.Serializable;
import java.util.Date;
/**
*
* @Title SMSLog.java
* @Package com.qurong.pojo
* @Description TODO
* @author zhanghj
* @date 2018年10月22日 下午2:22:54
* @version
*/
public class SMSLog implements Serializable{
/**
*
*/
private static final long serialVersionUID = -8693399013407586578L;
private long id;
/**
* 电话
*/
private String phone;
/**
* 短信类别:1:验证码
*/
private Integer smsType;
/**
* 创建时间
*/
private Date createTime;
/**
* 发送内容
*/
private String content;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public Integer getSmsType() {
return smsType;
}
public void setSmsType(Integer smsType) {
this.smsType = smsType;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}
package com.glsx.publicservice.service;
/**
*
* @Title CommonService.java
* @Package com.qurong.service
* @Description TODO
* @author zhanghj
* @date 2018年10月22日 下午4:18:53
* @version
*/
public interface CommonService {
/**
* 发送验证码
* @param mobile
* @return
*/
String sendVerificationCode(String mobile);
/**
* 获取序列号
* @param sequenceName
* @return
*/
//Long getNextVal(String sequenceName);
}
package com.glsx.publicservice.service.impl;
import java.text.MessageFormat;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.glsx.common.utils.StringUtils;
import com.glsx.publicservice.constants.Constants;
import com.glsx.publicservice.mapper.SMSLogMapper;
import com.glsx.publicservice.pojo.SMSLog;
import com.glsx.publicservice.service.CommonService;
import com.glsx.publicservice.util.RedisCacheUtil;
import com.glsx.publicservice.util.SmsUtil;
/**
*
* @Title CommonServiceImpl.java
* @Package com.qurong.service.impl
* @Description TODO
* @author zhanghj
* @date 2018年10月22日 下午3:01:25
* @version
*/
@Service
public class CommonServiceImpl implements CommonService {
private Logger logger = LoggerFactory.getLogger(CommonServiceImpl.class);
@Autowired
private SMSLogMapper smsLogDao;
@Autowired
private SmsUtil smsUtil;
@SuppressWarnings("rawtypes")
@Autowired
private RedisCacheUtil redisCacheUtil;
/*@Autowired
private CommonMapper commonDao;
*/
@SuppressWarnings("unchecked")
@Override
public String sendVerificationCode(String phone) {
// TODO Auto-generated method stub
String smsKey = Constants.SMS_VERIFY_CODE_PREFIX + "." + phone;
String smsCode = StringUtils.generateRandomCode(true, 4);
redisCacheUtil.setCacheObject(smsKey, smsCode, Constants.SMS_VERIFY_CODE_TIMEOUT, TimeUnit.SECONDS);
//redisTemplate.opsForValue().set(smsKey, smsCode, Constants.SMS_VERIFY_CODE_TIMEOUT, TimeUnit.SECONDS);
String msgContent = MessageFormat.format(Constants.USER_INFO_APPROVAL_SMS_CONTENT, smsCode);
SMSLog smsLog = new SMSLog();
smsLog.setSmsType(Constants.SMS_TYPE_VERIFY_CODE);
smsLog.setPhone(phone);
smsLog.setCreateTime(new Date());
smsLog.setContent(smsCode);
smsLogDao.saveSMSLog(smsLog);
String result = "发送手机号phone=" + phone + ">>>smsCode=" + smsCode;
logger.info(result);
smsUtil.send(phone, msgContent);
return smsCode;
}
/*@Override
public Long getNextVal(String sequenceName) {
// TODO Auto-generated method stub
return commonDao.getNextVal(sequenceName);
}*/
}
package com.glsx.publicservice.util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
/**
*
* @Title PropertiesUtil.java
* @Package com.glsx.manager.utils
* @Description TODO 读取配置文件属性值
* @author zhanghj
* @date 2018年12月24日 下午5:38:42
* @version 1.0.0
*/
@Component
public class PropertiesUtil {
private static Environment env;
@Autowired
public void setEnv(Environment env) {
PropertiesUtil.env = env;
}
public static String getProperty(String key){
return env.getProperty(key);
}
public static String getProperty(String key, String defaultVal){
return env.getProperty(key, defaultVal);
}
}
package com.glsx.publicservice.util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.BoundSetOperations;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.ListOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;
/**
* redis缓存帮助类
* Created by liumh on 2018/8/13
*/
@Component
public class RedisCacheUtil<T> {
@Autowired
public RedisTemplate redisTemplate;
/**
* 缓存基本的对象,Integer、String、实体类等
*
* @param key 缓存的键值
* @param value 缓存的值
* @return 缓存的对象
*/
public <T> ValueOperations<String, T> setCacheObject(String key, T value, long timeout, TimeUnit unit) {
ValueOperations<String, T> operation = redisTemplate.opsForValue();
operation.set(key, value, timeout, unit);
return operation;
}
/**
* 获得缓存的基本对象。
*
* @param key 缓存键值
* @return 缓存键值对应的数据
*/
public <T> T getCacheObject(String key) {
ValueOperations<String, T> operation = redisTemplate.opsForValue();
return operation.get(key);
}
/**
* 缓存List数据
*
* @param key 缓存的键值
* @param dataList 待缓存的List数据
* @return 缓存的对象
*/
public <T> ListOperations<String, T> setCacheList(String key, List<T> dataList) {
ListOperations listOperation = redisTemplate.opsForList();
if (null != dataList) {
int size = dataList.size();
for (int i = 0; i < size; i++) {
listOperation.leftPush(key, dataList.get(i));
}
}
return listOperation;
}
/**
* 获得缓存的list对象
*
* @param key 缓存的键值
* @return 缓存键值对应的数据
*/
public <T> List<T> getCacheList(String key) {
List<T> dataList = new ArrayList<T>();
ListOperations<String, T> listOperation = redisTemplate.opsForList();
Long size = listOperation.size(key);
for (int i = 0; i < size; i++) {
dataList.add(listOperation.index(key, i));
}
return dataList;
}
/**
* 缓存Set
*
* @param key 缓存键值
* @param dataSet 缓存的数据
* @return 缓存数据的对象
*/
public <T> BoundSetOperations<String, T> setCacheSet(String key, Set<T> dataSet) {
BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
Iterator<T> it = dataSet.iterator();
while (it.hasNext()) {
setOperation.add(it.next());
}
return setOperation;
}
/**
* 获得缓存的set
*
* @param key
* @return
*/
public Set<T> getCacheSet(String key) {
Set<T> dataSet = new HashSet<T>();
BoundSetOperations<String, T> operation = redisTemplate.boundSetOps(key);
Long size = operation.size();
for (int i = 0; i < size; i++) {
dataSet.add(operation.pop());
}
return dataSet;
}
/**
* 缓存Map
*
* @param key
* @param dataMap
* @return
*/
public <T> HashOperations<String, String, T> setCacheMap(String key, Map<String, T> dataMap) {
HashOperations hashOperations = redisTemplate.opsForHash();
if (null != dataMap) {
for (Map.Entry<String, T> entry : dataMap.entrySet()) {
hashOperations.put(key, entry.getKey(), entry.getValue());
}
}
return hashOperations;
}
/**
* 获得缓存的Map
*
* @param key
* @return
*/
public <T> Map<String, T> getCacheMap(String key) {
Map<String, T> map = redisTemplate.opsForHash().entries(key);
return map;
}
/**
* 缓存Map
*
* @param key
* @param dataMap
* @return
*/
public <T> HashOperations<String, Integer, T> setCacheIntegerMap(String key, Map<Integer, T> dataMap) {
HashOperations hashOperations = redisTemplate.opsForHash();
if (null != dataMap) {
for (Map.Entry<Integer, T> entry : dataMap.entrySet()) {
hashOperations.put(key, entry.getKey(), entry.getValue());
}
}
return hashOperations;
}
/**
* 获得缓存的Map
*
* @param key
* @return
*/
public <T> Map<Integer, T> getCacheIntegerMap(String key) {
Map<Integer, T> map = redisTemplate.opsForHash().entries(key);
return map;
}
public void delete(String key) {
redisTemplate.delete(key);
}
public void deleteByPrex(String prex) {
Set<String> keys = redisTemplate.keys(prex + "*");
redisTemplate.delete(keys);
}
public void deleteBySuffix(String suffix) {
Set<String> keys = redisTemplate.keys("*" + suffix);
redisTemplate.delete(keys);
}
public void deleteByKeys(String... keys) {
redisTemplate.delete(Arrays.asList(keys));
}
public List getListByPrex(String prex) {
Set<String> keys = redisTemplate.keys(prex + "*");
return redisTemplate.opsForValue().multiGet(keys);
}
}
package com.glsx.publicservice.util.fastdfs;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import org.apache.commons.io.FilenameUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import com.github.tobato.fastdfs.domain.StorePath;
import com.github.tobato.fastdfs.exception.FdfsUnsupportStorePathException;
import com.github.tobato.fastdfs.service.FastFileStorageClient;
import com.glsx.common.utils.StringUtils;
import com.glsx.publicservice.util.PropertiesUtil;
/**
*
* @Title FastDFSClientWrapper.java
* @Package com.qurong.credit.sp.utils.fastdfs
* @Description TODO fastdfs文件上传
* @author zhanghj
* @date 2018年7月27日 下午2:52:05
* @version
*/
@Component
public class FastDFSClientWrapper {
private static Logger logger = LoggerFactory.getLogger(FastDFSClientWrapper.class);
private static FastFileStorageClient storageClient;
// private static DefaultTrackerClient trackserClient;
// private static final String GENERAL_NGINX_PORT = "80";
private static final String FDFS_TRACKER_NGINX_DOMAIN = "fdfs_tracker_nginx_domain";
public static final String PROTOCOL = "http://";
public static final String SEPARATOR = "/";
/**
* 上传文件
*
* @param file
* 文件对象
* @return 文件访问地址
* @throws IOException
*/
public static String uploadFile(MultipartFile file) throws IOException {
StorePath storePath = storageClient.uploadFile(file.getInputStream(), file.getSize(),
FilenameUtils.getExtension(file.getOriginalFilename()), null);
return getResAccessUrl(storePath);
}
/**
* 将一段字符串生成一个文件上传
*
* @param content
* 文件内容
* @param fileExtension
* @return
*/
public static String uploadFile(String content, String fileExtension) {
byte[] buff = content.getBytes(Charset.forName("UTF-8"));
ByteArrayInputStream stream = new ByteArrayInputStream(buff);
StorePath storePath = storageClient.uploadFile(stream, buff.length, fileExtension, null);
return getResAccessUrl(storePath);
}
/**
* 将byte数组生成一个文件上传
*
* @param bytes 文件内容字节数组
* @param fileExtension
* @return
*/
public static String uploadFile(byte[] bytes, String fileExtension) {
ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
StorePath storePath = storageClient.uploadFile(stream, bytes.length, fileExtension, null);
return getResAccessUrl(storePath);
}
// 封装图片完整URL地址
private static String getResAccessUrl(StorePath storePath) {
/*String fdfsTrackerNginxPort = PropertiesUtil.getProperty("fdfs_tracker_nginx_port");
String fileAbsolutePath = "";
if (GENERAL_NGINX_PORT.equals(fdfsTrackerNginxPort)) {
fileAbsolutePath = PROTOCOL + trackserClient.getStoreStorage().getIp() + SEPARATOR
+ storePath.getFullPath();
} else {
fileAbsolutePath = PROTOCOL + trackserClient.getStoreStorage().getIp() + ":" + fdfsTrackerNginxPort
+ SEPARATOR + storePath.getFullPath();
}*/
String domain = PropertiesUtil.getProperty(FDFS_TRACKER_NGINX_DOMAIN);
return domain + SEPARATOR + storePath.getFullPath();
}
/**
* 删除文件
*
* @param fileUrl
* 文件访问地址
* @return
*/
public static void deleteFile(String fileUrl) {
if (StringUtils.isEmpty(fileUrl)) {
return;
}
try {
StorePath storePath = StorePath.praseFromUrl(fileUrl);
storageClient.deleteFile(storePath.getGroup(), storePath.getPath());
} catch (FdfsUnsupportStorePathException e) {
logger.warn(e.getMessage());
}
}
@Autowired
public void setStorageClient(FastFileStorageClient storageClient) {
FastDFSClientWrapper.storageClient = storageClient;
}
/*@Autowired
public void setTrackserClient(DefaultTrackerClient trackserClient) {
FastDFSClientWrapper.trackserClient = trackserClient;
}*/
}
......@@ -21,7 +21,7 @@ spring.datasource.maxOpenPreparedStatements=50
#mybatis\u96c6\u6210\u914d\u7f6e
mybatis.mapperLocations=classpath*:mapper/*.xml
mybatis.typeAliasesPackage=com.glsx.usercenter.pojo
mybatis.typeAliasesPackage=com.glsx.publicservice.pojo
#pagehelper
pagehelper.helperDialect=mysql
......@@ -40,23 +40,23 @@ spring.servlet.multipart.max-request-size=20MB
# REDIS (RedisProperties)
# Database index used by the connection factory.
spring.redis.database=0
spring.redis.database=0
# Redis server host.
spring.redis.host=192.168.0.39
# Maximum number of connections that can be allocated by the pool at a given time. Use a negative value for no limit.
spring.redis.lettuce.pool.max-active=32
# Maximum number of "idle" connections in the pool. Use a negative value to indicate an unlimited number of idle connections.
spring.redis.lettuce.pool.max-idle=32
spring.redis.lettuce.pool.max-idle=32
# Maximum amount of time a connection allocation should block before throwing an exception when the pool is exhausted. Use a negative value to block indefinitely.
spring.redis.lettuce.pool.max-wait=-1ms
spring.redis.lettuce.pool.max-wait=-1ms
# Target for the minimum number of idle connections to maintain in the pool. This setting only has an effect if it is positive.
spring.redis.lettuce.pool.min-idle=0
spring.redis.lettuce.pool.min-idle=0
# Shutdown timeout.
spring.redis.lettuce.shutdown-timeout=100ms
spring.redis.lettuce.shutdown-timeout=100ms
#Login password of the redis server.
spring.redis.password=hhxredis
# Redis server port.
spring.redis.port=6379
spring.redis.port=6379
#Whether to enable SSL support.
spring.redis.ssl=false
# Connection timeout.
......@@ -75,7 +75,7 @@ feign.client.config.default.loggerLevel=basic
#\u77ed\u4fe1
#sms.url=http://192.168.3.206:8118/router111
#sms.url=http://qcdidicb.glsx.net:7060/router
sms.url=http://qcdidicb.glsx.net:7060/router
sms.source=frms_sms_assign
##fastdfs
......@@ -90,4 +90,16 @@ fdfs_tracker_nginx_domain=http://192.168.0.63
#dubbo\u914d\u7f6e
dubbo.application.owner=common_merchant
dubbo.registry.address=zookeeper://192.168.1.36:2181
dubbo.application.name=biz-merchant-service-provider
\ No newline at end of file
dubbo.application.name=biz-merchant-service-provider
##freemarker
spring.freemarker.cache=false
spring.freemarker.charset=UTF-8
spring.freemarker.check-template-location=true
spring.freemarker.content-type=text/html
spring.freemarker.enabled=true
spring.freemarker.suffix=.ftl
spring.freemarker.template-loader-path=classpath:/templates
#\u9759\u6001\u8d44\u6e90\u8def\u5f84
spring.mvc.static-path-pattern=/**
\ No newline at end of file
<?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.glsx.publicservice.mapper.SMSLogMapper">
<insert id="saveSMSLog" useGeneratedKeys="true" keyColumn="id" parameterType="com.glsx.publicservice.pojo.SMSLog">
insert into sys_sms_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="phone != null and phone != ''">
phone,
</if>
<if test="content != null and content != ''">
content,
</if>
<if test="smsType != null">
sms_type,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values(" suffix=")" suffixOverrides=",">
<if test="phone != null and phone != ''">
#{phone},
</if>
<if test="content != null and content != ''">
#{content},
</if>
<if test="smsType != null">
#{smsType},
</if>
<if test="createTime != null">
#{createTime},
</if>
</trim>
</insert>
</mapper>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Type" content="multipart/form-data; charset=utf-8" />
<title>Insert title here</title>
<script type="text/javascript" src="https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/js/lib/jquery-1.10.2_d88366fd.js">
</script>
<script type="text/javascript">
</script>
</head>
<body>
<form action="/carservice/publicservice/common/uploadFile" method="POST" enctype="multipart/form-data">
文件名<input type="file" name="file"/><br/>
<input type="submit" value="提交"/><br/>
</form>
http://192.168.117.21/group1/M00/00/00/wKh1FVpuihaAOEYYAM6RZgQ2eg4341.gif<a href="/fileUpload/fileDownLoad?filePath=http://192.168.117.21/group1/M00/00/00/wKh1FVpuxWaABwJFAABcsTTSU2Q884.jpg">下载</a>
<a href="/fileUpload/fileDelete?filePath=http://192.168.117.21/group1/M00/00/00/wKh1FVpuihaAOEYYAM6RZgQ2eg4341.gif">删除</a>
</body>
</html>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!