You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1062 lines
36 KiB
1062 lines
36 KiB
package com.gaotao.modules.base.controller;
|
|
|
|
|
|
import com.gaotao.common.constant.SysMsgConstant;
|
|
import com.gaotao.common.utils.R;
|
|
import com.gaotao.modules.base.entity.*;
|
|
import com.gaotao.modules.base.service.BaseService;
|
|
import com.gaotao.modules.base.service.ReportLabelListService;
|
|
import com.gaotao.modules.base.service.ReportPaperListService;
|
|
import com.gaotao.modules.base.dto.*;
|
|
import com.gaotao.modules.base.vo.PaperUsageCheckResponse;
|
|
import com.gaotao.modules.base.service.PdfExportService;
|
|
import com.gaotao.modules.sys.controller.AbstractController;
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
@Slf4j
|
|
@RestController
|
|
@RequestMapping("/label/setting")
|
|
public class LabelSettingController extends AbstractController {
|
|
|
|
@Autowired
|
|
private BaseService baseService;
|
|
@Autowired
|
|
private ReportLabelListService reportLabelListService;
|
|
@Autowired
|
|
private ReportPaperListService reportPaperListService;
|
|
@Autowired
|
|
private PdfExportService pdfExportService;
|
|
@Autowired
|
|
private com.gaotao.modules.base.service.LabelDataProcessorService labelDataProcessorService;
|
|
|
|
/**
|
|
* @description: 查询打印标签的定义参数
|
|
* @author LR
|
|
* @date 2022/12/27 17:49
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/getLabelSettingList")
|
|
public R getLabelSettingList(@RequestBody LabelSettingData inData){
|
|
List<LabelSettingData> resultList = baseService.getLabelSettingList(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000))
|
|
.put("rows", resultList)
|
|
.put("total", resultList.size());
|
|
}
|
|
|
|
/**
|
|
* @description: 插入标签自定义的数据
|
|
* @author LR
|
|
* @date 2022/12/28 15:29
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/insertLabelSetting")
|
|
public R insertLabelSetting(@RequestBody LabelSettingData inData){
|
|
baseService.insertLabelSetting(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", "操作成功!");
|
|
}
|
|
|
|
/**
|
|
* @description: 修改标签自定义的数据
|
|
* @author LR
|
|
* @date 2022/12/28 15:30
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/updateLabelSetting")
|
|
public R updateLabelSetting(@RequestBody LabelSettingData inData){
|
|
baseService.updateLabelSetting(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 删除标签数据
|
|
* @author LR
|
|
* @date 2023/1/3 11:15
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/deleteLabelSetting")
|
|
public R deleteLabelSetting(@RequestBody LabelSettingData inData){
|
|
baseService.deleteLabelSetting(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 获取默认打印列表信息
|
|
* @author LR
|
|
* @date 2023/1/3 16:15
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/getDefaultLabelSettingList")
|
|
public R getDefaultLabelSettingList(@RequestBody DefaultLabelSettingData inData){
|
|
List<DefaultLabelSettingData> resultList = baseService.getDefaultLabelSettingList(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000))
|
|
.put("rows", resultList)
|
|
.put("total", resultList.size());
|
|
}
|
|
|
|
/**
|
|
* @description: 检查标签边编号
|
|
* @author LR
|
|
* @date 2023/1/3 17:48
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "checkLabelNo")
|
|
public R checkLabelNo(@RequestBody LabelSettingData inData){
|
|
LabelSettingData resultRow = baseService.checkLabelNo(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000))
|
|
.put("resultRow", resultRow);
|
|
}
|
|
|
|
/**
|
|
* @description: 插入默认标签的配置信息
|
|
* @author LR
|
|
* @date 2023/1/4 10:23
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/insertDefaultLabelSetting")
|
|
public R insertDefaultLabelSetting(@RequestBody DefaultLabelSettingData inData){
|
|
baseService.insertDefaultLabelSetting(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 修改默认标签的配置信息
|
|
* @author LR
|
|
* @date 2023/1/4 10:24
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/updateDefaultLabelSetting")
|
|
public R updateDefaultLabelSetting(@RequestBody DefaultLabelSettingData inData){
|
|
baseService.updateDefaultLabelSetting(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg",getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 删除默认标签数据
|
|
* @author LR
|
|
* @date 2023/1/3 11:15
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/deleteDefaultLabelSetting")
|
|
public R deleteDefaultLabelSetting(@RequestBody DefaultLabelSettingData inData) {
|
|
baseService.deleteDefaultLabelSetting(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 查询客制化标签的配置信息
|
|
* @author LR
|
|
* @date 2023/1/4 15:33
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/getCustomerLabelSettingList")
|
|
public R getCustomerLabelSettingList(@RequestBody CustomerLabelSettingData inData){
|
|
List<CustomerLabelSettingData> resultList = baseService.getCustomerLabelSettingList(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000))
|
|
.put("rows", resultList)
|
|
.put("total", resultList.size());
|
|
}
|
|
|
|
|
|
/**
|
|
* @description: 插入客制化标签的配置信息
|
|
* @author LR
|
|
* @date 2023/1/4 16:15
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/insertCustomerLabelSetting")
|
|
public R insertCustomerLabelSetting(@RequestBody CustomerLabelSettingData inData){
|
|
baseService.insertCustomerLabelSetting(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 修改客制化标签的配置信息
|
|
* @author LR
|
|
* @date 2023/1/4 16:16
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/updateCustomerLabelSetting")
|
|
public R updateCustomerLabelSetting(@RequestBody CustomerLabelSettingData inData){
|
|
baseService.updateCustomerLabelSetting(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 删除客制化标签数据
|
|
* @author LR
|
|
* @date 2023/1/4 16:16
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/deleteCustomerLabelSetting")
|
|
public R deleteCustomerLabelSetting(@RequestBody CustomerLabelSettingData inData) {
|
|
baseService.deleteCustomerLabelSetting(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 获取用户的标签打印机配置信息
|
|
* @author LR
|
|
* @date 2023/1/5 17:35
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/getUserLabelPrinters")
|
|
public R getUserLabelPrinters(@RequestBody UserLabelPrinterData inData){
|
|
List<UserLabelPrinterData> resultList = baseService.getUserLabelPrinters(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000))
|
|
.put("rows", resultList)
|
|
.put("total", resultList.size());
|
|
}
|
|
|
|
/**
|
|
* @description: 检查用户的id
|
|
* @author LR
|
|
* @date 2023/1/6 11:09
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/checkUserId")
|
|
public R checkUserId(@RequestBody UserLabelPrinterData inData){
|
|
SysUserData sysUser = baseService.checkUserId(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000))
|
|
.put("sysUser", sysUser);
|
|
}
|
|
|
|
/**
|
|
* @description: 插入用户标签打印机信息
|
|
* @author LR
|
|
* @date 2023/1/6 11:47
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/insertUserLabelPrinter")
|
|
public R insertUserLabelPrinter(@RequestBody UserLabelPrinterData inData){
|
|
baseService.insertUserLabelPrinter(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 修改用户标签打印机信息
|
|
* @author LR
|
|
* @date 2023/1/6 11:47
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/updateUserLabelPrinter")
|
|
public R updateUserLabelPrinter(@RequestBody UserLabelPrinterData inData){
|
|
baseService.updateUserLabelPrinter(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 删除用户标签打印机信息
|
|
* @author LR
|
|
* @date 2023/1/6 11:49
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/deleteUserLabelPrinter")
|
|
public R deleteUserLabelPrinter(@RequestBody UserLabelPrinterData inData) {
|
|
baseService.deleteUserLabelPrinter(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 获取标签打印参数配置信息
|
|
* @author LR
|
|
* @date 2023/1/6 17:13
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/getLabelParameterList")
|
|
public R getLabelParameterList(@RequestBody LabelParameterData inData){
|
|
List<LabelParameterData> resultList = baseService.getLabelParameterList(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000))
|
|
.put("rows", resultList)
|
|
.put("total", resultList.size());
|
|
}
|
|
|
|
/**
|
|
* @description: 插入标签打印参数
|
|
* @author LR
|
|
* @date 2023/1/8 20:15
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/insertLabelPrintParameter")
|
|
public R insertLabelPrintParameter(@RequestBody LabelParameterData inData){
|
|
baseService.insertLabelPrintParameter(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 修改标签打印参数的配置信息
|
|
* @author LR
|
|
* @date 2023/1/9 9:14
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/updateLabelPrintParameter")
|
|
public R updateLabelPrintParameter(@RequestBody LabelParameterData inData){
|
|
baseService.updateLabelPrintParameter(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 删除标签打印的配置信息
|
|
* @author LR
|
|
* @date 2023/1/9 9:14
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/deleteLabelPrintParameter")
|
|
public R deleteLabelPrintParameter(@RequestBody LabelParameterData inData){
|
|
baseService.deleteLabelPrintParameter(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 复制标签打印参数
|
|
* @author LR
|
|
* @date 2023/1/9 14:39
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/copyLabelPrintParameter")
|
|
public R copyLabelPrintParameter(@RequestBody LabelParameterData inData){
|
|
baseService.copyLabelPrintParameter(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 查询标签内容定义列表
|
|
* @author LR
|
|
* @date 2023/1/9 17:46
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/getLabelContentList")
|
|
public R getLabelContentList(@RequestBody LabelContentData inData){
|
|
List<LabelContentData> resultList = baseService.getLabelContentList(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000))
|
|
.put("rows", resultList)
|
|
.put("total", resultList.size());
|
|
}
|
|
|
|
/**
|
|
* @description: 插入标签内容定义
|
|
* @author LR
|
|
* @date 2023/1/9 18:16
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/insertLabelContent")
|
|
public R insertLabelContent(@RequestBody LabelContentData inData){
|
|
baseService.insertLabelContent(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 修改标签内容定义
|
|
* @author LR
|
|
* @date 2023/1/9 19:11
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/updateLabelContent")
|
|
public R updateLabelContent(@RequestBody LabelContentData inData){
|
|
baseService.updateLabelContent(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 删除标签内容定义
|
|
* @author LR
|
|
* @date 2023/1/9 19:25
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/deleteLabelContent")
|
|
public R deleteLabelContent(@RequestBody LabelContentData inData){
|
|
baseService.deleteLabelContent(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 复制标签内容定义
|
|
* @author LR
|
|
* @date 2023/1/9 19:27
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/copyLabelContent")
|
|
public R copyLabelContent(@RequestBody LabelContentData inData){
|
|
baseService.copyLabelContent(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 查询可以复制的标签内容定义
|
|
* @author LR
|
|
* @date 2023/1/10 10:58
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/getCopyLabelSettingList")
|
|
public R getCopyLabelSettingList(@RequestBody LabelSettingData inData){
|
|
List<LabelSettingData> resultList = baseService.getCopyLabelSettingList(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000))
|
|
.put("rows", resultList)
|
|
.put("total", resultList.size());
|
|
}
|
|
|
|
/**
|
|
* @description: 复制其他标签的标签内容定义
|
|
* @author LR
|
|
* @date 2023/1/10 11:37
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/copyLabelAllContentsWithOther")
|
|
public R copyLabelAllContentsWithOther(@RequestBody LabelSettingData inData){
|
|
baseService.copyLabelAllContentsWithOther(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 获取要用的标签内容
|
|
* @author LR
|
|
* @date 2023/1/10 14:48
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/getUsedLabelContent")
|
|
public R getUsedLabelContent(@RequestBody LabelContentData inData){
|
|
List<LabelContentData> resultList = baseService.getUsedLabelContent(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000))
|
|
.put("rows", resultList)
|
|
.put("total", resultList.size());
|
|
}
|
|
|
|
/**
|
|
* @description: 获取标签内容的流水号规则
|
|
* @author LR
|
|
* @date 2023/1/10 14:56
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/getLabelContentSerialRule")
|
|
public R getLabelContentSerialRule(@RequestBody LabelContentData inData){
|
|
List<LabelContentSerialRuleData> resultList = baseService.getLabelContentSerialRule(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000))
|
|
.put("rows", resultList)
|
|
.put("total", resultList.size());
|
|
}
|
|
|
|
/**
|
|
* @description: 插入标签内容流水号规则
|
|
* @author LR
|
|
* @date 2023/1/10 15:40
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/insertLabelContentSerialRule")
|
|
public R insertLabelContentSerialRule(@RequestBody LabelContentData inData){
|
|
baseService.insertLabelContentSerialRule(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 删除标签内容的流水号规则
|
|
* @author LR
|
|
* @date 2023/1/10 16:04
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/deleteLabelContentSerialRule")
|
|
public R deleteLabelContentSerialRule(@RequestBody LabelContentSerialRuleData inData){
|
|
baseService.deleteLabelContentSerialRule(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 获取标签内容的流水号信息
|
|
* @author LR
|
|
* @date 2023/1/10 14:56
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/getLabelSerialInfos")
|
|
public R getLabelSerialInfos(@RequestBody LabelContentData inData){
|
|
List<LabelContentSerialInfoData> resultList = baseService.getLabelSerialInfos(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000))
|
|
.put("rows", resultList)
|
|
.put("total", resultList.size());
|
|
}
|
|
|
|
/**
|
|
* @description: 插入标签流水号信息
|
|
* @author LR
|
|
* @date 2023/1/10 17:06
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/insertLabelSerialInfo")
|
|
public R insertLabelSerialInfo(@RequestBody LabelContentSerialInfoData inData){
|
|
baseService.insertLabelSerialInfo(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 修改标签流水号信息
|
|
* @author LR
|
|
* @date 2023/1/10 17:07
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/updateLabelSerialInfo")
|
|
public R updateLabelSerialInfo(@RequestBody LabelContentSerialInfoData inData){
|
|
baseService.updateLabelSerialInfo(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
/**
|
|
* @description: 删除标签流水号信息
|
|
* @author LR
|
|
* @date 2023/1/10 17:45
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/deleteLabelSerialInfo")
|
|
public R deleteLabelSerialInfo(@RequestBody LabelContentSerialInfoData inData){
|
|
baseService.deleteLabelSerialInfo(inData);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000));
|
|
}
|
|
|
|
@PostMapping("saveZplElements")
|
|
public R saveZplElements(@RequestBody ZplDataDto zplData){
|
|
reportLabelListService.saveZplElements(zplData);
|
|
return R.ok();
|
|
}
|
|
|
|
@RequestMapping(value = "getZplElements")
|
|
public R getZplElements(@RequestBody ReportLabelList reportLabelList){
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("data", reportLabelListService.getZplElements(reportLabelList.getReportId()));
|
|
}
|
|
|
|
/**
|
|
* @description: 打印标签
|
|
* @author Kiro
|
|
* @date 2025/1/24
|
|
* @version 1.0
|
|
*/
|
|
@PostMapping("printLabel")
|
|
public R printLabel(@RequestBody PrintLabelRequest printRequest){
|
|
try {
|
|
reportLabelListService.printLabel(printRequest);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", "打印任务已发送成功");
|
|
} catch (Exception e) {
|
|
return R.error("打印失败: " + e.getMessage());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description: 打印标签通用接口
|
|
*/
|
|
@PostMapping("printLabelCommon")
|
|
public R printLabelCommon(@RequestBody PrintLabelRequest printRequest){
|
|
try {
|
|
reportLabelListService.printLabelCommon(printRequest);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", "打印任务已发送成功");
|
|
} catch (Exception e) {
|
|
return R.error("打印失败: " + e.getMessage());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description: 打印标签
|
|
* @author Kiro
|
|
* @date 2025/1/24
|
|
* @version 1.0
|
|
*/
|
|
@PostMapping("printLabelTest")
|
|
public R printLabelTest(@RequestBody PrintLabelRequest printRequest){
|
|
try {
|
|
reportLabelListService.printLabelTest(printRequest);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", "打印任务已发送成功");
|
|
} catch (Exception e) {
|
|
return R.error("打印失败: " + e.getMessage());
|
|
}
|
|
}
|
|
|
|
// ==================== 纸张管理API ====================
|
|
|
|
/**
|
|
* @description: 获取纸张列表
|
|
* @author system
|
|
* @date 2024/01/01
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/paper/getPaperList")
|
|
public R getPaperList(@RequestBody PaperListRequest request) {
|
|
try {
|
|
List<ReportPaperList> paperList = reportPaperListService.getPaperList(request);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000))
|
|
.put("data", paperList)
|
|
.put("total", paperList.size());
|
|
} catch (Exception e) {
|
|
return R.error("获取纸张列表失败: " + e.getMessage());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description: 保存纸张(新增/更新)
|
|
* @author system
|
|
* @date 2024/01/01
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/paper/savePaper")
|
|
public R savePaper(@RequestBody PaperSaveRequest request) {
|
|
try {
|
|
ReportPaperList savedPaper = reportPaperListService.savePaper(request);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", request.getId() != null ? "纸张更新成功" : "纸张保存成功")
|
|
.put("data", savedPaper);
|
|
} catch (Exception e) {
|
|
return R.error("保存纸张失败: " + e.getMessage());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description: 删除纸张
|
|
* @author system
|
|
* @date 2024/01/01
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/paper/deletePaper")
|
|
public R deletePaper(@RequestBody PaperUsageCheckRequest request) {
|
|
try {
|
|
boolean success = reportPaperListService.deletePaper(
|
|
request.getId(),
|
|
request.getSite(),
|
|
getUser().getUsername()
|
|
);
|
|
|
|
if (success) {
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", "删除成功");
|
|
} else {
|
|
return R.error("删除失败");
|
|
}
|
|
} catch (Exception e) {
|
|
return R.error("删除纸张失败: " + e.getMessage());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description: 检查纸张名称是否重复
|
|
* @author system
|
|
* @date 2024/01/01
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/paper/checkPaperName")
|
|
public R checkPaperName(@RequestBody PaperSaveRequest request) {
|
|
try {
|
|
boolean exists = reportPaperListService.checkNameDuplicate(
|
|
request.getName(),
|
|
request.getSite(),
|
|
request.getId()
|
|
);
|
|
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", "检查完成")
|
|
.put("data", new java.util.HashMap<String, Object>() {{
|
|
put("exists", exists);
|
|
}});
|
|
} catch (Exception e) {
|
|
return R.error("检查纸张名称失败: " + e.getMessage());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description: 检查纸张使用情况
|
|
* @author system
|
|
* @date 2024/01/01
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/paper/checkPaperUsage")
|
|
public R checkPaperUsage(@RequestBody PaperUsageCheckRequest request) {
|
|
try {
|
|
PaperUsageCheckResponse usageInfo = reportPaperListService.checkPaperUsage(request);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", "检查完成")
|
|
.put("data", usageInfo);
|
|
} catch (Exception e) {
|
|
return R.error("检查纸张使用情况失败: " + e.getMessage());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description: 切换纸张状态(启用/禁用)
|
|
* @author system
|
|
* @date 2024/01/01
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/paper/togglePaperStatus")
|
|
public R togglePaperStatus(@RequestBody java.util.Map<String, Object> params) {
|
|
try {
|
|
Long id = Long.valueOf(params.get("id").toString());
|
|
Boolean isActive = Boolean.valueOf(params.get("isActive").toString());
|
|
String site = params.get("site").toString();
|
|
String username = params.get("username").toString();
|
|
|
|
boolean success = reportPaperListService.togglePaperStatus(id, isActive, site, username);
|
|
|
|
if (success) {
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", isActive ? "启用成功" : "禁用成功");
|
|
} else {
|
|
return R.error("操作失败");
|
|
}
|
|
} catch (Exception e) {
|
|
return R.error("切换纸张状态失败: " + e.getMessage());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description: 根据ID获取纸张信息
|
|
* @author system
|
|
* @date 2024/01/01
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/paper/getPaperById")
|
|
public R getPaperById(@RequestBody java.util.Map<String, Object> params) {
|
|
try {
|
|
Long id = Long.valueOf(params.get("id").toString());
|
|
ReportPaperList paper = reportPaperListService.getPaperById(id);
|
|
|
|
if (paper != null) {
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", "获取成功")
|
|
.put("data", paper);
|
|
} else {
|
|
return R.error("纸张不存在");
|
|
}
|
|
} catch (Exception e) {
|
|
return R.error("获取纸张信息失败: " + e.getMessage());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description: 批量删除纸张
|
|
* @author system
|
|
* @date 2024/01/01
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/paper/batchDeletePaper")
|
|
public R batchDeletePaper(@RequestBody java.util.Map<String, Object> params) {
|
|
try {
|
|
@SuppressWarnings("unchecked")
|
|
List<Long> ids = (List<Long>) params.get("ids");
|
|
String site = params.get("site").toString();
|
|
String username = params.get("username").toString();
|
|
|
|
int deletedCount = reportPaperListService.batchDeletePaper(ids, site, username);
|
|
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", "批量删除成功,共删除 " + deletedCount + " 个纸张");
|
|
} catch (Exception e) {
|
|
return R.error("批量删除纸张失败: " + e.getMessage());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description: 获取标签类型列表
|
|
* @author system
|
|
* @date 2025/01/24
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/getLabelTypeList")
|
|
public R getLabelTypeList(@RequestBody java.util.Map<String, Object> params) {
|
|
try {
|
|
String site = params.get("site").toString();
|
|
List<java.util.Map<String, Object>> labelTypeList = baseService.getLabelTypeList(site,null);
|
|
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", getLanguageMsg(SysMsgConstant.OBJECT_ID_200000))
|
|
.put("data", labelTypeList);
|
|
} catch (Exception e) {
|
|
return R.error("获取标签类型列表失败: " + e.getMessage());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description: 复制标签(包括基本信息和绘制内容)
|
|
* @author Kiro
|
|
* @date 2025/01/25
|
|
* @version 1.0
|
|
*/
|
|
@RequestMapping(value = "/copyLabelSetting")
|
|
public R copyLabelSetting(@RequestBody java.util.Map<String, Object> params) {
|
|
try {
|
|
String site = params.get("site").toString();
|
|
String username = params.get("username").toString();
|
|
String originalLabelNo = params.get("originalLabelNo").toString();
|
|
|
|
// 调用服务层方法复制标签
|
|
String newLabelNo = baseService.copyLabelSetting(site, username, originalLabelNo);
|
|
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", "标签复制成功")
|
|
.put("data", new java.util.HashMap<String, Object>() {{
|
|
put("newLabelNo", newLabelNo);
|
|
}});
|
|
} catch (Exception e) {
|
|
return R.error("复制标签失败: " + e.getMessage());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description: 使用真实数据预览标签(从数据库视图获取数据)
|
|
* @author Kiro
|
|
* @date 2025/1/24
|
|
* @version 1.0
|
|
*/
|
|
@PostMapping("previewLabelWithRealData")
|
|
public R previewLabelWithRealData(@RequestBody Map<String, Object> params) {
|
|
try {
|
|
String reportId = (String) params.get("reportId");
|
|
|
|
if (reportId == null || reportId.trim().isEmpty()) {
|
|
log.warn("标签ID为空");
|
|
return R.error("标签ID不能为空");
|
|
}
|
|
|
|
// 构建查询参数Map,排除reportId
|
|
Map<String, Object> queryParams = new HashMap<>();
|
|
for (Map.Entry<String, Object> entry : params.entrySet()) {
|
|
if (!"reportId".equals(entry.getKey()) && entry.getValue() != null) {
|
|
queryParams.put(entry.getKey(), entry.getValue());
|
|
}
|
|
}
|
|
|
|
log.info("预览标签参数: reportId={}, queryParams={}", reportId, queryParams);
|
|
|
|
// 使用真实数据生成ZPL代码预览
|
|
List<String> zplCodeList = reportLabelListService.previewLabelWithRealData(reportId, false, queryParams);
|
|
log.info("使用真实数据的ZPL代码生成成功,生成标签数: {}", zplCodeList.size());
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", "使用真实数据的ZPL代码生成成功")
|
|
.put("labelCount", zplCodeList.size())
|
|
.put("data", zplCodeList);
|
|
|
|
} catch (Exception e) {
|
|
log.error("使用真实数据的标签预览失败: {}", e.getMessage(), e);
|
|
return R.error(e.getMessage());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description: 导出预览图为PDF
|
|
* @author Kiro
|
|
* @date 2025/1/24
|
|
* @version 1.0
|
|
*/
|
|
@PostMapping("exportPreviewToPdf")
|
|
public void exportPreviewToPdf(@RequestBody Map<String, Object> params,
|
|
HttpServletResponse response) {
|
|
try {
|
|
log.info("收到PDF导出请求: {}", params);
|
|
|
|
String reportId = (String) params.get("reportId");
|
|
String imageData = (String) params.get("imageData");
|
|
|
|
if (reportId == null || reportId.trim().isEmpty()) {
|
|
response.setStatus(400);
|
|
response.getWriter().write("标签ID不能为空");
|
|
return;
|
|
}
|
|
|
|
if (imageData == null || imageData.trim().isEmpty()) {
|
|
response.setStatus(400);
|
|
response.getWriter().write("预览图数据不能为空");
|
|
return;
|
|
}
|
|
|
|
log.info("开始生成PDF: reportId={}", reportId);
|
|
|
|
// 生成PDF
|
|
java.io.ByteArrayOutputStream pdfStream = pdfExportService.exportPreviewToPdf(imageData, reportId);
|
|
|
|
// 设置响应头
|
|
response.setContentType("application/pdf");
|
|
response.setHeader("Content-Disposition",
|
|
"attachment; filename=\"label_preview_" + reportId + "_" +
|
|
java.time.LocalDateTime.now().format(java.time.format.DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss")) +
|
|
".pdf\"");
|
|
response.setContentLength(pdfStream.size());
|
|
|
|
// 输出PDF
|
|
response.getOutputStream().write(pdfStream.toByteArray());
|
|
response.getOutputStream().flush();
|
|
|
|
log.info("PDF导出成功: reportId={}, size={}KB", reportId, pdfStream.size() / 1024);
|
|
|
|
} catch (Exception e) {
|
|
log.error("PDF导出失败: {}", e.getMessage(), e);
|
|
try {
|
|
response.setStatus(500);
|
|
response.getWriter().write("PDF导出失败: " + e.getMessage());
|
|
} catch (Exception ex) {
|
|
log.error("写入错误响应失败", ex);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description: 获取父标签信息
|
|
* @author AI Assistant
|
|
* @date 2024/12/19
|
|
* @version 1.0
|
|
*/
|
|
@GetMapping("/getParentLabelInfo")
|
|
public R getParentLabelInfo(@RequestParam String labelNo) {
|
|
try {
|
|
log.info("收到获取父标签信息请求: labelNo={}", labelNo);
|
|
|
|
if (labelNo == null || labelNo.trim().isEmpty()) {
|
|
return R.error("标签编号不能为空");
|
|
}
|
|
|
|
Map<String, Object> parentInfo = baseService.getParentLabelInfo(labelNo);
|
|
|
|
if (parentInfo != null && !parentInfo.isEmpty()) {
|
|
log.info("父标签信息获取成功: {}", parentInfo);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", "父标签信息获取成功")
|
|
.put("data", parentInfo);
|
|
} else {
|
|
log.info("未找到父标签信息: labelNo={}", labelNo);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", "未找到父标签信息")
|
|
.put("data", null);
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
log.error("获取父标签信息失败: {}", e.getMessage(), e);
|
|
return R.error("获取父标签信息失败: " + e.getMessage());
|
|
}
|
|
}
|
|
|
|
@GetMapping("/getParentSerialElements")
|
|
public R getParentSerialElements(@RequestParam String labelNo) {
|
|
try {
|
|
log.info("收到获取父标签信息请求: labelNo={}", labelNo);
|
|
|
|
if (labelNo == null || labelNo.trim().isEmpty()) {
|
|
return R.error("标签编号不能为空");
|
|
}
|
|
|
|
List<Map<String, Object>> parentInfo = baseService.getParentSerialElements(labelNo);
|
|
|
|
if (parentInfo != null && !parentInfo.isEmpty()) {
|
|
log.info("父标签信息获取成功: {}", parentInfo);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", "父标签信息获取成功")
|
|
.put("data", parentInfo);
|
|
} else {
|
|
log.info("未找到父标签信息: labelNo={}", labelNo);
|
|
return R.ok()
|
|
.put("code", 200)
|
|
.put("msg", "未找到父标签信息")
|
|
.put("data", null);
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
log.error("获取父标签信息失败: {}", e.getMessage(), e);
|
|
return R.error("获取父标签信息失败: " + e.getMessage());
|
|
}
|
|
}
|
|
|
|
}
|