|
|
@ -1,5 +1,7 @@
|
|
|
|
package com.glxp.udi.admin.controller.param;
|
|
|
|
package com.glxp.udi.admin.controller.param;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.glxp.udi.admin.annotation.AuthRuleAnnotation;
|
|
|
|
import com.glxp.udi.admin.annotation.AuthRuleAnnotation;
|
|
|
|
import com.glxp.udi.admin.common.res.BaseResponse;
|
|
|
|
import com.glxp.udi.admin.common.res.BaseResponse;
|
|
|
@ -8,9 +10,9 @@ import com.glxp.udi.admin.req.param.SystemPDFTemplateRequest;
|
|
|
|
import com.glxp.udi.admin.req.param.SystemPDFTemplateSaveRequest;
|
|
|
|
import com.glxp.udi.admin.req.param.SystemPDFTemplateSaveRequest;
|
|
|
|
import com.glxp.udi.admin.res.PageSimpleResponse;
|
|
|
|
import com.glxp.udi.admin.res.PageSimpleResponse;
|
|
|
|
import com.glxp.udi.admin.res.param.SystemPDFTemplateResponse;
|
|
|
|
import com.glxp.udi.admin.res.param.SystemPDFTemplateResponse;
|
|
|
|
import com.glxp.udi.admin.res.param.SystemPDFTemplateSelectResponse;
|
|
|
|
|
|
|
|
import com.glxp.udi.admin.service.param.SystemPDFTemplateService;
|
|
|
|
import com.glxp.udi.admin.service.param.SystemPDFTemplateService;
|
|
|
|
import com.glxp.udi.admin.util.JasperUtils;
|
|
|
|
import com.glxp.udi.admin.util.JasperUtils;
|
|
|
|
|
|
|
|
import com.glxp.udi.admin.util.PageUtil;
|
|
|
|
import com.glxp.udi.common.enums.ResultEnum;
|
|
|
|
import com.glxp.udi.common.enums.ResultEnum;
|
|
|
|
import com.glxp.udi.common.util.ResultVOUtils;
|
|
|
|
import com.glxp.udi.common.util.ResultVOUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
@ -24,6 +26,7 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.validation.Valid;
|
|
|
|
import javax.validation.Valid;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.File;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
@ -55,24 +58,27 @@ public class SystemPDFTemplateController {
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("system/pdf/template/list")
|
|
|
|
/**
|
|
|
|
@GetMapping("/system/pdf/template/pdfTemplates")
|
|
|
|
* 查询客户专属和公共的打印模板
|
|
|
|
public BaseResponse pdfTemplates(@RequestParam(value = "page", defaultValue = "1") Integer page,
|
|
|
|
*
|
|
|
|
@RequestParam(value = "limit", defaultValue = "100") Integer limit) {
|
|
|
|
* @param systemPDFTemplateRequest
|
|
|
|
|
|
|
|
* @return
|
|
|
|
Page<SystemPDFTemplateEntity> pageResult = systemPDFTemplateService.listPDFTemplates(page, limit);
|
|
|
|
*/
|
|
|
|
PageSimpleResponse<SystemPDFTemplateSelectResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
@PostMapping("/system/pdf/template/customerTemplates")
|
|
|
|
pageSimpleResponse.setTotal(pageResult.getTotal());
|
|
|
|
public BaseResponse customerTemplates(@RequestBody SystemPDFTemplateRequest systemPDFTemplateRequest) {
|
|
|
|
List<SystemPDFTemplateSelectResponse> systemPDFTemplateSelectResponses = pageResult.getRecords().stream().map(e -> {
|
|
|
|
IPage<SystemPDFTemplateEntity> page = systemPDFTemplateService.findCustomerTemplates(systemPDFTemplateRequest);
|
|
|
|
SystemPDFTemplateSelectResponse systemPDFTemplateSelectResponse = new SystemPDFTemplateSelectResponse();
|
|
|
|
List<SystemPDFTemplateResponse> systemPDFTemplateResponses =new ArrayList<>(page.getRecords().size());
|
|
|
|
BeanUtils.copyProperties(e, systemPDFTemplateSelectResponse);
|
|
|
|
if (page.getTotal() > 0) {
|
|
|
|
systemPDFTemplateSelectResponse.setIdStr(String.valueOf(e.getId()));
|
|
|
|
page.getRecords().forEach(systemPDFTemplateEntity -> {
|
|
|
|
return systemPDFTemplateSelectResponse;
|
|
|
|
SystemPDFTemplateResponse systemPDFTemplateResponse = new SystemPDFTemplateResponse();
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
BeanUtil.copyProperties(systemPDFTemplateEntity, systemPDFTemplateResponse);
|
|
|
|
pageSimpleResponse.setList(systemPDFTemplateSelectResponses);
|
|
|
|
systemPDFTemplateResponses.add(systemPDFTemplateResponse);
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ResultVOUtils.success(PageUtil.page(page, systemPDFTemplateResponses));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("system/pdf/template/save")
|
|
|
|
@AuthRuleAnnotation("system/pdf/template/save")
|
|
|
|
@PostMapping("/system/pdf/template/save")
|
|
|
|
@PostMapping("/system/pdf/template/save")
|
|
|
|
public BaseResponse save(@RequestBody @Valid SystemPDFTemplateSaveRequest systemPDFTemplateSaveRequest, BindingResult bindingResult) {
|
|
|
|
public BaseResponse save(@RequestBody @Valid SystemPDFTemplateSaveRequest systemPDFTemplateSaveRequest, BindingResult bindingResult) {
|
|
|
@ -95,7 +101,6 @@ public class SystemPDFTemplateController {
|
|
|
|
if (!b) {
|
|
|
|
if (!b) {
|
|
|
|
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
|
|
|
return ResultVOUtils.error(ResultEnum.NOT_NETWORK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|