From 20b6055f1bfaefcb0b1e087e56328dbffa5bbeeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=98=8E=E6=A2=81?= <2429105222@qq.com> Date: Mon, 28 Aug 2023 16:07:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E4=BB=A3=E7=A0=81=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inv/DeptDeviceDetailController.java | 98 +++++++++++++++++++ .../inv/DeviceReceiveDetailController.java | 14 +++ .../inv/DeviceReceiveOrderController.java | 22 +++-- ...FilterDeviceReceiveOrderDetailRequest.java | 2 + 4 files changed, 127 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/inv/DeptDeviceDetailController.java b/src/main/java/com/glxp/api/controller/inv/DeptDeviceDetailController.java index 0e7d67b1..320789c8 100644 --- a/src/main/java/com/glxp/api/controller/inv/DeptDeviceDetailController.java +++ b/src/main/java/com/glxp/api/controller/inv/DeptDeviceDetailController.java @@ -1,28 +1,43 @@ package com.glxp.api.controller.inv; +import com.alibaba.fastjson.JSON; import com.github.pagehelper.PageInfo; import com.github.xiaoymin.knife4j.core.util.StrUtil; +import com.glxp.api.annotation.AuthRuleAnnotation; import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.entity.basic.UdiEntity; import com.glxp.api.entity.inv.DeptDeviceDetailEntity; +import com.glxp.api.entity.system.SysPdfTemplateRelevanceLabelEntity; +import com.glxp.api.entity.system.SystemPDFTemplateEntity; +import com.glxp.api.req.inout.InspectionPDFTemplateRequest; import com.glxp.api.req.inv.AddDeptDeviceRequest; import com.glxp.api.req.inv.FilterDeptDeviceRequest; +import com.glxp.api.req.inv.FilterDeviceReceiveOrderRequest; import com.glxp.api.req.system.DeleteRequest; import com.glxp.api.res.inv.DeptDeviceDetailResponse; import com.glxp.api.service.inv.DeptDeviceDetailService; +import com.glxp.api.service.system.SystemPDFModuleService; +import com.glxp.api.service.system.SystemPDFTemplateService; import com.glxp.api.util.CustomUtil; +import com.glxp.api.util.JasperUtils; import com.glxp.api.util.udi.FilterUdiUtils; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; 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.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 部门设备明细接口 @@ -33,6 +48,12 @@ public class DeptDeviceDetailController { @Resource private DeptDeviceDetailService deptDeviceDetailService; + @Resource + private SystemPDFModuleService systemPDFModuleService; + @Resource + private SystemPDFTemplateService systemPDFTemplateService; + @Value("${file_path}") + private String filePath; /** * 查询部门设备明细列表 @@ -116,4 +137,81 @@ public class DeptDeviceDetailController { return deptDeviceDetailService.deleteDevice(deleteRequest.getId()); } + /** + * 校验模板文件 + * + * @param inspectionPDFTemplateRequest + * @return + */ + @AuthRuleAnnotation("") + @PostMapping("/udiwms/inv/deptDevice/verifyTemplateFile") + public BaseResponse verifyTemplateFile(@RequestBody InspectionPDFTemplateRequest inspectionPDFTemplateRequest) { + if (null == inspectionPDFTemplateRequest) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "参数不能为空!"); + } + //查询模板文件是否存在 + + SysPdfTemplateRelevanceLabelEntity sysPdfTemplateRelevanceLabelEntity = systemPDFModuleService.selectByLabelId(inspectionPDFTemplateRequest.getId()); + if (null == sysPdfTemplateRelevanceLabelEntity) { + return ResultVOUtils.error(ResultEnum.DATA_NOT, "所属模块错误"); + } + + SystemPDFTemplateEntity systemPDFTemplateEntity = systemPDFTemplateService.selectById(String.valueOf(sysPdfTemplateRelevanceLabelEntity.getTemplateId())); + if (null == systemPDFTemplateEntity) { + return ResultVOUtils.error(ResultEnum.DATA_NOT, "模板错误"); + } + return ResultVOUtils.success(sysPdfTemplateRelevanceLabelEntity.getTemplateId()); + } + + /** + * 打印模板单号标签 + * + * @param + * @param request + * @param response + * @throws Exception + */ + @AuthRuleAnnotation("") + @PostMapping("/udiwms/inv/deptDevice/printOrder") + public void printOrder(@RequestBody FilterDeviceReceiveOrderRequest filterDeviceReceiveOrderRequest, HttpServletRequest request, HttpServletResponse response) throws Exception { + SystemPDFTemplateEntity systemPDFTemplateEntity = systemPDFTemplateService.selectById(filterDeviceReceiveOrderRequest.getTemplateId()); + //打印单号标签 + Map data = new HashMap<>(1); + List list = new ArrayList<>(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");//定义新的日期格式 + FilterDeptDeviceRequest filterDeptDeviceRequest=new FilterDeptDeviceRequest(); + filterDeptDeviceRequest.setId(filterDeviceReceiveOrderRequest.getId()); + List deptDeviceDetailResponseList = deptDeviceDetailService.filterList(filterDeptDeviceRequest); + int i = 1; + if (deptDeviceDetailResponseList != null && deptDeviceDetailResponseList.size() > 0) { + for (DeptDeviceDetailResponse obj : deptDeviceDetailResponseList) { + Map supData = new HashMap<>(); + supData.put("orderIdFk", obj.getOrderIdFk() == null ? ' ' : obj.getOrderIdFk()); + supData.put("code", obj.getCode() == null ? ' ' : obj.getCode()); + supData.put("batchNo", obj.getBatchNo() == null ? ' ' : obj.getBatchNo()); + supData.put("productionDate", obj.getProductionDate() == null ? ' ' : obj.getProductionDate()); + supData.put("expireDate", obj.getExpireDate() == null ? ' ' : obj.getExpireDate()); + supData.put("serialNo", obj.getSerialNo() == null ? ' ' : obj.getSerialNo()); + supData.put("createTime", obj.getCreateTime() == null ? ' ' : obj.getCreateTime()); + supData.put("invName", obj.getInvName() == null ? ' ' : obj.getInvName()); + supData.put("zczbhhzbapzbh", obj.getZczbhhzbapzbh() == null ? ' ' : obj.getZczbhhzbapzbh()); + supData.put("ggxh", obj.getGgxh() == null ? ' ' : obj.getGgxh()); + supData.put("supName", obj.getSupName() == null ? ' ' : obj.getSupName()); + supData.put("measname", obj.getMeasname() == null ? ' ' : obj.getMeasname()); + supData.put("deviceName", obj.getDeviceName() == null ? ' ' : obj.getDeviceName()); + supData.put("manufactory", obj.getManufactory() == null ? ' ' : obj.getManufactory()); + supData.put("measname", obj.getMeasname() == null ? ' ' : obj.getMeasname()); + supData.put("supName", obj.getSupName() == null ? ' ' : obj.getSupName()); + list.add(supData); + i++; + } + } + + data.put("data",list); + String param = JSON.toJSONString(data); + JasperUtils.jasperReport(request, response, param, filePath + "pdf/template/" + systemPDFTemplateEntity.getPath(), "pdf"); + } + + + } diff --git a/src/main/java/com/glxp/api/controller/inv/DeviceReceiveDetailController.java b/src/main/java/com/glxp/api/controller/inv/DeviceReceiveDetailController.java index 54d9799b..128ae24e 100644 --- a/src/main/java/com/glxp/api/controller/inv/DeviceReceiveDetailController.java +++ b/src/main/java/com/glxp/api/controller/inv/DeviceReceiveDetailController.java @@ -6,9 +6,12 @@ import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; import com.glxp.api.entity.inv.DeviceReceiveOrderDetailEntity; +import com.glxp.api.req.basic.FilterUdiRelRequest; import com.glxp.api.req.inv.AddDeviceReceiveOrderDetailRequest; import com.glxp.api.req.inv.FilterDeviceReceiveOrderDetailRequest; +import com.glxp.api.res.basic.UdiRelevanceResponse; import com.glxp.api.res.inv.DeviceReceiveOrderDetailResponse; +import com.glxp.api.service.basic.UdiRelevanceService; import com.glxp.api.service.inv.DeviceReceiveOrderDetailService; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.BindingResult; @@ -29,6 +32,8 @@ public class DeviceReceiveDetailController { @Resource private DeviceReceiveOrderDetailService detailService; + @Resource + private UdiRelevanceService udiRelevanceService; /** * 查询领用记录详情列表 @@ -128,4 +133,13 @@ public class DeviceReceiveDetailController { return ResultVOUtils.page(pageInfo); } + @GetMapping("/device/receive/order/detail/selectProductByRelId") + public BaseResponse selectProductByRelId(FilterDeviceReceiveOrderDetailRequest detailRequest) { + FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest(); + filterUdiRelRequest.setRelId(detailRequest.getRelId()); + UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectOneUdi(filterUdiRelRequest); + return ResultVOUtils.success(udiRelevanceResponse); + } + + } diff --git a/src/main/java/com/glxp/api/controller/inv/DeviceReceiveOrderController.java b/src/main/java/com/glxp/api/controller/inv/DeviceReceiveOrderController.java index 41433503..bdb7b9b0 100644 --- a/src/main/java/com/glxp/api/controller/inv/DeviceReceiveOrderController.java +++ b/src/main/java/com/glxp/api/controller/inv/DeviceReceiveOrderController.java @@ -10,6 +10,7 @@ import com.glxp.api.constant.FileConstant; import com.glxp.api.dao.schedule.SystemParamConfigDao; import com.glxp.api.entity.inv.DeviceReceiveOrderDetailEntity; import com.glxp.api.entity.inv.DeviceReceiveOrderEntity; +import com.glxp.api.entity.inv.DeviceRepairOrderDetailEntity; import com.glxp.api.entity.purchase.SupCertEntity; import com.glxp.api.entity.system.SysPdfTemplateRelevanceLabelEntity; import com.glxp.api.entity.system.SysPdfTemplateRelevanceStatemenEntity; @@ -187,16 +188,16 @@ public class DeviceReceiveOrderController { } //查询模板文件是否存在 - SysPdfTemplateRelevanceLabelEntity sysPdfTemplateRelevanceLabelEntity = systemPDFModuleService.selectByLabelId(inspectionPDFTemplateRequest.getId()); - if (null == sysPdfTemplateRelevanceLabelEntity) { + SysPdfTemplateRelevanceStatemenEntity sysPdfTemplateRelevanceStatemenEntity = systemPDFModuleService.selectByStatemenId(inspectionPDFTemplateRequest.getId()); + if (null == sysPdfTemplateRelevanceStatemenEntity) { return ResultVOUtils.error(ResultEnum.DATA_NOT, "所属模块错误"); } - SystemPDFTemplateEntity systemPDFTemplateEntity = systemPDFTemplateService.selectById(String.valueOf(sysPdfTemplateRelevanceLabelEntity.getTemplateId())); + SystemPDFTemplateEntity systemPDFTemplateEntity = systemPDFTemplateService.selectById(String.valueOf(sysPdfTemplateRelevanceStatemenEntity.getTemplateId())); if (null == systemPDFTemplateEntity) { return ResultVOUtils.error(ResultEnum.DATA_NOT, "模板错误"); } - return ResultVOUtils.success(sysPdfTemplateRelevanceLabelEntity.getTemplateId()); + return ResultVOUtils.success(sysPdfTemplateRelevanceStatemenEntity.getTemplateId()); } /** @@ -216,11 +217,14 @@ public class DeviceReceiveOrderController { List list = new ArrayList<>(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");//定义新的日期格式 FilterDeptDeviceRequest filterDeptDeviceRequest=new FilterDeptDeviceRequest(); - filterDeptDeviceRequest.setId(filterDeviceReceiveOrderRequest.getId()); - List deptDeviceDetailResponseList = deptDeviceDetailService.filterList(filterDeptDeviceRequest); + //查询主表 + DeviceReceiveOrderEntity deviceReceiveOrderEntity = deviceReceiveOrderService.selectDeviceOrder(filterDeviceReceiveOrderRequest.getOrderId()); + FilterDeviceReceiveOrderDetailRequest filterDeviceReceiveOrderDetailRequest =new FilterDeviceReceiveOrderDetailRequest(); + filterDeviceReceiveOrderDetailRequest.setOrderIdFk(filterDeviceReceiveOrderRequest.getOrderId()); + List deviceReceiveOrderDetailResponses = deviceReceiveOrderDetailService.selectByorderIdFk(filterDeviceReceiveOrderDetailRequest); int i = 1; - if (deptDeviceDetailResponseList != null && deptDeviceDetailResponseList.size() > 0) { - for (DeptDeviceDetailResponse obj : deptDeviceDetailResponseList) { + if (deviceReceiveOrderDetailResponses != null && deviceReceiveOrderDetailResponses.size() > 0) { + for (DeviceReceiveOrderDetailResponse obj : deviceReceiveOrderDetailResponses) { Map supData = new HashMap<>(); supData.put("orderIdFk", obj.getOrderIdFk() == null ? ' ' : obj.getOrderIdFk()); supData.put("code", obj.getCode() == null ? ' ' : obj.getCode()); @@ -234,7 +238,7 @@ public class DeviceReceiveOrderController { supData.put("ggxh", obj.getGgxh() == null ? ' ' : obj.getGgxh()); supData.put("supName", obj.getSupName() == null ? ' ' : obj.getSupName()); supData.put("measname", obj.getMeasname() == null ? ' ' : obj.getMeasname()); - supData.put("deviceName", obj.getDeviceName() == null ? ' ' : obj.getDeviceName()); + supData.put("deviceName", obj.getProductName() == null ? ' ' : obj.getProductName()); supData.put("manufactory", obj.getManufactory() == null ? ' ' : obj.getManufactory()); supData.put("measname", obj.getMeasname() == null ? ' ' : obj.getMeasname()); supData.put("supName", obj.getSupName() == null ? ' ' : obj.getSupName()); diff --git a/src/main/java/com/glxp/api/req/inv/FilterDeviceReceiveOrderDetailRequest.java b/src/main/java/com/glxp/api/req/inv/FilterDeviceReceiveOrderDetailRequest.java index e60fa8e1..897fa1b0 100644 --- a/src/main/java/com/glxp/api/req/inv/FilterDeviceReceiveOrderDetailRequest.java +++ b/src/main/java/com/glxp/api/req/inv/FilterDeviceReceiveOrderDetailRequest.java @@ -43,5 +43,7 @@ public class FilterDeviceReceiveOrderDetailRequest extends ListPageRequest { * 状态 */ private Integer status; + + private String relId; }