|
|
|
@ -1,22 +1,40 @@
|
|
|
|
|
package com.glxp.api.controller.auth;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
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.system.SysPdfTemplateRelevanceLabelEntity;
|
|
|
|
|
import com.glxp.api.entity.system.SystemPDFTemplateEntity;
|
|
|
|
|
import com.glxp.api.exception.JsonException;
|
|
|
|
|
import com.glxp.api.req.auth.SysWorkplaceRequest;
|
|
|
|
|
import com.glxp.api.req.dev.DeviceInfoDetailQuery;
|
|
|
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
|
|
|
import com.glxp.api.service.auth.SysWorkplaceService;
|
|
|
|
|
import com.glxp.api.service.system.SystemPDFModuleService;
|
|
|
|
|
import com.glxp.api.service.system.SystemPDFTemplateService;
|
|
|
|
|
import com.glxp.api.util.JasperUtils;
|
|
|
|
|
import com.glxp.api.vo.dev.DeviceInfoVo;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
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 : zhuzhu
|
|
|
|
@ -32,9 +50,8 @@ public class SysWorkplaceController extends BaseController {
|
|
|
|
|
SysWorkplaceService sysWorkplaceService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/udiwms/sysWorkplace/page")
|
|
|
|
|
public BaseResponse page(@RequestBody SysWorkplaceRequest request){
|
|
|
|
|
public BaseResponse page(@RequestBody SysWorkplaceRequest request) {
|
|
|
|
|
// Page<SystemWorkplace> page = sysWorkplaceService.page(new Page<>(request.getPage(), request.getLimit()), Wrappers.lambdaQuery(SystemWorkplace.class)
|
|
|
|
|
// .eq(StrUtil.isNotBlank(request.getInvCode()),SystemWorkplace::getInvCode,request.getInvCode())
|
|
|
|
|
// .like(StrUtil.isNotBlank(request.getKey()),SystemWorkplace::getWorkplaceId,request.getKey())
|
|
|
|
@ -49,22 +66,22 @@ public class SysWorkplaceController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/udiwms/sysWorkplace/addWorkplace")
|
|
|
|
|
public BaseResponse addWorkplace(@RequestBody SysWorkplace sysWorkplace){
|
|
|
|
|
public BaseResponse addWorkplace(@RequestBody SysWorkplace sysWorkplace) {
|
|
|
|
|
sysWorkplace.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
sysWorkplace.setCreateTime(new Date());
|
|
|
|
|
sysWorkplace.setUpdateTime(new Date());
|
|
|
|
|
boolean save = sysWorkplaceService.save(sysWorkplace);
|
|
|
|
|
if (!save){
|
|
|
|
|
if (!save) {
|
|
|
|
|
return ResultVOUtils.error("新增错误");
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success("新增成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/udiwms/sysWorkplace/updateWorkplace")
|
|
|
|
|
public BaseResponse updateWorkplace(@RequestBody SysWorkplace sysWorkplace){
|
|
|
|
|
public BaseResponse updateWorkplace(@RequestBody SysWorkplace sysWorkplace) {
|
|
|
|
|
sysWorkplace.setUpdateTime(new Date());
|
|
|
|
|
boolean save = sysWorkplaceService.updateById(sysWorkplace);
|
|
|
|
|
if (!save){
|
|
|
|
|
if (!save) {
|
|
|
|
|
return ResultVOUtils.error("更新错误");
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success("更新成功");
|
|
|
|
@ -72,23 +89,57 @@ public class SysWorkplaceController extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/udiwms/sysWorkplace/deleteWorkplace")
|
|
|
|
|
public BaseResponse deleteWorkplace(@RequestBody SysWorkplace sysWorkplace){
|
|
|
|
|
public BaseResponse deleteWorkplace(@RequestBody SysWorkplace sysWorkplace) {
|
|
|
|
|
boolean save = sysWorkplaceService.removeById(sysWorkplace);
|
|
|
|
|
if (!save){
|
|
|
|
|
if (!save) {
|
|
|
|
|
return ResultVOUtils.error("删除错误");
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success("删除成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/udiwms/sysWorkplace/createWorkplaceId")
|
|
|
|
|
public BaseResponse createWorkplaceId(){
|
|
|
|
|
public BaseResponse createWorkplaceId() {
|
|
|
|
|
Long workplaceId = sysWorkplaceService.maxWorkplaceId();
|
|
|
|
|
if (workplaceId != null){
|
|
|
|
|
if (workplaceId != null) {
|
|
|
|
|
workplaceId = workplaceId + 1;
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success(workplaceId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private SystemPDFModuleService systemPDFModuleService;
|
|
|
|
|
@Resource
|
|
|
|
|
private SystemPDFTemplateService systemPDFTemplateService;
|
|
|
|
|
@Value("${file_path}")
|
|
|
|
|
private String filePath;
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/udiwms/sysWorkplace/label/print")
|
|
|
|
|
public BaseResponse printLabel(@RequestBody SysWorkplace sysWorkplace, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
|
|
|
|
|
|
|
|
SysPdfTemplateRelevanceLabelEntity sysPdfTemplateRelevanceLabelEntity = systemPDFModuleService.selectByLabelId(sysWorkplace.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, "模板错误");
|
|
|
|
|
}
|
|
|
|
|
//打印单号标签
|
|
|
|
|
Map<String, Object> data = new HashMap<>(1);
|
|
|
|
|
Map<String, Object> supData = new HashMap<>();
|
|
|
|
|
supData.put("workplaceId", sysWorkplace.getWorkplaceId() + "");
|
|
|
|
|
supData.put("workplaceName", sysWorkplace.getWorkplaceName() == null ? ' ' : sysWorkplace.getWorkplaceName());
|
|
|
|
|
supData.put("invName", sysWorkplace.getInvName() == null ? ' ' : sysWorkplace.getInvName());
|
|
|
|
|
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, "模板错误");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|