|
|
|
@ -1,22 +1,38 @@
|
|
|
|
|
package com.glxp.api.controller.auth;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
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.controller.BaseController;
|
|
|
|
|
import com.glxp.api.entity.auth.SysWorkplace;
|
|
|
|
|
import com.glxp.api.entity.basic.SysWorkplaceQueue;
|
|
|
|
|
import com.glxp.api.entity.system.SysPdfTemplateRelevanceLabelEntity;
|
|
|
|
|
import com.glxp.api.entity.system.SystemPDFTemplateEntity;
|
|
|
|
|
import com.glxp.api.req.basic.SysWorkplaceQueueRequest;
|
|
|
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
|
|
|
import com.glxp.api.res.basic.SysWorkplaceResponse;
|
|
|
|
|
import com.glxp.api.service.auth.SysWorkplaceService;
|
|
|
|
|
import com.glxp.api.service.basic.SysWorkplaceQueueService;
|
|
|
|
|
import com.glxp.api.service.system.SystemPDFModuleService;
|
|
|
|
|
import com.glxp.api.service.system.SystemPDFTemplateService;
|
|
|
|
|
import com.glxp.api.util.JasperUtils;
|
|
|
|
|
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.util.Date;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author : zhangsan
|
|
|
|
@ -32,6 +48,16 @@ public class SysWorkplaceQueueController extends BaseController {
|
|
|
|
|
@Resource
|
|
|
|
|
SysWorkplaceQueueService sysWorkplaceQueueService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private SystemPDFModuleService systemPDFModuleService;
|
|
|
|
|
@Resource
|
|
|
|
|
private SystemPDFTemplateService systemPDFTemplateService;
|
|
|
|
|
@Value("${file_path}")
|
|
|
|
|
private String filePath;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
SysWorkplaceService sysWorkplaceService;
|
|
|
|
|
|
|
|
|
|
@GetMapping("/udiwms/sysWorkplaceQueue/page")
|
|
|
|
|
public BaseResponse page(SysWorkplaceQueueRequest request) {
|
|
|
|
|
List<SysWorkplaceQueue> page = sysWorkplaceQueueService.filterList(request);
|
|
|
|
@ -81,5 +107,36 @@ public class SysWorkplaceQueueController extends BaseController {
|
|
|
|
|
String code = sysWorkplaceQueueService.createQueueCode();
|
|
|
|
|
return ResultVOUtils.success(code);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/udiwms/sysWorkplaceQueue/label/print")
|
|
|
|
|
public BaseResponse printLabel(@RequestBody SysWorkplaceQueue sysWorkplaceQueue, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
|
|
|
|
|
|
|
|
SysPdfTemplateRelevanceLabelEntity sysPdfTemplateRelevanceLabelEntity = systemPDFModuleService.selectByLabelId(sysWorkplaceQueue.getLabelId() + "");
|
|
|
|
|
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, "模板错误");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SysWorkplace workplace = sysWorkplaceService.getWorkplace(sysWorkplaceQueue.getWorkPlaceIdFk());
|
|
|
|
|
//打印单号标签
|
|
|
|
|
Map<String, Object> data = new HashMap<>(1);
|
|
|
|
|
Map<String, Object> supData = new HashMap<>();
|
|
|
|
|
supData.put("name", sysWorkplaceQueue.getName() + "");
|
|
|
|
|
supData.put("code", sysWorkplaceQueue.getCode());
|
|
|
|
|
supData.put("workplaceName", workplace.getWorkplaceName());
|
|
|
|
|
// supData.put("remake", sysWorkplace.getRemake() == null ? ' ' : sysWorkplace.getRemake());
|
|
|
|
|
// supData.put("qrCode", "{\"DMHotskey\":{\"workPlace\":" + sysWorkplace.getWorkplaceId() + "}}");
|
|
|
|
|
data.put("data", supData);
|
|
|
|
|
String param = JSON.toJSONString(data);
|
|
|
|
|
log.error(param);
|
|
|
|
|
JasperUtils.jasperReport(request, response, param, filePath + "pdf/template/" + systemPDFTemplateEntity.getPath(), "pdf");
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.DATA_NOT, "模板错误");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|