소스 검색

上传文件

小么熊🐻 1 년 전
부모
커밋
f092587ab9

+ 110 - 0
nbjk-admin/src/main/java/com/miaxis/app/controller/feed/FeedBackController.java

@@ -0,0 +1,110 @@
+package com.miaxis.app.controller.feed;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.Constants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.feed.domain.FeedBack;
+import com.miaxis.feed.service.IFeedBackService;
+import io.swagger.annotations.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * 【意见反馈】Controller
+ *
+ * @author miaxis
+ * @date 2023-05-08
+ */
+@RestController
+@RequestMapping(Constants.STUDENT_PREFIX +"/feed/back")
+@Api(tags={"【app-意见反馈】"})
+public class FeedBackController extends BaseController{
+    @Autowired
+    private IFeedBackService feedBackService;
+
+    /**
+     * 查询意见反馈列表
+     */
+    @PreAuthorize("@ss.hasPermi('feed:back:list')")
+    @GetMapping("/list")
+    @ApiOperation("查询意见反馈列表")
+        @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageNum",value = "当前页码" ,dataType = "int", paramType = "query", required = false),
+            @ApiImplicitParam(name = "pageSize",value = "每页数据量" , dataType = "int", paramType = "query", required = false),
+    })
+    public ResponsePageInfo<FeedBack> list(@ModelAttribute FeedBack feedBack){
+        startPage();
+        List<FeedBack> list = feedBackService.selectFeedBackList(feedBack);
+        return toResponsePageInfo(list);
+    }
+    
+    /**
+     * 导出意见反馈列表
+     */
+    @PreAuthorize("@ss.hasPermi('feed:back:export')")
+    @Log(title = "意见反馈", businessType = BusinessTypeEnum.EXPORT)
+    @GetMapping("/export")
+    @ApiOperation("导出意见反馈列表Excel")
+    public Response<String> export(@ModelAttribute FeedBack feedBack){
+        List<FeedBack> list = feedBackService.selectFeedBackList(feedBack);
+        ExcelUtil<FeedBack> util = new ExcelUtil<FeedBack>(FeedBack.class);
+        return util.exportExcel(list, "back");
+    }
+
+    /**
+     * 获取意见反馈详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('feed:back:query')")
+    @GetMapping(value = "/{id}")
+    @ApiOperation("获取意见反馈详细信息")
+    public Response<FeedBack> getInfo(
+            @ApiParam(name = "id", value = "意见反馈参数", required = true)
+            @PathVariable("id") Long id
+    ){
+        return Response.success(feedBackService.getById(id));
+    }
+
+    /**
+     * 新增意见反馈
+     */
+    @PreAuthorize("@ss.hasPermi('feed:back:add')")
+    @Log(title = "意见反馈", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    @ApiOperation("新增意见反馈")
+    public Response<Integer> add(@RequestBody FeedBack feedBack){
+        return toResponse(feedBackService.save(feedBack) ? 1 : 0);
+    }
+
+    /**
+     * 修改意见反馈
+     */
+    @PreAuthorize("@ss.hasPermi('feed:back:edit')")
+    @Log(title = "意见反馈", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    @ApiOperation("修改意见反馈")
+    public Response<Integer> edit(@RequestBody FeedBack feedBack){
+        return toResponse(feedBackService.updateById(feedBack) ? 1 : 0);
+    }
+
+    /**
+     * 删除意见反馈
+     */
+    @PreAuthorize("@ss.hasPermi('feed:back:remove')")
+    @Log(title = "意见反馈", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{ids}")
+    @ApiOperation("删除意见反馈")
+    public  Response<Integer> remove(
+            @ApiParam(name = "ids", value = "意见反馈ids参数", required = true)
+            @PathVariable Long[] ids
+    ){
+        return toResponse(feedBackService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
+    }
+}

+ 113 - 0
nbjk-admin/src/main/java/com/miaxis/app/controller/file/FileInfoController.java

@@ -0,0 +1,113 @@
+package com.miaxis.app.controller.file;
+
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.constant.Constants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.StringUtils;
+import com.miaxis.common.utils.poi.ExcelUtil;
+import com.miaxis.file.domain.FileInfo;
+import com.miaxis.file.service.IFileInfoService;
+import io.swagger.annotations.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * 【上传文件】Controller
+ *
+ * @author miaxis
+ * @date 2023-05-08
+ */
+@RestController
+@RequestMapping(Constants.STUDENT_PREFIX+"/file/info")
+@Api(tags={"【app-上传文件】"})
+public class FileInfoController extends BaseController{
+    @Autowired
+    private IFileInfoService fileInfoService;
+
+    /**
+     * 查询上传文件列表
+     */
+    @GetMapping("/list")
+    @ApiOperation("查询上传文件列表")
+        @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageNum",value = "当前页码" ,dataType = "int", paramType = "query", required = false),
+            @ApiImplicitParam(name = "pageSize",value = "每页数据量" , dataType = "int", paramType = "query", required = false),
+    })
+    public ResponsePageInfo<FileInfo> list(@ModelAttribute FileInfo fileInfo){
+        startPage();
+        List<FileInfo> list = fileInfoService.selectFileInfoList(fileInfo);
+        return toResponsePageInfo(list);
+    }
+    
+
+
+    /**
+     * 获取上传文件详细信息
+     */
+    @GetMapping(value = "/{id}")
+    @ApiOperation("获取上传文件详细信息")
+    public Response<FileInfo> getInfo(
+            @ApiParam(name = "id", value = "上传文件参数", required = true)
+            @PathVariable("id") Long id
+    ){
+        return Response.success(fileInfoService.getById(id));
+    }
+
+    /**
+     * 新增上传文件
+     */
+    @Log(title = "上传文件", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    @ApiOperation("新增上传文件")
+    public Response<Integer> add(@RequestBody FileInfo fileInfo){
+        return toResponse(fileInfoService.save(fileInfo) ? 1 : 0);
+    }
+
+    /**
+     * 修改上传文件
+     */
+    @Log(title = "上传文件", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    @ApiOperation("修改上传文件")
+    public Response<Integer> edit(@RequestBody FileInfo fileInfo){
+        return toResponse(fileInfoService.updateById(fileInfo) ? 1 : 0);
+    }
+
+    /**
+     * 删除上传文件
+     */
+    @Log(title = "上传文件", businessType = BusinessTypeEnum.DELETE)
+	@DeleteMapping("/{ids}")
+    @ApiOperation("删除上传文件")
+    public  Response<Integer> remove(
+            @ApiParam(name = "ids", value = "上传文件ids参数", required = true)
+            @PathVariable Long[] ids
+    ){
+        return toResponse(fileInfoService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
+    }
+
+    /**
+     * 文件上传
+     */
+    @PutMapping("/fileUp")
+    @ApiOperation("文件上传")
+    public Response fileUp(List<MultipartFile> coverFiles,
+                                @RequestParam("businessType") String businessType
+                            ) throws IOException {
+        if (coverFiles==null || coverFiles.size()==0){
+            throw new CustomException("文件未上传");
+        }
+        return fileInfoService.fileUp(businessType,coverFiles);
+    }
+
+}

+ 4 - 2
nbjk-admin/src/main/resources/application-dev.yml

@@ -125,8 +125,10 @@ geo:
     path: /data/db/GeoLite2-City.mmdb
 
 
-
-
+#File文件保存地址
+file:
+    path: /data/www/wwwroot/ndata/upfile/feedback
+    url: https://ndata1.zzxcx.net/upfile/feedback
 
 
 

+ 4 - 1
nbjk-admin/src/main/resources/application-local.yml

@@ -125,7 +125,10 @@ geo:
     path: D:\ideaMiaxis\db\GeoLite2-City.mmdb
 
 
-
+#File文件保存地址
+file:
+    path: G:\中正\题库图\ndata\upfile\feedback
+    url: https://ndata1.zzxcx.net/upfile/feedback
 
 
 

+ 6 - 1
nbjk-admin/src/main/resources/application-prod.yml

@@ -123,4 +123,9 @@ wxpay:
 
 #GeoLite 地址库
 geo:
-    path: /data/db/GeoLite2-City.mmdb
+    path: /data/db/GeoLite2-City.mmdb
+
+#File文件保存地址
+file:
+    path: /data/www/wwwroot/ndata/upfile/feedback
+    url: https://ndata.zzxcx.net/upfile/feedback

+ 14 - 6
nbjk-admin/src/test/java/com/miaxis/test/Test.java

@@ -1,16 +1,24 @@
 package com.miaxis.test;
 
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.Random;
+import java.util.TimeZone;
 
 public class Test {
 
     public static void main(String[] args) {
-        Random random = new Random();
-
-        for (int i=0; i<100; i++){
-            int r = random.nextInt(3);
-                System.out.println(r);
-        }
+        long timestamp = 1682363931131L;
+        // 将时间戳转换为Date对象
+        Date date = new Date(timestamp);
+        // 创建SimpleDateFormat对象,指定输出格式
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        // 将时区设置为北京时区
+        sdf.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
+        // 格式化Date对象为字符串
+        String timeStr = sdf.format(date);
+        // 输出结果
+        System.out.println(timeStr);
 
     }
 

+ 19 - 0
nbjk-common/src/main/java/com/miaxis/common/config/FileConfig.java

@@ -0,0 +1,19 @@
+package com.miaxis.common.config;
+
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Data
+@Component
+@ConfigurationProperties(prefix = "file")
+public class FileConfig {
+
+    //保存路径
+    private String path;
+    //访问路径url
+    private String url;
+
+
+}

+ 104 - 0
nbjk-service/src/main/java/com/miaxis/feed/domain/FeedBack.java

@@ -0,0 +1,104 @@
+package com.miaxis.feed.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.miaxis.common.annotation.Excel;
+import com.miaxis.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.miaxis.common.core.domain.BaseBusinessEntity;
+import lombok.Data;
+/**
+ * 意见反馈对象 feed_back
+ *
+ * @author miaxis
+ * @date 2023-05-08
+ */
+@Data
+@TableName("feed_back")
+@ApiModel(value = "FeedBack", description = "意见反馈对象 feed_back")
+public class FeedBack extends BaseBusinessEntity{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    @TableId(value = "id")
+    @ApiModelProperty(value = "$column.columnComment")
+    private Long id;
+
+    /** 1.遇到问题 2.使用建议 */
+    @Excel(name = "1.遇到问题 2.使用建议")
+    @TableField("type")
+    @ApiModelProperty(value = "1.遇到问题 2.使用建议")
+    private Long type;
+
+    /** 内容 500字以内 */
+    @Excel(name = "内容 500字以内")
+    @TableField("content")
+    @ApiModelProperty(value = "内容 500字以内")
+    private String content;
+
+    /** 电话号码 */
+    @Excel(name = "电话号码")
+    @TableField("phone")
+    @ApiModelProperty(value = "电话号码")
+    private String phone;
+
+    /** 图片IDS */
+    @Excel(name = "图片IDS")
+    @TableField("img_ids")
+    @ApiModelProperty(value = "图片IDS")
+    private String imgIds;
+
+    public void setId(Long id){
+        this.id = id;
+    }
+
+    public Long getId(){
+        return id;
+    }
+    public void setType(Long type){
+        this.type = type;
+    }
+
+    public Long getType(){
+        return type;
+    }
+    public void setContent(String content){
+        this.content = content;
+    }
+
+    public String getContent(){
+        return content;
+    }
+    public void setPhone(String phone){
+        this.phone = phone;
+    }
+
+    public String getPhone(){
+        return phone;
+    }
+    public void setImgIds(String imgIds){
+        this.imgIds = imgIds;
+    }
+
+    public String getImgIds(){
+        return imgIds;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("type", getType())
+            .append("content", getContent())
+            .append("phone", getPhone())
+            .append("imgIds", getImgIds())
+            .append("createTime", getCreateTime())
+            .append("updateTime", getUpdateTime())
+            .toString();
+    }
+}

+ 22 - 0
nbjk-service/src/main/java/com/miaxis/feed/mapper/FeedBackMapper.java

@@ -0,0 +1,22 @@
+package com.miaxis.feed.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.miaxis.feed.domain.FeedBack;
+
+/**
+ * 意见反馈Mapper接口
+ *
+ * @author miaxis
+ * @date 2023-05-08
+ */
+public interface FeedBackMapper extends BaseMapper<FeedBack> {
+    /**
+     * 查询意见反馈列表
+     *
+     * @param feedBack 意见反馈
+     * @return 意见反馈集合
+     */
+    public List<FeedBack> selectFeedBackList(FeedBack feedBack);
+
+}

+ 21 - 0
nbjk-service/src/main/java/com/miaxis/feed/service/IFeedBackService.java

@@ -0,0 +1,21 @@
+package com.miaxis.feed.service;
+
+import java.util.List;
+import com.miaxis.feed.domain.FeedBack;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 意见反馈Service接口
+ *
+ * @author miaxis
+ * @date 2023-05-08
+ */
+public interface IFeedBackService extends IService<FeedBack>{
+    /**
+     * 查询意见反馈列表
+     *
+     * @param feedBack 意见反馈
+     * @return 意见反馈集合
+     */
+    public List<FeedBack> selectFeedBackList(FeedBack feedBack);
+}

+ 36 - 0
nbjk-service/src/main/java/com/miaxis/feed/service/impl/FeedBackServiceImpl.java

@@ -0,0 +1,36 @@
+package com.miaxis.feed.service.impl;
+
+import java.util.List;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.miaxis.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.apache.commons.lang3.StringUtils;
+import com.miaxis.feed.mapper.FeedBackMapper;
+import com.miaxis.feed.domain.FeedBack;
+import com.miaxis.feed.service.IFeedBackService;
+
+/**
+ * 意见反馈Service业务层处理
+ *
+ * @author miaxis
+ * @date 2023-05-08
+ */
+@Service
+public class FeedBackServiceImpl extends ServiceImpl<FeedBackMapper, FeedBack> implements IFeedBackService {
+    @Autowired
+    private FeedBackMapper feedBackMapper;
+
+    /**
+     * 查询意见反馈列表
+     *
+     * @param feedBack 意见反馈
+     * @return 意见反馈
+     */
+    @Override
+    public List<FeedBack> selectFeedBackList(FeedBack feedBack){
+        return feedBackMapper.selectFeedBackList(feedBack);
+    }
+}

+ 64 - 0
nbjk-service/src/main/java/com/miaxis/file/domain/FileInfo.java

@@ -0,0 +1,64 @@
+package com.miaxis.file.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.miaxis.common.annotation.Excel;
+import com.miaxis.common.core.domain.BaseBusinessEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+/**
+ * 上传文件对象 file_info
+ *
+ * @author miaxis
+ * @date 2023-05-08
+ */
+@Data
+@TableName("file_info")
+@ApiModel(value = "FileInfo", description = "上传文件对象 file_info")
+public class FileInfo extends BaseBusinessEntity{
+    private static final long serialVersionUID = 1L;
+
+    /** 文件ID */
+    @TableId(value = "id")
+    @ApiModelProperty(value = "文件ID")
+    private Long id;
+
+    /** 文件类型 */
+    @Excel(name = "文件类型")
+    @TableField("file_type")
+    @ApiModelProperty(value = "文件类型")
+    private String fileType;
+
+    /** 业务类型 */
+    @Excel(name = "业务类型")
+    @TableField("business_type")
+    @ApiModelProperty(value = "业务类型")
+    private String businessType;
+
+    /** 顺序 */
+    @Excel(name = "顺序")
+    @TableField("seq")
+    @ApiModelProperty(value = "顺序")
+    private Integer seq;
+
+    /** 文件名称 */
+    @Excel(name = "文件名称")
+    @TableField("file_name")
+    @ApiModelProperty(value = "文件名称")
+    private String fileName;
+
+    /** 文件url(访问地址) */
+    @Excel(name = "文件url(访问地址)")
+    @TableField("file_url")
+    @ApiModelProperty(value = "文件url(访问地址)")
+    private String fileUrl;
+
+    /** 文件路径 */
+    @Excel(name = "文件路径")
+    @TableField("file_path")
+    @ApiModelProperty(value = "文件路径")
+    private String filePath;
+
+}

+ 22 - 0
nbjk-service/src/main/java/com/miaxis/file/mapper/FileInfoMapper.java

@@ -0,0 +1,22 @@
+package com.miaxis.file.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.miaxis.file.domain.FileInfo;
+
+/**
+ * 上传文件Mapper接口
+ *
+ * @author miaxis
+ * @date 2023-05-08
+ */
+public interface FileInfoMapper extends BaseMapper<FileInfo> {
+    /**
+     * 查询上传文件列表
+     *
+     * @param fileInfo 上传文件
+     * @return 上传文件集合
+     */
+    public List<FileInfo> selectFileInfoList(FileInfo fileInfo);
+
+}

+ 27 - 0
nbjk-service/src/main/java/com/miaxis/file/service/IFileInfoService.java

@@ -0,0 +1,27 @@
+package com.miaxis.file.service;
+
+import java.io.IOException;
+import java.util.List;
+
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.file.domain.FileInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * 上传文件Service接口
+ *
+ * @author miaxis
+ * @date 2023-05-08
+ */
+public interface IFileInfoService extends IService<FileInfo>{
+    /**
+     * 查询上传文件列表
+     *
+     * @param fileInfo 上传文件
+     * @return 上传文件集合
+     */
+    List<FileInfo> selectFileInfoList(FileInfo fileInfo);
+
+    Response fileUp(String businessType, List<MultipartFile> coverFiles) throws IOException;
+}

+ 101 - 0
nbjk-service/src/main/java/com/miaxis/file/service/impl/FileInfoServiceImpl.java

@@ -0,0 +1,101 @@
+package com.miaxis.file.service.impl;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.List;
+import java.util.Random;
+import java.util.UUID;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.miaxis.common.config.FileConfig;
+import com.miaxis.common.config.WxpayConfig;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.FileUploadTypeEnum;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.DateUtils;
+import com.tencentcloudapi.vod.v20180717.models.DescribeMediaInfosResponse;
+import com.tencentcloudapi.vod.v20180717.models.ModifyMediaInfoRequest;
+import com.tencentcloudapi.vod.v20180717.models.ModifyMediaInfoResponse;
+import org.apache.commons.codec.binary.Base64;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.apache.commons.lang3.StringUtils;
+import com.miaxis.file.mapper.FileInfoMapper;
+import com.miaxis.file.domain.FileInfo;
+import com.miaxis.file.service.IFileInfoService;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * 上传文件Service业务层处理
+ *
+ * @author miaxis
+ * @date 2023-05-08
+ */
+@Service
+public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> implements IFileInfoService {
+    @Autowired
+    private FileInfoMapper fileInfoMapper;
+
+
+    @Autowired
+    private FileConfig fileConfig;
+
+    /**
+     * 查询上传文件列表
+     *
+     * @param fileInfo 上传文件
+     * @return 上传文件
+     */
+    @Override
+    public List<FileInfo> selectFileInfoList(FileInfo fileInfo) {
+        return fileInfoMapper.selectFileInfoList(fileInfo);
+    }
+
+    @Override
+    public Response fileUp(String businessType, List<MultipartFile> coverFiles) throws IOException {
+        String ids = "";
+        for (int i = 0; i < coverFiles.size(); i++) {
+            byte[] getData = coverFiles.get(i).getBytes();
+            String fileName = coverFiles.get(i).getOriginalFilename();
+
+            int index = fileName.lastIndexOf(".");
+            String fileType = fileName.substring(index+1,fileName.length());
+
+            //文件保存位置
+            File saveDir = new File(fileConfig.getPath());
+            if (!saveDir.exists()) {
+                saveDir.mkdir();
+            }
+            // 生成UUID
+            String uuid = UUID.randomUUID().toString();
+            // 截取其中的一部分作为随机字符串
+            String randomStr = uuid.substring(0, 3);
+            String newFileName = System.currentTimeMillis()+ randomStr + "." + fileType;
+            File fileOut = new File(saveDir + File.separator + newFileName);
+            FileOutputStream fos = new FileOutputStream(fileOut);
+            fos.write(getData);
+            if (fos != null) {
+                fos.close();
+            }
+            FileInfo fileInfo = new FileInfo();
+            fileInfo.setFileType(fileType);
+            fileInfo.setBusinessType(businessType);
+            fileInfo.setSeq(i);
+            fileInfo.setFileName(newFileName);
+            fileInfo.setFileUrl(fileConfig.getUrl() + "/" + newFileName);
+            fileInfo.setFilePath(saveDir + File.separator + newFileName);
+            this.save(fileInfo);
+            if(i==0) {
+                ids += fileInfo.getId();
+            } else {
+                ids += "," + fileInfo.getId();
+            }
+            System.out.println(fileInfo.getId()+"这是是个ID");
+        }
+        return Response.success(ids);
+    }
+}

+ 31 - 0
nbjk-service/src/main/resources/mapper/feed/FeedBackMapper.xml

@@ -0,0 +1,31 @@
+<?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.miaxis.feed.mapper.FeedBackMapper">
+
+    <resultMap type="FeedBack" id="FeedBackResult">
+        <result property="id"    column="id"    />
+        <result property="type"    column="type"    />
+        <result property="content"    column="content"    />
+        <result property="phone"    column="phone"    />
+        <result property="imgIds"    column="img_ids"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateTime"    column="update_time"    />
+    </resultMap>
+
+    <sql id="selectFeedBackVo">
+        select * from feed_back
+    </sql>
+
+    <select id="selectFeedBackList" parameterType="FeedBack" resultMap="FeedBackResult">
+        <include refid="selectFeedBackVo"/>
+        <where>
+            <if test="type != null "> and type = #{type}</if>
+            <if test="content != null  and content != ''"> and content = #{content}</if>
+            <if test="phone != null  and phone != ''"> and phone = #{phone}</if>
+            <if test="imgIds != null  and imgIds != ''"> and img_ids = #{imgIds}</if>
+        </where>
+    </select>
+
+</mapper>