futian.liu
2023-12-22 3e9a4b3480e6508f3c6f7ac8723509d8b1120d20
consum-base/src/main/java/com/consum/base/controller/DepFormScrappedController.java
@@ -1,38 +1,41 @@
package com.consum.base.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ReflectUtil;
import com.consum.base.BaseController;
import com.consum.base.core.utils.CommonUtil;
import com.consum.base.pojo.LDeptFormScrappedParam;
import com.consum.base.pojo.query.LDeptFormScrappedQry;
import com.consum.base.service.DepFormScrappedServiceImpl;
import com.consum.model.po.FinSysTenantUser;
import com.walker.db.page.GenericPager;
import com.walker.infrastructure.utils.CollectionUtils;
import com.walker.infrastructure.utils.DateUtils;
import com.walker.infrastructure.utils.StringUtils;
import com.walker.web.ResponseValue;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.consum.base.BaseController;
import com.consum.base.core.utils.CommonUtil;
import com.consum.base.pojo.LDeptFormScrappedParam;
import com.consum.base.pojo.query.LDeptFormScrappedQry;
import com.consum.base.service.DepFormScrappedService;
import com.consum.model.po.FinSysTenantUser;
import com.walker.db.page.GenericPager;
import com.walker.infrastructure.utils.CollectionUtils;
import com.walker.infrastructure.utils.DateUtils;
import com.walker.infrastructure.utils.StringUtils;
import com.walker.web.ResponseValue;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.hutool.core.convert.Convert;
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;
/**
 * @ClassName DepFormScrappedController
@@ -46,11 +49,11 @@
@RequestMapping("/pc/l/wh/form/scrapped")
public class DepFormScrappedController extends BaseController {
    @Resource
    private DepFormScrappedServiceImpl depFormScrappedService;
    private DepFormScrappedService depFormScrappedService;
    @ApiOperation(value = "新增报废单", notes = "新增报废单")
    @PostMapping("/deptAdd")
    public ResponseValue deptAdd() {
    public ResponseValue deptAdd() throws Exception {
        LDeptFormScrappedParam param = CommonUtil.getObjFromReqBody(LDeptFormScrappedParam.class);
        LDeptFormScrappedParam query = new LDeptFormScrappedParam();
        CommonUtil.copyProperties(param, query);
@@ -58,18 +61,17 @@
        FinSysTenantUser sysInfo = this.getSysInfo();
        return depFormScrappedService.add(param, this.getCurrentUser(), sysInfo);
        depFormScrappedService.add(param, this.getCurrentUser(), sysInfo);
        return ResponseValue.success();
    }
    /**
     * @Description 列表查询
     * 1.查询报废单 2.查询报废单物品
     * @Description 列表查询 1.查询报废单 2.查询报废单物品
     * @Date
     */
    @ApiOperation(value = "列表查询", notes = "列表查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", value = "查询条件", dataType = "LWhFormScrappedQry", paramType = "query")
    })
        @ApiImplicitParam(name = "param", value = "查询条件", dataType = "LWhFormScrappedQry", paramType = "query")})
    @GetMapping("/deptList")
    public ResponseValue queryList() {
        LDeptFormScrappedQry param = CommonUtil.getObjFromReq(LDeptFormScrappedQry.class);
@@ -132,9 +134,7 @@
     * @Description 根据id查询详情
     */
    @ApiOperation(value = "根据id查询详情", notes = "根据id查询详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "报废单id", dataType = "Long", paramType = "query")
    })
    @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "报废单id", dataType = "Long", paramType = "query")})
    @GetMapping("/deptDetail")
    public ResponseValue getById(Long id) {
        if (id == null) {
@@ -144,9 +144,7 @@
    }
    @ApiOperation(value = "导出报废单", notes = "导出报废单")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "报废单id", dataType = "Long", paramType = "query")
    })
    @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "报废单id", dataType = "Long", paramType = "query")})
    @GetMapping("/deptList/export")
    public void export(Long id, HttpServletResponse response) throws Exception {
        if (id == null) {
@@ -226,9 +224,9 @@
        return ResponseValue.success(depFormScrappedService.listByModel2(param));
    }
//    public static void main(String[] args) {
//        TemplateExportParams exportParams = new TemplateExportParams("D:\\MyProjects\\jmy\\低值易耗品\\low-consum-manage\\deploy-jar-single\\src\\main\\resources\\import\\deptScrapped.xlsx");
    // TemplateExportParams exportParams = new
    // TemplateExportParams("D:\\MyProjects\\jmy\\低值易耗品\\low-consum-manage\\deploy-jar-single\\src\\main\\resources\\import\\deptScrapped.xlsx");
//        exportParams.setHeadingStartRow(2);
//
//        List<Map<String, Object>> export = new ArrayList<>();