| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | |
| | | }) |
| | | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop()//@SsoAop(power = "-1") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid PrDivide po, @Parameter(hidden = true) BindingResult bindingResult){ |
| | | DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出分水房列表 |
| | | * @param response |
| | | * @param vo |
| | | */ |
| | | @SneakyThrows(IOException.class) |
| | | @RequestMapping(value = "/exportDivides", method = RequestMethod.GET) |
| | | public void exportDivides(HttpServletResponse response, QueryVo vo) { |
| | |
| | | .doWrite(memberList); |
| | | } |
| | | |
| | | @SneakyThrows |
| | | @RequestMapping(value = "/importDivides", method = RequestMethod.POST) |
| | | @ResponseBody |
| | | public BaseResponse<Boolean> importDivides(@RequestPart("file") MultipartFile file) { |
| | | List<VoDivide> memberList = EasyExcel.read(file.getInputStream()) |
| | | .head(VoDivide.class) |
| | | .sheet() |
| | | .doReadSync(); |
| | | return BaseResponseUtils.buildSuccess(memberList) ; |
| | | } |
| | | |
| | | /** |
| | | * 设置excel下载响应头属性 |
| | | */ |