|
@@ -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();
|