| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.mdm.basesetting.machine.MachineService; |
| | | import org.springblade.mdm.basesetting.machine.vo.MachineExcelVO; |
| | | import org.springblade.mdm.basesetting.machine.vo.MachineQueryVO; |
| | | import org.springblade.mdm.basesetting.machine.vo.MachineVO; |
| | | import org.springblade.mdm.machineback.service.MachineBackFileService; |
| | | import org.springblade.mdm.machineback.vo.MachineBackFileExcelVO; |
| | | import org.springblade.mdm.machineback.vo.MachineBackFileQueryVO; |
| | | import org.springblade.mdm.machineback.vo.MachineBackFileVO; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | |
| | | */ |
| | | @Operation(summary = "接收", description = "接收文件") |
| | | @PostMapping("/accept") |
| | | public R<Void> accept(String ids) { |
| | | public R<Void> accept(@RequestParam String ids) { |
| | | service.accept(ids); |
| | | return R.success(); |
| | | } |
| | |
| | | IPage<MachineBackFileVO> pages = service.pageQuery(query); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 分页 |
| | | */ |
| | | @Operation(summary = "导出Excel", description = "导出Excel") |
| | | @GetMapping("/export-excel") |
| | | public void exportExcel(MachineBackFileQueryVO query, HttpServletResponse response) { |
| | | query.setCurrent(1); |
| | | query.setSize(Integer.MAX_VALUE); |
| | | |
| | | IPage<MachineBackFileVO> pages = service.pageQuery(query); |
| | | List<MachineBackFileExcelVO> list = new ArrayList<>(); |
| | | pages.getRecords().forEach(m ->{ |
| | | MachineBackFileExcelVO excelVO = new MachineBackFileExcelVO(); |
| | | BeanUtils.copyProperties(m, excelVO); |
| | | excelVO.setCureStatus(m.getIsCured()==1?"已固化":"未固化"); |
| | | list.add(excelVO); |
| | | }); |
| | | ExcelUtil.export(response, "机床回传文件" + DateUtil.time(), "机床回传文件表", list, MachineBackFileExcelVO.class); |
| | | } |
| | | } |