Commit b102969e by 杨林龙

添加上传文件接口

1 parent 3c9f160d
......@@ -4,7 +4,7 @@ import org.oreframework.boot.main.AbsOreBootStarter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.context.annotation.ComponentScan;
/**
* @author deployer name
......@@ -16,6 +16,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
*/
@SpringBootApplication
@ServletComponentScan
@ComponentScan({"com.glsx","cn.com.glsx"})
public class Main extends AbsOreBootStarter {
@Override
......
......@@ -12,8 +12,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
//@Api
@RestController
@RequestMapping(value = "/admgr")
......@@ -53,7 +51,7 @@ public class AdMgrController {
}
@RequestMapping(value = "/startandstop", method = RequestMethod.GET)
@RequestMapping(value = "/startandstop", method = RequestMethod.POST)
@ResponseBody
public R startandstop(int id, int status) {
int num = adMgrService.startandstop(id, status);
......@@ -62,4 +60,24 @@ public class AdMgrController {
}
return R.ok("修改广告投放状态成功");
}
// @RequestMapping(value = "/start", method = RequestMethod.POST)
// @ResponseBody
// public R start(int id) {
// int num = adMgrService.startandstop(id,1);
// if (num == 0) {
// return R.error("修改广告投放状态失败");
// }
// return R.ok("修改广告投放状态成功");
// }
//
// @RequestMapping(value = "/stop", method = RequestMethod.POST)
// @ResponseBody
// public R stop(int id) {
// Integer num = adMgrService.startandstop(id,0);
// if (num == 0) {
// return R.error("修改广告投放状态失败");
// }
// return R.ok("修改广告投放状态成功");
// }
}
......@@ -11,8 +11,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
//@Api
@RestController
@RequestMapping(value = "/apimgr")
......@@ -31,7 +29,7 @@ public class ApiMgrController {
return apiMgrService.getApiMgrList(page);
}
@RequestMapping(value = "/startandstop", method = RequestMethod.GET)
@RequestMapping(value = "/startandstop", method = RequestMethod.POST)
@ResponseBody
public R startAndStop(int id, int status) {
int num = apiMgrService.startAndStop(id, status);
......@@ -40,4 +38,24 @@ public class ApiMgrController {
}
return R.ok("API使用状态修改成功");
}
// @RequestMapping(value = "/start", method = RequestMethod.POST)
// @ResponseBody
// public R start(int id) {
// int num = apiMgrService.startAndStop(id, 1);
// if (num == 0) {
// return R.error("修改广告投放状态失败");
// }
// return R.ok("修改广告投放状态成功");
// }
//
// @RequestMapping(value = "/stop", method = RequestMethod.POST)
// @ResponseBody
// public R stop(int id) {
// int num = apiMgrService.startAndStop(id, 0);
// if (num == 0) {
// return R.error("修改广告投放状态失败");
// }
// return R.ok("修改广告投放状态成功");
// }
}
package com.glsx.controller;
import cn.com.glsx.openplatform.model.Area;
import cn.com.glsx.openplatform.model.PlatformCustomer;
import cn.com.glsx.openplatform.service.CustomerMgrService;
import cn.com.glsx.openplatform.vo.R;
......@@ -56,7 +57,7 @@ public class CustomerMgrController {
@RequestMapping(value = "/getAddressOptions", method = RequestMethod.GET)
@ResponseBody
public R getAddressOptions(int id) {
List<String> addressOptionList = customerMgrService.getAddressOptionList(id);
List<Area> addressOptionList = customerMgrService.getAddressOptionList(id);
return R.ok().data(addressOptionList);
}
......
package com.glsx.controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import cn.com.glsx.openplatform.enums.ResultCodeEnum;
import cn.com.glsx.openplatform.util.FdfsUtils;
import cn.com.glsx.openplatform.vo.R;
......@@ -16,6 +13,10 @@ import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping("/file")
public class FileController {
......@@ -75,9 +76,9 @@ public class FileController {
@RequestMapping(value = "/uploadFile2", method = {RequestMethod.POST})
public Object uploadFile2() {
byte[] bytes;
bytes = new byte[] {65, 10};
bytes = new byte[]{65, 10};
String fileUrl = FdfsUtils.uploadFile(bytes, "txt");
System.out.println(fileUrl);
logger.info("fileUrl===========" + fileUrl);
return R.ok().data(fileUrl);
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!