zhou zhou
3 天以前 03c3e3cfc1262e26a218a4b8340c0a53ca3065c6
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/MatnrController.java
@@ -18,6 +18,7 @@
import com.vincent.rsf.server.manager.entity.Matnr;
import com.vincent.rsf.server.manager.entity.excel.MatnrsTemplate;
import com.vincent.rsf.server.manager.service.MatnrService;
import com.vincent.rsf.server.manager.utils.buildPageRowsUtils;
import com.vincent.rsf.server.system.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -27,7 +28,7 @@
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletResponse;
import java.util.*;
@RestController
@@ -49,7 +50,9 @@
//        }
        BaseParam baseParam = buildParam(map, BaseParam.class);
        PageParam<Matnr, BaseParam> pageParam = new PageParam<>(baseParam, Matnr.class);
        return R.ok().add(matnrService.getMatnrPage(pageParam, map));
        PageParam<Matnr, BaseParam> page = matnrService.getMatnrPage(pageParam, map);
        buildPageRowsUtils.userNameMap(page.getRecords());
        return R.ok().add(page);
    }
@@ -108,6 +111,10 @@
            Matnr matnr1 = matnrService.getById(matnr.getId());
            if (!Objects.isNull(matnr1.getFieldsIndex())) {
                params.put("fieldsIndex", matnr1.getFieldsIndex());
            } else {
                String uuid16 = CommonUtil.randomUUID16();
                params.put("index", uuid16);
                matnr.setFieldsIndex(uuid16);
            }
            FieldsUtils.updateFieldsValue(params);
        }
@@ -200,16 +207,16 @@
        if (!Objects.isNull(map.get("ids"))) {
            matnrs = matnrService.list(new LambdaQueryWrapper<Matnr>().in(Matnr::getId, map.get("ids")).eq(Matnr::getStatus, 1));
        } else {
            matnrs = matnrService.list(new LambdaQueryWrapper<Matnr>().last("limit 1"));
            matnrs = matnrService.list();
        }
        ExcelUtil.build(ExcelUtil.create(null, MatnrsTemplate.class, true), response);
        ExcelUtil.build(ExcelUtil.create(matnrs, Matnr.class, false), response);
    }
    @PreAuthorize("hasAuthority('manager:matnr:list')")
    @ApiOperation("下载物料模板")
    @PostMapping("/matnr/template/download")
    public void download(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception {
        ExcelUtil.build(ExcelUtil.create(null, MatnrsTemplate.class, true), response);
        ExcelUtil.build(ExcelUtil.create(null, MatnrsTemplate.class), response);
    }