|
|
|
@@ -5,12 +5,19 @@ import com.simple.common.Result; |
|
|
|
import com.simple.common.ResultData; |
|
|
|
import com.simple.domain.po.WxMsg; |
|
|
|
import com.simple.service.WxMsgService; |
|
|
|
import com.simple.utils.Constant; |
|
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
|
import io.swagger.annotations.ApiImplicitParams; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import org.apache.commons.io.IOUtils; |
|
|
|
import org.apache.log4j.Logger; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.io.FileOutputStream; |
|
|
|
import java.util.UUID; |
|
|
|
|
|
|
|
@RestController |
|
|
|
@RequestMapping("wxMsg") |
|
|
|
@@ -62,5 +69,29 @@ public class WxMsgController extends BaseController |
|
|
|
public ResultData findById(Long id) { |
|
|
|
return new ResultData(Result.SUCCESS,"查询成功",wxMsgService.getById(id)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping("/excleupload") |
|
|
|
public ResultData courseplanimport(@RequestParam("file") MultipartFile file) { |
|
|
|
if (file.isEmpty()) { |
|
|
|
return new ResultData(Result.SUCCESS,"上传文件不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
String filename= UUID.randomUUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); |
|
|
|
File path=new File(Constant.fileDirectory); |
|
|
|
if(!path.exists()){ |
|
|
|
path.mkdirs(); |
|
|
|
} |
|
|
|
String filepath= Constant.fileDirectory+File.separator+filename; |
|
|
|
try { |
|
|
|
FileOutputStream out=new FileOutputStream(new File(filepath)); |
|
|
|
IOUtils.write(file.getBytes(), out); |
|
|
|
IOUtils.closeQuietly(out); |
|
|
|
} catch (Exception e) { |
|
|
|
return new ResultData(Result.ERROR,"上传失败"); |
|
|
|
} |
|
|
|
|
|
|
|
return new ResultData(Result.SUCCESS,"上传成功",filepath); |
|
|
|
} |
|
|
|
|
|
|
|
} |