|
|
|
@ -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<String, Object> data = new HashMap<>(1);
|
|
|
|
|
List<Object> list = new ArrayList<>();
|
|
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");//定义新的日期格式
|
|
|
|
|
FilterDeptDeviceRequest filterDeptDeviceRequest=new FilterDeptDeviceRequest();
|
|
|
|
|
filterDeptDeviceRequest.setId(filterDeviceReceiveOrderRequest.getId());
|
|
|
|
|
List<DeptDeviceDetailResponse> deptDeviceDetailResponseList = deptDeviceDetailService.filterList(filterDeptDeviceRequest);
|
|
|
|
|
int i = 1;
|
|
|
|
|
if (deptDeviceDetailResponseList != null && deptDeviceDetailResponseList.size() > 0) {
|
|
|
|
|
for (DeptDeviceDetailResponse obj : deptDeviceDetailResponseList) {
|
|
|
|
|
Map<String, Object> 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");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|