This commit is contained in:
2025-07-01 17:54:58 +08:00
commit 57dcd609e2
5136 changed files with 346184 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.zhwl</groupId>
<artifactId>zhwl-business</artifactId>
<version>3.8.7</version>
</parent>
<artifactId>zhwl-printset</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.zhwl</groupId>
<artifactId>zhwl-framework</artifactId>
</dependency>
<dependency>
<groupId>com.zhwl</groupId>
<artifactId>zhwl-ticket-order</artifactId>
</dependency>
<dependency>
<groupId>com.zhwl</groupId>
<artifactId>zhwl-eatery</artifactId>
<version>3.8.7</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,98 @@
package com.zhwl.printset.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhwl.common.annotation.Log;
import com.zhwl.common.core.controller.BaseController;
import com.zhwl.common.core.domain.AjaxResult;
import com.zhwl.common.enums.BusinessType;
import com.zhwl.printset.domain.ZdyPrintLog;
import com.zhwl.printset.service.IZdyPrintLogService;
import com.zhwl.common.utils.poi.ExcelUtil;
import com.zhwl.common.core.page.TableDataInfo;
/**
* 打印日志Controller
*
* @author wangxing
* @date 2024-07-30
*/
@RestController
@RequestMapping("/printset/printLog")
public class ZdyPrintLogController extends BaseController {
@Autowired
private IZdyPrintLogService zdyPrintLogService;
/**
* 查询打印日志列表
*/
@PreAuthorize("@ss.hasPermi('printset:printLog:list')")
@GetMapping("/list")
public TableDataInfo list(ZdyPrintLog zdyPrintLog) {
startPage();
List<ZdyPrintLog> list = zdyPrintLogService.selectZdyPrintLogList(zdyPrintLog);
return getDataTable(list);
}
/**
* 导出打印日志列表
*/
@PreAuthorize("@ss.hasPermi('printset:printLog:export')")
@Log(title = "打印日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ZdyPrintLog zdyPrintLog) {
List<ZdyPrintLog> list = zdyPrintLogService.selectZdyPrintLogList(zdyPrintLog);
ExcelUtil<ZdyPrintLog> util = new ExcelUtil<ZdyPrintLog>(ZdyPrintLog. class);
util.exportExcel(response, list, "打印日志数据");
}
/**
* 获取打印日志详细信息
*/
@PreAuthorize("@ss.hasPermi('printset:printLog:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(zdyPrintLogService.selectZdyPrintLogById(id));
}
/**
* 新增打印日志
*/
@PreAuthorize("@ss.hasPermi('printset:printLog:add')")
@Log(title = "打印日志", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ZdyPrintLog zdyPrintLog) {
return toAjax(zdyPrintLogService.insertZdyPrintLog(zdyPrintLog));
}
/**
* 修改打印日志
*/
@PreAuthorize("@ss.hasPermi('printset:printLog:edit')")
@Log(title = "打印日志", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ZdyPrintLog zdyPrintLog) {
return toAjax(zdyPrintLogService.updateZdyPrintLog(zdyPrintLog));
}
/**
* 删除打印日志
*/
@PreAuthorize("@ss.hasPermi('printset:printLog:remove')")
@Log(title = "打印日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(zdyPrintLogService.deleteZdyPrintLogByIds(ids));
}
}

View File

@@ -0,0 +1,90 @@
package com.zhwl.printset.controller;
import com.zhwl.common.annotation.Log;
import com.zhwl.common.core.controller.BaseController;
import com.zhwl.common.core.domain.AjaxResult;
import com.zhwl.common.core.page.TableDataInfo;
import com.zhwl.common.enums.BusinessType;
import com.zhwl.common.utils.poi.ExcelUtil;
import com.zhwl.printset.domain.ZdyPrintModule;
import com.zhwl.printset.service.IZdyPrintModuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 打印配置-组件管理Controller
*
* @author wangxing
* @date 2024-06-13
*/
@RestController
@RequestMapping("/printset/printModule")
public class ZdyPrintModuleController extends BaseController {
@Autowired
private IZdyPrintModuleService zdyPrintModuleService;
/**
* 查询打印配置-组件管理列表
*/
// @PreAuthorize("@ss.hasPermi('printset:printModule:list')")
@GetMapping("/list")
public TableDataInfo list(ZdyPrintModule zdyPrintModule) {
startPage();
List<ZdyPrintModule> list = zdyPrintModuleService.selectZdyPrintModuleList(zdyPrintModule);
return getDataTable(list);
}
/**
* 导出打印配置-组件管理列表
*/
// @PreAuthorize("@ss.hasPermi('printset:printModule:export')")
@Log(title = "打印配置-组件管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ZdyPrintModule zdyPrintModule) {
List<ZdyPrintModule> list = zdyPrintModuleService.selectZdyPrintModuleList(zdyPrintModule);
ExcelUtil<ZdyPrintModule> util = new ExcelUtil<ZdyPrintModule>(ZdyPrintModule.class);
util.exportExcel(response, list, "打印配置-组件管理数据");
}
/**
* 获取打印配置-组件管理详细信息
*/
// @PreAuthorize("@ss.hasPermi('printset:printModule:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Integer id) {
return success(zdyPrintModuleService.selectZdyPrintModuleById(id));
}
/**
* 新增打印配置-组件管理
*/
// @PreAuthorize("@ss.hasPermi('printset:printModule:add')")
@Log(title = "打印配置-组件管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ZdyPrintModule zdyPrintModule) {
return toAjax(zdyPrintModuleService.insertZdyPrintModule(zdyPrintModule));
}
/**
* 修改打印配置-组件管理
*/
// @PreAuthorize("@ss.hasPermi('printset:printModule:edit')")
@Log(title = "打印配置-组件管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ZdyPrintModule zdyPrintModule) {
return toAjax(zdyPrintModuleService.updateZdyPrintModule(zdyPrintModule));
}
/**
* 删除打印配置-组件管理
*/
// @PreAuthorize("@ss.hasPermi('printset:printModule:remove')")
@Log(title = "打印配置-组件管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Integer[] ids) {
return toAjax(zdyPrintModuleService.deleteZdyPrintModuleByIds(ids));
}
}

View File

@@ -0,0 +1,53 @@
package com.zhwl.printset.controller;
import com.zhwl.common.core.controller.BaseController;
import com.zhwl.common.core.domain.AjaxResult;
import com.zhwl.common.core.domain.entity.SysUser;
import com.zhwl.common.utils.SecurityUtils;
import com.zhwl.printset.service.IZdyPrintOrderService;
import com.zhwl.ticket.constant.Constants;
import com.zhwl.ticket.order.domain.bo.CommonParamBo;
import com.zhwl.ticket.order.domain.vo.CommonParamVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 订单打印
*
* @author wangxing
* @date 2024-06-13
*/
@RestController
@RequestMapping("/printset/printOrder")
public class ZdyPrintOrderController extends BaseController {
@Autowired
private IZdyPrintOrderService zdyPrintOrderervice;
/**
* 订单打印
*/
@PreAuthorize("@ss.hasPermi('business:ticketOrder:printTicket') or @ss.hasPermi('business:ticketOrder:sale')")
@GetMapping("/printTicket")
public AjaxResult printTicket(CommonParamBo commonParamBo) {
SysUser user = SecurityUtils.getLoginUser().getUser();
commonParamBo.setAdminId(user.getUserId());
commonParamBo.setAdminName(user.getNickName());
commonParamBo.setPrintType(Constants.PRINT_TYPE_WINDOWS);
return AjaxResult.success(zdyPrintOrderervice.printOrder(commonParamBo));
}
/**
* 餐饮打印小票 入参 orderDetailId订单id printType打印类型
* 1 根据用户部门和打印类型查询确定 打印模板id 唯一切不为空
* 2 循环遍历模板配合 订单id查询出对应内容并替换掉模板上的内容
*/
// @PreAuthorize("@ss.hasPermi('business:ticketOrder:printTicket') or @ss.hasPermi('business:ticketOrder:sale')")
@GetMapping("/print/eateryTicket")
public AjaxResult printEateryTicket(CommonParamVo commonParamVo) {
return AjaxResult.success(zdyPrintOrderervice.printEateryTicket(commonParamVo));
}
}

View File

@@ -0,0 +1,99 @@
package com.zhwl.printset.controller;
import com.zhwl.common.annotation.Log;
import com.zhwl.common.core.controller.BaseController;
import com.zhwl.common.core.domain.AjaxResult;
import com.zhwl.common.core.page.TableDataInfo;
import com.zhwl.common.enums.BusinessType;
import com.zhwl.common.utils.poi.ExcelUtil;
import com.zhwl.printset.domain.ZdyPrintTemplate;
import com.zhwl.printset.service.IZdyPrintTemplateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 打印配置-模板管理Controller
*
* @author wangxing
* @date 2024-06-13
*/
@RestController
@RequestMapping("/printset/printTemplate")
public class ZdyPrintTemplateController extends BaseController {
@Autowired
private IZdyPrintTemplateService zdyPrintTemplateService;
/**
* 查询打印配置-模板管理列表
*/
@PreAuthorize("@ss.hasPermi('printset:printTemplate:list')")
@GetMapping("/list")
public TableDataInfo list(ZdyPrintTemplate zdyPrintTemplate) {
startPage();
List<ZdyPrintTemplate> list = zdyPrintTemplateService.selectZdyPrintTemplateList(zdyPrintTemplate);
return getDataTable(list);
}
/**
* 导出打印配置-模板管理列表
*/
@PreAuthorize("@ss.hasPermi('printset:printTemplate:export')")
@Log(title = "打印配置-模板管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ZdyPrintTemplate zdyPrintTemplate) {
List<ZdyPrintTemplate> list = zdyPrintTemplateService.selectZdyPrintTemplateList(zdyPrintTemplate);
ExcelUtil<ZdyPrintTemplate> util = new ExcelUtil<ZdyPrintTemplate>(ZdyPrintTemplate.class);
util.exportExcel(response, list, "打印配置-模板管理数据");
}
/**
* 获取打印配置-模板管理详细信息
*/
@PreAuthorize("@ss.hasPermi('printset:printTemplate:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Integer id) {
return success(zdyPrintTemplateService.selectZdyPrintTemplateById(id));
}
/**
* 新增打印配置-模板管理
*/
@PreAuthorize("@ss.hasPermi('printset:printTemplate:add')")
@Log(title = "打印配置-模板管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ZdyPrintTemplate zdyPrintTemplate) {
return toAjax(zdyPrintTemplateService.insertZdyPrintTemplate(zdyPrintTemplate));
}
/**
* 修改打印配置-模板管理
*/
@PreAuthorize("@ss.hasPermi('printset:printTemplate:edit')")
@Log(title = "打印配置-模板管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ZdyPrintTemplate zdyPrintTemplate) {
return toAjax(zdyPrintTemplateService.updateZdyPrintTemplate(zdyPrintTemplate));
}
/**
* 删除打印配置-模板管理
*/
@PreAuthorize("@ss.hasPermi('printset:printTemplate:remove')")
@Log(title = "打印配置-模板管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Integer id) {
return toAjax(zdyPrintTemplateService.deleteZdyPrintTemplateById(id));
}
/**
* 获取打印配置-根据打印配置参数key查询
*/
@GetMapping(value = "/saleType/{configKey}")
public AjaxResult getTemplateInfo(@PathVariable("configKey") String configKey) {
return success(zdyPrintTemplateService.getTemplateInfo(configKey));
}
}

View File

@@ -0,0 +1,90 @@
package com.zhwl.printset.controller;
import com.zhwl.common.annotation.Log;
import com.zhwl.common.core.controller.BaseController;
import com.zhwl.common.core.domain.AjaxResult;
import com.zhwl.common.core.page.TableDataInfo;
import com.zhwl.common.enums.BusinessType;
import com.zhwl.common.utils.poi.ExcelUtil;
import com.zhwl.printset.domain.ZdyPrintTemplateModule;
import com.zhwl.printset.service.IZdyPrintTemplateModuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 打印配置-模板关联组件Controller
*
* @author wangxing
* @date 2024-06-13
*/
@RestController
@RequestMapping("/printset/printTemplateModule")
public class ZdyPrintTemplateModuleController extends BaseController {
@Autowired
private IZdyPrintTemplateModuleService zdyPrintTemplateModuleService;
/**
* 查询打印配置-模板关联组件列表
*/
// @PreAuthorize("@ss.hasPermi('printset:printTemplateModule:list')")
@GetMapping("/list")
public TableDataInfo list(ZdyPrintTemplateModule zdyPrintTemplateModule) {
startPage();
List<ZdyPrintTemplateModule> list = zdyPrintTemplateModuleService.selectZdyPrintTemplateModuleList(zdyPrintTemplateModule);
return getDataTable(list);
}
/**
* 导出打印配置-模板关联组件列表
*/
// @PreAuthorize("@ss.hasPermi('printset:printTemplateModule:export')")
@Log(title = "打印配置-模板关联组件", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ZdyPrintTemplateModule zdyPrintTemplateModule) {
List<ZdyPrintTemplateModule> list = zdyPrintTemplateModuleService.selectZdyPrintTemplateModuleList(zdyPrintTemplateModule);
ExcelUtil<ZdyPrintTemplateModule> util = new ExcelUtil<ZdyPrintTemplateModule>(ZdyPrintTemplateModule.class);
util.exportExcel(response, list, "打印配置-模板关联组件数据");
}
/**
* 获取打印配置-模板关联组件详细信息
*/
// @PreAuthorize("@ss.hasPermi('printset:printTemplateModule:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Integer id) {
return success(zdyPrintTemplateModuleService.selectZdyPrintTemplateModuleById(id));
}
/**
* 新增打印配置-模板关联组件
*/
// @PreAuthorize("@ss.hasPermi('printset:printTemplateModule:add')")
@Log(title = "打印配置-模板关联组件", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ZdyPrintTemplateModule zdyPrintTemplateModule) {
return toAjax(zdyPrintTemplateModuleService.insertZdyPrintTemplateModule(zdyPrintTemplateModule));
}
/**
* 修改打印配置-模板关联组件
*/
// @PreAuthorize("@ss.hasPermi('printset:printTemplateModule:edit')")
@Log(title = "打印配置-模板关联组件", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ZdyPrintTemplateModule zdyPrintTemplateModule) {
return toAjax(zdyPrintTemplateModuleService.updateZdyPrintTemplateModule(zdyPrintTemplateModule));
}
/**
* 删除打印配置-模板关联组件
*/
// @PreAuthorize("@ss.hasPermi('printset:printTemplateModule:remove')")
@Log(title = "打印配置-模板关联组件", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Integer[] ids) {
return toAjax(zdyPrintTemplateModuleService.deleteZdyPrintTemplateModuleByIds(ids));
}
}

View File

@@ -0,0 +1,103 @@
package com.zhwl.printset.domain;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhwl.common.annotation.Excel;
import com.zhwl.common.core.domain.BaseEntity;
/**
* 打印日志对象 zdy_print_log
*
* @author wangxing
* @date 2024-07-30
*/
@Data
public class ZdyPrintLog extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private Long id;
/**
* 门票ID
*/
@Excel(name = "门票ID")
private Long ticketId;
/**
* 门票名称
*/
@Excel(name = "门票名称")
private String ticketName;
/**
* 订单ID
*/
@Excel(name = "订单ID")
private Long orderId;
/**
* 订单副表ID
*/
@Excel(name = "订单副表ID")
private Long orderItemId;
/**
* 订单详情ID
*/
@Excel(name = "订单详情ID")
private Long orderDetailId;
/**
* 订单子表ID
*/
@Excel(name = "订单子表ID")
private Long orderDetailChildId;
/**
* 打印类型
*/
@Excel(name = "打印类型")
private String printType;
/**
* 打印数量
*/
@Excel(name = "打印数量")
private Integer printNum;
/** 管理员ID */
@Excel(name = "管理员ID")
private Long adminId;
/** 管理员名称 */
@Excel(name = "管理员名称")
private String adminName;
/** 用户ID */
@Excel(name = "用户ID")
private Long userId;
/** 用户名称 */
@Excel(name = "用户名称")
private String userName;
/**
* 打印状态(0失败 1成功)
*/
@Excel(name = "打印状态(0失败 1成功)")
private Integer printStatus;
/**
* 失败原因
*/
@Excel(name = "失败原因")
private String failMsg;
/**
* 打印类型名称
*/
private String printTypeName;
}

View File

@@ -0,0 +1,100 @@
package com.zhwl.printset.domain;
import com.zhwl.common.annotation.Excel;
import com.zhwl.common.core.domain.BaseEntity;
import lombok.Data;
/**
* 打印配置-组件管理对象 zdy_print_module
*
* @author wangxing
* @date 2024-06-13
*/
@Data
public class ZdyPrintModule extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private Integer id;
/**
* 所属景区Id
*/
@Excel(name = "所属景区Id")
private Integer scenicId;
/**
* 组件名称
*/
@Excel(name = "组件名称")
private String name;
/**
* 组件类型
*/
@Excel(name = "组件类型")
private Integer type;
/**
* 组件类别
*/
@Excel(name = "组件类别")
private String category;
/**
* 关联数据表名称
*/
@Excel(name = "关联数据表名称")
private String table;
/**
* 关联字段
*/
@Excel(name = "关联字段")
private String field;
/**
* 字段类型
*/
@Excel(name = "字段类型")
private String fieldType;
/**
* 字典类型
*/
@Excel(name = "字典类型")
private String dictType;
/**
* 组件类型名称
*/
private String typeName;
/**
* 图片路径-字典备注remark
*/
private String image;
/**
* 餐饮组件类型
*/
private String eateryType;
/**
* 组件类别名称
*/
private String categoryName;
/**
* 景区名称
*/
private String scenicName;
/**
* 图标
*/
private String imageUrl;
private String sort;
private String statisticType;
}

View File

@@ -0,0 +1,99 @@
package com.zhwl.printset.domain;
import com.zhwl.common.annotation.Excel;
import com.zhwl.common.core.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* 打印配置-模板管理对象 zdy_print_template
*
* @author wangxing
* @date 2024-06-13
*/
@Data
public class ZdyPrintTemplate extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* ID
*/
private Integer id;
/**
* 部门Id-关联景区
*/
@Excel(name = "部门Id")
private Long deptId;
/**
* 模板名称
*/
@Excel(name = "模板名称")
private String name;
/**
* 模板类型
*/
@Excel(name = "模板类型")
private Integer type;
/**
* 纸张宽度(毫米)
*/
@Excel(name = "纸张宽度", readConverterExp = "毫米")
private BigDecimal width;
/**
* 纸张高度(毫米)
*/
@Excel(name = "纸张高度", readConverterExp = "毫米")
private BigDecimal height;
/**
* 页面边距
*/
@Excel(name = "页面边距")
private Integer margins;
/**
* 背景图片
*/
@Excel(name = "背景图片")
private String image;
/**
* 模板类型名称
*/
private String typeName;
/**
* 模板关联组件列表
*/
private List<ZdyPrintTemplateModule> templateModuleList;
/**
* 景区名称
*/
private String scenicName;
/** 背景图模式 */
@Excel(name = "背景图模式")
private String imageModule;
/**
* 使用标记
*/
private String useFlag;
/**
* 打印设备
*/
private String printDevice;
/**
* 打印设备
*/
private String category;
}

View File

@@ -0,0 +1,97 @@
package com.zhwl.printset.domain;
import com.zhwl.common.annotation.Excel;
import com.zhwl.common.core.domain.BaseEntity;
import lombok.Data;
/**
* 打印配置-模板关联组件对象 zdy_print_template_module
*
* @author wangxing
* @date 2024-06-13
*/
@Data
public class ZdyPrintTemplateModule extends BaseEntity {
private static final long serialVersionUID = 1L;
/** ID */
private Integer id;
/** 所属模板ID */
@Excel(name = "所属模板ID")
private Integer templateId;
/** 文本内容 */
@Excel(name = "文本内容")
private Object content;
/** 显示位置 */
@Excel(name = "显示位置")
private Integer textAlign;
/** 文本大小 */
@Excel(name = "文本大小")
private Integer fontSize;
/** 文本粗细 */
@Excel(name = "文本粗细")
private String fontWeight;
/** 框体高度 */
@Excel(name = "框体高度")
private Integer height;
/** 文本颜色 */
@Excel(name = "文本颜色")
private String fontColor;
/** 背景颜色 */
@Excel(name = "背景颜色")
private String backgroudColor;
/** 排序 */
@Excel(name = "排序")
private Integer sort;
/** 自适应 */
@Excel(name = "自适应")
private Integer isAuto;
/** 页面边距 */
@Excel(name = "页面边距")
private Integer pageDistance;
/** 图片边距 */
@Excel(name = "图片边距")
private Integer imageDistance;
/** 图片地址 */
@Excel(name = "图片地址")
private String imageUrl;
/** 分割类型 */
@Excel(name = "分割类型")
private Integer separateType;
/** 分割线样式 */
@Excel(name = "分割线样式")
private String separateStyle;
/** 标题 */
@Excel(name = "标题")
private String title;
/**
* 显示位置名称
*/
private String TextAlignName;
/**
* 分割线样式名称
*/
private String separateStyleName;
/** 系统组件Id */
@Excel(name = "系统组件Id")
private Integer systemModuleId;
/** 组件类型 */
@Excel(name = "组件类型")
private String type;
}

View File

@@ -0,0 +1,57 @@
package com.zhwl.printset.domain.dto;
import com.zhwl.common.core.domain.ZdyTicketOrderItem;
import com.zhwl.printset.domain.ZdyPrintTemplate;
import com.zhwl.printset.domain.ZdyPrintTemplateModule;
import com.zhwl.ticket.order.domain.bo.CommonParamBo;
import com.zhwl.ticket.order.domain.vo.ZdyTicketOrderVo;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 打印
* @author wangxing
*/
@Builder
@Data
public class PrintDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 订单
*/
private ZdyTicketOrderVo zdyTicketOrderVo;
/**
* 门票副表
*/
private ZdyTicketOrderItem item;
/**
* 打印模板
*/
private ZdyPrintTemplate zdyPrintTemplate;
/**
* 模板ID
*/
private List<ZdyPrintTemplateModule> templateModuleList;
/**
* 模板数据
*/
private List<ZdyPrintTemplate> zdyPrintTemplateList;
/**
* 打印入参
*/
private CommonParamBo commonParamBo;
/**
* 打印次数配置
*/
private String printNum;
}

View File

@@ -0,0 +1,29 @@
package com.zhwl.printset.enums;
/**
* @description: 打印配置-字段类型
* @Author ZB
*/
public enum PrintFieldTypeEnum {
DATETIME("dateTime", "日期"),
DICT("dict", "字典"),
STRING("string", "文本"),
JSON_ARRAY("JSONArray", "关联表");
private final String code;
private final String name;
public String getCode() {
return code;
}
public String getName() {
return name;
}
PrintFieldTypeEnum(String code, String name) {
this.code = code;
this.name = name;
}
}

View File

@@ -0,0 +1,71 @@
package com.zhwl.printset.mapper;
import java.util.List;
import com.zhwl.printset.domain.ZdyPrintLog;
import org.apache.ibatis.annotations.Param;
/**
* 打印日志Mapper接口
*
* @author wangxing
* @date 2024-07-30
*/
public interface ZdyPrintLogMapper {
/**
* 查询打印日志
*
* @param id 打印日志主键
* @return 打印日志
*/
public ZdyPrintLog selectZdyPrintLogById(Long id);
/**
* 查询打印日志列表
*
* @param zdyPrintLog 打印日志
* @return 打印日志集合
*/
public List<ZdyPrintLog> selectZdyPrintLogList(ZdyPrintLog zdyPrintLog);
/**
* 新增打印日志
*
* @param zdyPrintLog 打印日志
* @return 结果
*/
public int insertZdyPrintLog(ZdyPrintLog zdyPrintLog);
/**
* 修改打印日志
*
* @param zdyPrintLog 打印日志
* @return 结果
*/
public int updateZdyPrintLog(ZdyPrintLog zdyPrintLog);
/**
* 删除打印日志
*
* @param id 打印日志主键
* @return 结果
*/
public int deleteZdyPrintLogById(Long id);
/**
* 批量删除打印日志
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteZdyPrintLogByIds(Long[] ids);
/**
* 查询自助机打印数量
*
* @param orderDetailId
* @param printType 打印类型
* @return 结果
*/
public int selectPrintNum(@Param("orderDetailId") Long orderDetailId, @Param("printType") String printType);
}

View File

@@ -0,0 +1,68 @@
package com.zhwl.printset.mapper;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.zhwl.printset.domain.ZdyPrintModule;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 打印配置-组件管理Mapper接口
*
* @author wangxing
* @date 2024-06-13
*/
public interface ZdyPrintModuleMapper {
/**
* 查询打印配置-组件管理
*
* @param id 打印配置-组件管理主键
* @return 打印配置-组件管理
*/
public ZdyPrintModule selectZdyPrintModuleById(Integer id);
/**
* 查询打印配置-组件管理列表
*
* @param zdyPrintModule 打印配置-组件管理
* @return 打印配置-组件管理集合
*/
public List<ZdyPrintModule> selectZdyPrintModuleList(ZdyPrintModule zdyPrintModule);
/**
* 新增打印配置-组件管理
*
* @param zdyPrintModule 打印配置-组件管理
* @return 结果
*/
public int insertZdyPrintModule(ZdyPrintModule zdyPrintModule);
/**
* 修改打印配置-组件管理
*
* @param zdyPrintModule 打印配置-组件管理
* @return 结果
*/
public int updateZdyPrintModule(ZdyPrintModule zdyPrintModule);
/**
* 删除打印配置-组件管理
*
* @param id 打印配置-组件管理主键
* @return 结果
*/
public int deleteZdyPrintModuleById(Integer id);
/**
* 批量删除打印配置-组件管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteZdyPrintModuleByIds(Integer[] ids);
Object selectOrderInfo(@Param("table") String table, @Param("field") String field, @Param("orderId") String orderId);
List<JSONObject> selectJsonArray(@Param("table")String table, @Param("field")String field, @Param("orderId")String orderId);
}

View File

@@ -0,0 +1,66 @@
package com.zhwl.printset.mapper;
import com.zhwl.printset.domain.ZdyPrintTemplate;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 打印配置-模板管理Mapper接口
*
* @author wangxing
* @date 2024-06-13
*/
@Mapper
public interface ZdyPrintTemplateMapper {
/**
* 查询打印配置-模板管理
*
* @param id 打印配置-模板管理主键
* @return 打印配置-模板管理
*/
public ZdyPrintTemplate selectZdyPrintTemplateById(Integer id);
/**
* 查询打印配置-模板管理列表
*
* @param zdyPrintTemplate 打印配置-模板管理
* @return 打印配置-模板管理集合
*/
public List<ZdyPrintTemplate> selectZdyPrintTemplateList(ZdyPrintTemplate zdyPrintTemplate);
/**
* 新增打印配置-模板管理
*
* @param zdyPrintTemplate 打印配置-模板管理
* @return 结果
*/
public int insertZdyPrintTemplate(ZdyPrintTemplate zdyPrintTemplate);
/**
* 修改打印配置-模板管理
*
* @param zdyPrintTemplate 打印配置-模板管理
* @return 结果
*/
public int updateZdyPrintTemplate(ZdyPrintTemplate zdyPrintTemplate);
/**
* 删除打印配置-模板管理
*
* @param id 打印配置-模板管理主键
* @return 结果
*/
public int deleteZdyPrintTemplateById(Integer id);
/**
* 批量删除打印配置-模板管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteZdyPrintTemplateByIds(Integer[] ids);
List<ZdyPrintTemplate> selectZdyPrintTemplateByType(@Param("deptId") Long deptId, @Param("type")String printType);
}

View File

@@ -0,0 +1,73 @@
package com.zhwl.printset.mapper;
import com.zhwl.printset.domain.ZdyPrintTemplateModule;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 打印配置-模板关联组件Mapper接口
*
* @author wangxing
* @date 2024-06-13
*/
@Mapper
public interface ZdyPrintTemplateModuleMapper {
/**
* 查询打印配置-模板关联组件
*
* @param id 打印配置-模板关联组件主键
* @return 打印配置-模板关联组件
*/
public ZdyPrintTemplateModule selectZdyPrintTemplateModuleById(Integer id);
/**
* 查询打印配置-模板关联组件列表
*
* @param zdyPrintTemplateModule 打印配置-模板关联组件
* @return 打印配置-模板关联组件集合
*/
public List<ZdyPrintTemplateModule> selectZdyPrintTemplateModuleList(ZdyPrintTemplateModule zdyPrintTemplateModule);
/**
* 新增打印配置-模板关联组件
*
* @param zdyPrintTemplateModule 打印配置-模板关联组件
* @return 结果
*/
public int insertZdyPrintTemplateModule(ZdyPrintTemplateModule zdyPrintTemplateModule);
/**
* 修改打印配置-模板关联组件
*
* @param zdyPrintTemplateModule 打印配置-模板关联组件
* @return 结果
*/
public int updateZdyPrintTemplateModule(ZdyPrintTemplateModule zdyPrintTemplateModule);
/**
* 删除打印配置-模板关联组件
*
* @param id 打印配置-模板关联组件主键
* @return 结果
*/
public int deleteZdyPrintTemplateModuleById(Integer id);
/**
* 批量删除打印配置-模板关联组件
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteZdyPrintTemplateModuleByIds(Integer[] ids);
public List<ZdyPrintTemplateModule> selectZdyPrintTemplateModuleByTempId(Integer templateId);
/**
* 删除打印配置-模板关联组件
*
* @param templateId
* @return 结果
*/
public int deleteZdyPrintTemplateModuleByTempId(Integer templateId);
}

View File

@@ -0,0 +1,71 @@
package com.zhwl.printset.service;
import java.util.List;
import com.zhwl.printset.domain .ZdyPrintLog;
import org.apache.ibatis.annotations.Param;
/**
* 打印日志Service接口
*
* @author wangxing
* @date 2024-07-30
*/
public interface IZdyPrintLogService {
/**
* 查询打印日志
*
* @param id 打印日志主键
* @return 打印日志
*/
public ZdyPrintLog selectZdyPrintLogById(Long id);
/**
* 查询打印日志列表
*
* @param zdyPrintLog 打印日志
* @return 打印日志集合
*/
public List<ZdyPrintLog> selectZdyPrintLogList(ZdyPrintLog zdyPrintLog);
/**
* 新增打印日志
*
* @param zdyPrintLog 打印日志
* @return 结果
*/
public int insertZdyPrintLog(ZdyPrintLog zdyPrintLog);
/**
* 修改打印日志
*
* @param zdyPrintLog 打印日志
* @return 结果
*/
public int updateZdyPrintLog(ZdyPrintLog zdyPrintLog);
/**
* 批量删除打印日志
*
* @param ids 需要删除的打印日志主键集合
* @return 结果
*/
public int deleteZdyPrintLogByIds(Long[] ids);
/**
* 删除打印日志信息
*
* @param id 打印日志主键
* @return 结果
*/
public int deleteZdyPrintLogById(Long id);
/**
* 查询自助机打印数量
*
* @param orderDetailId
* @param printType 打印类型
* @return 结果
*/
public int selectPrintNum(@Param("orderDetailId") Long orderDetailId, @Param("printType") String printType);
}

View File

@@ -0,0 +1,61 @@
package com.zhwl.printset.service;
import com.zhwl.printset.domain.ZdyPrintModule;
import java.util.List;
/**
* 打印配置-组件管理Service接口
*
* @author wangxing
* @date 2024-06-13
*/
public interface IZdyPrintModuleService {
/**
* 查询打印配置-组件管理
*
* @param id 打印配置-组件管理主键
* @return 打印配置-组件管理
*/
public ZdyPrintModule selectZdyPrintModuleById(Integer id);
/**
* 查询打印配置-组件管理列表
*
* @param zdyPrintModule 打印配置-组件管理
* @return 打印配置-组件管理集合
*/
public List<ZdyPrintModule> selectZdyPrintModuleList(ZdyPrintModule zdyPrintModule);
/**
* 新增打印配置-组件管理
*
* @param zdyPrintModule 打印配置-组件管理
* @return 结果
*/
public int insertZdyPrintModule(ZdyPrintModule zdyPrintModule);
/**
* 修改打印配置-组件管理
*
* @param zdyPrintModule 打印配置-组件管理
* @return 结果
*/
public int updateZdyPrintModule(ZdyPrintModule zdyPrintModule);
/**
* 批量删除打印配置-组件管理
*
* @param ids 需要删除的打印配置-组件管理主键集合
* @return 结果
*/
public int deleteZdyPrintModuleByIds(Integer[] ids);
/**
* 删除打印配置-组件管理信息
*
* @param id 打印配置-组件管理主键
* @return 结果
*/
public int deleteZdyPrintModuleById(Integer id);
}

View File

@@ -0,0 +1,26 @@
package com.zhwl.printset.service;
import com.zhwl.printset.domain.ZdyPrintModule;
import com.zhwl.printset.domain.ZdyPrintTemplate;
import com.zhwl.ticket.order.domain.bo.CommonParamBo;
import com.zhwl.ticket.order.domain.vo.CommonParamVo;
import java.util.List;
/**
* 订单打印
*
* @author wangxing
* @date 2024-06-13
*/
public interface IZdyPrintOrderService {
/**
* 订单打印
*
* @param commonParamBo
* @return 模板订单列表
*/
List<ZdyPrintTemplate> printOrder(CommonParamBo commonParamBo);
List<ZdyPrintTemplate> printEateryTicket(CommonParamVo commonParamBo);
}

View File

@@ -0,0 +1,61 @@
package com.zhwl.printset.service;
import com.zhwl.printset.domain.ZdyPrintTemplateModule;
import java.util.List;
/**
* 打印配置-模板关联组件Service接口
*
* @author wangxing
* @date 2024-06-13
*/
public interface IZdyPrintTemplateModuleService {
/**
* 查询打印配置-模板关联组件
*
* @param id 打印配置-模板关联组件主键
* @return 打印配置-模板关联组件
*/
public ZdyPrintTemplateModule selectZdyPrintTemplateModuleById(Integer id);
/**
* 查询打印配置-模板关联组件列表
*
* @param zdyPrintTemplateModule 打印配置-模板关联组件
* @return 打印配置-模板关联组件集合
*/
public List<ZdyPrintTemplateModule> selectZdyPrintTemplateModuleList(ZdyPrintTemplateModule zdyPrintTemplateModule);
/**
* 新增打印配置-模板关联组件
*
* @param zdyPrintTemplateModule 打印配置-模板关联组件
* @return 结果
*/
public int insertZdyPrintTemplateModule(ZdyPrintTemplateModule zdyPrintTemplateModule);
/**
* 修改打印配置-模板关联组件
*
* @param zdyPrintTemplateModule 打印配置-模板关联组件
* @return 结果
*/
public int updateZdyPrintTemplateModule(ZdyPrintTemplateModule zdyPrintTemplateModule);
/**
* 批量删除打印配置-模板关联组件
*
* @param ids 需要删除的打印配置-模板关联组件主键集合
* @return 结果
*/
public int deleteZdyPrintTemplateModuleByIds(Integer[] ids);
/**
* 删除打印配置-模板关联组件信息
*
* @param id 打印配置-模板关联组件主键
* @return 结果
*/
public int deleteZdyPrintTemplateModuleById(Integer id);
}

View File

@@ -0,0 +1,68 @@
package com.zhwl.printset.service;
import com.zhwl.printset.domain.ZdyPrintTemplate;
import java.util.List;
/**
* 打印配置-模板管理Service接口
*
* @author wangxing
* @date 2024-06-13
*/
public interface IZdyPrintTemplateService {
/**
* 查询打印配置-模板管理
*
* @param id 打印配置-模板管理主键
* @return 打印配置-模板管理
*/
public ZdyPrintTemplate selectZdyPrintTemplateById(Integer id);
/**
* 查询打印配置-模板管理列表
*
* @param zdyPrintTemplate 打印配置-模板管理
* @return 打印配置-模板管理集合
*/
public List<ZdyPrintTemplate> selectZdyPrintTemplateList(ZdyPrintTemplate zdyPrintTemplate);
/**
* 新增打印配置-模板管理
*
* @param zdyPrintTemplate 打印配置-模板管理
* @return 结果
*/
public int insertZdyPrintTemplate(ZdyPrintTemplate zdyPrintTemplate);
/**
* 修改打印配置-模板管理
*
* @param zdyPrintTemplate 打印配置-模板管理
* @return 结果
*/
public int updateZdyPrintTemplate(ZdyPrintTemplate zdyPrintTemplate);
/**
* 批量删除打印配置-模板管理
*
* @param ids 需要删除的打印配置-模板管理主键集合
* @return 结果
*/
public int deleteZdyPrintTemplateByIds(Integer[] ids);
/**
* 删除打印配置-模板管理信息
*
* @param id 打印配置-模板管理主键
* @return 结果
*/
public int deleteZdyPrintTemplateById(Integer id);
/**
* 根据打印配置参数查询模板详情
* @param configKey
* @return
*/
public ZdyPrintTemplate getTemplateInfo(String configKey);
}

View File

@@ -0,0 +1,101 @@
package com.zhwl.printset.service.impl;
import java.util.List;
import com.zhwl.common.enums.DictTypeEnum;
import com.zhwl.common.utils.DateUtils;
import com.zhwl.common.utils.DictUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhwl.printset.mapper.ZdyPrintLogMapper;
import com.zhwl.printset.domain.ZdyPrintLog;
import com.zhwl.printset.service.IZdyPrintLogService;
/**
* 打印日志Service业务层处理
*
* @author wangxing
* @date 2024-07-30
*/
@Service
public class ZdyPrintLogServiceImpl implements IZdyPrintLogService {
@Autowired
private ZdyPrintLogMapper zdyPrintLogMapper;
/**
* 查询打印日志
*
* @param id 打印日志主键
* @return 打印日志
*/
@Override
public ZdyPrintLog selectZdyPrintLogById(Long id) {
return zdyPrintLogMapper.selectZdyPrintLogById(id);
}
/**
* 查询打印日志列表
*
* @param zdyPrintLog 打印日志
* @return 打印日志
*/
@Override
public List<ZdyPrintLog> selectZdyPrintLogList(ZdyPrintLog zdyPrintLog) {
List<ZdyPrintLog> zdyPrintLogs = zdyPrintLogMapper.selectZdyPrintLogList(zdyPrintLog);
zdyPrintLogs.forEach(log -> {
log.setPrintTypeName(DictUtils.getDictLabel(DictTypeEnum.PRINT_TYPE.getType(), log.getPrintType()));
});
return zdyPrintLogs;
}
/**
* 新增打印日志
*
* @param zdyPrintLog 打印日志
* @return 结果
*/
@Override
public int insertZdyPrintLog(ZdyPrintLog zdyPrintLog) {
zdyPrintLog.setCreateTime(DateUtils.getNowDate());
return zdyPrintLogMapper.insertZdyPrintLog(zdyPrintLog);
}
/**
* 修改打印日志
*
* @param zdyPrintLog 打印日志
* @return 结果
*/
@Override
public int updateZdyPrintLog(ZdyPrintLog zdyPrintLog) {
return zdyPrintLogMapper.updateZdyPrintLog(zdyPrintLog);
}
/**
* 批量删除打印日志
*
* @param ids 需要删除的打印日志主键
* @return 结果
*/
@Override
public int deleteZdyPrintLogByIds(Long[] ids) {
return zdyPrintLogMapper.deleteZdyPrintLogByIds(ids);
}
/**
* 删除打印日志信息
*
* @param id 打印日志主键
* @return 结果
*/
@Override
public int deleteZdyPrintLogById(Long id) {
return zdyPrintLogMapper.deleteZdyPrintLogById(id);
}
@Override
public int selectPrintNum(Long orderDetailId, String printType) {
return zdyPrintLogMapper.selectPrintNum(orderDetailId,printType);
}
}

View File

@@ -0,0 +1,117 @@
package com.zhwl.printset.service.impl;
import com.zhwl.common.annotation.DataScope;
import com.zhwl.common.core.domain.entity.SysDictData;
import com.zhwl.common.enums.DictTypeEnum;
import com.zhwl.common.utils.DateUtils;
import com.zhwl.common.utils.DictUtils;
import com.zhwl.common.utils.StringUtils;
import com.zhwl.printset.domain.ZdyPrintModule;
import com.zhwl.printset.mapper.ZdyPrintModuleMapper;
import com.zhwl.printset.service.IZdyPrintModuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
* 打印配置-组件管理Service业务层处理
*
* @author wangxing
* @date 2024-06-13
*/
@Service
public class ZdyPrintModuleServiceImpl implements IZdyPrintModuleService {
@Autowired
private ZdyPrintModuleMapper zdyPrintModuleMapper;
/**
* 查询打印配置-组件管理
*
* @param id 打印配置-组件管理主键
* @return 打印配置-组件管理
*/
@Override
public ZdyPrintModule selectZdyPrintModuleById(Integer id) {
ZdyPrintModule zdyPrintModule = zdyPrintModuleMapper.selectZdyPrintModuleById(id);
toName(zdyPrintModule);
return zdyPrintModule;
}
/**
* 查询打印配置-组件管理列表
*
* @param zdyPrintModule 打印配置-组件管理
* @return 打印配置-组件管理
*/
@Override
@DataScope(deptAlias = "d")
public List<ZdyPrintModule> selectZdyPrintModuleList(ZdyPrintModule zdyPrintModule) {
List<ZdyPrintModule> zdyPrintModules = zdyPrintModuleMapper.selectZdyPrintModuleList(zdyPrintModule);
zdyPrintModules.forEach(this::toName);
return zdyPrintModules;
}
/**
* 新增打印配置-组件管理
*
* @param zdyPrintModule 打印配置-组件管理
* @return 结果
*/
@Override
public int insertZdyPrintModule(ZdyPrintModule zdyPrintModule) {
zdyPrintModule.setCreateTime(DateUtils.getNowDate());
return zdyPrintModuleMapper.insertZdyPrintModule(zdyPrintModule);
}
/**
* 修改打印配置-组件管理
*
* @param zdyPrintModule 打印配置-组件管理
* @return 结果
*/
@Override
public int updateZdyPrintModule(ZdyPrintModule zdyPrintModule) {
zdyPrintModule.setUpdateTime(DateUtils.getNowDate());
return zdyPrintModuleMapper.updateZdyPrintModule(zdyPrintModule);
}
/**
* 批量删除打印配置-组件管理
*
* @param ids 需要删除的打印配置-组件管理主键
* @return 结果
*/
@Override
public int deleteZdyPrintModuleByIds(Integer[] ids) {
return zdyPrintModuleMapper.deleteZdyPrintModuleByIds(ids);
}
/**
* 删除打印配置-组件管理信息
*
* @param id 打印配置-组件管理主键
* @return 结果
*/
@Override
public int deleteZdyPrintModuleById(Integer id) {
return zdyPrintModuleMapper.deleteZdyPrintModuleById(id);
}
private void toName(ZdyPrintModule zdyPrintModule) {
//组件类型
if (Objects.nonNull(zdyPrintModule.getType())) {
Optional<SysDictData> refundTypeDict = DictUtils.getDictDataOption(DictTypeEnum.PRINT_MODULE_TYPE, String.valueOf(zdyPrintModule.getType()));
refundTypeDict.ifPresent(sysDictData -> {
zdyPrintModule.setTypeName(sysDictData.getDictLabel());
zdyPrintModule.setImage(sysDictData.getRemark());
});
}
//组件类别
if (StringUtils.isNotEmpty(zdyPrintModule.getCategory())) {
zdyPrintModule.setCategoryName(DictUtils.getDictLabel(DictTypeEnum.PRINT_MODULE_CATEGORY.getType(), zdyPrintModule.getCategory()));
}
}
}

View File

@@ -0,0 +1,89 @@
package com.zhwl.printset.service.impl;
import com.zhwl.common.utils.DateUtils;
import com.zhwl.printset.domain.ZdyPrintTemplateModule;
import com.zhwl.printset.mapper.ZdyPrintTemplateModuleMapper;
import com.zhwl.printset.service.IZdyPrintTemplateModuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 打印配置-模板关联组件Service业务层处理
*
* @author wangxing
* @date 2024-06-13
*/
@Service
public class ZdyPrintTemplateModuleServiceImpl implements IZdyPrintTemplateModuleService {
@Autowired
private ZdyPrintTemplateModuleMapper zdyPrintTemplateModuleMapper;
/**
* 查询打印配置-模板关联组件
*
* @param id 打印配置-模板关联组件主键
* @return 打印配置-模板关联组件
*/
@Override
public ZdyPrintTemplateModule selectZdyPrintTemplateModuleById(Integer id) {
return zdyPrintTemplateModuleMapper.selectZdyPrintTemplateModuleById(id);
}
/**
* 查询打印配置-模板关联组件列表
*
* @param zdyPrintTemplateModule 打印配置-模板关联组件
* @return 打印配置-模板关联组件
*/
@Override
public List<ZdyPrintTemplateModule> selectZdyPrintTemplateModuleList(ZdyPrintTemplateModule zdyPrintTemplateModule) {
return zdyPrintTemplateModuleMapper.selectZdyPrintTemplateModuleList(zdyPrintTemplateModule);
}
/**
* 新增打印配置-模板关联组件
*
* @param zdyPrintTemplateModule 打印配置-模板关联组件
* @return 结果
*/
@Override
public int insertZdyPrintTemplateModule(ZdyPrintTemplateModule zdyPrintTemplateModule) {
zdyPrintTemplateModule.setCreateTime(DateUtils.getNowDate());
return zdyPrintTemplateModuleMapper.insertZdyPrintTemplateModule(zdyPrintTemplateModule);
}
/**
* 修改打印配置-模板关联组件
*
* @param zdyPrintTemplateModule 打印配置-模板关联组件
* @return 结果
*/
@Override
public int updateZdyPrintTemplateModule(ZdyPrintTemplateModule zdyPrintTemplateModule) {
return zdyPrintTemplateModuleMapper.updateZdyPrintTemplateModule(zdyPrintTemplateModule);
}
/**
* 批量删除打印配置-模板关联组件
*
* @param ids 需要删除的打印配置-模板关联组件主键
* @return 结果
*/
@Override
public int deleteZdyPrintTemplateModuleByIds(Integer[] ids) {
return zdyPrintTemplateModuleMapper.deleteZdyPrintTemplateModuleByIds(ids);
}
/**
* 删除打印配置-模板关联组件信息
*
* @param id 打印配置-模板关联组件主键
* @return 结果
*/
@Override
public int deleteZdyPrintTemplateModuleById(Integer id) {
return zdyPrintTemplateModuleMapper.deleteZdyPrintTemplateModuleById(id);
}
}

View File

@@ -0,0 +1,199 @@
package com.zhwl.printset.service.impl;
import com.zhwl.common.annotation.DataScope;
import com.zhwl.common.enums.DictTypeEnum;
import com.zhwl.common.exception.ServiceException;
import com.zhwl.common.utils.DateUtils;
import com.zhwl.common.utils.DictUtils;
import com.zhwl.common.utils.SecurityUtils;
import com.zhwl.common.utils.StringUtils;
import com.zhwl.printset.domain.ZdyPrintTemplate;
import com.zhwl.printset.domain.ZdyPrintTemplateModule;
import com.zhwl.printset.mapper.ZdyPrintTemplateMapper;
import com.zhwl.printset.mapper.ZdyPrintTemplateModuleMapper;
import com.zhwl.printset.service.IZdyPrintTemplateService;
import com.zhwl.system.domain.SysConfig;
import com.zhwl.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* 打印配置-模板管理Service业务层处理
*
* @author wangxing
* @date 2024-06-13
*/
@Service
public class ZdyPrintTemplateServiceImpl implements IZdyPrintTemplateService {
@Autowired
private ZdyPrintTemplateMapper zdyPrintTemplateMapper;
@Autowired
private ZdyPrintTemplateModuleMapper zdyPrintTemplateModuleMapper;
@Autowired
private ISysConfigService sysConfigService;
/**
* 查询打印配置-模板管理
*
* @param id 打印配置-模板管理主键
* @return 打印配置-模板管理
*/
@Override
public ZdyPrintTemplate selectZdyPrintTemplateById(Integer id) {
ZdyPrintTemplate zdyPrintTemplate = zdyPrintTemplateMapper.selectZdyPrintTemplateById(id);
List<ZdyPrintTemplateModule> zdyPrintTemplateModules = zdyPrintTemplateModuleMapper.selectZdyPrintTemplateModuleByTempId(zdyPrintTemplate.getId());
zdyPrintTemplate.setTemplateModuleList(zdyPrintTemplateModules);
toName(zdyPrintTemplate);
return zdyPrintTemplate;
}
/**
* 查询打印配置-模板管理列表
*
* @param zdyPrintTemplate 打印配置-模板管理
* @return 打印配置-模板管理
*/
@DataScope(deptAlias = "d")
@Override
public List<ZdyPrintTemplate> selectZdyPrintTemplateList(ZdyPrintTemplate zdyPrintTemplate) {
List<ZdyPrintTemplate> zdyPrintTemplates = zdyPrintTemplateMapper.selectZdyPrintTemplateList(zdyPrintTemplate);
zdyPrintTemplates.forEach(this::toName);
return zdyPrintTemplates;
}
/**
* 新增打印配置-模板管理
*
* @param zdyPrintTemplate 打印配置-模板管理
* @return 结果
*/
@Override
@Transactional
public int insertZdyPrintTemplate(ZdyPrintTemplate zdyPrintTemplate) {
Date nowDate = DateUtils.getNowDate();
zdyPrintTemplate.setCreateTime(nowDate);
Long deptId = SecurityUtils.getLoginUser().getDeptId();
zdyPrintTemplate.setDeptId(deptId);
selectSameTypeAndUpdateUseFlag(zdyPrintTemplate);
int i = zdyPrintTemplateMapper.insertZdyPrintTemplate(zdyPrintTemplate);
insertTemplateModule(zdyPrintTemplate);
return i;
}
private void selectSameTypeAndUpdateUseFlag(ZdyPrintTemplate zdyPrintTemplate) {
if (StringUtils.isEmpty(zdyPrintTemplate.getUseFlag()) || "N".equals(zdyPrintTemplate.getUseFlag())) {
return;
}
ZdyPrintTemplate search = new ZdyPrintTemplate();
search.setType(zdyPrintTemplate.getType());
List<ZdyPrintTemplate> zdyPrintTemplates = zdyPrintTemplateMapper.selectZdyPrintTemplateList(search);
zdyPrintTemplates.forEach(item -> {
item.setUseFlag("N");
zdyPrintTemplateMapper.updateZdyPrintTemplate(item);
});
}
/**
* 修改打印配置-模板管理
*
* @param zdyPrintTemplate 打印配置-模板管理
* @return 结果
*/
@Override
@Transactional
public int updateZdyPrintTemplate(ZdyPrintTemplate zdyPrintTemplate) {
selectSameTypeAndUpdateUseFlag(zdyPrintTemplate);
int i = zdyPrintTemplateMapper.updateZdyPrintTemplate(zdyPrintTemplate);
zdyPrintTemplateModuleMapper.deleteZdyPrintTemplateModuleByTempId(zdyPrintTemplate.getId());
insertTemplateModule(zdyPrintTemplate);
return i;
}
/**
* 批量删除打印配置-模板管理
*
* @param ids 需要删除的打印配置-模板管理主键
* @return 结果
*/
@Override
public int deleteZdyPrintTemplateByIds(Integer[] ids) {
return zdyPrintTemplateMapper.deleteZdyPrintTemplateByIds(ids);
}
/**
* 删除打印配置-模板管理信息
*
* @param id 打印配置-模板管理主键
* @return 结果
*/
@Override
public int deleteZdyPrintTemplateById(Integer id) {
SysConfig sysConfig = new SysConfig();
sysConfig.setGroupId("print.module");
List<SysConfig> list = sysConfigService.selectConfigList(sysConfig);
for (SysConfig config : list) {
if (Objects.equals(config.getConfigValue(), id.toString())) {
throw new ServiceException("模版使用中,不能删除");
}
}
return zdyPrintTemplateMapper.deleteZdyPrintTemplateById(id);
}
/**
* 根据打印配置参数查询模板详情
*
* @param configKey
* @return
*/
@Override
public ZdyPrintTemplate getTemplateInfo(String configKey) {
String value = sysConfigService.selectConfigByKey(configKey);
if (StringUtils.isEmpty(value)) {
throw new ServiceException("打印模板未设置!");
}
return this.selectZdyPrintTemplateById(Integer.valueOf(value));
}
//数据转换
private void toName(ZdyPrintTemplate zdyPrintTemplate) {
//模板类型
if (Objects.nonNull(zdyPrintTemplate.getType())) {
zdyPrintTemplate.setTypeName(DictUtils.getDictLabel(DictTypeEnum.PRINT_TEMPLATE_TYPE.getType(), String.valueOf(zdyPrintTemplate.getType())));
}
if (StringUtils.isNotEmpty(zdyPrintTemplate.getTemplateModuleList())) {
List<ZdyPrintTemplateModule> templateModuleList = zdyPrintTemplate.getTemplateModuleList();
templateModuleList.forEach(d -> {
if (Objects.nonNull(d.getTextAlign())) {
d.setTextAlignName(DictUtils.getDictLabel(DictTypeEnum.PRINT_TEMPLATE_POSITION.getType(), String.valueOf(d.getTextAlign())));
}
});
}
}
/**
* 添加模板组件关联表
*
* @param zdyPrintTemplate
*/
private void insertTemplateModule(ZdyPrintTemplate zdyPrintTemplate) {
List<ZdyPrintTemplateModule> templateModuleList = zdyPrintTemplate.getTemplateModuleList();
if (StringUtils.isNotEmpty(templateModuleList)) {
templateModuleList.forEach(d -> {
d.setTemplateId(zdyPrintTemplate.getId());
d.setCreateTime(DateUtils.getNowDate());
zdyPrintTemplateModuleMapper.insertZdyPrintTemplateModule(d);
});
}
}
}

View File

@@ -0,0 +1,500 @@
package com.zhwl.printset.service.impl;
import cn.hutool.core.util.DesensitizedUtil;
import com.zhwl.common.core.domain.ZdyTicketOrderDetail;
import com.zhwl.common.core.domain.ZdyTicketOrderItem;
import com.zhwl.common.core.domain.ZdyUserTourist;
import com.zhwl.common.core.domain.vo.ZdyTicketOrderDetailReturnVo;
import com.zhwl.common.enums.DictTypeEnum;
import com.zhwl.common.exception.ServiceException;
import com.zhwl.common.utils.*;
import com.zhwl.common.utils.bean.BeanUtils;
import com.zhwl.eatery.domain.ZdyEateryOrder;
import com.zhwl.eatery.mapper.ZdyEateryOrderMapper;
import com.zhwl.printset.domain.ZdyPrintLog;
import com.zhwl.printset.domain.ZdyPrintModule;
import com.zhwl.printset.domain.ZdyPrintTemplate;
import com.zhwl.printset.domain.ZdyPrintTemplateModule;
import com.zhwl.printset.domain.dto.PrintDTO;
import com.zhwl.printset.mapper.ZdyPrintLogMapper;
import com.zhwl.printset.mapper.ZdyPrintModuleMapper;
import com.zhwl.printset.mapper.ZdyPrintTemplateMapper;
import com.zhwl.printset.mapper.ZdyPrintTemplateModuleMapper;
import com.zhwl.printset.service.IZdyPrintLogService;
import com.zhwl.printset.service.IZdyPrintOrderService;
import com.zhwl.system.service.ISysConfigService;
import com.zhwl.ticket.constant.Constants;
import com.zhwl.ticket.order.domain.bo.CommonParamBo;
import com.zhwl.ticket.order.domain.vo.CommonParamVo;
import com.zhwl.ticket.order.domain.vo.VerificationMessageVo;
import com.zhwl.ticket.order.domain.vo.ZdyTicketOrderVo;
import com.zhwl.ticket.order.mapper.ZdyTicketOrderDetailMapper;
import com.zhwl.ticket.order.service.IZdyTicketOrderDetailService;
import com.zhwl.ticket.order.service.IZdyTicketOrderItemService;
import com.zhwl.ticket.order.service.IZdyTicketOrderService;
import com.zhwl.user.domain.ZdyUser;
import com.zhwl.user.service.IZdyUserService;
import com.zhwl.user.service.IZdyUserTouristService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors;
import static com.zhwl.common.enums.ScenicOrderType.*;
/**
* 打印配置-组件管理Service业务层处理
*
* @author wangxing
* @date 2024-06-13
*/
@Slf4j
@Service
public class ZdyPrintorderServiceImpl implements IZdyPrintOrderService {
@Autowired
private IZdyTicketOrderService zdyTicketOrderService;
@Autowired
private ISysConfigService sysConfigService;
@Autowired
private ZdyPrintTemplateMapper zdyPrintTemplateMapper;
@Autowired
private IZdyTicketOrderDetailService zdyTicketOrderDetailService;
@Autowired
private IZdyTicketOrderItemService zdyTicketOrderItemService;
@Autowired
private IZdyUserTouristService zdyUserTouristService;
@Autowired
private IZdyUserService zdyUserService;
@Autowired
private ZdyPrintTemplateModuleMapper zdyPrintTemplateModuleMapper;
@Autowired
private IZdyPrintLogService zdyPrintLogService;
@Autowired
private ZdyPrintModuleMapper zdyPrintModuleMapper;
@Autowired
private ZdyEateryOrderMapper zdyEateryOrderMapper;
@Autowired
MybatisBatchUtils mybatisBatchUtils;
/**
* 打印订单
*
* @param commonParamBo
* @return
*/
@Transactional(rollbackFor = Exception.class)
@Override
public List<ZdyPrintTemplate> printOrder(CommonParamBo commonParamBo) {
log.info("commonParamBo:{}", commonParamBo);
if (Objects.isNull(commonParamBo)) {
throw new ServiceException("打印参数不能为空!");
}
//发送消息
VerificationMessageVo verificationMessageVo = new VerificationMessageVo();
String failMsg = "";
//生成打印模板
String value = "";
if (Objects.equals(commonParamBo.getPrintType(), Constants.PRINT_TYPE_WINDOWS)) {
value = sysConfigService.selectConfigByKey("print.module.window");
} else if (Objects.equals(commonParamBo.getPrintType(), Constants.PRINT_TYPE_AUTOMATIC)) {
value = sysConfigService.selectConfigByKey("print.module.self");
}
if (StringUtils.isEmpty(value)) {
failMsg = "未找到可用模版";
addPrintErrorLog(commonParamBo, failMsg);
throw new ServiceException(failMsg);
}
List<ZdyPrintTemplate> zdyPrintTemplateList = new ArrayList<>();
ZdyPrintTemplate zdyPrintTemplate = zdyPrintTemplateMapper.selectZdyPrintTemplateById(Integer.valueOf(value));
if (Objects.isNull(zdyPrintTemplate)) {
failMsg = "打印模版不存在";
addPrintErrorLog(commonParamBo, failMsg);
throw new ServiceException(failMsg);
}
//订单来源
String orderSource = "";
//注定单编号
String orderCode = "";
//自助机打印数量限制
String printNumLimit = sysConfigService.selectConfigByKey("print.module.self.printNum");
List<ZdyPrintTemplateModule> templateModuleList = zdyPrintTemplateModuleMapper.selectZdyPrintTemplateModuleByTempId(Integer.valueOf(value));
//全部打印
if (Objects.nonNull(commonParamBo.getOrderId())) {
ZdyTicketOrderVo zdyTicketOrderVo = zdyTicketOrderService.selectZdyTicketOrderById(Long.parseLong(commonParamBo.getOrderId().toString()));
List<ZdyTicketOrderItem> orderItemList = zdyTicketOrderVo.getOrderItemList();
orderItemList = orderItemList.stream().filter(item -> Objects.equals(item.getPaymentType(), PAYMENT_TYPE_ONE.getStatus()) && !Objects.equals(item.getVerificationType(), VERIFICATION_TYPE_TWO.getStatus()) && !Objects.equals(item.getRefundStatus(), REFUND_STATUS_FOUR.getStatus())).collect(Collectors.toList());
for (ZdyTicketOrderItem item : orderItemList) {
PrintDTO printDTO = PrintDTO.builder().zdyTicketOrderVo(zdyTicketOrderVo).item(item).zdyPrintTemplate(zdyPrintTemplate)
.templateModuleList(templateModuleList).zdyPrintTemplateList(zdyPrintTemplateList).commonParamBo(commonParamBo)
.printNum(printNumLimit).build();
zdyPrintTemplateList = printItemList(printDTO);
verificationMessageVo.setOrderItemId(item.getId());
}
orderSource = zdyTicketOrderVo.getOrderSource();
orderCode = zdyTicketOrderVo.getOrderCode();
//部分打印
} else if (Objects.nonNull(commonParamBo.getOrderItemId())) {
ZdyTicketOrderItem zdyTicketOrderItem = zdyTicketOrderItemService.selectZdyTicketOrderItemById(commonParamBo.getOrderItemId());
ZdyTicketOrderVo zdyTicketOrderVo = zdyTicketOrderService.selectZdyTicketOrderById(zdyTicketOrderItem.getOrderId());
PrintDTO printDTO = PrintDTO.builder().zdyTicketOrderVo(zdyTicketOrderVo).item(zdyTicketOrderItem).zdyPrintTemplate(zdyPrintTemplate)
.templateModuleList(templateModuleList).zdyPrintTemplateList(new ArrayList<>()).commonParamBo(commonParamBo)
.printNum(printNumLimit).build();
zdyPrintTemplateList = printItemList(printDTO);
orderSource = zdyTicketOrderVo.getOrderSource();
orderCode = zdyTicketOrderVo.getOrderCode();
verificationMessageVo.setOrderItemId(zdyTicketOrderItem.getId());
//单条打印
} else if (Objects.nonNull(commonParamBo.getOrderDetailId())) {
ZdyTicketOrderDetailReturnVo zdyTicketOrderDetail = zdyTicketOrderDetailService.selectZdyTicketOrderDetailById(commonParamBo.getOrderDetailId());
ZdyTicketOrderItem zdyTicketOrderItem = zdyTicketOrderItemService.selectZdyTicketOrderItemById(zdyTicketOrderDetail.getOrderItemId());
ZdyTicketOrderVo zdyTicketOrderVo = zdyTicketOrderService.selectZdyTicketOrderById(zdyTicketOrderItem.getOrderId());
if (!Objects.equals(zdyTicketOrderDetail.getPaymentType(), PAYMENT_TYPE_ONE.getStatus())) {
failMsg = "订单未完成付款,不可打印!";
addPrintErrorLog(commonParamBo, failMsg);
throw new ServiceException(failMsg);
}
if (Objects.equals(zdyTicketOrderDetail.getVerificationType(), VERIFICATION_TYPE_TWO.getStatus())) {
failMsg = "订单已核销完成,不可打印!";
addPrintErrorLog(commonParamBo, failMsg);
throw new ServiceException(failMsg);
}
if (Objects.equals(zdyTicketOrderDetail.getRefundStatus(), REFUND_STATUS_FOUR.getStatus())) {
failMsg = "订单已完成退款,不可打印!";
addPrintErrorLog(commonParamBo, failMsg);
throw new ServiceException(failMsg);
}
zdyPrintTemplate.setTemplateModuleList(toChangeTemplateModule(zdyTicketOrderDetail, zdyTicketOrderItem, zdyTicketOrderVo, templateModuleList, 1));
zdyPrintTemplateList.add(zdyPrintTemplate);
zdyPrintLogService.insertZdyPrintLog(insertPrintLog(zdyTicketOrderDetail, zdyTicketOrderItem, commonParamBo));
checkPrintNum(zdyTicketOrderDetail, commonParamBo, printNumLimit);
orderSource = zdyTicketOrderVo.getOrderSource();
orderCode = zdyTicketOrderVo.getOrderCode();
verificationMessageVo.setOrderDetailId(commonParamBo.getOrderDetailId());
}
//打印完成 OTA渠道订单发送通知+抖音
// if (Objects.equals(orderSource, ORDER_SOURCE_ELEVEN)
// || Objects.equals(orderSource, ORDER_SOURCE_TWELVE)
// ) {
// verificationMessageVo.setOrderSource(orderSource);
// verificationMessageVo.setOrderCode(orderCode);
// SpringUtils.getBean(RedisCache.class).publish(RedisTopicEnums.TOPIC_ORDER_VERIFICATION.getTopic(), verificationMessageVo);
// }
log.info("打印详情出参:{}", zdyPrintTemplateList);
return zdyPrintTemplateList;
}
@Override
public List<ZdyPrintTemplate> printEateryTicket(CommonParamVo commonParamVo) {
String orderId = commonParamVo.getOrderId();
/**
* * 餐饮打印小票 入参 orderDetailId订单id printType打印类型
* * 1 根据用户部门和打印类型查询确定 打印模板id 唯一切不为空
* * 2 循环遍历模板配合 订单id查询出对应内容并替换掉模板上的内容
*/
List<ZdyPrintTemplate> zdyPrintTemplateList = zdyPrintTemplateMapper.selectZdyPrintTemplateByType(SecurityUtils.getDeptId(), commonParamVo.getPrintType());
if (Objects.isNull(zdyPrintTemplateList) && zdyPrintTemplateList.size() == 0) {
throw new RuntimeException("该账户没有配置此类型的打印模板,请先前往 ”餐饮—打印设置“ 配置");
}
if (Objects.isNull(orderId)) {
throw new RuntimeException("请确定要打印的订单id");
}
ZdyEateryOrder zdyEateryOrder = zdyEateryOrderMapper.selectZdyEateryOrderById(orderId);
if (Objects.isNull(zdyEateryOrder)) {
throw new RuntimeException("请确定要打印的订单id");
}
for (ZdyPrintTemplate zdyPrintTemplate : zdyPrintTemplateList) {
ZdyPrintTemplateModule zdyPrintTemplateModule = new ZdyPrintTemplateModule();
zdyPrintTemplateModule.setTemplateId(zdyPrintTemplate.getId());
List<ZdyPrintTemplateModule> zdyPrintTemplateModules = zdyPrintTemplateModuleMapper.selectZdyPrintTemplateModuleList(zdyPrintTemplateModule);
if (Objects.isNull(zdyPrintTemplateModules) || zdyPrintTemplateModules.size() == 0) {
throw new RuntimeException("该账户没有配置此类型的打印模板,请先前往 ”餐饮—打印设置“ 配置");
}
for (ZdyPrintTemplateModule item : zdyPrintTemplateModules) {
Integer systemModuleId = item.getSystemModuleId();
//如果是0 是系统配置得模板模块不需要查询参数
if (systemModuleId == 0) {
continue;
}
ZdyPrintModule zdyPrintModule = zdyPrintModuleMapper.selectZdyPrintModuleById(systemModuleId);
//查询不到模板组件直接返回原始数据
if (Objects.isNull(zdyPrintModule)) {
continue;
}
String table = zdyPrintModule.getTable();
String field = zdyPrintModule.getField();
String fieldType = zdyPrintModule.getFieldType();
// 每次查询一个参数返回, 多查询
// 劣 会有大量查询产生
// 优 但是后续不需要开发直接进行配置
if (StringUtils.isNotEmpty(table) && StringUtils.isNotEmpty(field) && StringUtils.isNotEmpty(fieldType)) {
field = handlerQueryFields(field, zdyPrintModule.getStatisticType());
switch (fieldType) {
case "dateTime":
Object dateTimeObject = zdyPrintModuleMapper.selectOrderInfo(table, field, orderId);
if (Objects.isNull(dateTimeObject)) {
item.setContent(toChangeContent(item.getContent().toString(), ""));
continue;
}
LocalDateTime date = (LocalDateTime) dateTimeObject;
DateTimeFormatter df = DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD_HH_MM_SS);
String format = date.format(df);
item.setContent(toChangeContent(item.getContent().toString(), format));
break;
case "string":
Object stringObject = zdyPrintModuleMapper.selectOrderInfo(table, field, orderId);
if (Objects.isNull(stringObject)) {
item.setContent(toChangeContent(item.getContent().toString(), ""));
continue;
}
item.setContent(toChangeContent(item.getContent().toString(), stringObject.toString()));
break;
case "JSONArray":
List jsonArray = zdyPrintModuleMapper.selectJsonArray(table, field, orderId);
item.setContent(jsonArray);
break;
case "dict":
//dictObject字典键需要反差字典表查询字典值
Object dictValue = zdyPrintModuleMapper.selectOrderInfo(table, field, orderId);
String dictType = zdyPrintModule.getDictType();
if (!Objects.isNull(dictValue) && StringUtils.isNotEmpty(dictType)) {
item.setContent(DictUtils.getDictLabel(dictType, dictValue.toString()));
}
item.setContent("");
break;
default:
break;
}
}
//特殊需要赋值字段
if (StringUtils.isNotEmpty(zdyPrintModule.getName()) && "票据名称".equals(zdyPrintModule.getName())) {
item.setContent(zdyPrintTemplate.getName());
}
}
zdyPrintTemplate.setTemplateModuleList(zdyPrintTemplateModules);
}
return zdyPrintTemplateList;
}
private String handlerQueryFields(String field, String statisticType) {
if (StringUtils.isEmpty(statisticType) || "none".equals(statisticType)) {
return field;
}
return statisticType + "(" + field + ")";
}
/**
* 模板数据填充
*
* @return
*/
private List<ZdyPrintTemplateModule> toChangeTemplateModule(ZdyTicketOrderDetail ticketOrderDetail, ZdyTicketOrderItem zdyTicketOrderItem, ZdyTicketOrderVo zdyTicketOrderVo, List<ZdyPrintTemplateModule> templateModuleList, Integer peopleNum) {
String qrcodeRule = zdyTicketOrderItem.getQrcodeRule();
HashMap<Object, Object> param = new HashMap<>();
if (Objects.equals(qrcodeRule, Constants.QRCODE_RULE_ONE)) {
Long userTouristId = ticketOrderDetail.getUserTouristId();
ZdyUserTourist zdyUserTourist = zdyUserTouristService.selectZdyUserTouristById(userTouristId);
param.put("verificationCode", ticketOrderDetail.getVerificationCode());
if (Objects.nonNull(zdyUserTourist)) {
param.put("userName", zdyUserTourist.getName());
param.put("idCard", DesensitizedUtil.idCardNum(zdyUserTourist.getIdCard(), 6, 4));
} else {
param.put("userName", Objects.isNull(ticketOrderDetail.getUserName()) ? "" : ticketOrderDetail.getUserName());
param.put("idCard", Objects.isNull(ticketOrderDetail.getIdentityCard()) ? "" : DesensitizedUtil.idCardNum(ticketOrderDetail.getIdentityCard(), 6, 4));
}
param.put("buyQuantity", peopleNum);
param.put("price", zdyTicketOrderItem.getPrice());
} else {
Long userId = zdyTicketOrderItem.getUserId();
ZdyUser zdyUser = zdyUserService.selectZdyUserById(userId);
param.put("verificationCode", zdyTicketOrderItem.getOrderCode());
if (Objects.nonNull(zdyUser)) {
param.put("userName", zdyUser.getName());
param.put("idCard", DesensitizedUtil.idCardNum(zdyUser.getIdCard(), 6, 4));
} else {
param.put("userName", Objects.isNull(zdyTicketOrderItem.getUserName()) ? "" : zdyTicketOrderItem.getUserName());
param.put("idCard", Objects.isNull(zdyTicketOrderItem.getIdentityCard()) ? "" : DesensitizedUtil.idCardNum(zdyTicketOrderItem.getIdentityCard(), 6, 4));
}
param.put("buyQuantity", peopleNum);
param.put("price", zdyTicketOrderItem.getPrice().multiply(new BigDecimal(peopleNum)));
}
List<ZdyPrintTemplateModule> moduleList = templateModuleList
.stream()
.map(templateModule -> {
ZdyPrintTemplateModule zdyPrintTemplateModule = new ZdyPrintTemplateModule();
BeanUtils.copyProperties(templateModule, zdyPrintTemplateModule);
return zdyPrintTemplateModule;
}).collect(Collectors.toList());
if (StringUtils.isNotEmpty(moduleList)) {
moduleList.forEach(d -> {
String content = Objects.nonNull(d.getContent()) ? d.getContent().toString() : null;
switch (d.getSystemModuleId()) {
case 1:
content = toChangeContent(content, zdyTicketOrderItem.getTicketName());
break;
case 2:
content = toChangeContent(content, zdyTicketOrderItem.getClassify());
break;
case 3:
content = toChangeContent(content, param.get("price").toString());
break;
case 4:
Date availableStartTime = ticketOrderDetail.getAvailableStartTime();
Date availableEndTime = ticketOrderDetail.getAvailableEndTime();
if (Objects.isNull(availableStartTime) || Objects.isNull(availableEndTime)) {
content = toChangeContent(content, "");
} else {
content = toChangeContent(content, DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, availableStartTime) + "" + DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, availableEndTime));
}
break;
case 5:
content = toChangeContent(content, param.get("verificationCode").toString());
break;
case 6:
content = toChangeContent(content, zdyTicketOrderVo.getOrderCode());
break;
case 7:
content = toChangeContent(content, DictUtils.getDictLabel(DictTypeEnum.PAYMENT_METHOD.getType(), zdyTicketOrderItem.getPaymentMethod()));
break;
case 8:
content = toChangeContent(content, DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, zdyTicketOrderItem.getCreateTime()));
break;
case 9:
content = toChangeContent(content, param.get("verificationCode").toString());
break;
case 10:
content = toChangeContent(content, param.get("userName").toString());
break;
case 11:
content = toChangeContent(content, param.get("idCard").toString());
break;
case 69:
content = toChangeContent(content, param.get("buyQuantity").toString());
break;
case 70:
content = toChangeContent(content, Objects.isNull(zdyTicketOrderItem.getMarketPrice()) ? "0.00" : zdyTicketOrderItem.getMarketPrice().toString());
break;
default:
break;
}
d.setContent(content);
});
}
return moduleList;
}
//字符替换
private String toChangeContent(String content, String value) {
return StringUtils.isNotEmpty(content) ? content.replaceAll("\\{.*?\\}", value) : value;
}
//添加打印日志
private ZdyPrintLog addPrintLog(CommonParamBo commonParamBo) {
ZdyPrintLog zdyPrintLog = new ZdyPrintLog();
BeanUtils.copyProperties(commonParamBo, zdyPrintLog);
zdyPrintLog.setCreateTime(DateUtils.getNowDate());
zdyPrintLog.setPrintStatus(Constants.ZDY_ZHWL_TRUE);
return zdyPrintLog;
}
//添加打印错误日志
private void addPrintErrorLog(CommonParamBo commonParamBo, String failMsg) {
ZdyPrintLog zdyPrintLog = new ZdyPrintLog();
BeanUtils.copyProperties(commonParamBo, zdyPrintLog);
zdyPrintLog.setCreateTime(DateUtils.getNowDate());
zdyPrintLog.setPrintStatus(Constants.ZDY_ZHWL_FALSE);
zdyPrintLog.setFailMsg(failMsg);
zdyPrintLogService.insertZdyPrintLog(zdyPrintLog);
}
//保存打印日志
private ZdyPrintLog insertPrintLog(ZdyTicketOrderDetailReturnVo detail, ZdyTicketOrderItem item, CommonParamBo commonParamBo) {
ZdyPrintLog zdyPrintLog = addPrintLog(commonParamBo);
zdyPrintLog.setTicketId(detail.getTicketId());
zdyPrintLog.setOrderItemId(detail.getOrderItemId());
zdyPrintLog.setOrderId(item.getOrderId());
zdyPrintLog.setOrderDetailId(detail.getId());
zdyPrintLog.setTicketName(item.getTicketName());
return zdyPrintLog;
}
private List<ZdyPrintTemplate> printItemList(PrintDTO printDTO) {
ZdyTicketOrderItem item = printDTO.getItem();
List<ZdyPrintTemplate> zdyPrintTemplateList = printDTO.getZdyPrintTemplateList();
ZdyPrintTemplate zdyPrintTemplate = printDTO.getZdyPrintTemplate();
List<ZdyTicketOrderDetailReturnVo> ticketOrderDetailList = item.getTicketOrderDetailList();
ZdyTicketOrderVo zdyTicketOrderVo = printDTO.getZdyTicketOrderVo();
List<ZdyPrintTemplateModule> templateModuleList = printDTO.getTemplateModuleList();
CommonParamBo commonParamBo = printDTO.getCommonParamBo();
String printNum = printDTO.getPrintNum();
ticketOrderDetailList = ticketOrderDetailList.stream()
.filter(d -> Objects.equals(d.getPaymentType(), PAYMENT_TYPE_ONE.getStatus())
&& Objects.equals(d.getVerificationType(), VERIFICATION_TYPE_ZERO.getStatus())
&& (Objects.equals(d.getRefundStatus(), REFUND_STATUS_ZERO.getStatus())
|| Objects.equals(d.getRefundStatus(), REFUND_STATUS_TWO.getStatus())
|| Objects.equals(d.getRefundStatus(), REFUND_STATUS_NO.getStatus()))
).collect(Collectors.toList());
if (StringUtils.isEmpty(ticketOrderDetailList)) {
String failMsg = "无可打印门票!";
addPrintErrorLog(commonParamBo, failMsg);
throw new ServiceException(failMsg);
}
List<ZdyPrintLog> printLogList = new ArrayList<>();
if (Objects.equals(item.getQrcodeRule(), Constants.QRCODE_RULE_ONE)) {
ticketOrderDetailList.forEach(detail -> {
checkPrintNum(detail, commonParamBo, printNum);
ZdyPrintTemplate template = new ZdyPrintTemplate();
BeanUtils.copyProperties(zdyPrintTemplate, template);
template.setTemplateModuleList(toChangeTemplateModule(detail, item, zdyTicketOrderVo, templateModuleList, 1));
zdyPrintTemplateList.add(template);
printLogList.add(insertPrintLog(detail, item, commonParamBo));
});
} else {
ZdyPrintTemplate template = new ZdyPrintTemplate();
BeanUtils.copyProperties(zdyPrintTemplate, template);
template.setTemplateModuleList(toChangeTemplateModule(ticketOrderDetailList.get(0), item, zdyTicketOrderVo, templateModuleList, ticketOrderDetailList.size()));
zdyPrintTemplateList.add(template);
ticketOrderDetailList.forEach(d -> {
checkPrintNum(d, commonParamBo, printNum);
printLogList.add(insertPrintLog(d, item, commonParamBo));
});
}
mybatisBatchUtils.batchUpdateOrInsert(printLogList, ZdyPrintLogMapper.class, (d, m) -> m.insertZdyPrintLog(d));
return zdyPrintTemplateList;
}
/**
* 校验打印数量(自助机)
*/
private void checkPrintNum(ZdyTicketOrderDetailReturnVo detail, CommonParamBo commonParamBo, String printNumLimit) {
if (Objects.equals(commonParamBo.getPrintType(), Constants.PRINT_TYPE_WINDOWS)) {
return;
}
int sum = zdyPrintLogService.selectPrintNum(detail.getId(), Constants.PRINT_TYPE_AUTOMATIC);
boolean flag = StringUtils.isNotEmpty(printNumLimit) ? sum < Integer.parseInt(printNumLimit) : Boolean.TRUE;
if (!flag) {
String failMsg = "已达打印次数限制";
addPrintErrorLog(commonParamBo, failMsg);
throw new ServiceException(failMsg);
}
}
}

View File

@@ -0,0 +1,220 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhwl.printset.mapper.ZdyPrintLogMapper">
<resultMap type="ZdyPrintLog" id="ZdyPrintLogResult">
<result property="id" column="id"/>
<result property="ticketId" column="ticket_id"/>
<result property="orderId" column="order_id"/>
<result property="orderItemId" column="order_item_id"/>
<result property="orderDetailId" column="order_detail_id"/>
<result property="orderDetailChildId" column="order_detail_child_id"/>
<result property="printType" column="print_type"/>
<result property="printNum" column="print_num"/>
<result property="adminId" column="admin_id"/>
<result property="adminName" column="admin_name"/>
<result property="userId" column="user_id"/>
<result property="userName" column="user_name"/>
<result property="createTime" column="create_time"/>
<result property="printStatus" column="print_status"/>
<result property="failMsg" column="fail_msg"/>
<result property="ticketName" column="ticket_name"/>
</resultMap>
<sql id="selectZdyPrintLogVo">
select id, ticket_id,ticket_name, order_id, order_item_id, order_detail_id, order_detail_child_id, print_type, print_num, admin_id, admin_name, user_id, user_name, create_time, print_status, fail_msg
from zdy_print_log
</sql>
<select id="selectZdyPrintLogList" parameterType="ZdyPrintLog" resultMap="ZdyPrintLogResult">
<include refid="selectZdyPrintLogVo"/>
<where>
<if test="ticketId != null ">
and ticket_id = #{ticketId}
</if>
<if test="orderId != null ">
and order_id = #{orderId}
</if>
<if test="orderItemId != null ">
and order_item_id = #{orderItemId}
</if>
<if test="orderDetailId != null ">
and order_detail_id = #{orderDetailId}
</if>
<if test="orderDetailChildId != null ">
and order_detail_child_id = #{orderDetailChildId}
</if>
<if test="printType != null and printType != ''">
and print_type = #{printType}
</if>
<if test="printNum != null ">
and print_num = #{printNum}
</if>
<if test="adminId != null ">
and admin_id = #{adminId}
</if>
<if test="adminName != null and adminName != ''">
and admin_name like concat('%', #{adminName}, '%')
</if>
<if test="userId != null ">
and user_id = #{userId}
</if>
<if test="userName != null and userName != ''">
and user_name like concat('%', #{userName}, '%')
</if>
<if test="printStatus != null ">
and print_status = #{printStatus}
</if>
<if test="ticketName != null and ticketName != ''">
and ticket_name like concat('%', #{ticketName}, '%')
</if>
</where>
order by create_time desc
</select>
<select id="selectZdyPrintLogById" parameterType="Long"
resultMap="ZdyPrintLogResult">
<include refid="selectZdyPrintLogVo"/>
where id = #{id}
</select>
<insert id="insertZdyPrintLog" parameterType="ZdyPrintLog" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_print_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="ticketId != null">ticket_id,
</if>
<if test="orderId != null">order_id,
</if>
<if test="orderItemId != null">order_item_id,
</if>
<if test="orderDetailId != null">order_detail_id,
</if>
<if test="orderDetailChildId != null">order_detail_child_id,
</if>
<if test="printType != null">print_type,
</if>
<if test="printNum != null">print_num,
</if>
<if test="adminId != null">admin_id,
</if>
<if test="adminName != null">admin_name,
</if>
<if test="userId != null">user_id,
</if>
<if test="userName != null">user_name,
</if>
<if test="createTime != null">create_time,
</if>
<if test="printStatus != null">print_status,
</if>
<if test="failMsg != null">fail_msg,
</if>
<if test="ticketName != null">ticket_name,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ticketId != null">#{ticketId},
</if>
<if test="orderId != null">#{orderId},
</if>
<if test="orderItemId != null">#{orderItemId},
</if>
<if test="orderDetailId != null">#{orderDetailId},
</if>
<if test="orderDetailChildId != null">#{orderDetailChildId},
</if>
<if test="printType != null">#{printType},
</if>
<if test="printNum != null">#{printNum},
</if>
<if test="adminId != null">#{adminId},
</if>
<if test="adminName != null">#{adminName},
</if>
<if test="userId != null">#{userId},
</if>
<if test="userName != null">#{userName},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="printStatus != null">#{printStatus},
</if>
<if test="failMsg != null">#{failMsg},
</if>
<if test="ticketName != null">#{ticketName},
</if>
</trim>
</insert>
<update id="updateZdyPrintLog" parameterType="ZdyPrintLog">
update zdy_print_log
<trim prefix="SET" suffixOverrides=",">
<if test="ticketId != null">ticket_id =
#{ticketId},
</if>
<if test="orderId != null">order_id =
#{orderId},
</if>
<if test="orderItemId != null">order_item_id =
#{orderItemId},
</if>
<if test="orderDetailId != null">order_detail_id =
#{orderDetailId},
</if>
<if test="orderDetailChildId != null">order_detail_child_id =
#{orderDetailChildId},
</if>
<if test="printType != null">print_type =
#{printType},
</if>
<if test="printNum != null">print_num =
#{printNum},
</if>
<if test="adminId != null">admin_id =
#{adminId},
</if>
<if test="adminName != null">admin_name =
#{adminName},
</if>
<if test="userId != null">user_id =
#{userId},
</if>
<if test="userName != null">user_name =
#{userName},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="printStatus != null">print_status =
#{printStatus},
</if>
<if test="failMsg != null">fail_msg =
#{failMsg},
</if>
<if test="ticketName != null">ticket_name =
#{ticketName},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyPrintLogById" parameterType="Long">
delete from zdy_print_log where id = #{id}
</delete>
<delete id="deleteZdyPrintLogByIds" parameterType="String">
delete from zdy_print_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectPrintNum" resultType="Integer">
select ifnull(sum(print_num),0) as printNum from zdy_print_log
where order_detail_id = #{orderDetailId} and print_type = #{printType}
</select>
</mapper>

View File

@@ -0,0 +1,196 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhwl.printset.mapper.ZdyPrintModuleMapper">
<resultMap type="ZdyPrintModule" id="ZdyPrintModuleResult">
<result property="id" column="id"/>
<result property="scenicId" column="scenic_id"/>
<result property="name" column="name"/>
<result property="type" column="type"/>
<result property="category" column="category"/>
<result property="table" column="table"/>
<result property="field" column="field"/>
<result property="fieldType" column="field_type"/>
<result property="dictType" column="dict_type"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="imageUrl" column="image_url"/>
<result property="sort" column="sort"/>
<result property="eateryType" column="eatery_type"/>
<result property="statisticType" column="statistic_type"/>
</resultMap>
<sql id="selectZdyPrintModuleVo">
select zpm.id, scenic_id, zpm.name, zpm.type, category, `table`, field, field_type, dict_type, zpm.create_time,
zpm.update_time, image_url, sort, eatery_type, statistic_type
from zdy_print_module zpm
</sql>
<select id="selectZdyPrintModuleList" parameterType="ZdyPrintModule" resultMap="ZdyPrintModuleResult">
<include refid="selectZdyPrintModuleVo"/>
LEFT JOIN zdy_scenic zs ON zs.id = zpm.scenic_id
LEFT JOIN sys_dept d ON d.dept_id = zs.dept_id
<where>
<if test="scenicId != null ">
and scenic_id = #{scenicId}
</if>
<if test="name != null and name != ''">
and name like concat('%', #{name}, '%')
</if>
<if test="type != null ">
and type = #{type}
</if>
<if test="category != null ">
and category = #{category}
</if>
<if test="table != null and table != ''">
and table = #{table}
</if>
<if test="fieldType != null and fieldType != ''">
and field_type = #{fieldType}
</if>
${params.dataScope}
</where>
order by sort
</select>
<select id="selectZdyPrintModuleById" parameterType="Integer"
resultMap="ZdyPrintModuleResult">
<include refid="selectZdyPrintModuleVo"/>
where id = #{id}
</select>
<select id="selectOrderInfo" resultType="java.lang.Object">
select ${field} from ${table}
where id = #{orderId}
</select>
<select id="selectJsonArray" resultType="com.alibaba.fastjson2.JSONObject">
select ${field} from ${table}
where order_id = #{orderId}
</select>
<insert id="insertZdyPrintModule" parameterType="ZdyPrintModule" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_print_module
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="scenicId != null">scenic_id,
</if>
<if test="name != null and name != ''">name,
</if>
<if test="type != null">type,
</if>
<if test="category != null">category,
</if>
<if test="table != null">table,
</if>
<if test="field != null">field,
</if>
<if test="fieldType != null">field_type,
</if>
<if test="dictType != null">dict_type,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="imageUrl != null">image_url,
</if>
<if test="sort != null">sort,
</if>
<if test="eateryType != null">eatery_type,
</if>
<if test="statisticType != null">statistic_type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="scenicId != null">#{scenicId},
</if>
<if test="name != null and name != ''">#{name},
</if>
<if test="type != null">#{type},
</if>
<if test="category != null">#{category},
</if>
<if test="table != null">#{table},
</if>
<if test="field != null">#{field},
</if>
<if test="fieldType != null">#{fieldType},
</if>
<if test="dictType != null">#{dictType},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="imageUrl != null">#{imageUrl},
</if>
<if test="sort != null">#{sort},
</if>
<if test="eateryType != null">#{eateryType},
</if>
<if test="statisticType != null">#{statisticType},
</if>
</trim>
</insert>
<update id="updateZdyPrintModule" parameterType="ZdyPrintModule">
update zdy_print_module
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">`name` =
#{name},
</if>
<if test="type != null">`type` =
#{type},
</if>
<if test="category != null">category =
#{category},
</if>
<if test="table != null">`table` =
#{table},
</if>
<if test="field != null">`field` =
#{field},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="imageUrl != null">image_url =
#{imageUrl},
</if>
<if test="fieldType != null">field_type =
#{fieldType},
</if>
<if test="dictType != null">dict_type =
#{dictType},
</if>
<if test="sort != null">sort =
#{sort},
</if>
<if test="eateryType != null">eatery_type =
#{eateryType},
</if>
<if test="statisticType != null">statistic_type =
#{statisticType},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyPrintModuleById" parameterType="Integer">
delete
from zdy_print_module
where id = #{id}
</delete>
<delete id="deleteZdyPrintModuleByIds" parameterType="String">
delete from zdy_print_module where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,206 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhwl.printset.mapper.ZdyPrintTemplateMapper">
<resultMap type="ZdyPrintTemplate" id="ZdyPrintTemplateResult">
<result property="id" column="id"/>
<result property="deptId" column="dept_id"/>
<result property="name" column="name"/>
<result property="type" column="type"/>
<result property="width" column="width"/>
<result property="height" column="height"/>
<result property="margins" column="margins"/>
<result property="image" column="image"/>
<result property="createTime" column="create_time"/>
<result property="imageModule" column="image_module"/>
<result property="useFlag" column="use_flag"/>
<result property="printDevice" column="print_device"/>
<result property="category" column="category"/>
</resultMap>
<sql id="selectZdyPrintTemplateVo">
select te.id,
te.dept_id,
te.name,
te.type,
te.width,
te.height,
te.margins,
te.image,
te.create_time,
te.image_module,
te.use_flag,
te.print_device,
te.category
from zdy_print_template te
</sql>
<select id="selectZdyPrintTemplateList" parameterType="ZdyPrintTemplate" resultMap="ZdyPrintTemplateResult">
<include refid="selectZdyPrintTemplateVo"/>
left join sys_dept d on d.dept_id = te.dept_id
<where>
<if test="deptId != null ">
and dept_id = #{deptId}
</if>
<if test="name != null and name != ''">
and name like concat('%', #{name}, '%')
</if>
<if test="type != null ">
and type = #{type}
</if>
<if test="width != null ">
and width = #{width}
</if>
<if test="height != null ">
and height = #{height}
</if>
<if test="margins != null ">
and margins = #{margins}
</if>
<if test="image != null and image != ''">
and image = #{image}
</if>
<if test="useFlag != null and useFlag != ''">
and use_flag = #{useFlag}
</if>
<if test="category != null and category != ''">
and category = #{category}
</if>
${params.dataScope}
</where>
</select>
<select id="selectZdyPrintTemplateById" parameterType="Integer"
resultMap="ZdyPrintTemplateResult">
<include refid="selectZdyPrintTemplateVo"/>
where id = #{id}
</select>
<select id="selectZdyPrintTemplateByType" resultMap="ZdyPrintTemplateResult">
<include refid="selectZdyPrintTemplateVo"/>
<where>
and use_flag = "Y"
<if test="deptId != null">and dept_id = #{deptId}</if>
<if test="type != null">and type= #{type}</if>
</where>
</select>
<insert id="insertZdyPrintTemplate" parameterType="ZdyPrintTemplate" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_print_template
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deptId != null">dept_id,
</if>
<if test="name != null and name != ''">name,
</if>
<if test="type != null">type,
</if>
<if test="width != null">width,
</if>
<if test="height != null">height,
</if>
<if test="margins != null">margins,
</if>
<if test="image != null">image,
</if>
<if test="createTime != null">create_time,
</if>
<if test="imageModule != null and imageModule != ''">
image_module,
</if>
<if test="useFlag != null and useFlag != ''">
use_flag,
</if>
<if test="printDevice != null and printDevice != ''">
print_device,
</if>
<if test="category != null and category != ''">
category,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deptId != null">#{deptId},
</if>
<if test="name != null and name != ''">#{name},
</if>
<if test="type != null">#{type},
</if>
<if test="width != null">#{width},
</if>
<if test="height != null">#{height},
</if>
<if test="margins != null">#{margins},
</if>
<if test="image != null">#{image},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="imageModule != null and imageModule != ''">#{imageModule},
</if>
<if test="useFlag != null and useFlag != ''">#{useFlag},
</if>
<if test="printDevice != null and printDevice != ''">#{printDevice},
</if>
<if test="category != null and category != ''">#{category},
</if>
</trim>
</insert>
<update id="updateZdyPrintTemplate" parameterType="ZdyPrintTemplate">
update zdy_print_template
<trim prefix="SET" suffixOverrides=",">
<if test="deptId != null">dept_id =
#{deptId},
</if>
<if test="name != null and name != ''">name =
#{name},
</if>
<if test="type != null">type =
#{type},
</if>
<if test="width != null">width =
#{width},
</if>
<if test="height != null">height =
#{height},
</if>
<if test="margins != null">margins =
#{margins},
</if>
<if test="image != null">image =
#{image},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="imageModule != null">image_module =
#{imageModule},
</if>
<if test="useFlag != null">use_flag =
#{useFlag},
</if>
<if test="printDevice != null">print_device =
#{printDevice},
</if>
<if test="category != null">category =
#{category},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyPrintTemplateById" parameterType="Integer">
delete
from zdy_print_template
where id = #{id}
</delete>
<delete id="deleteZdyPrintTemplateByIds" parameterType="String">
delete from zdy_print_template where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,253 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhwl.printset.mapper.ZdyPrintTemplateModuleMapper">
<resultMap type="ZdyPrintTemplateModule" id="ZdyPrintTemplateModuleResult">
<result property="id" column="id"/>
<result property="templateId" column="template_id"/>
<result property="content" column="content"/>
<result property="textAlign" column="text_align"/>
<result property="fontSize" column="font_size"/>
<result property="fontWeight" column="font_weight"/>
<result property="height" column="height"/>
<result property="fontColor" column="font_color"/>
<result property="backgroudColor" column="backgroud_color"/>
<result property="createTime" column="create_time"/>
<result property="sort" column="sort"/>
<result property="isAuto" column="is_auto"/>
<result property="pageDistance" column="page_distance"/>
<result property="imageDistance" column="image_distance"/>
<result property="imageUrl" column="image_url"/>
<result property="separateType" column="separate_type"/>
<result property="separateStyle" column="separate_style"/>
<result property="title" column="title"/>
<result property="remark" column="remark"/>
<result property="systemModuleId" column="system_module_id"/>
<result property="type" column="type"/>
</resultMap>
<sql id="selectZdyPrintTemplateModuleVo">
select id,
template_id,
content,
text_align,
font_size,
font_weight,
height,
font_color,
backgroud_color,
create_time,
sort,
is_auto,
page_distance,
image_distance,
image_url,
separate_type,
separate_style,
title,
remark,
system_module_id,
type
from zdy_print_template_module ptm
</sql>
<select id="selectZdyPrintTemplateModuleList" parameterType="ZdyPrintTemplateModule"
resultMap="ZdyPrintTemplateModuleResult">
<include refid="selectZdyPrintTemplateModuleVo"/>
<where>
<if test="templateId != null ">
and ptm.template_id = #{templateId}
</if>
</where>
</select>
<select id="selectZdyPrintTemplateModuleById" parameterType="Integer"
resultMap="ZdyPrintTemplateModuleResult">
<include refid="selectZdyPrintTemplateModuleVo"/>
where id = #{id}
</select>
<insert id="insertZdyPrintTemplateModule" parameterType="ZdyPrintTemplateModule" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_print_template_module
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="templateId != null">template_id,
</if>
<if test="content != null and content != ''">content,
</if>
<if test="textAlign != null">text_align,
</if>
<if test="fontSize != null">font_size,
</if>
<if test="fontWeight != null">font_weight,
</if>
<if test="height != null">height,
</if>
<if test="fontColor != null">font_color,
</if>
<if test="backgroudColor != null">backgroud_color,
</if>
<if test="createTime != null">create_time,
</if>
<if test="sort != null">sort,
</if>
<if test="isAuto != null">is_auto,
</if>
<if test="pageDistance != null">page_distance,
</if>
<if test="imageDistance != null">image_distance,
</if>
<if test="imageUrl != null">image_url,
</if>
<if test="separateType != null">separate_type,
</if>
<if test="separateStyle != null">separate_style,
</if>
<if test="title != null and title != ''">title,
</if>
<if test="remark != null and remark != ''">remark,
</if>
<if test="systemModuleId != null">system_module_id,
</if>
<if test="type != null">type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="templateId != null">#{templateId},
</if>
<if test="content != null and content != ''">#{content},
</if>
<if test="textAlign != null">#{textAlign},
</if>
<if test="fontSize != null">#{fontSize},
</if>
<if test="fontWeight != null">#{fontWeight},
</if>
<if test="height != null">#{height},
</if>
<if test="fontColor != null">#{fontColor},
</if>
<if test="backgroudColor != null">#{backgroudColor},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="sort != null">#{sort},
</if>
<if test="isAuto != null">#{isAuto},
</if>
<if test="pageDistance != null">#{pageDistance},
</if>
<if test="imageDistance != null">#{imageDistance},
</if>
<if test="imageUrl != null">#{imageUrl},
</if>
<if test="separateType != null">#{separateType},
</if>
<if test="separateStyle != null">#{separateStyle},
</if>
<if test="title != null">#{title},
</if>
<if test="remark != null and remark != ''">#{remark},
</if>
<if test="systemModuleId != null">#{systemModuleId},
</if>
<if test="type != null">#{type},
</if>
</trim>
</insert>
<update id="updateZdyPrintTemplateModule" parameterType="ZdyPrintTemplateModule">
update zdy_print_template_module
<trim prefix="SET" suffixOverrides=",">
<if test="templateId != null">template_id =
#{templateId},
</if>
<if test="content != null and content != ''">content =
#{content},
</if>
<if test="textAlign != null">text_align =
#{textAlign},
</if>
<if test="fontSize != null">font_size =
#{fontSize},
</if>
<if test="fontWeight != null">font_weight =
#{fontWeight},
</if>
<if test="height != null">height =
#{height},
</if>
<if test="fontColor != null">font_color =
#{fontColor},
</if>
<if test="backgroudColor != null">backgroud_color =
#{backgroudColor},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="sort != null">sort =
#{sort},
</if>
<if test="isAuto != null">is_auto =
#{isAuto},
</if>
<if test="pageDistance != null">page_distance =
#{pageDistance},
</if>
<if test="imageDistance != null">image_distance =
#{imageDistance},
</if>
<if test="imageUrl != null">image_url =
#{imageUrl},
</if>
<if test="separateType != null">separate_type =
#{separateType},
</if>
<if test="separateStyle != null">separate_style =
#{separateStyle},
</if>
<if test="title != null">title =
#{title},
</if>
<if test="remark != null">remark =
#{remark},
</if>
<if test="systemModuleId != null">system_module_id =
#{systemModuleId},
</if>
<if test="type != null">type =
#{type},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyPrintTemplateModuleById" parameterType="Integer">
delete
from zdy_print_template_module
where id = #{id}
</delete>
<delete id="deleteZdyPrintTemplateModuleByIds" parameterType="String">
delete from zdy_print_template_module where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectZdyPrintTemplateModuleByTempId" parameterType="Integer"
resultMap="ZdyPrintTemplateModuleResult">
<include refid="selectZdyPrintTemplateModuleVo"/>
where template_id = #{template_id}
</select>
<delete id="deleteZdyPrintTemplateModuleByTempId" parameterType="Integer">
delete
from zdy_print_template_module
where template_id = #{template_id}
</delete>
</mapper>

View File

@@ -0,0 +1,220 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhwl.printset.mapper.ZdyPrintLogMapper">
<resultMap type="ZdyPrintLog" id="ZdyPrintLogResult">
<result property="id" column="id"/>
<result property="ticketId" column="ticket_id"/>
<result property="orderId" column="order_id"/>
<result property="orderItemId" column="order_item_id"/>
<result property="orderDetailId" column="order_detail_id"/>
<result property="orderDetailChildId" column="order_detail_child_id"/>
<result property="printType" column="print_type"/>
<result property="printNum" column="print_num"/>
<result property="adminId" column="admin_id"/>
<result property="adminName" column="admin_name"/>
<result property="userId" column="user_id"/>
<result property="userName" column="user_name"/>
<result property="createTime" column="create_time"/>
<result property="printStatus" column="print_status"/>
<result property="failMsg" column="fail_msg"/>
<result property="ticketName" column="ticket_name"/>
</resultMap>
<sql id="selectZdyPrintLogVo">
select id, ticket_id,ticket_name, order_id, order_item_id, order_detail_id, order_detail_child_id, print_type, print_num, admin_id, admin_name, user_id, user_name, create_time, print_status, fail_msg
from zdy_print_log
</sql>
<select id="selectZdyPrintLogList" parameterType="ZdyPrintLog" resultMap="ZdyPrintLogResult">
<include refid="selectZdyPrintLogVo"/>
<where>
<if test="ticketId != null ">
and ticket_id = #{ticketId}
</if>
<if test="orderId != null ">
and order_id = #{orderId}
</if>
<if test="orderItemId != null ">
and order_item_id = #{orderItemId}
</if>
<if test="orderDetailId != null ">
and order_detail_id = #{orderDetailId}
</if>
<if test="orderDetailChildId != null ">
and order_detail_child_id = #{orderDetailChildId}
</if>
<if test="printType != null and printType != ''">
and print_type = #{printType}
</if>
<if test="printNum != null ">
and print_num = #{printNum}
</if>
<if test="adminId != null ">
and admin_id = #{adminId}
</if>
<if test="adminName != null and adminName != ''">
and admin_name like concat('%', #{adminName}, '%')
</if>
<if test="userId != null ">
and user_id = #{userId}
</if>
<if test="userName != null and userName != ''">
and user_name like concat('%', #{userName}, '%')
</if>
<if test="printStatus != null ">
and print_status = #{printStatus}
</if>
<if test="ticketName != null and ticketName != ''">
and ticket_name like concat('%', #{ticketName}, '%')
</if>
</where>
order by create_time desc
</select>
<select id="selectZdyPrintLogById" parameterType="Long"
resultMap="ZdyPrintLogResult">
<include refid="selectZdyPrintLogVo"/>
where id = #{id}
</select>
<insert id="insertZdyPrintLog" parameterType="ZdyPrintLog" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_print_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="ticketId != null">ticket_id,
</if>
<if test="orderId != null">order_id,
</if>
<if test="orderItemId != null">order_item_id,
</if>
<if test="orderDetailId != null">order_detail_id,
</if>
<if test="orderDetailChildId != null">order_detail_child_id,
</if>
<if test="printType != null">print_type,
</if>
<if test="printNum != null">print_num,
</if>
<if test="adminId != null">admin_id,
</if>
<if test="adminName != null">admin_name,
</if>
<if test="userId != null">user_id,
</if>
<if test="userName != null">user_name,
</if>
<if test="createTime != null">create_time,
</if>
<if test="printStatus != null">print_status,
</if>
<if test="failMsg != null">fail_msg,
</if>
<if test="ticketName != null">ticket_name,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ticketId != null">#{ticketId},
</if>
<if test="orderId != null">#{orderId},
</if>
<if test="orderItemId != null">#{orderItemId},
</if>
<if test="orderDetailId != null">#{orderDetailId},
</if>
<if test="orderDetailChildId != null">#{orderDetailChildId},
</if>
<if test="printType != null">#{printType},
</if>
<if test="printNum != null">#{printNum},
</if>
<if test="adminId != null">#{adminId},
</if>
<if test="adminName != null">#{adminName},
</if>
<if test="userId != null">#{userId},
</if>
<if test="userName != null">#{userName},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="printStatus != null">#{printStatus},
</if>
<if test="failMsg != null">#{failMsg},
</if>
<if test="ticketName != null">#{ticketName},
</if>
</trim>
</insert>
<update id="updateZdyPrintLog" parameterType="ZdyPrintLog">
update zdy_print_log
<trim prefix="SET" suffixOverrides=",">
<if test="ticketId != null">ticket_id =
#{ticketId},
</if>
<if test="orderId != null">order_id =
#{orderId},
</if>
<if test="orderItemId != null">order_item_id =
#{orderItemId},
</if>
<if test="orderDetailId != null">order_detail_id =
#{orderDetailId},
</if>
<if test="orderDetailChildId != null">order_detail_child_id =
#{orderDetailChildId},
</if>
<if test="printType != null">print_type =
#{printType},
</if>
<if test="printNum != null">print_num =
#{printNum},
</if>
<if test="adminId != null">admin_id =
#{adminId},
</if>
<if test="adminName != null">admin_name =
#{adminName},
</if>
<if test="userId != null">user_id =
#{userId},
</if>
<if test="userName != null">user_name =
#{userName},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="printStatus != null">print_status =
#{printStatus},
</if>
<if test="failMsg != null">fail_msg =
#{failMsg},
</if>
<if test="ticketName != null">ticket_name =
#{ticketName},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyPrintLogById" parameterType="Long">
delete from zdy_print_log where id = #{id}
</delete>
<delete id="deleteZdyPrintLogByIds" parameterType="String">
delete from zdy_print_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectPrintNum" resultType="Integer">
select ifnull(sum(print_num),0) as printNum from zdy_print_log
where order_detail_id = #{orderDetailId} and print_type = #{printType}
</select>
</mapper>

View File

@@ -0,0 +1,196 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhwl.printset.mapper.ZdyPrintModuleMapper">
<resultMap type="ZdyPrintModule" id="ZdyPrintModuleResult">
<result property="id" column="id"/>
<result property="scenicId" column="scenic_id"/>
<result property="name" column="name"/>
<result property="type" column="type"/>
<result property="category" column="category"/>
<result property="table" column="table"/>
<result property="field" column="field"/>
<result property="fieldType" column="field_type"/>
<result property="dictType" column="dict_type"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="imageUrl" column="image_url"/>
<result property="sort" column="sort"/>
<result property="eateryType" column="eatery_type"/>
<result property="statisticType" column="statistic_type"/>
</resultMap>
<sql id="selectZdyPrintModuleVo">
select zpm.id, scenic_id, zpm.name, zpm.type, category, `table`, field, field_type, dict_type, zpm.create_time,
zpm.update_time, image_url, sort, eatery_type, statistic_type
from zdy_print_module zpm
</sql>
<select id="selectZdyPrintModuleList" parameterType="ZdyPrintModule" resultMap="ZdyPrintModuleResult">
<include refid="selectZdyPrintModuleVo"/>
LEFT JOIN zdy_scenic zs ON zs.id = zpm.scenic_id
LEFT JOIN sys_dept d ON d.dept_id = zs.dept_id
<where>
<if test="scenicId != null ">
and scenic_id = #{scenicId}
</if>
<if test="name != null and name != ''">
and name like concat('%', #{name}, '%')
</if>
<if test="type != null ">
and type = #{type}
</if>
<if test="category != null ">
and category = #{category}
</if>
<if test="table != null and table != ''">
and table = #{table}
</if>
<if test="fieldType != null and fieldType != ''">
and field_type = #{fieldType}
</if>
${params.dataScope}
</where>
order by sort
</select>
<select id="selectZdyPrintModuleById" parameterType="Integer"
resultMap="ZdyPrintModuleResult">
<include refid="selectZdyPrintModuleVo"/>
where id = #{id}
</select>
<select id="selectOrderInfo" resultType="java.lang.Object">
select ${field} from ${table}
where id = #{orderId}
</select>
<select id="selectJsonArray" resultType="com.alibaba.fastjson2.JSONObject">
select ${field} from ${table}
where order_id = #{orderId}
</select>
<insert id="insertZdyPrintModule" parameterType="ZdyPrintModule" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_print_module
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="scenicId != null">scenic_id,
</if>
<if test="name != null and name != ''">name,
</if>
<if test="type != null">type,
</if>
<if test="category != null">category,
</if>
<if test="table != null">table,
</if>
<if test="field != null">field,
</if>
<if test="fieldType != null">field_type,
</if>
<if test="dictType != null">dict_type,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="imageUrl != null">image_url,
</if>
<if test="sort != null">sort,
</if>
<if test="eateryType != null">eatery_type,
</if>
<if test="statisticType != null">statistic_type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="scenicId != null">#{scenicId},
</if>
<if test="name != null and name != ''">#{name},
</if>
<if test="type != null">#{type},
</if>
<if test="category != null">#{category},
</if>
<if test="table != null">#{table},
</if>
<if test="field != null">#{field},
</if>
<if test="fieldType != null">#{fieldType},
</if>
<if test="dictType != null">#{dictType},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="imageUrl != null">#{imageUrl},
</if>
<if test="sort != null">#{sort},
</if>
<if test="eateryType != null">#{eateryType},
</if>
<if test="statisticType != null">#{statisticType},
</if>
</trim>
</insert>
<update id="updateZdyPrintModule" parameterType="ZdyPrintModule">
update zdy_print_module
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">`name` =
#{name},
</if>
<if test="type != null">`type` =
#{type},
</if>
<if test="category != null">category =
#{category},
</if>
<if test="table != null">`table` =
#{table},
</if>
<if test="field != null">`field` =
#{field},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="imageUrl != null">image_url =
#{imageUrl},
</if>
<if test="fieldType != null">field_type =
#{fieldType},
</if>
<if test="dictType != null">dict_type =
#{dictType},
</if>
<if test="sort != null">sort =
#{sort},
</if>
<if test="eateryType != null">eatery_type =
#{eateryType},
</if>
<if test="statisticType != null">statistic_type =
#{statisticType},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyPrintModuleById" parameterType="Integer">
delete
from zdy_print_module
where id = #{id}
</delete>
<delete id="deleteZdyPrintModuleByIds" parameterType="String">
delete from zdy_print_module where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,206 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhwl.printset.mapper.ZdyPrintTemplateMapper">
<resultMap type="ZdyPrintTemplate" id="ZdyPrintTemplateResult">
<result property="id" column="id"/>
<result property="deptId" column="dept_id"/>
<result property="name" column="name"/>
<result property="type" column="type"/>
<result property="width" column="width"/>
<result property="height" column="height"/>
<result property="margins" column="margins"/>
<result property="image" column="image"/>
<result property="createTime" column="create_time"/>
<result property="imageModule" column="image_module"/>
<result property="useFlag" column="use_flag"/>
<result property="printDevice" column="print_device"/>
<result property="category" column="category"/>
</resultMap>
<sql id="selectZdyPrintTemplateVo">
select te.id,
te.dept_id,
te.name,
te.type,
te.width,
te.height,
te.margins,
te.image,
te.create_time,
te.image_module,
te.use_flag,
te.print_device,
te.category
from zdy_print_template te
</sql>
<select id="selectZdyPrintTemplateList" parameterType="ZdyPrintTemplate" resultMap="ZdyPrintTemplateResult">
<include refid="selectZdyPrintTemplateVo"/>
left join sys_dept d on d.dept_id = te.dept_id
<where>
<if test="deptId != null ">
and dept_id = #{deptId}
</if>
<if test="name != null and name != ''">
and name like concat('%', #{name}, '%')
</if>
<if test="type != null ">
and type = #{type}
</if>
<if test="width != null ">
and width = #{width}
</if>
<if test="height != null ">
and height = #{height}
</if>
<if test="margins != null ">
and margins = #{margins}
</if>
<if test="image != null and image != ''">
and image = #{image}
</if>
<if test="useFlag != null and useFlag != ''">
and use_flag = #{useFlag}
</if>
<if test="category != null and category != ''">
and category = #{category}
</if>
${params.dataScope}
</where>
</select>
<select id="selectZdyPrintTemplateById" parameterType="Integer"
resultMap="ZdyPrintTemplateResult">
<include refid="selectZdyPrintTemplateVo"/>
where id = #{id}
</select>
<select id="selectZdyPrintTemplateByType" resultMap="ZdyPrintTemplateResult">
<include refid="selectZdyPrintTemplateVo"/>
<where>
and use_flag = "Y"
<if test="deptId != null">and dept_id = #{deptId}</if>
<if test="type != null">and type= #{type}</if>
</where>
</select>
<insert id="insertZdyPrintTemplate" parameterType="ZdyPrintTemplate" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_print_template
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deptId != null">dept_id,
</if>
<if test="name != null and name != ''">name,
</if>
<if test="type != null">type,
</if>
<if test="width != null">width,
</if>
<if test="height != null">height,
</if>
<if test="margins != null">margins,
</if>
<if test="image != null">image,
</if>
<if test="createTime != null">create_time,
</if>
<if test="imageModule != null and imageModule != ''">
image_module,
</if>
<if test="useFlag != null and useFlag != ''">
use_flag,
</if>
<if test="printDevice != null and printDevice != ''">
print_device,
</if>
<if test="category != null and category != ''">
category,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deptId != null">#{deptId},
</if>
<if test="name != null and name != ''">#{name},
</if>
<if test="type != null">#{type},
</if>
<if test="width != null">#{width},
</if>
<if test="height != null">#{height},
</if>
<if test="margins != null">#{margins},
</if>
<if test="image != null">#{image},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="imageModule != null and imageModule != ''">#{imageModule},
</if>
<if test="useFlag != null and useFlag != ''">#{useFlag},
</if>
<if test="printDevice != null and printDevice != ''">#{printDevice},
</if>
<if test="category != null and category != ''">#{category},
</if>
</trim>
</insert>
<update id="updateZdyPrintTemplate" parameterType="ZdyPrintTemplate">
update zdy_print_template
<trim prefix="SET" suffixOverrides=",">
<if test="deptId != null">dept_id =
#{deptId},
</if>
<if test="name != null and name != ''">name =
#{name},
</if>
<if test="type != null">type =
#{type},
</if>
<if test="width != null">width =
#{width},
</if>
<if test="height != null">height =
#{height},
</if>
<if test="margins != null">margins =
#{margins},
</if>
<if test="image != null">image =
#{image},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="imageModule != null">image_module =
#{imageModule},
</if>
<if test="useFlag != null">use_flag =
#{useFlag},
</if>
<if test="printDevice != null">print_device =
#{printDevice},
</if>
<if test="category != null">category =
#{category},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyPrintTemplateById" parameterType="Integer">
delete
from zdy_print_template
where id = #{id}
</delete>
<delete id="deleteZdyPrintTemplateByIds" parameterType="String">
delete from zdy_print_template where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,253 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhwl.printset.mapper.ZdyPrintTemplateModuleMapper">
<resultMap type="ZdyPrintTemplateModule" id="ZdyPrintTemplateModuleResult">
<result property="id" column="id"/>
<result property="templateId" column="template_id"/>
<result property="content" column="content"/>
<result property="textAlign" column="text_align"/>
<result property="fontSize" column="font_size"/>
<result property="fontWeight" column="font_weight"/>
<result property="height" column="height"/>
<result property="fontColor" column="font_color"/>
<result property="backgroudColor" column="backgroud_color"/>
<result property="createTime" column="create_time"/>
<result property="sort" column="sort"/>
<result property="isAuto" column="is_auto"/>
<result property="pageDistance" column="page_distance"/>
<result property="imageDistance" column="image_distance"/>
<result property="imageUrl" column="image_url"/>
<result property="separateType" column="separate_type"/>
<result property="separateStyle" column="separate_style"/>
<result property="title" column="title"/>
<result property="remark" column="remark"/>
<result property="systemModuleId" column="system_module_id"/>
<result property="type" column="type"/>
</resultMap>
<sql id="selectZdyPrintTemplateModuleVo">
select id,
template_id,
content,
text_align,
font_size,
font_weight,
height,
font_color,
backgroud_color,
create_time,
sort,
is_auto,
page_distance,
image_distance,
image_url,
separate_type,
separate_style,
title,
remark,
system_module_id,
type
from zdy_print_template_module ptm
</sql>
<select id="selectZdyPrintTemplateModuleList" parameterType="ZdyPrintTemplateModule"
resultMap="ZdyPrintTemplateModuleResult">
<include refid="selectZdyPrintTemplateModuleVo"/>
<where>
<if test="templateId != null ">
and ptm.template_id = #{templateId}
</if>
</where>
</select>
<select id="selectZdyPrintTemplateModuleById" parameterType="Integer"
resultMap="ZdyPrintTemplateModuleResult">
<include refid="selectZdyPrintTemplateModuleVo"/>
where id = #{id}
</select>
<insert id="insertZdyPrintTemplateModule" parameterType="ZdyPrintTemplateModule" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_print_template_module
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="templateId != null">template_id,
</if>
<if test="content != null and content != ''">content,
</if>
<if test="textAlign != null">text_align,
</if>
<if test="fontSize != null">font_size,
</if>
<if test="fontWeight != null">font_weight,
</if>
<if test="height != null">height,
</if>
<if test="fontColor != null">font_color,
</if>
<if test="backgroudColor != null">backgroud_color,
</if>
<if test="createTime != null">create_time,
</if>
<if test="sort != null">sort,
</if>
<if test="isAuto != null">is_auto,
</if>
<if test="pageDistance != null">page_distance,
</if>
<if test="imageDistance != null">image_distance,
</if>
<if test="imageUrl != null">image_url,
</if>
<if test="separateType != null">separate_type,
</if>
<if test="separateStyle != null">separate_style,
</if>
<if test="title != null and title != ''">title,
</if>
<if test="remark != null and remark != ''">remark,
</if>
<if test="systemModuleId != null">system_module_id,
</if>
<if test="type != null">type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="templateId != null">#{templateId},
</if>
<if test="content != null and content != ''">#{content},
</if>
<if test="textAlign != null">#{textAlign},
</if>
<if test="fontSize != null">#{fontSize},
</if>
<if test="fontWeight != null">#{fontWeight},
</if>
<if test="height != null">#{height},
</if>
<if test="fontColor != null">#{fontColor},
</if>
<if test="backgroudColor != null">#{backgroudColor},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="sort != null">#{sort},
</if>
<if test="isAuto != null">#{isAuto},
</if>
<if test="pageDistance != null">#{pageDistance},
</if>
<if test="imageDistance != null">#{imageDistance},
</if>
<if test="imageUrl != null">#{imageUrl},
</if>
<if test="separateType != null">#{separateType},
</if>
<if test="separateStyle != null">#{separateStyle},
</if>
<if test="title != null">#{title},
</if>
<if test="remark != null and remark != ''">#{remark},
</if>
<if test="systemModuleId != null">#{systemModuleId},
</if>
<if test="type != null">#{type},
</if>
</trim>
</insert>
<update id="updateZdyPrintTemplateModule" parameterType="ZdyPrintTemplateModule">
update zdy_print_template_module
<trim prefix="SET" suffixOverrides=",">
<if test="templateId != null">template_id =
#{templateId},
</if>
<if test="content != null and content != ''">content =
#{content},
</if>
<if test="textAlign != null">text_align =
#{textAlign},
</if>
<if test="fontSize != null">font_size =
#{fontSize},
</if>
<if test="fontWeight != null">font_weight =
#{fontWeight},
</if>
<if test="height != null">height =
#{height},
</if>
<if test="fontColor != null">font_color =
#{fontColor},
</if>
<if test="backgroudColor != null">backgroud_color =
#{backgroudColor},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="sort != null">sort =
#{sort},
</if>
<if test="isAuto != null">is_auto =
#{isAuto},
</if>
<if test="pageDistance != null">page_distance =
#{pageDistance},
</if>
<if test="imageDistance != null">image_distance =
#{imageDistance},
</if>
<if test="imageUrl != null">image_url =
#{imageUrl},
</if>
<if test="separateType != null">separate_type =
#{separateType},
</if>
<if test="separateStyle != null">separate_style =
#{separateStyle},
</if>
<if test="title != null">title =
#{title},
</if>
<if test="remark != null">remark =
#{remark},
</if>
<if test="systemModuleId != null">system_module_id =
#{systemModuleId},
</if>
<if test="type != null">type =
#{type},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyPrintTemplateModuleById" parameterType="Integer">
delete
from zdy_print_template_module
where id = #{id}
</delete>
<delete id="deleteZdyPrintTemplateModuleByIds" parameterType="String">
delete from zdy_print_template_module where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectZdyPrintTemplateModuleByTempId" parameterType="Integer"
resultMap="ZdyPrintTemplateModuleResult">
<include refid="selectZdyPrintTemplateModuleVo"/>
where template_id = #{template_id}
</select>
<delete id="deleteZdyPrintTemplateModuleByTempId" parameterType="Integer">
delete
from zdy_print_template_module
where template_id = #{template_id}
</delete>
</mapper>