Commit 78f2968c authored by libin's avatar libin

随车物品

parent 5a71352c
......@@ -16,9 +16,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
......@@ -26,6 +24,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.List;
/**
......@@ -72,19 +71,20 @@ public class UserMemberAdminController {
@ApiOperation("会员excel模板下载")
@GetMapping(value = "/app/unauth/user/excel_model/dowload",produces = "application/vnd.ms-excel")
public ResponseEntity<byte[]> dowloadUserMemberExcelModel(HttpServletResponse response){
// 重置response
response.reset();
response.setCharacterEncoding("utf-8");
// response.setContentType("application/vnd.ms-excel");
@GetMapping(value = "/app/unauth/user/excel_model/dowload")
public ResponseEntity<byte[]> dowloadUserMemberExcelModel(){
response.addHeader("Content-Disposition", "attachment;filename=usermember.xlsx");
HttpHeaders headers = new HttpHeaders();
// headers.add("Content-Disposition","attachment;filename=usermember.xlsx");
// headers.add("Content-Type","application/vnd.ms-excel");
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
headers.setContentDisposition(ContentDisposition.builder("attachment").filename("usermember.xlsx", Charset.forName("UTF-8")).build());
InputStream inputStream = AdminBootstrap.class.getClassLoader().getResourceAsStream("file/usermember.xlsx");
try {
response.setContentLength(inputStream.available());
headers.setContentLength(Long.valueOf(inputStream.available()));
byte[] bytes = IOUtils.toByteArray(inputStream);
return ResponseEntity.ok(bytes);
inputStream.close();
return new ResponseEntity<>(bytes,headers,HttpStatus.OK);
} catch (IOException e) {
e.printStackTrace();
}
......
package com.github.wxiaoqi.security.api.vo.config;
import feign.Logger;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.util.StringUtils;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
......@@ -38,6 +36,4 @@ public class HeaderConfig implements RequestInterceptor {
}
}
}
}
......@@ -93,11 +93,14 @@ public class AccompanyingItemBiz extends BaseBiz<AccompanyingItemMapper, Accompa
}
public List<AccompanyingItemVo> listAllItem(){
public List<AccompanyingItemVo> listAllItem(List<Integer> types){
List<AccompanyingItemVo> accompanyingItemVos = new ArrayList<>();
Example example = new Example(AccompanyingItem.class);
Example.Criteria criteria = example.createCriteria();
if (CollectionUtils.isNotEmpty(types)){
criteria.andIn("type",types);
}
criteria.andEqualTo("isDel",0);
List<AccompanyingItem> accompanyingItems = mapper.selectByExample(example);
if (CollectionUtils.isEmpty(accompanyingItems)){
......
......@@ -16,6 +16,7 @@ import com.xxfc.platform.vehicle.pojo.vo.AccompanyingItemVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import java.util.Collections;
import java.util.List;
/**
......@@ -75,7 +76,13 @@ public class AccompanyingItemController extends BaseController<AccompanyingItemB
@GetMapping("/app/unauth/items")
public RestResponse<List<AccompanyingItemVo>> listAccompanyingItemVo(){
List<AccompanyingItemVo> accompanyingItemVos = baseBiz.listAllItem();
List<AccompanyingItemVo> accompanyingItemVos = baseBiz.listAllItem(Collections.EMPTY_LIST);
return RestResponse.codeAndData(RestResponse.SUC_CODE,accompanyingItemVos);
}
@GetMapping("/app/unauth/type_items")
public RestResponse<List<AccompanyingItemVo>> listAccompanyingItemVoByTypes(@RequestParam(value = "type",required = false) List<Integer> type){
List<AccompanyingItemVo> accompanyingItemVos = baseBiz.listAllItem(type);
return RestResponse.codeAndData(RestResponse.SUC_CODE,accompanyingItemVos);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment