121 changed files with 1029 additions and 306 deletions
@ -1,2 +1,2 @@ |
|||||
/*ALTER TABLE dim_agency ADD COLUMN AGENCY_DIM_TYPE VARCHAR(10) NOT NULL COMMENT '机关维度类型。self:机关本身自己,all:机关自己+下级+网格+部门等';*/ |
#ALTER TABLE dim_agency ADD COLUMN AGENCY_DIM_TYPE VARCHAR(10) NOT NULL COMMENT '机关维度类型。self:机关本身自己,all:机关自己+下级+网格+部门等'; |
||||
select 1; |
select 1; |
||||
@ -0,0 +1,68 @@ |
|||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.service.OssService; |
||||
|
import org.apache.commons.io.FileUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.mock.web.MockMultipartFile; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import java.io.*; |
||||
|
import java.net.Inet4Address; |
||||
|
import java.net.InetAddress; |
||||
|
import java.net.UnknownHostException; |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("test") |
||||
|
public class TestController { |
||||
|
|
||||
|
@Autowired |
||||
|
private OssService ossService; |
||||
|
|
||||
|
@PostMapping("local-upload") |
||||
|
public Result localUpload(@RequestPart("file") MultipartFile file, @RequestParam("fileName") String fileName) { |
||||
|
|
||||
|
final File tempFile = new File("/opt/upload_files/" + fileName); |
||||
|
|
||||
|
try(InputStream inputStream = file.getInputStream()) { |
||||
|
FileUtils.copyInputStreamToFile(inputStream, tempFile); |
||||
|
} catch (IOException e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("upload2aliyun") |
||||
|
public Result upload2aliyun(@RequestParam("fileName") String fileName) { |
||||
|
try (final FileInputStream fis = new FileInputStream("/opt/upload_files/" + fileName)) { |
||||
|
final MockMultipartFile mockMultipartFile = new MockMultipartFile(fileName, fis); |
||||
|
return ossService.uploadImg(mockMultipartFile, null); |
||||
|
} catch (FileNotFoundException e) { |
||||
|
e.printStackTrace(); |
||||
|
} catch (IOException e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Description ribbon测试 |
||||
|
* @return |
||||
|
* @author wxz |
||||
|
* @date 2021.08.05 16:28 |
||||
|
*/ |
||||
|
@PostMapping("test-ribbon-rcv/{sleep}") |
||||
|
public Result testRibbonRcv(@PathVariable("sleep") Long sleep) { |
||||
|
InetAddress localHost = null; |
||||
|
try { |
||||
|
Thread.sleep(sleep); |
||||
|
localHost = Inet4Address.getLocalHost(); |
||||
|
} catch (UnknownHostException e) { |
||||
|
e.printStackTrace(); |
||||
|
} catch (InterruptedException e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
return new Result().ok(localHost); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.cloud.commons.util.InetUtils; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("lb") |
||||
|
public class LbController { |
||||
|
|
||||
|
@Autowired |
||||
|
private InetUtils inetUtils; |
||||
|
|
||||
|
@PostMapping("get-host") |
||||
|
public Result getHost() { |
||||
|
String ipAddress = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress(); |
||||
|
return new Result().ok(ipAddress); |
||||
|
} |
||||
|
|
||||
|
} |
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue