Bläddra i källkod

bug--审核列表的错误分页

buzhanyi 2 år sedan
förälder
incheckning
44cb317490

+ 10 - 4
purchase-admin/src/main/java/com/ozs/web/controller/plan/PlanQuarterController.java

@@ -26,6 +26,7 @@ import com.ozs.plan.service.impl.PlanQuarterServiceImpl;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.http.MediaType;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -119,18 +120,23 @@ public class PlanQuarterController extends BaseController {
     @Log(title = ModularConstans.planQuarter, businessType = BusinessType.QUERY)
     @Log(title = ModularConstans.planQuarter, businessType = BusinessType.QUERY)
     public AjaxResult examineList(@RequestBody PlanQuarterStandardVo vo, HttpServletRequest request) {
     public AjaxResult examineList(@RequestBody PlanQuarterStandardVo vo, HttpServletRequest request) {
         List<PlanQuarterResponseVo> planQuarterList = new ArrayList<>();
         List<PlanQuarterResponseVo> planQuarterList = new ArrayList<>();
+        Page pages = new Page();
         try {
         try {
+            PlanQuarterStandardVo standardVo = new PlanQuarterStandardVo();
+            BeanUtils.copyProperties(vo, standardVo);
+            standardVo.setPageNum(null);
+            standardVo.setPageSize(null);
             LoginUser loginUser = tokenService.getLoginUser(request);
             LoginUser loginUser = tokenService.getLoginUser(request);
-            vo.setCreated(String.valueOf(loginUser.getUserId()));
-            vo.setPurchaseDeptId(String.valueOf(loginUser.getDeptId()));
-            List<PlanQuarter> planYears = quarterService.queryPage(vo);
+            standardVo.setCreated(String.valueOf(loginUser.getUserId()));
+            standardVo.setPurchaseDeptId(String.valueOf(loginUser.getDeptId()));
+            List<PlanQuarter> planYears = quarterService.queryPage(standardVo);
             if (!ObjectUtils.isEmpty(planYears) && !ObjectUtils.isEmpty(planYears.size())) {
             if (!ObjectUtils.isEmpty(planYears) && !ObjectUtils.isEmpty(planYears.size())) {
                 planQuarterList = quarterServiceImpl.changeTo(planYears);
                 planQuarterList = quarterServiceImpl.changeTo(planYears);
+                pages = PageUtils.getPages(vo.getPageNum().intValue(), vo.getPageSize().intValue(), planQuarterList);
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();
         }
         }
-        Page pages = PageUtils.getPages(vo.getPageNum().intValue(), vo.getPageSize().intValue(), planQuarterList);
         return AjaxResult.success(pages);
         return AjaxResult.success(pages);
     }
     }
 
 

+ 14 - 8
purchase-admin/src/main/java/com/ozs/web/controller/plan/PlanYearsController.java

@@ -30,6 +30,7 @@ import com.ozs.system.service.SysProcurementStandardService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.util.ObjectUtils;
 import org.springframework.util.ObjectUtils;
@@ -128,18 +129,23 @@ public class PlanYearsController extends BaseController {
     @Log(title = ModularConstans.planYear, businessType = BusinessType.QUERY)
     @Log(title = ModularConstans.planYear, businessType = BusinessType.QUERY)
     public AjaxResult examineList(@RequestBody PlanYearsStandardVo vo, HttpServletRequest request) {
     public AjaxResult examineList(@RequestBody PlanYearsStandardVo vo, HttpServletRequest request) {
         List<PlanYearsResponseVo> planYearsList = new ArrayList<>();
         List<PlanYearsResponseVo> planYearsList = new ArrayList<>();
+        Page pages = new Page();
         try {
         try {
+            PlanYearsStandardVo standardVo = new PlanYearsStandardVo();
+            BeanUtils.copyProperties(vo, standardVo);
+            standardVo.setPageNum(null);
+            standardVo.setPageSize(null);
             LoginUser loginUser = tokenService.getLoginUser(request);
             LoginUser loginUser = tokenService.getLoginUser(request);
-            vo.setPurchaseDeptId(String.valueOf(loginUser.getDeptId()));
-            vo.setCreated(String.valueOf(loginUser.getUserId()));
-            List<PlanYears> planYears = planYearsService.queryPage(vo);
+            standardVo.setPurchaseDeptId(String.valueOf(loginUser.getDeptId()));
+            standardVo.setCreated(String.valueOf(loginUser.getUserId()));
+            List<PlanYears> planYears = planYearsService.queryPage(standardVo);
             if (!ObjectUtils.isEmpty(planYears) && !ObjectUtils.isEmpty(planYears.size())) {
             if (!ObjectUtils.isEmpty(planYears) && !ObjectUtils.isEmpty(planYears.size())) {
                 planYearsList = planYearsService.changeTo(planYears);
                 planYearsList = planYearsService.changeTo(planYears);
+                pages = PageUtils.getPages(vo.getPageNum().intValue(), vo.getPageSize().intValue(), planYearsList);
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();
         }
         }
-        Page pages = PageUtils.getPages(vo.getPageNum().intValue(), vo.getPageSize().intValue(), planYearsList);
         return AjaxResult.success(pages);
         return AjaxResult.success(pages);
     }
     }
 
 
@@ -340,16 +346,16 @@ public class PlanYearsController extends BaseController {
     @GetMapping("/downloaExcel")
     @GetMapping("/downloaExcel")
     public void downloadZip(HttpServletResponse response) {
     public void downloadZip(HttpServletResponse response) {
         List<PlanYearsResponseVo> list = new ArrayList<PlanYearsResponseVo>();
         List<PlanYearsResponseVo> list = new ArrayList<PlanYearsResponseVo>();
-        list.add(new PlanYearsResponseVo(1L, "单位1" , "环太平洋项目" , "物资服务类" , "徒步环太平洋" , new BigDecimal(12.23), "单位1,单位2" , "科目一" , "2023-02" , "2023-03" , "2023-04" , "重点采购项目,重大规划任务项目" , ""));
-        list.add(new PlanYearsResponseVo(2L, "单位2" , "环北冰洋项目" , "工程类" , "徒步环北冰洋" , new BigDecimal(15.88), "单位1" , "科目二" , "2023-01" , "2023-05" , "2023-08" , "重点采购项目" , ""));
+        list.add(new PlanYearsResponseVo(1L, "单位1", "环太平洋项目", "物资服务类", "徒步环太平洋", new BigDecimal(12.23), "单位1,单位2", "科目一", "2023-02", "2023-03", "2023-04", "重点采购项目,重大规划任务项目", ""));
+        list.add(new PlanYearsResponseVo(2L, "单位2", "环北冰洋项目", "工程类", "徒步环北冰洋", new BigDecimal(15.88), "单位1", "科目二", "2023-01", "2023-05", "2023-08", "重点采购项目", ""));
         InputStream resourceAsStream = this.getClass().getResourceAsStream("/template/plan_year.xlsx");
         InputStream resourceAsStream = this.getClass().getResourceAsStream("/template/plan_year.xlsx");
         OutputStream outputStream = null;
         OutputStream outputStream = null;
         try {
         try {
             response.setContentType("application/vnd.ms-excel");
             response.setContentType("application/vnd.ms-excel");
             response.setCharacterEncoding("utf-8");
             response.setCharacterEncoding("utf-8");
             // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
             // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
-            String fileName = URLEncoder.encode("年度计划(模板)" , "UTF-8").replaceAll("\\+" , "%20");
-            response.setHeader("Content-disposition" , "attachment;filename*=utf-8''" + fileName + ".xlsx");
+            String fileName = URLEncoder.encode("年度计划(模板)", "UTF-8").replaceAll("\\+", "%20");
+            response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
             outputStream = response.getOutputStream();
             outputStream = response.getOutputStream();
             ExcelWriter excelWriter = EasyExcel.write(outputStream)
             ExcelWriter excelWriter = EasyExcel.write(outputStream)
                     .withTemplate(resourceAsStream).autoCloseStream(true).build();
                     .withTemplate(resourceAsStream).autoCloseStream(true).build();

+ 8 - 4
purchase-admin/src/main/java/com/ozs/web/controller/plan/ProvisionalPlanController.java

@@ -166,18 +166,22 @@ public class ProvisionalPlanController extends BaseController {
                 || StringUtils.isNull(vo.getPageSize())) {
                 || StringUtils.isNull(vo.getPageSize())) {
             throw new ServiceException("分页参数不能为空!");
             throw new ServiceException("分页参数不能为空!");
         }
         }
+        Page pages = new Page();
         try {
         try {
+            ProvisionalPlanVo standardVo = new ProvisionalPlanVo();
+            standardVo.setPageNum(null);
+            standardVo.setPageSize(null);
             LoginUser loginUser = tokenService.getLoginUser(request);
             LoginUser loginUser = tokenService.getLoginUser(request);
-            vo.setCreated(String.valueOf(loginUser.getUserId()));
-            vo.setPurchaseDeptId(loginUser.getDeptId());
-            List<ProvisionalPlan> provisionalPlans = provisionalPlanService.queryPage(vo);
+            standardVo.setCreated(String.valueOf(loginUser.getUserId()));
+            standardVo.setPurchaseDeptId(loginUser.getDeptId());
+            List<ProvisionalPlan> provisionalPlans = provisionalPlanService.queryPage(standardVo);
             if (!ObjectUtils.isEmpty(provisionalPlans) && !ObjectUtils.isEmpty(provisionalPlans.size())) {
             if (!ObjectUtils.isEmpty(provisionalPlans) && !ObjectUtils.isEmpty(provisionalPlans.size())) {
                 provisionalPlanList = provisionalPlanServiceImpl.changeTo(provisionalPlans);
                 provisionalPlanList = provisionalPlanServiceImpl.changeTo(provisionalPlans);
+                pages = PageUtils.getPages(vo.getPageNum().intValue(), vo.getPageSize().intValue(), provisionalPlanList);
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();
         }
         }
-        Page pages = PageUtils.getPages(vo.getPageNum().intValue(), vo.getPageSize().intValue(), provisionalPlanList);
         return AjaxResult.success(pages);
         return AjaxResult.success(pages);
     }
     }