64 lines
1.9 KiB
Java
64 lines
1.9 KiB
Java
package cn.unizk.controller;
|
|
|
|
import cn.unizk.entity.dto.IsoDTO;
|
|
import cn.unizk.entity.vo.SysUserVO;
|
|
import cn.unizk.entity.vo.SysUserVO2;
|
|
import cn.unizk.service.LoginService;
|
|
import cn.unizk.utils.HttpUtil;
|
|
import com.google.gson.Gson;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import javax.annotation.Resource;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* @Author hao
|
|
* @Date 2025/8/22 11:32
|
|
* @Version 1.0
|
|
**/
|
|
@RequestMapping("/pc")
|
|
@RestController
|
|
public class LoginController {
|
|
|
|
@Resource
|
|
private LoginService loginService;
|
|
|
|
@PostMapping("/loginByUsername")
|
|
public SysUserVO loginByUsername(@RequestBody SysUserVO sysUserVO){
|
|
return loginService.loginByUsername(sysUserVO);
|
|
}
|
|
|
|
@PostMapping("/test")
|
|
public String test(@RequestParam("file") MultipartFile file){
|
|
/*byte[] fileHeader = new byte[16];
|
|
InputStream is = null;
|
|
try {
|
|
is = file.getInputStream();
|
|
int bytesRead = is.read(fileHeader);
|
|
is.close();
|
|
if (bytesRead < 4) {
|
|
throw new ServiceException("文件太小,无法识别");
|
|
}
|
|
FileMagicNumber magicNumber = FileMagicNumber.getMagicNumber(fileHeader);
|
|
return magicNumber.getMimeType();
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
}
|
|
return null;*/
|
|
Map<String,String> params = new HashMap<>();
|
|
params.put("un","un");
|
|
params.put("mu","mu");
|
|
params.put("hw","hw");
|
|
params.put("sw","sw");
|
|
params.put("bt","bt");
|
|
String s = HttpUtil.doGet("http://localhost:8083/device/submitputstore", null, params);
|
|
Gson gson = new Gson();
|
|
IsoDTO isoDTO = gson.fromJson(s, IsoDTO.class);
|
|
System.out.println(isoDTO.toString());
|
|
return "success";
|
|
}
|
|
|
|
}
|