| ÎļþÃû´Ó blade-service/blade-mdm/src/main/java/org/springblade/mdm/machineback/controller/MachineBackFileController.java ÐÞ¸Ä |
| | |
| | | package org.springblade.mdm.machineback.controller; |
| | | package org.springblade.mdm.machinefile.controller; |
| | | |
| | | 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.entity.Machine; |
| | | import org.springblade.mdm.basesetting.producedivision.entity.MdmDept; |
| | | import org.springblade.mdm.basesetting.producedivision.service.MdmDeptService; |
| | | import org.springblade.mdm.gkw.programnode.service.MachineFileService; |
| | | 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.springblade.system.pojo.entity.Dept; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springblade.mdm.machinefile.entity.MachineFile; |
| | | import org.springblade.mdm.machinefile.service.MachineAcceptedFileService; |
| | | import org.springblade.mdm.machinefile.service.MachineFileService; |
| | | import org.springblade.mdm.machinefile.vo.MachineBackFileQueryVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/machineback/file") |
| | | @RequestMapping("/machinefile/collect") |
| | | @Tag(name = "æºåºåä¼ æä»¶", description = "æºåºåä¼ æä»¶") |
| | | public class MachineBackFileController { |
| | | public class MachineCollectFileController { |
| | | |
| | | @Autowired |
| | | private MachineBackFileService service; |
| | | private MachineAcceptedFileService service; |
| | | @Autowired |
| | | private MachineFileService machineFileService; |
| | | @Autowired |
| | |
| | | * æ¥æ¶ |
| | | */ |
| | | @Operation(summary = "æ¥æ¶", description = "æ¥æ¶æä»¶") |
| | | @PostMapping("/accept") |
| | | @PostMapping("/temp-accept") |
| | | public R<Void> accept(@RequestParam String ids) { |
| | | try { |
| | | service.accept(ids); |
| | | return R.success(); |
| | | }catch(Exception e) { |
| | | log.error("æ¥åæä»¶å¼å¸¸",e); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @Operation(summary = "æ¹éæ¥æ¶", description = "æ¥æ¶æææä»¶") |
| | | @PostMapping("/temp-accept-all") |
| | | public R<Void> acceptAll() { |
| | | try { |
| | | service.acceptAll(); |
| | | return R.success(); |
| | | }catch(Exception e) { |
| | | log.error("æ¥åæä»¶å¼å¸¸",e); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | *æç»ï¼å°±æ¯å é¤ |
| | | */ |
| | | @Operation(summary = "æç»", description = "æç»") |
| | | @PostMapping("/reject") |
| | | @PostMapping("/temp-reject") |
| | | public R<Void> reject(@RequestParam String ids) { |
| | | try { |
| | | service.reject(ids); |
| | |
| | | /** |
| | | * å页 |
| | | */ |
| | | @Operation(summary = "å页æ¥è¯¢", description = "åç§°æç¼ç ") |
| | | @GetMapping("/page") |
| | | public R<IPage<MachineBackFileVO>> page(MachineBackFileQueryVO query) { |
| | | @Operation(summary = "æºåºæä»¶TEMPç®å½å页æ¥è¯¢", description = "å»ç©¿æä»¶å页æ¥è¯¢ï¼æ¥è¯¢ç®å½ä¸çæä»¶ï¼è¿ä¸ç®æ¶æºåºåä¼ æä»¶") |
| | | @GetMapping("/file-page-for-acceept") |
| | | public R<IPage<MachineFile>> filePageForAccept(MachineBackFileQueryVO query) { |
| | | List<Long> deptIds = new ArrayList<>(); |
| | | if("workshop".equals(query.getNodeType()) || "seg".equals(query.getNodeType())) { |
| | | //èç¹ä¸ºè½¦é´ã工段 |
| | |
| | | }else if("dir".equals(query.getNodeType())){ |
| | | query.setMachineCode(query.getMachineCode()); |
| | | } |
| | | IPage<MachineBackFileVO> pages = machineFileService.machineBackFilePageQuery(query); |
| | | IPage<MachineFile> pages = machineFileService.filePageForAccept(query); |
| | | return R.data(pages); |
| | | } |
| | | /** |
| | | * å页 |
| | | */ |
| | | /* |
| | | @Operation(summary = "导åºExcel", description = "导åºExcel") |
| | | @GetMapping("/export-excel") |
| | | public void exportExcel(MachineBackFileQueryVO query, HttpServletResponse response) { |
| | |
| | | query.setSize(Integer.MAX_VALUE); |
| | | |
| | | //IPage<MachineBackFileVO> pages = service.pageQuery(query); |
| | | IPage<MachineBackFileVO> pages = machineFileService.machineBackFilePageQuery(query); |
| | | IPage<MachineFile> pages = machineFileService.filePageForAccept(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); |
| | | } |
| | | }*/ |
| | | } |