wangliang 5 年之前
父节点
当前提交
43e6c0b83c

+ 6 - 6
pom.xml

@@ -27,7 +27,7 @@
         <project.version>1.0.0</project.version>
         <swagger2.version>2.9.2</swagger2.version>
         <logback.version>1.2.3</logback.version>
-        <!--        <fastjson.version>1.2.68</fastjson.version>-->
+        <fastjson.version>1.2.68</fastjson.version>
         <druid.version>1.1.20</druid.version>
         <fileupload.version>1.4</fileupload.version>
         <poi.version>3.17</poi.version>
@@ -145,11 +145,11 @@
                 <artifactId>aliyun-sdk-oss</artifactId>
                 <version>${aliyun.version}</version>
             </dependency>
-            <!--            <dependency>-->
-            <!--                <groupId>com.alibaba</groupId>-->
-            <!--                <artifactId>fastjson</artifactId>-->
-            <!--                <version>${fastjson.version}</version>-->
-            <!--            </dependency>-->
+            <dependency>
+                <groupId>com.alibaba</groupId>
+                <artifactId>fastjson</artifactId>
+                <version>${fastjson.version}</version>
+            </dependency>
             <dependency>
                 <groupId>com.fasterxml.jackson.core</groupId>
                 <artifactId>jackson-core</artifactId>

+ 22 - 0
themis-backend/src/main/java/com/qmth/themis/backend/api/SysController.java

@@ -3,9 +3,11 @@ package com.qmth.themis.backend.api;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.qmth.themis.backend.util.ServletUtil;
 import com.qmth.themis.business.constant.SystemConstant;
+import com.qmth.themis.business.entity.TBAttachment;
 import com.qmth.themis.business.entity.TBPrivilege;
 import com.qmth.themis.business.entity.TBUser;
 import com.qmth.themis.business.enums.RoleEnum;
+import com.qmth.themis.business.service.TBAttachmentService;
 import com.qmth.themis.business.service.TBPrivilegeService;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.exception.BusinessException;
@@ -16,9 +18,11 @@ 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 javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -39,6 +43,9 @@ public class SysController {
     @Resource
     TBPrivilegeService tbPrivilegeService;
 
+    @Resource
+    TBAttachmentService tbAttachmentService;
+
     @ApiOperation(value = "菜单查询接口")
     @RequestMapping(value = "/getMenu", method = RequestMethod.GET)
     @ApiResponses({@ApiResponse(code = 200, message = "菜单信息", response = TBPrivilege.class)})
@@ -73,4 +80,19 @@ public class SysController {
 //        return ResultUtil.ok(map);
         return ResultUtil.ok(SystemConstant.SUCCESS);
     }
+
+    @ApiOperation(value = "上传文件接口")
+    @RequestMapping(value = "/file/upload", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "{\"id\":0}", response = Result.class)})
+    public Result fileUpload(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file, HttpServletRequest request) throws IOException {
+        TBAttachment tbAttachment = tbAttachmentService.saveAttachment(file, request.getHeader(SystemConstant.MD5), request.getHeader(SystemConstant.PATH));
+        if (Objects.isNull(tbAttachment)) {
+            throw new BusinessException("保存附件失败");
+        }
+        Map map = new HashMap();
+        map.put(SystemConstant.ID, tbAttachment.getId());
+        map.put("name", tbAttachment.getName());
+        map.put(SystemConstant.TYPE, tbAttachment.getType());
+        return ResultUtil.ok(map);
+    }
 }

+ 58 - 0
themis-backend/src/main/java/com/qmth/themis/backend/api/TBUserController.java

@@ -99,6 +99,42 @@ public class TBUserController {
         if (!Objects.equals(loginPassword, aesPassword)) {
             throw new BusinessException(ExceptionResultEnum.PASSWORD_NO);
         }
+        return userLoginCommon(user, request);
+    }
+
+    @ApiOperation(value = "短信验证码登陆接口")
+    @RequestMapping(value = "/login/verifyCode", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "用户信息", response = TBUser.class)})
+    public Result verifyCode(@ApiParam(value = "用户信息", required = true) @RequestBody Map<String, Object> mapParameter, HttpServletRequest request) throws NoSuchAlgorithmException {
+        if (Objects.isNull(mapParameter.get("loginName")) || Objects.equals(mapParameter.get("loginName"), "")) {
+            throw new BusinessException(ExceptionResultEnum.LOGIN_NAME_IS_NULL);
+        }
+        if (Objects.isNull(mapParameter.get("verifyCode")) || Objects.equals(mapParameter.get("verifyCode"), "")) {
+            throw new BusinessException(ExceptionResultEnum.VERIFYCODE_IS_NULL);
+        }
+        String loginName = String.valueOf(mapParameter.get("loginName"));
+        String verifyCode = String.valueOf(mapParameter.get("verifyCode"));
+
+        QueryWrapper<TBUser> wrapper = new QueryWrapper<>();
+        wrapper.lambda().eq(TBUser::getLoginName, loginName);
+        TBUser user = tbUserService.getOne(wrapper);
+        //用户不存在
+        if (Objects.isNull(user)) {
+            throw new BusinessException(ExceptionResultEnum.USER_NO);
+        }
+        //todo 加入验证码校验逻辑
+        return userLoginCommon(user, request);
+    }
+
+    /**
+     * 用户登录公用
+     *
+     * @param user
+     * @param request
+     * @return
+     * @throws NoSuchAlgorithmException
+     */
+    public Result userLoginCommon(TBUser user, HttpServletRequest request) throws NoSuchAlgorithmException {
         //停用
         if (user.getEnable().intValue() == 0) {
             throw new BusinessException(ExceptionResultEnum.USER_ENABLE);
@@ -519,4 +555,26 @@ public class TBUserController {
         tbUserService.saveOrUpdate(tbUser);
         return ResultUtil.ok(JacksonUtil.parseJson(SystemConstant.SUCCESS));
     }
+
+    @ApiOperation(value = "获取短信验证码接口")
+    @RequestMapping(value = "/getVerifyCode", method = RequestMethod.GET)
+    @ApiResponses({@ApiResponse(code = 200, message = "{\"verifyCode\":123456}", response = Result.class)})
+    public Result getVerifyCode(@ApiParam(value = "登录名", required = true) @RequestParam String loginName, HttpServletRequest request) {
+        Map map = new HashMap();
+        return ResultUtil.ok(map);
+    }
+
+    @ApiOperation(value = "获取短信验证码接口")
+    @RequestMapping(value = "/validate/verifyCode", method = RequestMethod.GET)
+    @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
+    public Result validateVerifyCode(@ApiParam(value = "验证码", required = true) @RequestParam String verifyCode, HttpServletRequest request) {
+        return ResultUtil.ok(JacksonUtil.parseJson(SystemConstant.SUCCESS));
+    }
+
+    @ApiOperation(value = "二次验证获取短信验证码接口")
+    @RequestMapping(value = "/validate/getVerifyCode", method = RequestMethod.GET)
+    @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
+    public Result validateGetVerifyCode(HttpServletRequest request) {
+        return ResultUtil.ok(JacksonUtil.parseJson(SystemConstant.SUCCESS));
+    }
 }

+ 6 - 0
themis-business/src/main/java/com/qmth/themis/business/constant/SystemConstant.java

@@ -44,6 +44,12 @@ public class SystemConstant {
     public static final String ERROR = "/error";
     public static final String SESSION_TOPIC_BUFFER_LIST = "session:topic:buffer:list";
     public static final String USERLOG_TOPIC_BUFFER_LIST = "userLog:topic:buffer:list";
+    public static final String TYPE = "type";
+    public static final String LOCAL = "local";
+    public static final String OSS = "oss";
+    public static final String PATH = "path";
+    public static final String ID = "id";
+    public static final String MD5 = "md5";
     /**
      * session过期时间
      */

+ 17 - 0
themis-business/src/main/java/com/qmth/themis/business/dao/TBAttachmentMapper.java

@@ -0,0 +1,17 @@
+package com.qmth.themis.business.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.qmth.themis.business.entity.TBAttachment;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @Description: 附件 mapper
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020/4/17
+ */
+@Mapper
+public interface TBAttachmentMapper extends BaseMapper<TBAttachment> {
+
+}

+ 139 - 0
themis-business/src/main/java/com/qmth/themis/business/entity/TBAttachment.java

@@ -0,0 +1,139 @@
+package com.qmth.themis.business.entity;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import org.springframework.data.annotation.CreatedBy;
+import org.springframework.data.annotation.CreatedDate;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @Description: 附件表
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020-04-17
+ */
+@ApiModel(value = "t_b_attachment", description = "附件表")
+public class TBAttachment implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "主键")
+    @TableId(value = "id")
+    private Long id; //主键
+
+    @TableField("name")
+    @ApiModelProperty(value = "附件名称")
+    private String name; //附件名称
+
+    @TableField("path")
+    @ApiModelProperty(value = "路径")
+    private String path; //路径
+
+    @TableField("type")
+    @ApiModelProperty(value = "类型")
+    private String type; //类型
+
+    @TableField("size")
+    @ApiModelProperty(value = "大小", example = "0")
+    private BigDecimal size; //大小
+
+    @TableField("md5")
+    @ApiModelProperty(value = "MD5")
+    private String md5; //MD5
+
+    @TableField("remark")
+    @ApiModelProperty(value = "备注")
+    private String remark; //备注
+
+    @CreatedBy
+    @TableField("create_by")
+    @ApiModelProperty(value = "创建人id")
+    private Long createId; //创建人id
+
+    @CreatedDate
+    @TableField(value = "create_time", fill = FieldFill.INSERT)
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime; //创建时间
+
+    public static long getSerialVersionUID() {
+        return serialVersionUID;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getPath() {
+        return path;
+    }
+
+    public void setPath(String path) {
+        this.path = path;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public BigDecimal getSize() {
+        return size;
+    }
+
+    public void setSize(BigDecimal size) {
+        this.size = size;
+    }
+
+    public String getMd5() {
+        return md5;
+    }
+
+    public void setMd5(String md5) {
+        this.md5 = md5;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public Long getCreateId() {
+        return createId;
+    }
+
+    public void setCreateId(Long createId) {
+        this.createId = createId;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+}

+ 44 - 0
themis-business/src/main/java/com/qmth/themis/business/service/TBAttachmentService.java

@@ -0,0 +1,44 @@
+package com.qmth.themis.business.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.themis.business.entity.TBAttachment;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 附件 服务类
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020-04-17
+ */
+public interface TBAttachmentService extends IService<TBAttachment> {
+
+    /**
+     * 保存附件
+     *
+     * @param file
+     * @param md5
+     * @param path
+     * @return
+     * @throws IOException
+     */
+    TBAttachment saveAttachment(MultipartFile file, String md5, String path) throws IOException;
+
+    /**
+     * 删除附件
+     *
+     * @param tbAttachment
+     */
+    void deleteAttachment(TBAttachment tbAttachment);
+
+    /**
+     * 批量删除附件
+     *
+     * @param map
+     */
+    void batchDeleteAttachment(List<Map> map);
+}

+ 188 - 0
themis-business/src/main/java/com/qmth/themis/business/service/impl/TBAttachmentServiceImpl.java

@@ -0,0 +1,188 @@
+package com.qmth.themis.business.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.themis.business.constant.SystemConstant;
+import com.qmth.themis.business.dao.TBAttachmentMapper;
+import com.qmth.themis.business.entity.TBAttachment;
+import com.qmth.themis.business.service.TBAttachmentService;
+import com.qmth.themis.business.util.JacksonUtil;
+import com.qmth.themis.business.util.OssUtil;
+import com.qmth.themis.business.util.RedisUtil;
+import com.qmth.themis.common.enums.ExceptionResultEnum;
+import com.qmth.themis.common.exception.BusinessException;
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.io.FileUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.FileCopyUtils;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.*;
+
+/**
+ * @Description: 附件 服务实现类
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020-04-17
+ */
+@Service
+public class TBAttachmentServiceImpl extends ServiceImpl<TBAttachmentMapper, TBAttachment> implements TBAttachmentService {
+    private final static Logger log = LoggerFactory.getLogger(TBAttachmentServiceImpl.class);
+
+    @Resource
+    OssUtil ossUtil;
+
+    /**
+     * 保存附件
+     *
+     * @param file
+     * @param md5
+     * @param path
+     * @return
+     * @throws IOException
+     */
+    @Override
+    @Transactional
+    public TBAttachment saveAttachment(MultipartFile file, String md5, String path) throws IOException {
+        TBAttachment tbAttachment = null;
+        try {
+            int temp = file.getOriginalFilename().indexOf(".");
+            String fileName = file.getOriginalFilename().substring(0, temp);
+            String format = file.getOriginalFilename().substring(temp, file.getOriginalFilename().length());
+//            List<String> attachmentTypeList = dictionaryConfig.sysDomain().getAttachmentType();
+//            if (Objects.nonNull(format)) {
+//                long count = attachmentTypeList.stream().filter(s -> format.equalsIgnoreCase(s)).count();
+//                if (count == 0) {
+//                    throw new BusinessException("文件格式只能为" + attachmentTypeList.toString());
+//                }
+//            }
+            long size = file.getSize();
+            BigDecimal b = new BigDecimal(size);
+            BigDecimal num = new BigDecimal(1024);
+            b = b.divide(num).divide(num).setScale(2, BigDecimal.ROUND_HALF_UP);
+            if (b.doubleValue() > 200) {
+                throw new BusinessException("文件大小不能超过200MB");
+            }
+            log.info("fileName:{}", fileName);
+            log.info("format:{}", format);
+            log.info("size:{}", b);
+            log.info("getOriginalFilename:{}", file.getOriginalFilename());
+            String fileMd5 = DigestUtils.md5Hex(file.getBytes());
+            log.info("fileMd5:{}", fileMd5);
+            log.info("md5:{}", md5);
+            if (Objects.isNull(md5)) {
+                throw new BusinessException("request里的md5为空");
+            }
+            if (!Objects.equals(fileMd5, md5)) {
+                throw new BusinessException("md5不一致");
+            }
+            tbAttachment = new TBAttachment();
+            tbAttachment.setPath(path);
+            tbAttachment.setName(fileName);
+            tbAttachment.setType(format);
+            tbAttachment.setSize(b);
+            tbAttachment.setMd5(fileMd5);
+
+            boolean oss = true;
+//            boolean oss = dictionaryConfig.sysDomain().isOss();
+            LocalDateTime nowTime = LocalDateTime.now();
+            StringJoiner stringJoiner = new StringJoiner("")
+//                    .add(dictionaryConfig.sysDomain().getLocalhostPath())
+//                    .add(File.separator).add(String.valueOf(schoolId))
+                    .add(File.separator).add(String.valueOf(nowTime.getYear()))
+                    .add(File.separator).add(String.valueOf(nowTime.getMonthValue()))
+                    .add(File.separator).add(String.valueOf(nowTime.getDayOfMonth()));
+            if (oss) {//上传至oss
+                stringJoiner.add(File.separator).add(String.valueOf(UUID.randomUUID()).replaceAll("-", ""))
+                        .add(tbAttachment.getType());
+//                ossUtil.ossUpload(stringJoiner.toString(), file.getInputStream());
+            } else {//上传至服务器
+                File mkdir = new File(stringJoiner.toString());
+                if (!mkdir.exists()) {
+                    mkdir.mkdirs();
+                }
+                stringJoiner.add(File.separator).add(String.valueOf(UUID.randomUUID()).replaceAll("-", ""))
+                        .add(tbAttachment.getType());
+                FileUtils.copyInputStreamToFile(file.getInputStream(), new File(stringJoiner.toString()));
+            }
+            JSONObject jsonObject = new JSONObject();
+            if (oss) {
+                jsonObject.put(SystemConstant.TYPE, SystemConstant.OSS);
+            } else {
+                jsonObject.put(SystemConstant.TYPE, SystemConstant.LOCAL);
+            }
+            jsonObject.put(SystemConstant.PATH, stringJoiner.toString());
+            tbAttachment.setRemark(jsonObject.toJSONString());
+//            TcPBasicUser currentUser = (TcPBasicUser) RedisUtil.getUser(userId);
+//            if (Objects.isNull(currentUser)) {
+//                throw new BusinessException(ExceptionResultEnum.LOGIN_NO);
+//            }
+//            tbAttachment.setCreateId(currentUser.getId());
+            this.save(tbAttachment);
+        } catch (Exception e) {
+            e.printStackTrace();
+            deleteAttachment(tbAttachment);
+            if (e instanceof BusinessException) {
+                throw new BusinessException(e.getMessage());
+            } else {
+                throw new RuntimeException(e);
+            }
+        }
+        return tbAttachment;
+    }
+
+    /**
+     * 删除附件
+     *
+     * @param tbAttachment
+     */
+    @Override
+    public void deleteAttachment(TBAttachment tbAttachment) {
+        if (Objects.nonNull(tbAttachment) && Objects.nonNull(tbAttachment.getRemark())) {
+            JSONObject jsonObject = JSONObject.parseObject(tbAttachment.getRemark());
+            String type = String.valueOf(jsonObject.get(SystemConstant.TYPE));
+            if (Objects.nonNull(type) && Objects.equals(type, SystemConstant.OSS)) {//删除阿里云附件
+//                ossUtil.ossDelete(jsonObject.get(SystemConstant.PATH).toString());
+            } else {//删除服务器附件
+                File file = new File(jsonObject.get(SystemConstant.PATH).toString());
+                file.delete();
+            }
+        }
+    }
+
+    /**
+     * 批量删除附件
+     *
+     * @param map
+     */
+    @Override
+    public void batchDeleteAttachment(List<Map> map) {
+        List<String> paths = null;
+        String type = null;
+        if (Objects.nonNull(map)) {
+            paths = new ArrayList<>();
+            for (Map m : map) {
+                JSONObject jsonObject = JSONObject.parseObject((String) m.get("remark"));
+                type = (String) jsonObject.get("type");
+                paths.add((String) jsonObject.get("path"));
+            }
+        }
+        if (Objects.nonNull(type) && Objects.equals(type, SystemConstant.OSS)) {//删除阿里云附件
+//            ossUtil.ossBatchDelete(paths);
+        } else if (Objects.nonNull(type) && Objects.equals(type, SystemConstant.LOCAL)) {//删除服务器附件
+            for (String s : paths) {
+                File file = new File(s);
+                file.delete();
+            }
+        }
+    }
+}

+ 35 - 10
themis-business/src/main/resources/db/init.sql

@@ -386,6 +386,36 @@ LOCK TABLES `t_b_app` WRITE;
 /*!40000 ALTER TABLE `t_b_app` ENABLE KEYS */;
 UNLOCK TABLES;
 
+--
+-- Table structure for table `t_b_attachment`
+--
+
+DROP TABLE IF EXISTS `t_b_attachment`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `t_b_attachment` (
+  `id` bigint NOT NULL COMMENT '主键',
+  `name` varchar(100) DEFAULT NULL COMMENT '附件名称',
+  `path` varchar(500) DEFAULT NULL COMMENT '路径',
+  `type` varchar(30) DEFAULT NULL COMMENT '类型',
+  `size` double DEFAULT NULL COMMENT '大小',
+  `md5` varchar(255) DEFAULT NULL COMMENT 'MD5',
+  `remark` varchar(500) DEFAULT NULL COMMENT '备注',
+  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
+  `create_id` bigint DEFAULT NULL COMMENT '创建人',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='附件表';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Dumping data for table `t_b_attachment`
+--
+
+LOCK TABLES `t_b_attachment` WRITE;
+/*!40000 ALTER TABLE `t_b_attachment` DISABLE KEYS */;
+/*!40000 ALTER TABLE `t_b_attachment` ENABLE KEYS */;
+UNLOCK TABLES;
+
 --
 -- Table structure for table `t_b_client_version`
 --
@@ -452,7 +482,7 @@ CREATE TABLE `t_b_org` (
 
 LOCK TABLES `t_b_org` WRITE;
 /*!40000 ALTER TABLE `t_b_org` DISABLE KEYS */;
-INSERT INTO `t_b_org` VALUES (1,'test1','test1',NULL,1,0,NULL,NULL,NULL,'2020-07-02 12:08:31','2020-07-02 12:08:31','sysadmin','11111111111',0,0,NULL,NULL);
+INSERT INTO `t_b_org` VALUES (1,'test1','test1',NULL,1,0,NULL,NULL,NULL,'2020-07-02 12:08:31','2020-07-02 12:08:31','sysadmin','11111111111',0,0,NULL,NULL),(1281509005815296001,'test5','test2','http://11',1,NULL,1,'2','2','2020-07-10 16:42:11','2020-07-11 16:19:44','3','4',1,1,1,1);
 /*!40000 ALTER TABLE `t_b_org` ENABLE KEYS */;
 UNLOCK TABLES;
 
@@ -546,7 +576,7 @@ DROP TABLE IF EXISTS `t_b_session`;
 /*!40101 SET @saved_cs_client     = @@character_set_client */;
 /*!40101 SET character_set_client = utf8 */;
 CREATE TABLE `t_b_session` (
-  `id` varchar(30) NOT NULL COMMENT '主键',
+  `id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主键',
   `identity` varchar(100) NOT NULL COMMENT '用户标识',
   `type` varchar(50) NOT NULL COMMENT '用户类型',
   `source` varchar(50) NOT NULL COMMENT '访问来源',
@@ -601,7 +631,7 @@ CREATE TABLE `t_b_user` (
 
 LOCK TABLES `t_b_user` WRITE;
 /*!40000 ALTER TABLE `t_b_user` DISABLE KEYS */;
-INSERT INTO `t_b_user` VALUES (1,'sysadmin','yXVUkR45PFz0UfpbDB8/ew==',NULL,1,1,'2020-07-02 12:08:31',NULL,'系统管理员','sysadmin',NULL,NULL),(2,'t1','yXVUkR45PFz0UfpbDB8/ew==',NULL,1,1,'2020-07-02 12:08:31',NULL,NULL,'测试老师1',NULL,NULL),(3,'s1','yXVUkR45PFz0UfpbDB8/ew==',NULL,1,1,'2020-07-02 12:08:31',NULL,NULL,'测试学生1',NULL,NULL);
+INSERT INTO `t_b_user` VALUES (1,'sysadmin','yXVUkR45PFz0UfpbDB8/ew==',NULL,1,1,'2020-07-02 12:08:31',NULL,'系统管理员','sysadmin',NULL,NULL),(2,'t1','yXVUkR45PFz0UfpbDB8/ew==',NULL,1,1,'2020-07-02 12:08:31',NULL,NULL,'测试老师1',NULL,NULL),(3,'s1','yXVUkR45PFz0UfpbDB8/ew==',NULL,1,1,'2020-07-02 12:08:31',NULL,NULL,'测试学生1',NULL,NULL),(14404271441182720,'s3','yXVUkR45PFz0UfpbDB8/ew==','111111',1,1,'2020-07-10 17:57:30','2020-07-11 16:20:09',NULL,'s2',14404271441182720,14404271441182720);
 /*!40000 ALTER TABLE `t_b_user` ENABLE KEYS */;
 UNLOCK TABLES;
 
@@ -626,7 +656,7 @@ CREATE TABLE `t_b_user_role` (
 
 LOCK TABLES `t_b_user_role` WRITE;
 /*!40000 ALTER TABLE `t_b_user_role` DISABLE KEYS */;
-INSERT INTO `t_b_user_role` VALUES (1,1,'SUPER_ADMIN'),(2,2,'TEACHER'),(3,3,'STUDENT');
+INSERT INTO `t_b_user_role` VALUES (1,1,'SUPER_ADMIN'),(2,2,'TEACHER'),(3,3,'STUDENT'),(14742176286113792,14404271441182720,'STUDENT'),(14742176374194176,14404271441182720,'TEACHER');
 /*!40000 ALTER TABLE `t_b_user_role` ENABLE KEYS */;
 UNLOCK TABLES;
 
@@ -721,7 +751,6 @@ CREATE TABLE `t_e_exam` (
 
 LOCK TABLES `t_e_exam` WRITE;
 /*!40000 ALTER TABLE `t_e_exam` DISABLE KEYS */;
-INSERT INTO `t_e_exam` VALUES (14017935244787712,1,'zXnGzKId0o6l4VVm0lfw','123','test1','2020-07-09 16:22:16','2020-07-09 16:22:16',0,'123456',30,30,'99999',30,'88888',5,30,3,1,1,1,1,1,1,1,1,'2020-07-09 16:22:16',NULL,0,1,0,30,30,1,1,1,1,1,30,3,1,1,1,'1',1,NULL,NULL),(14018717067247616,1,'tveXEdkYjQEHvQd1JqKK','123','test1','2020-07-09 16:25:23','2020-07-09 16:25:23',0,'123456',30,30,'99999',30,'88888',5,30,3,1,1,1,1,1,1,1,1,'2020-07-09 16:25:23',NULL,0,1,0,30,30,1,1,1,1,1,30,3,1,1,1,'1',1,NULL,NULL),(14018960554983424,1,'gtWz7PojgIE9rmutRkKq','123','test1','2020-07-09 16:26:21','2020-07-09 16:26:21',0,'123456',30,30,'99999',30,'88888',5,30,3,1,1,1,1,1,1,1,1,'2020-07-09 16:26:25',NULL,0,1,0,30,30,1,1,1,1,1,30,3,1,1,1,'1',1,NULL,NULL),(14019477511340032,1,'aRghUl1VDFU9gEMnpChX','123','test1','2020-07-09 16:28:24','2020-07-09 16:28:24',0,'123456',30,30,'99999',30,'88888',5,30,3,1,1,1,1,1,1,1,1,'2020-07-09 16:28:24','2020-07-09 16:28:24',0,1,0,30,30,1,1,1,1,1,30,3,1,1,1,'1',1,NULL,NULL);
 /*!40000 ALTER TABLE `t_e_exam` ENABLE KEYS */;
 UNLOCK TABLES;
 
@@ -792,7 +821,6 @@ CREATE TABLE `t_e_exam_activity_test1` (
 
 LOCK TABLES `t_e_exam_activity_test1` WRITE;
 /*!40000 ALTER TABLE `t_e_exam_activity_test1` DISABLE KEYS */;
-INSERT INTO `t_e_exam_activity_test1` VALUES (14017936758931456,14017935244787712,'O1XFPKl9L9cGfj8r8nLq',30,30,1,30,'2020-07-09 16:22:17','2020-07-09 16:22:17','2020-07-09 16:22:17',NULL,NULL,NULL),(14018717528621056,14018717067247616,'SZiB2Tsn3PaEJUbKOpXw',30,30,1,30,'2020-07-09 16:25:23','2020-07-09 16:25:23','2020-07-09 16:25:23',NULL,NULL,NULL),(14019124715847680,14018960554983424,'Ffu657LSUwsCT9lPYiI3',30,30,1,30,'2020-07-09 16:27:00','2020-07-09 16:27:00','2020-07-09 16:27:00',NULL,NULL,NULL),(14019477708472320,14019477511340032,'VVh0GsP5KKbZaCeu5dtX',30,30,1,30,'2020-07-09 16:28:24','2020-07-09 16:28:24','2020-07-09 16:28:24',NULL,NULL,NULL);
 /*!40000 ALTER TABLE `t_e_exam_activity_test1` ENABLE KEYS */;
 UNLOCK TABLES;
 
@@ -858,7 +886,6 @@ CREATE TABLE `t_e_exam_course` (
 
 LOCK TABLES `t_e_exam_course` WRITE;
 /*!40000 ALTER TABLE `t_e_exam_course` DISABLE KEYS */;
-INSERT INTO `t_e_exam_course` VALUES (14017937207721984,14017935244787712,'HExIq','测试科目1',1,1,1,1,1),(14018717809639424,14018717067247616,'MtHC8','测试科目1',1,1,1,1,1),(14019125760229376,14018960554983424,'Lh6AE','测试科目1',1,1,1,1,1),(14019477788164096,14019477511340032,'iLbDF','测试科目1',1,1,1,1,1);
 /*!40000 ALTER TABLE `t_e_exam_course` ENABLE KEYS */;
 UNLOCK TABLES;
 
@@ -976,7 +1003,6 @@ CREATE TABLE `t_e_exam_student` (
 
 LOCK TABLES `t_e_exam_student` WRITE;
 /*!40000 ALTER TABLE `t_e_exam_student` DISABLE KEYS */;
-INSERT INTO `t_e_exam_student` VALUES (14017938180800512,14017935244787712,14017936758931456,14017934745665536,'HExIq','1','SFiCvTk5ERz6bq5jxUzP','132','{\"examTest1\":\"aaa\",\"examTest2\":\"bbb\"}',1,NULL,NULL,'test1',1,'2020-07-09 16:22:17',NULL,NULL,NULL),(14018718455562240,14018717067247616,14018717528621056,14018716748480512,'MtHC8','1','R75yEUGeO40N7G74BfHl','132','{\"examTest1\":\"aaa\",\"examTest2\":\"bbb\"}',1,NULL,NULL,'test1',1,'2020-07-09 16:25:23',NULL,NULL,NULL),(14019126959800320,14018960554983424,14019124715847680,14018960143941632,'Lh6AE','1','ZVJfQteiTjg0D1ISA3Ye','132','{\"examTest1\":\"aaa\",\"examTest2\":\"bbb\"}',1,NULL,NULL,'test1',1,'2020-07-09 16:27:00',NULL,NULL,NULL),(14019477951741952,14019477511340032,14019477708472320,14019477171601408,'iLbDF','1','Y7bwz3KvsdSmCCSQfduV','132','{\"examTest1\":\"aaa\",\"examTest2\":\"bbb\"}',1,NULL,NULL,'test1',1,'2020-07-09 16:28:24','2020-07-09 16:28:24',NULL,NULL);
 /*!40000 ALTER TABLE `t_e_exam_student` ENABLE KEYS */;
 UNLOCK TABLES;
 
@@ -1072,7 +1098,6 @@ CREATE TABLE `t_e_student` (
 
 LOCK TABLES `t_e_student` WRITE;
 /*!40000 ALTER TABLE `t_e_student` DISABLE KEYS */;
-INSERT INTO `t_e_student` VALUES (14017934745665536,1,'gohtNJ7vBpn1LQsrPShynwjfi9FCi7','123456','Y1Cru3cVGkOzjB07JB','57541179016','aaa',1,'http://11111','2020-07-09 16:22:16',NULL,NULL,NULL,1),(14018716748480512,1,'N9EoeYUHmz52fw27jtIp0rFtTLwc8j','123456','Td25r1Y4zFVB1sxF4d','94684987712','aaa',1,'http://11111','2020-07-09 16:25:23',NULL,NULL,NULL,1),(14018960143941632,1,'CRA0fFM3eXaG6bNf4ZXP7axv3O0p8Y','123456','upwjbg4s0Zj7muOykT','66120611075','aaa',1,'http://11111','2020-07-09 16:26:21',NULL,NULL,NULL,1),(14019477171601408,1,'xZtRoAV3uTD0FsBgCuWDyUcNDKbrpk','123456','tqep3qX5oWZ4Ygqwbe','20836923204','aaa',1,'http://11111','2020-07-09 16:28:24','2020-07-09 16:28:24',NULL,NULL,1);
 /*!40000 ALTER TABLE `t_e_student` ENABLE KEYS */;
 UNLOCK TABLES;
 
@@ -1544,4 +1569,4 @@ UNLOCK TABLES;
 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
 
--- Dump completed on 2020-07-09 18:48:31
+-- Dump completed on 2020-07-12 13:54:42

+ 5 - 0
themis-business/src/main/resources/mapper/TBAttachmentMapper.xml

@@ -0,0 +1,5 @@
+<?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.qmth.themis.business.dao.TBAttachmentMapper">
+
+</mapper>

+ 4 - 4
themis-common/pom.xml

@@ -14,10 +14,10 @@
     </parent>
 
     <dependencies>
-        <!--        <dependency>-->
-        <!--            <groupId>com.alibaba</groupId>-->
-        <!--            <artifactId>fastjson</artifactId>-->
-        <!--        </dependency>-->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+        </dependency>
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-core</artifactId>

+ 2 - 0
themis-common/src/main/java/com/qmth/themis/common/enums/ExceptionResultEnum.java

@@ -36,6 +36,8 @@ public enum ExceptionResultEnum {
 
     PASSWORD_IS_NULL("102", "密码不能为空"),
 
+    VERIFYCODE_IS_NULL("102", "验证码不能为空"),
+
     SCHOOL_ID_IS_NULL("102", "学校id不能为空"),
 
     MD5_IS_NULL("102", "附件MD5不能为空"),