|
|
|
@ -1,12 +1,20 @@
|
|
|
|
|
package com.glxp.api.admin.controller.inventory;
|
|
|
|
|
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.glxp.api.admin.annotation.AuthRuleAnnotation;
|
|
|
|
|
import com.glxp.api.admin.entity.info.SystemPDFModuleEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.info.SystemPDFTemplateEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.inventory.DeviceMAOrderEntity;
|
|
|
|
|
import com.glxp.api.admin.req.info.SystemPDFModuleRequest;
|
|
|
|
|
import com.glxp.api.admin.req.inventory.AddDeviceMAOrderRequest;
|
|
|
|
|
import com.glxp.api.admin.req.inventory.FilterDeviceMAOrderRequest;
|
|
|
|
|
import com.glxp.api.admin.req.itextpdf.InspectionPDFTemplateRequest;
|
|
|
|
|
import com.glxp.api.admin.res.PageSimpleResponse;
|
|
|
|
|
import com.glxp.api.admin.res.inventory.DeviceMAOrderResponse;
|
|
|
|
|
import com.glxp.api.admin.service.info.SystemPDFModuleService;
|
|
|
|
|
import com.glxp.api.admin.service.info.SystemPDFTemplateService;
|
|
|
|
|
import com.glxp.api.admin.service.inventory.DeviceMAOrderService;
|
|
|
|
|
import com.glxp.api.admin.util.JasperUtils;
|
|
|
|
|
import com.glxp.api.common.enums.ResultEnum;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
@ -18,7 +26,10 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设备养护记录接口
|
|
|
|
@ -29,6 +40,11 @@ public class DeviceMAOrderController {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private DeviceMAOrderService deviceMAOrderService;
|
|
|
|
|
@Resource
|
|
|
|
|
private SystemPDFTemplateService systemPDFTemplateService;
|
|
|
|
|
@Resource
|
|
|
|
|
private SystemPDFModuleService systemPDFModuleService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询设备养护记录列表
|
|
|
|
@ -109,5 +125,49 @@ public class DeviceMAOrderController {
|
|
|
|
|
return deviceMAOrderService.addDeviceMAOrder(addDeviceMAOrderRequest);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 校验模板文件
|
|
|
|
|
*
|
|
|
|
|
* @param inspectionPDFTemplateRequest
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/device/MA/order/verifyTemplateFile")
|
|
|
|
|
public BaseResponse verifyTemplateFile(@RequestBody InspectionPDFTemplateRequest inspectionPDFTemplateRequest) {
|
|
|
|
|
if (null == inspectionPDFTemplateRequest) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "参数不能为空!");
|
|
|
|
|
}
|
|
|
|
|
//查询模板文件是否存在
|
|
|
|
|
SystemPDFModuleRequest systemPDFModuleRequest = new SystemPDFModuleRequest();
|
|
|
|
|
systemPDFModuleRequest.setId(inspectionPDFTemplateRequest.getModuleId());
|
|
|
|
|
SystemPDFModuleEntity systemPDFModule = systemPDFModuleService.findSystemPDFModule(systemPDFModuleRequest);
|
|
|
|
|
if (null == systemPDFModule) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.DATA_NOT, "所属模块错误");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SystemPDFTemplateEntity systemPDFTemplateEntity = systemPDFTemplateService.selectById(String.valueOf(systemPDFModule.getTemplateId()));
|
|
|
|
|
if (null == systemPDFTemplateEntity) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.DATA_NOT, "模板错误");
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success(systemPDFModule.getTemplateId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 打印设备养护记录
|
|
|
|
|
*
|
|
|
|
|
* @param filterDeviceMAOrderRequest
|
|
|
|
|
* @param request
|
|
|
|
|
* @param response
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/device/MA/order/pintOrder")
|
|
|
|
|
public void printOrder(@RequestBody FilterDeviceMAOrderRequest filterDeviceMAOrderRequest, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
|
|
|
SystemPDFTemplateEntity systemPDFTemplateEntity = systemPDFTemplateService.selectById(filterDeviceMAOrderRequest.getTemplateId());
|
|
|
|
|
//查询打印数据
|
|
|
|
|
Map<String, Object> data = deviceMAOrderService.getPrintData(filterDeviceMAOrderRequest.getOrderId());
|
|
|
|
|
JasperUtils.jasperReport(request, response, data, systemPDFTemplateEntity.getPath(), "pdf");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|