WangHan
2025-04-02 a8ba678a3fe5a39da2c732014cebbb66e408e97c
consum-base/src/main/java/com/consum/base/controller/LWhFormOutputController.java
@@ -9,9 +9,8 @@
import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.compress.utils.Lists;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
@@ -50,17 +49,14 @@
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.hutool.core.util.ReflectUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
/**
 * @Description 出库单
 * @Author 卢庆阳
 * @Date 2023/10/27
 */
@Api(value = "出库单", tags = "出库单")
// @Api(value = "出库单", tags = "出库单")
@RestController
@RequestMapping("/pc/l/wh/form/output")
public class LWhFormOutputController extends BaseController {
@@ -70,16 +66,16 @@
    @Autowired
    private LWhProcureModelService lWhProcureModelService;
    @Resource
    private LWarehouseFlowService lWarehouseFlowService;
    private LWarehouseFlowService lWarehouseFlowServiceImpl;
    /**
     * @Description 新增出库单
     * @Author 卢庆阳
     * @Date 2023/10/27
     */
    @ApiOperation(value = "新增出库单", notes = "新增出库单")
    @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "出库单实体", dataType = "lWhFormOutputParam",
        dataTypeClass = LWhFormOutputParam.class, paramType = "body")})
    // @ApiOperation(value = "新增出库单", notes = "新增出库单")
//    @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "出库单实体", dataType = "lWhFormOutputParam",
//        dataTypeClass = LWhFormOutputParam.class, paramType = "body")})
    @PostMapping("/add")
    public ResponseValue add() {
        LWhFormOutputParam param = CommonUtil.getObjFromReqBody(LWhFormOutputParam.class);
@@ -97,9 +93,9 @@
    /**
     * @Description 列表查询
     */
    @ApiOperation(value = "列表查询", notes = "列表查询")
    @ApiImplicitParam(name = "param", value = "出库单实体", required = true, dataType = "LWhFormOutputParam",
        paramType = "query")
    // @ApiOperation(value = "列表查询", notes = "列表查询")
//    @ApiImplicitParam(name = "param", value = "出库单实体", required = true, dataType = "LWhFormOutputParam",
//        paramType = "query")
    @GetMapping("/list")
    public ResponseValue queryFormOutputList() {
        LWhFormOutputQry param = CommonUtil.getObjFromReq(LWhFormOutputQry.class);
@@ -132,8 +128,6 @@
        }
        try {
            Field fieldDatas = GenericPager.class.getDeclaredField("datas");
            // fieldDatas.setAccessible(true);
            // fieldDatas.set(genericPager, resultList);
            ReflectUtil.setFieldValue(genericPager, fieldDatas, resultList);
        } catch (Exception e) {
            logger.error("查询出库单列表失败", e);
@@ -144,10 +138,10 @@
    /**
     * 根据id查询详情
     */
    @ApiOperation(value = "根据id查询详情", notes = "根据id查询详情")
    @ApiImplicitParam(name = "id", value = "出库单id", required = true, dataType = "Long", paramType = "query")
    // @ApiOperation(value = "根据id查询详情", notes = "根据id查询详情")
    // @ApiImplicitParam(name = "id", value = "出库单id", required = true, dataType = "Long", paramType = "query")
    @GetMapping("/detail")
    public ResponseValue getById(Long id) throws IllegalAccessException {
    public ResponseValue getById(Long id) throws Exception {
        if (id == null) {
            return ResponseValue.error("出库单id为空");
        }
@@ -197,9 +191,9 @@
        return goodsTemplateInfoVO;
    }
    @ApiOperation(value = "查询出库单详情明细", notes = "查询出库单详情明细")
    @ApiImplicitParam(name = "formOutputQry", value = "出库单详情查询条件", required = true, dataType = "LWhFormOutputQry",
        paramType = "query")
    // @ApiOperation(value = "查询出库单详情明细", notes = "查询出库单详情明细")
//    @ApiImplicitParam(name = "formOutputQry", value = "出库单详情查询条件", required = true, dataType = "LWhFormOutputQry",
//        paramType = "query")
    @GetMapping("/detail/list")
    public ResponseValue queryFormOutputDetailList() {
        LWhFormOutputQry formOutputQry = CommonUtil.getObjFromReq(LWhFormOutputQry.class);
@@ -208,14 +202,14 @@
            return ResponseValue.error("登录用户信息不存在");
        }
        formOutputQry.setAgencyId(Long.valueOf(currentUser.getTenantId()));
        PageUtil genericPager = lWarehouseFlowService.queryAllBusinessFlow(formOutputQry);
        PageUtil genericPager = lWarehouseFlowServiceImpl.queryAllBusinessFlow(formOutputQry);
        return ResponseValue.success(genericPager);
    }
    @ApiOperation(value = "出库单导出", notes = "出库单导出")
    @ApiImplicitParam(name = "id", value = "出库单id", required = true, dataType = "Long", paramType = "query")
    // @ApiOperation(value = "出库单导出", notes = "出库单导出")
    // @ApiImplicitParam(name = "id", value = "出库单id", required = true, dataType = "Long", paramType = "query")
    @GetMapping("/list/export")
    public ResponseValue<String> export(Long id, HttpServletResponse response) throws Exception {
    public ResponseValue export(Long id, HttpServletResponse response) throws Exception {
        FinSysTenantUser sysInfo = this.getSysInfo();
        if (sysInfo == null) {
            throw new RuntimeException("登录用户信息不存在");
@@ -251,7 +245,8 @@
        map.put("totalAmount", totalAmount);
        Workbook workbook = ExcelExportUtil.exportExcel(params, OutputExcelTemplate.class, exportList, map);
        return ResponseValue.success(downLoadExcel("出库单", response, workbook));
        String filePath = downLoadExcel("出库单", workbook);
        return ResponseValue.success("导出成功", filePath);
    }