das接口修改
This commit is contained in:
parent
4af603d7c1
commit
5a03ca40a8
@ -51,6 +51,7 @@ public class HuExcelUtils {
|
||||
|
||||
ServletOutputStream out = null;
|
||||
try {
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
//attachment 弹出下载对话框, inline 则会使用默认浏览器打开文件,不出现弹框(在线预览)
|
||||
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, String.format("attachment;filename=%s", URLEncoder.encode(fileName + ".xls", StandardCharsets.UTF_8)));
|
||||
out = response.getOutputStream();
|
||||
|
@ -103,8 +103,9 @@ public class LoginServiceImpl implements LoginService {
|
||||
@Override
|
||||
public void logout(HttpServletRequest request) {
|
||||
String token = request.getHeader("token");
|
||||
adminRedisTemplate.del(token);
|
||||
StpUtil.logoutByTokenValue(token);
|
||||
if (adminRedisTemplate.del(token)) {
|
||||
StpUtil.logoutByTokenValue(token);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -132,7 +132,10 @@ public class EquipmentController {
|
||||
/** 设备导出 */
|
||||
@PostMapping("/import")
|
||||
public R<Void> importSysIotModel(String id, @RequestParam("file") MultipartFile file) throws IOException, ParseException {
|
||||
sysEquipmentService.importSysEquipment(id, file);
|
||||
return R.success();
|
||||
boolean result = sysEquipmentService.importSysEquipment(id, file);
|
||||
if (result) {
|
||||
return R.success("导出成功");
|
||||
}
|
||||
return R.success("导出失败");
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,6 @@ public interface SysEquipmentService {
|
||||
|
||||
void exportSysEquipment(SysEquipmentDto sysEquipmentDto, HttpServletRequest request, HttpServletResponse response);
|
||||
|
||||
void importSysEquipment(String parentEquipmentId,MultipartFile file) throws IOException, ParseException;
|
||||
boolean importSysEquipment(String parentEquipmentId,MultipartFile file) throws IOException, ParseException;
|
||||
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
|
||||
// 一次性写出内容,使用默认样式,强制输出标题
|
||||
writer.write(sysEquipmentList, true);
|
||||
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
ServletOutputStream out = null;
|
||||
try {
|
||||
// 设置请求头属性
|
||||
@ -169,7 +169,8 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importSysEquipment(String parentEquipmentId, MultipartFile file) throws IOException, ParseException {
|
||||
public boolean importSysEquipment(String parentEquipmentId, MultipartFile file) throws IOException, ParseException {
|
||||
boolean flag = false;
|
||||
// 通过文件获取输入流
|
||||
InputStream is = file.getInputStream();
|
||||
// 借助hutool读取
|
||||
@ -218,7 +219,10 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
|
||||
field.setUpdatedBy(StpUtil.getLoginIdAsString());
|
||||
sysEquipmentList.add(field);
|
||||
}
|
||||
sysEquipmentMapper.insertBatch(sysEquipmentList);
|
||||
if(sysEquipmentMapper.insertBatch(sysEquipmentList)){
|
||||
flag = true;
|
||||
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user