zhousq
3 months ago
23 changed files with 1497 additions and 65 deletions
Binary file not shown.
@ -0,0 +1,127 @@ |
|||||
|
package com.win.print.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.ui.ModelMap; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
import com.win.common.annotation.Log; |
||||
|
import com.win.common.enums.BusinessType; |
||||
|
import com.win.print.domain.WinPrintClientPrinters; |
||||
|
import com.win.print.service.IWinPrintClientPrintersService; |
||||
|
import com.win.common.core.controller.BaseController; |
||||
|
import com.win.common.core.domain.AjaxResult; |
||||
|
import com.win.common.utils.poi.ExcelUtil; |
||||
|
import com.win.common.core.page.TableDataInfo; |
||||
|
|
||||
|
/** |
||||
|
* 客户端打印机对照Controller |
||||
|
* |
||||
|
* @author zhousq |
||||
|
* @date 2024-07-29 |
||||
|
*/ |
||||
|
@Controller |
||||
|
@RequestMapping("/print/clientPrinters") |
||||
|
public class WinPrintClientPrintersController extends BaseController |
||||
|
{ |
||||
|
private String prefix = "print/clientPrinters"; |
||||
|
|
||||
|
@Autowired |
||||
|
private IWinPrintClientPrintersService winPrintClientPrintersService; |
||||
|
|
||||
|
@RequiresPermissions("print:clientPrinters:view") |
||||
|
@GetMapping() |
||||
|
public String clientPrinters() |
||||
|
{ |
||||
|
return prefix + "/clientPrinters"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询客户端打印机对照列表 |
||||
|
*/ |
||||
|
@RequiresPermissions("print:clientPrinters:list") |
||||
|
@PostMapping("/list") |
||||
|
@ResponseBody |
||||
|
public TableDataInfo list(WinPrintClientPrinters winPrintClientPrinters) |
||||
|
{ |
||||
|
startPage(); |
||||
|
List<WinPrintClientPrinters> list = winPrintClientPrintersService.selectWinPrintClientPrintersList(winPrintClientPrinters); |
||||
|
return getDataTable(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 导出客户端打印机对照列表 |
||||
|
*/ |
||||
|
@RequiresPermissions("print:clientPrinters:export") |
||||
|
@Log(title = "客户端打印机对照", businessType = BusinessType.EXPORT) |
||||
|
@PostMapping("/export") |
||||
|
@ResponseBody |
||||
|
public AjaxResult export(WinPrintClientPrinters winPrintClientPrinters) |
||||
|
{ |
||||
|
List<WinPrintClientPrinters> list = winPrintClientPrintersService.selectWinPrintClientPrintersList(winPrintClientPrinters); |
||||
|
ExcelUtil<WinPrintClientPrinters> util = new ExcelUtil<WinPrintClientPrinters>(WinPrintClientPrinters.class); |
||||
|
return util.exportExcel(list, "客户端打印机对照数据"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增客户端打印机对照 |
||||
|
*/ |
||||
|
@GetMapping("/add") |
||||
|
public String add() |
||||
|
{ |
||||
|
return prefix + "/add"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增保存客户端打印机对照 |
||||
|
*/ |
||||
|
@RequiresPermissions("print:clientPrinters:add") |
||||
|
@Log(title = "客户端打印机对照", businessType = BusinessType.INSERT) |
||||
|
@PostMapping("/add") |
||||
|
@ResponseBody |
||||
|
public AjaxResult addSave(WinPrintClientPrinters winPrintClientPrinters) |
||||
|
{ |
||||
|
return toAjax(winPrintClientPrintersService.insertWinPrintClientPrinters(winPrintClientPrinters)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改客户端打印机对照 |
||||
|
*/ |
||||
|
@RequiresPermissions("print:clientPrinters:edit") |
||||
|
@GetMapping("/edit/{id}") |
||||
|
public String edit(@PathVariable("id") Long id , ModelMap mmap) |
||||
|
{ |
||||
|
WinPrintClientPrinters winPrintClientPrinters = winPrintClientPrintersService.selectWinPrintClientPrintersById(id); |
||||
|
mmap.put("winPrintClientPrinters", winPrintClientPrinters); |
||||
|
return prefix + "/edit"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改保存客户端打印机对照 |
||||
|
*/ |
||||
|
@RequiresPermissions("print:clientPrinters:edit") |
||||
|
@Log(title = "客户端打印机对照", businessType = BusinessType.UPDATE) |
||||
|
@PostMapping("/edit") |
||||
|
@ResponseBody |
||||
|
public AjaxResult editSave(WinPrintClientPrinters winPrintClientPrinters) |
||||
|
{ |
||||
|
return toAjax(winPrintClientPrintersService.updateWinPrintClientPrinters(winPrintClientPrinters)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除客户端打印机对照 |
||||
|
*/ |
||||
|
@RequiresPermissions("print:clientPrinters:remove") |
||||
|
@Log(title = "客户端打印机对照", businessType = BusinessType.DELETE) |
||||
|
@PostMapping( "/remove") |
||||
|
@ResponseBody |
||||
|
public AjaxResult remove(String ids) |
||||
|
{ |
||||
|
return toAjax(winPrintClientPrintersService.deleteWinPrintClientPrintersByIds(ids)); |
||||
|
} |
||||
|
} |
@ -0,0 +1,71 @@ |
|||||
|
package com.win.print.domain; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.win.common.annotation.Excel; |
||||
|
import com.win.common.core.domain.BaseEntity; |
||||
|
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
|
import org.apache.commons.lang3.builder.ToStringStyle; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 客户端打印机对照对象 win_print_client_printers |
||||
|
* |
||||
|
* @author zhousq |
||||
|
* @date 2024-07-29 |
||||
|
*/ |
||||
|
public class WinPrintClientPrinterSimple extends BaseEntity |
||||
|
{ |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** 客户端编码 */ |
||||
|
@Excel(name = "客户端编码") |
||||
|
private String clientCode; |
||||
|
|
||||
|
/** 打印机名称 */ |
||||
|
@Excel(name = "打印机名称") |
||||
|
private String printerName; |
||||
|
@Excel(name = "打印机编码") |
||||
|
private String printerUuid ; |
||||
|
/** 打印机业务名称 */ |
||||
|
@Excel(name = "打印机业务名称") |
||||
|
private String printerNameBusy ; |
||||
|
|
||||
|
public void setClientCode(String clientCode) |
||||
|
{ |
||||
|
this.clientCode = clientCode; |
||||
|
} |
||||
|
|
||||
|
public String getClientCode() |
||||
|
{ |
||||
|
return clientCode; |
||||
|
} |
||||
|
|
||||
|
public void setPrinterName(String printerName) |
||||
|
{ |
||||
|
this.printerName = printerName; |
||||
|
} |
||||
|
|
||||
|
public String getPrinterName() |
||||
|
{ |
||||
|
return printerName; |
||||
|
} |
||||
|
|
||||
|
public String getPrinterUuid() { |
||||
|
return printerUuid; |
||||
|
} |
||||
|
|
||||
|
public void setPrinterUuid(String printerUuid) { |
||||
|
this.printerUuid = printerUuid; |
||||
|
} |
||||
|
|
||||
|
public String getPrinterNameBusy() { |
||||
|
return printerNameBusy; |
||||
|
} |
||||
|
|
||||
|
public void setPrinterNameBusy(String printerNameBusy) { |
||||
|
this.printerNameBusy = printerNameBusy; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,182 @@ |
|||||
|
package com.win.print.domain; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
|
import org.apache.commons.lang3.builder.ToStringStyle; |
||||
|
import com.win.common.annotation.Excel; |
||||
|
import com.win.common.core.domain.BaseEntity; |
||||
|
|
||||
|
/** |
||||
|
* 客户端打印机对照对象 win_print_client_printers |
||||
|
* |
||||
|
* @author zhousq |
||||
|
* @date 2024-07-29 |
||||
|
*/ |
||||
|
public class WinPrintClientPrinters extends BaseEntity |
||||
|
{ |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** 租户号 */ |
||||
|
private String tenantId; |
||||
|
|
||||
|
/** 乐观锁 */ |
||||
|
private Long revision; |
||||
|
|
||||
|
/** 创建人 */ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** 创建时间 */ |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd") |
||||
|
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** 更新人 */ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** 更新时间 */ |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd") |
||||
|
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
/** 客户端编码 */ |
||||
|
@Excel(name = "客户端编码") |
||||
|
private String clientCode; |
||||
|
|
||||
|
/** 打印机名称 */ |
||||
|
@Excel(name = "打印机名称") |
||||
|
private String printerName; |
||||
|
@Excel(name = "打印机编码") |
||||
|
private String printerUuid ; |
||||
|
/** 打印机业务名称 */ |
||||
|
@Excel(name = "打印机业务名称") |
||||
|
private String printerNameBusy ; |
||||
|
private Long id; |
||||
|
private String status; |
||||
|
|
||||
|
public Long getId() { |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
public void setId(Long id) { |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public String getStatus() { |
||||
|
return status; |
||||
|
} |
||||
|
|
||||
|
public void setStatus(String status) { |
||||
|
this.status = status; |
||||
|
} |
||||
|
|
||||
|
public void setTenantId(String tenantId) |
||||
|
{ |
||||
|
this.tenantId = tenantId; |
||||
|
} |
||||
|
|
||||
|
public String getTenantId() |
||||
|
{ |
||||
|
return tenantId; |
||||
|
} |
||||
|
|
||||
|
public void setRevision(Long revision) |
||||
|
{ |
||||
|
this.revision = revision; |
||||
|
} |
||||
|
|
||||
|
public Long getRevision() |
||||
|
{ |
||||
|
return revision; |
||||
|
} |
||||
|
|
||||
|
public void setCreatedBy(String createdBy) |
||||
|
{ |
||||
|
this.createdBy = createdBy; |
||||
|
} |
||||
|
|
||||
|
public String getCreatedBy() |
||||
|
{ |
||||
|
return createdBy; |
||||
|
} |
||||
|
|
||||
|
public void setCreatedTime(Date createdTime) |
||||
|
{ |
||||
|
this.createdTime = createdTime; |
||||
|
} |
||||
|
|
||||
|
public Date getCreatedTime() |
||||
|
{ |
||||
|
return createdTime; |
||||
|
} |
||||
|
|
||||
|
public void setUpdatedBy(String updatedBy) |
||||
|
{ |
||||
|
this.updatedBy = updatedBy; |
||||
|
} |
||||
|
|
||||
|
public String getUpdatedBy() |
||||
|
{ |
||||
|
return updatedBy; |
||||
|
} |
||||
|
|
||||
|
public void setUpdatedTime(Date updatedTime) |
||||
|
{ |
||||
|
this.updatedTime = updatedTime; |
||||
|
} |
||||
|
|
||||
|
public Date getUpdatedTime() |
||||
|
{ |
||||
|
return updatedTime; |
||||
|
} |
||||
|
|
||||
|
public void setClientCode(String clientCode) |
||||
|
{ |
||||
|
this.clientCode = clientCode; |
||||
|
} |
||||
|
|
||||
|
public String getClientCode() |
||||
|
{ |
||||
|
return clientCode; |
||||
|
} |
||||
|
|
||||
|
public void setPrinterName(String printerName) |
||||
|
{ |
||||
|
this.printerName = printerName; |
||||
|
} |
||||
|
|
||||
|
public String getPrinterName() |
||||
|
{ |
||||
|
return printerName; |
||||
|
} |
||||
|
|
||||
|
public String getPrinterUuid() { |
||||
|
return printerUuid; |
||||
|
} |
||||
|
|
||||
|
public void setPrinterUuid(String printerUuid) { |
||||
|
this.printerUuid = printerUuid; |
||||
|
} |
||||
|
|
||||
|
public String getPrinterNameBusy() { |
||||
|
return printerNameBusy; |
||||
|
} |
||||
|
|
||||
|
public void setPrinterNameBusy(String printerNameBusy) { |
||||
|
this.printerNameBusy = printerNameBusy; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String toString() { |
||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
||||
|
.append("tenantId", getTenantId()) |
||||
|
.append("revision", getRevision()) |
||||
|
.append("createdBy", getCreatedBy()) |
||||
|
.append("createdTime", getCreatedTime()) |
||||
|
.append("updatedBy", getUpdatedBy()) |
||||
|
.append("updatedTime", getUpdatedTime()) |
||||
|
.append("clientCode", getClientCode()) |
||||
|
.append("printerName", getPrinterName()) |
||||
|
.toString(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,56 @@ |
|||||
|
package com.win.print.domain; |
||||
|
|
||||
|
import com.win.common.annotation.Excel; |
||||
|
import com.win.common.core.domain.BaseEntity; |
||||
|
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
|
import org.apache.commons.lang3.builder.ToStringStyle; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 打印模版设置对象 win_print_model |
||||
|
* |
||||
|
* @author zhousq |
||||
|
* @date 2024-07-22 |
||||
|
*/ |
||||
|
|
||||
|
public class WinPrintModelSimple extends BaseEntity |
||||
|
{ |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** 模版名称 */ |
||||
|
//"模版名称")
|
||||
|
private String mName; |
||||
|
|
||||
|
/** 模版编号 */ |
||||
|
//模版编号"
|
||||
|
private String mCode; |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
public void setmName(String mName) |
||||
|
{ |
||||
|
this.mName = mName; |
||||
|
} |
||||
|
|
||||
|
public String getmName() |
||||
|
{ |
||||
|
return mName; |
||||
|
} |
||||
|
|
||||
|
public void setmCode(String mCode) |
||||
|
{ |
||||
|
this.mCode = mCode; |
||||
|
} |
||||
|
|
||||
|
public String getmCode() |
||||
|
{ |
||||
|
return mCode; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,65 @@ |
|||||
|
package com.win.print.mapper; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import com.win.print.domain.WinPrintClientPrinterSimple; |
||||
|
import com.win.print.domain.WinPrintClientPrinters; |
||||
|
|
||||
|
/** |
||||
|
* 客户端打印机对照Mapper接口 |
||||
|
* |
||||
|
* @author zhousq |
||||
|
* @date 2024-07-29 |
||||
|
*/ |
||||
|
public interface WinPrintClientPrintersMapper |
||||
|
{ |
||||
|
/** |
||||
|
* 查询客户端打印机对照 |
||||
|
* |
||||
|
* @param id 客户端打印机对照主键 |
||||
|
* @return 客户端打印机对照 |
||||
|
*/ |
||||
|
public WinPrintClientPrinters selectWinPrintClientPrintersById(Long id); |
||||
|
public WinPrintClientPrinterSimple selectClientPrinteByUuid(String uuid); |
||||
|
|
||||
|
/** |
||||
|
* 查询客户端打印机对照列表 |
||||
|
* |
||||
|
* @param winPrintClientPrinters 客户端打印机对照 |
||||
|
* @return 客户端打印机对照集合 |
||||
|
*/ |
||||
|
public List<WinPrintClientPrinters> selectWinPrintClientPrintersList(WinPrintClientPrinters winPrintClientPrinters); |
||||
|
public List<WinPrintClientPrinters> selectClientPrintersList(); |
||||
|
/** |
||||
|
* 新增客户端打印机对照 |
||||
|
* |
||||
|
* @param winPrintClientPrinters 客户端打印机对照 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int insertWinPrintClientPrinters(WinPrintClientPrinters winPrintClientPrinters); |
||||
|
|
||||
|
/** |
||||
|
* 修改客户端打印机对照 |
||||
|
* |
||||
|
* @param winPrintClientPrinters 客户端打印机对照 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int updateWinPrintClientPrinters(WinPrintClientPrinters winPrintClientPrinters); |
||||
|
|
||||
|
/** |
||||
|
* 删除客户端打印机对照 |
||||
|
* |
||||
|
* @param id 客户端打印机对照主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteWinPrintClientPrintersById(Long id); |
||||
|
public int deleteWinPrintClientPrintersByCode(String code); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除客户端打印机对照 |
||||
|
* |
||||
|
* @param ids 需要删除的数据主键集合 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteWinPrintClientPrintersByIds(String[] ids); |
||||
|
} |
@ -0,0 +1,65 @@ |
|||||
|
package com.win.print.service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import com.win.print.domain.WinPrintClientPrinterSimple; |
||||
|
import com.win.print.domain.WinPrintClientPrinters; |
||||
|
|
||||
|
/** |
||||
|
* 客户端打印机对照Service接口 |
||||
|
* |
||||
|
* @author zhousq |
||||
|
* @date 2024-07-29 |
||||
|
*/ |
||||
|
public interface IWinPrintClientPrintersService |
||||
|
{ |
||||
|
/** |
||||
|
* 查询客户端打印机对照 |
||||
|
* |
||||
|
* @param id 客户端打印机对照主键 |
||||
|
* @return 客户端打印机对照 |
||||
|
*/ |
||||
|
public WinPrintClientPrinters selectWinPrintClientPrintersById(Long id); |
||||
|
public WinPrintClientPrinterSimple selectWinPrintClientPrintersByUuid(String uuid); |
||||
|
/** |
||||
|
* 查询客户端打印机对照列表 |
||||
|
* |
||||
|
* @param winPrintClientPrinters 客户端打印机对照 |
||||
|
* @return 客户端打印机对照集合 |
||||
|
*/ |
||||
|
public List<WinPrintClientPrinters> selectWinPrintClientPrintersList(WinPrintClientPrinters winPrintClientPrinters); |
||||
|
public List<WinPrintClientPrinters> selectClientPrintersList(); |
||||
|
/** |
||||
|
* 新增客户端打印机对照 |
||||
|
* |
||||
|
* @param winPrintClientPrinters 客户端打印机对照 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int insertWinPrintClientPrinters(WinPrintClientPrinters winPrintClientPrinters); |
||||
|
|
||||
|
/** |
||||
|
* 修改客户端打印机对照 |
||||
|
* |
||||
|
* @param winPrintClientPrinters 客户端打印机对照 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int updateWinPrintClientPrinters(WinPrintClientPrinters winPrintClientPrinters); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除客户端打印机对照 |
||||
|
* |
||||
|
* @param ids 需要删除的客户端打印机对照主键集合 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteWinPrintClientPrintersByIds(String ids); |
||||
|
|
||||
|
/** |
||||
|
* 删除客户端打印机对照信息 |
||||
|
* |
||||
|
* @param id 客户端打印机对照主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteWinPrintClientPrintersById(Long id); |
||||
|
public int deleteWinPrintClientPrintersByCode(String code); |
||||
|
|
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
package com.win.print.service; |
||||
|
|
||||
|
import cn.hutool.core.collection.CollUtil; |
||||
|
import cn.hutool.core.date.DateUtil; |
||||
|
import com.win.common.config.WinConfig; |
||||
|
import com.win.print.domain.WinPrintClientPrinters; |
||||
|
import jakarta.annotation.Resource; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 手动任务可以下发通知,接收到打印数据更新 |
||||
|
* |
||||
|
* */ |
||||
|
@Service |
||||
|
public class LocalPrinterDataUpdateTask { |
||||
|
@Resource |
||||
|
IWinPrintClientPrintersService iWinPrintClientPrintersService; |
||||
|
@Resource |
||||
|
DictPrinterListService dictPrinterListService; |
||||
|
@Transactional() |
||||
|
public void updatePrinterToDb(){ |
||||
|
iWinPrintClientPrintersService.deleteWinPrintClientPrintersByCode(WinConfig.getClientCode()); |
||||
|
List<String> printersNameList = dictPrinterListService.getPrintersNameList(); |
||||
|
if(CollUtil.isNotEmpty(printersNameList)){ |
||||
|
printersNameList.forEach(item->{ |
||||
|
WinPrintClientPrinters wp=new WinPrintClientPrinters(); |
||||
|
wp.setUpdatedBy("auto"); |
||||
|
wp.setCreatedBy("auto"); |
||||
|
wp.setPrinterName(item); |
||||
|
wp.setUpdatedTime(DateUtil.date()); |
||||
|
wp.setCreatedTime(DateUtil.date()); |
||||
|
wp.setClientCode(WinConfig.getClientCode()); |
||||
|
iWinPrintClientPrintersService.insertWinPrintClientPrinters(wp); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,109 @@ |
|||||
|
package com.win.print.service.impl; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import com.win.print.domain.WinPrintClientPrinterSimple; |
||||
|
import jakarta.annotation.Resource; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import com.win.print.mapper.WinPrintClientPrintersMapper; |
||||
|
import com.win.print.domain.WinPrintClientPrinters; |
||||
|
import com.win.print.service.IWinPrintClientPrintersService; |
||||
|
import com.win.common.core.text.Convert; |
||||
|
|
||||
|
/** |
||||
|
* 客户端打印机对照Service业务层处理 |
||||
|
* |
||||
|
* @author zhousq |
||||
|
* @date 2024-07-29 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class WinPrintClientPrintersServiceImpl implements IWinPrintClientPrintersService |
||||
|
{ |
||||
|
@Resource |
||||
|
private WinPrintClientPrintersMapper winPrintClientPrintersMapper; |
||||
|
|
||||
|
/** |
||||
|
* 查询客户端打印机对照 |
||||
|
* |
||||
|
* @param id 客户端打印机对照主键 |
||||
|
* @return 客户端打印机对照 |
||||
|
*/ |
||||
|
@Override |
||||
|
public WinPrintClientPrinters selectWinPrintClientPrintersById(Long id) |
||||
|
{ |
||||
|
return winPrintClientPrintersMapper.selectWinPrintClientPrintersById(id); |
||||
|
} |
||||
|
@Override |
||||
|
public WinPrintClientPrinterSimple selectWinPrintClientPrintersByUuid(String uuid) |
||||
|
{ |
||||
|
return winPrintClientPrintersMapper.selectClientPrinteByUuid(uuid); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询客户端打印机对照列表 |
||||
|
* |
||||
|
* @param winPrintClientPrinters 客户端打印机对照 |
||||
|
* @return 客户端打印机对照 |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<WinPrintClientPrinters> selectWinPrintClientPrintersList(WinPrintClientPrinters winPrintClientPrinters) |
||||
|
{ |
||||
|
return winPrintClientPrintersMapper.selectWinPrintClientPrintersList(winPrintClientPrinters); |
||||
|
} |
||||
|
@Override |
||||
|
public List<WinPrintClientPrinters> selectClientPrintersList(){ |
||||
|
return winPrintClientPrintersMapper.selectClientPrintersList(); |
||||
|
} |
||||
|
/** |
||||
|
* 新增客户端打印机对照 |
||||
|
* |
||||
|
* @param winPrintClientPrinters 客户端打印机对照 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int insertWinPrintClientPrinters(WinPrintClientPrinters winPrintClientPrinters) |
||||
|
{ |
||||
|
return winPrintClientPrintersMapper.insertWinPrintClientPrinters(winPrintClientPrinters); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改客户端打印机对照 |
||||
|
* |
||||
|
* @param winPrintClientPrinters 客户端打印机对照 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int updateWinPrintClientPrinters(WinPrintClientPrinters winPrintClientPrinters) |
||||
|
{ |
||||
|
return winPrintClientPrintersMapper.updateWinPrintClientPrinters(winPrintClientPrinters); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 批量删除客户端打印机对照 |
||||
|
* |
||||
|
* @param ids 需要删除的客户端打印机对照主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int deleteWinPrintClientPrintersByIds(String ids) |
||||
|
{ |
||||
|
return winPrintClientPrintersMapper.deleteWinPrintClientPrintersByIds(Convert.toStrArray(ids)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除客户端打印机对照信息 |
||||
|
* |
||||
|
* @param id 客户端打印机对照主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int deleteWinPrintClientPrintersById(Long id) |
||||
|
{ |
||||
|
return winPrintClientPrintersMapper.deleteWinPrintClientPrintersById(id); |
||||
|
} |
||||
|
@Override |
||||
|
public int deleteWinPrintClientPrintersByCode(String code){ |
||||
|
return winPrintClientPrintersMapper.deleteWinPrintClientPrintersByCode(code); |
||||
|
} |
||||
|
} |
@ -0,0 +1,290 @@ |
|||||
|
package com.win.print.util; |
||||
|
|
||||
|
import cn.hutool.core.collection.CollUtil; |
||||
|
import cn.hutool.core.img.ImgUtil; |
||||
|
import cn.hutool.core.util.ObjectUtil; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.itextpdf.forms.PdfAcroForm; |
||||
|
import com.itextpdf.forms.fields.PdfFormField; |
||||
|
import com.itextpdf.io.font.PdfEncodings; |
||||
|
import com.itextpdf.io.image.ImageData; |
||||
|
import com.itextpdf.io.image.ImageDataFactory; |
||||
|
import com.itextpdf.io.image.ImageType; |
||||
|
import com.itextpdf.kernel.font.PdfFont; |
||||
|
import com.itextpdf.kernel.font.PdfFontFactory; |
||||
|
import com.itextpdf.kernel.geom.Rectangle; |
||||
|
import com.itextpdf.kernel.pdf.*; |
||||
|
import com.itextpdf.kernel.pdf.annot.PdfAnnotation; |
||||
|
import com.itextpdf.kernel.pdf.annot.PdfWidgetAnnotation; |
||||
|
import com.itextpdf.kernel.pdf.canvas.PdfCanvas; |
||||
|
import com.win.common.utils.file.ImageUtils; |
||||
|
import com.win.print.domain.WinPrintModel; |
||||
|
import com.win.print.domain.WinPrintModelParams; |
||||
|
import com.win.print.service.IWinPrintModelParamsService; |
||||
|
import com.win.print.service.IWinPrintModelService; |
||||
|
import com.win.print.service.IWinPrintTasksLogsService; |
||||
|
import com.win.print.service.QRCodeService; |
||||
|
import jakarta.annotation.Resource; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import org.springframework.beans.factory.annotation.Value; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.awt.*; |
||||
|
|
||||
|
import java.io.File; |
||||
|
import java.io.IOException; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.Optional; |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* pdf 模版处理工具类 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class PdfModelUitl { |
||||
|
private static final Logger log = LoggerFactory.getLogger(PdfModelUitl.class); |
||||
|
//通过pdfform方式进行模版渲染后生成新的文档
|
||||
|
|
||||
|
@Resource |
||||
|
QRCodeService qrCodeService; |
||||
|
@Value("${win.path.template}") |
||||
|
private String templatePathDefault; //打印模版的存储路径
|
||||
|
@Value("${win.path.print}") |
||||
|
private String printFilepath; //生成的打印文件存储路径
|
||||
|
/** |
||||
|
* 待填充的PDF模板文档 |
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
public void pdfMdelFromRender(List<WinPrintModelParams> paramsList,File tempFile, JSONObject data, String modelName, String templatePath) throws IOException, NoSuchFieldException { |
||||
|
PdfReader reader = new PdfReader(templatePath+"/"+modelName); |
||||
|
PdfWriter writer = new PdfWriter(tempFile); |
||||
|
PdfDocument pdf = new PdfDocument(reader, writer); |
||||
|
PdfAcroForm form = PdfAcroForm.getAcroForm(pdf, true); |
||||
|
if (CollUtil.isNotEmpty(paramsList)) { |
||||
|
if (ObjectUtil.isNotEmpty(data)) { |
||||
|
paramsList.forEach(item -> { |
||||
|
if ("QRIMG".equals(item.getParamType())) { |
||||
|
//渲染Qr图片
|
||||
|
qrCodeService.generateQRCode(Optional.ofNullable(data.getString(item.getParamCode())).orElse(""),172,172); |
||||
|
|
||||
|
} else if ("IMG".equals(item.getParamType())) { |
||||
|
//渲染普通图片
|
||||
|
} else { |
||||
|
Optional.ofNullable( form.getField(item.getParamCode())).ifPresent(act->{act.setValue(Optional.ofNullable(data.getString(item.getParamCode())).orElse(""));}); |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
} else { |
||||
|
throw new NoSuchFieldException("没有任何可渲染的数据内容!"); |
||||
|
} |
||||
|
} else { //如果没有配置任何模版参数抛出异常
|
||||
|
throw new NoSuchFieldException("没找到模版的参数配置信息!"); |
||||
|
} |
||||
|
|
||||
|
// 重复以上步骤,根据需要填充所有字段
|
||||
|
// 设置表单为只读(可选)
|
||||
|
form.flattenFields(); |
||||
|
pdf.close(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 填充及返回填充后的数据 |
||||
|
* |
||||
|
* @param fillData - 待填充数据 |
||||
|
* @return - 填充后bytes数据 |
||||
|
*/ |
||||
|
public void fill(Map<String, Object> fillData,PdfDocument templateDocument) { |
||||
|
try { |
||||
|
PdfAcroForm form = PdfAcroForm.getAcroForm(templateDocument, true); |
||||
|
fillData.forEach((keyword, value) -> { |
||||
|
Optional.ofNullable(form.getField(keyword)).ifPresent(templateFormField -> { |
||||
|
if (value instanceof byte[]) { |
||||
|
PdfArray pos = templateFormField.getWidgets().get(0).getRectangle(); |
||||
|
float x = pos.getAsNumber(0).floatValue(); |
||||
|
float y = pos.getAsNumber(1).floatValue(); |
||||
|
float width = pos.getAsNumber(2).floatValue() - x; |
||||
|
float height = pos.getAsNumber(3).floatValue() - y; |
||||
|
Rectangle rectangle = new Rectangle(x, y, width, height); |
||||
|
PdfWidgetAnnotation widget = new PdfWidgetAnnotation(rectangle); |
||||
|
PdfFormField formField = PdfFormField.createEmptyField(templateDocument); |
||||
|
PdfPage annotationPage = findAnnotationPage(keyword,templateDocument); |
||||
|
if (annotationPage != null) { |
||||
|
doFillFieldImage(annotationPage, formField, (byte[]) value); |
||||
|
} |
||||
|
} else { |
||||
|
templateFormField.setValue(String.valueOf(value)); |
||||
|
if (defaultFont() != null) { |
||||
|
templateFormField.setFont(templateFormField.getFont()); |
||||
|
} |
||||
|
} |
||||
|
form.partialFormFlattening(keyword); |
||||
|
}); |
||||
|
}); |
||||
|
form.flattenFields(); |
||||
|
} finally { |
||||
|
if (templateDocument != null) { |
||||
|
templateDocument.close(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
/** |
||||
|
* 图片填充 |
||||
|
* |
||||
|
* @param newPage - 当前页 |
||||
|
* @param formField - 表单文本域 |
||||
|
* @param imgBytes - 图片文件字节数组 |
||||
|
*/ |
||||
|
private void doFillFieldImage(PdfPage newPage, PdfFormField formField, byte[] imgBytes) { |
||||
|
Rectangle rtl = formField.getWidgets().get(0).getRectangle().toRectangle(); // 获取表单域的xy坐标
|
||||
|
PdfCanvas canvas = new PdfCanvas(newPage); |
||||
|
ImageData img = ImageDataFactory.create(imgBytes); |
||||
|
if (Float.compare(img.getWidth(), rtl.getWidth()) <= 0 && Float.compare(img.getHeight(), rtl.getHeight()) <= 0) {// 不处理
|
||||
|
canvas.addImage(img, rtl.getX(), rtl.getY(), true); |
||||
|
} else { |
||||
|
// 压缩图片。计算得到图片放缩的最大比例
|
||||
|
float scale = Math.max(img.getWidth() / rtl.getWidth(), img.getHeight() / rtl.getHeight()); |
||||
|
int imgWidth = Math.round(img.getWidth() / scale); |
||||
|
int imgHeight = Math.round(img.getHeight() / scale); |
||||
|
// 压缩图片
|
||||
|
byte[] compressImgBytes; |
||||
|
Image scale1 = ImgUtil.scale(ImgUtil.toImage(imgBytes), scale); |
||||
|
compressImgBytes = ImgUtil.toBytes(scale1, ImgUtil.IMAGE_TYPE_PNG); |
||||
|
img = ImageDataFactory.create(compressImgBytes); |
||||
|
canvas.addImage(img, rtl.getX(), rtl.getY(), true); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据表单域关键字查找当前关键字所在页对象(PdfPage) |
||||
|
* |
||||
|
* @param keyword - 关键字 |
||||
|
* @return - page object |
||||
|
*/ |
||||
|
private PdfPage findAnnotationPage(String keyword,PdfDocument templateDocument) { |
||||
|
int pages = templateDocument.getNumberOfPages(); |
||||
|
for (int index = 1; index <= pages; index++) { |
||||
|
PdfPage page = templateDocument.getPage(index); |
||||
|
for (PdfAnnotation annotation : page.getAnnotations()) { |
||||
|
PdfString title = annotation.getPdfObject().getAsString(PdfName.T); |
||||
|
if (title != null && keyword.equals(String.valueOf(title))) { |
||||
|
return page; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取模板文件表单域关键字位置信息 |
||||
|
*/ |
||||
|
private Map<Integer, Map<String, float[]>> getFormKeywordsPos(PdfDocument templateDocument) { |
||||
|
int pages = templateDocument.getNumberOfPages(); |
||||
|
Map<Integer, Map<String, float[]>> maps = new HashMap<>(pages); |
||||
|
for (int index = 1; index <= pages; index++) { |
||||
|
maps.putIfAbsent(index, new HashMap<>()); |
||||
|
PdfPage page = templateDocument.getPage(index); |
||||
|
// 获取当前页的表单域
|
||||
|
int finalIndex = index; |
||||
|
page.getAnnotations().forEach(anno -> { |
||||
|
PdfString title = anno.getTitle(); |
||||
|
PdfArray rectangle = anno.getRectangle(); |
||||
|
float x = rectangle.getAsNumber(0).floatValue(); |
||||
|
float y = rectangle.getAsNumber(1).floatValue(); |
||||
|
float width = rectangle.getAsNumber(2).floatValue() - x; |
||||
|
float height = rectangle.getAsNumber(3).floatValue() - y; |
||||
|
maps.get(finalIndex).put(title.getValue(), new float[]{x, y, width, height}); |
||||
|
}); |
||||
|
} |
||||
|
return maps; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 加载字体 |
||||
|
*/ |
||||
|
private static final String ILLEGAL_CHARACTERS_REGEX = "[\\\\/:*?\"<>|]"; |
||||
|
private static final String DEFAULT_FONT_PATH = "/fonts/STKAITI.TTF"; |
||||
|
private static final String DEFAULT_EXTEND_PATH = "/fonts/extend/"; |
||||
|
private static final Map<String, String> FONTS_MAP = fontsMap(); |
||||
|
/** |
||||
|
* 默认字体 |
||||
|
* @return PdfFont |
||||
|
* @throws IOException |
||||
|
*/ |
||||
|
private PdfFont defaultFont() { |
||||
|
// 默认华文楷体
|
||||
|
PdfFont baseFont; |
||||
|
try { |
||||
|
baseFont = PdfFontFactory.createFont(DEFAULT_FONT_PATH, PdfEncodings.IDENTITY_H); |
||||
|
} catch (Exception e) { |
||||
|
throw new RuntimeException("无法获取默认字体:" + e.getMessage(),e); |
||||
|
} |
||||
|
return baseFont; |
||||
|
} |
||||
|
/** |
||||
|
* 获取字体 |
||||
|
* @param font 字体信息 |
||||
|
* @return PdfFont |
||||
|
*/ |
||||
|
String extendPath = "D:\\fonts\\"; |
||||
|
private PdfFont getFont(PdfFont font) { |
||||
|
String fontName = font.getFontProgram().getFontNames().getFontName(); |
||||
|
String fontKey = FONTS_MAP.get(fontName); |
||||
|
if(fontKey==null){ |
||||
|
font = defaultFont(); |
||||
|
}else { |
||||
|
try { |
||||
|
if(fontKey.toLowerCase().endsWith("ttc")){ |
||||
|
font = PdfFontFactory.createFont(this.extendPath + fontKey + ",0", PdfEncodings.IDENTITY_H); |
||||
|
}else { |
||||
|
font = PdfFontFactory.createFont(this.extendPath + fontKey, PdfEncodings.IDENTITY_H); |
||||
|
} |
||||
|
} catch (IOException e) { |
||||
|
font = defaultFont(); |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
} |
||||
|
return font; |
||||
|
} |
||||
|
/** |
||||
|
* 字体映射关系 |
||||
|
* @return |
||||
|
*/ |
||||
|
private static Map<String, String> fontsMap(){ |
||||
|
Map<String, String> map = new HashMap<>(); |
||||
|
// 字体映射关系,可扩展
|
||||
|
// itext字体标注/字体文件名
|
||||
|
map.put("DengXian", "Deng.ttf");//等线
|
||||
|
map.put("DengXian-Light", "Dengl.ttf");//等线Light
|
||||
|
map.put("DengXian,Bold", "Dengb.ttf");//等线粗体
|
||||
|
map.put("FZShuTi", "FZSTK.TTF");//方正舒体
|
||||
|
map.put("FZYaoTi", "FZYTK.TTF");//方正姚体
|
||||
|
map.put("FangSong", "simfang.ttf");//仿宋
|
||||
|
map.put("SimHei", "simhei.ttf");//黑体
|
||||
|
map.put("STCaiyun", "STCAIYUN.TTF");//华文彩云
|
||||
|
map.put("STFangsong", "STFANGSO.TTF");//华文仿宋
|
||||
|
map.put("STHupo", "STHUPO.TTF");//华文琥珀
|
||||
|
map.put("STKaiti", "STKAITI.TTF");//华文楷体
|
||||
|
map.put("STLiti", "STLITI.TTF");//华文隶书
|
||||
|
map.put("STSong", "STSONG.TTF");//华文宋体
|
||||
|
map.put("STXihei", "STXIHEI.TTF");//华文细黑
|
||||
|
map.put("STXinwei", "STXINWEI.TTF");//华文新魏
|
||||
|
map.put("STXingkai", "STXINGKA.TTF");//华文行楷
|
||||
|
map.put("STZhongsong", "STZHONGS.TTF");//华文中宋
|
||||
|
map.put("KaiTi", "simkai.ttf");//楷体
|
||||
|
map.put("LiSu", "SIMLI.TTF");//隶书
|
||||
|
map.put("SimSun", "simsun.ttc");//宋体
|
||||
|
map.put("MicrosoftYaHei", "msyh.ttc");//微软雅黑
|
||||
|
map.put("MicrosoftYaHeiLight", "msyhl.ttc");//微软雅黑Light
|
||||
|
map.put("MicrosoftYaHei,Bold", "msyhbd.ttc");//微软雅黑粗体
|
||||
|
map.put("NSimSun", "simsun.ttc");//新宋体
|
||||
|
map.put("YouYuan", "SIMYOU.TTF");//幼圆
|
||||
|
return map; |
||||
|
} |
||||
|
} |
@ -0,0 +1,117 @@ |
|||||
|
<?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.win.print.mapper.WinPrintClientPrintersMapper"> |
||||
|
|
||||
|
<resultMap type="WinPrintClientPrinters" id="WinPrintClientPrintersResult"> |
||||
|
<result property="tenantId" column="tenant_id" /> |
||||
|
<result property="revision" column="revision" /> |
||||
|
<result property="createdBy" column="created_by" /> |
||||
|
<result property="createdTime" column="created_time" /> |
||||
|
<result property="updatedBy" column="updated_by" /> |
||||
|
<result property="updatedTime" column="updated_time" /> |
||||
|
<result property="clientCode" column="client_code" /> |
||||
|
<result property="printerName" column="printer_name" /> |
||||
|
<result property="printerUuid" column="printer_uuid" /> |
||||
|
<result property="printerNameBusy" column="printer_name_busy" /> |
||||
|
<result property="id" column="id" /> |
||||
|
<result property="status" column="status" /> |
||||
|
</resultMap> |
||||
|
<resultMap type="WinPrintClientPrinterSimple" id="WinPrintClientPrintersResultSimple"> |
||||
|
<result property="clientCode" column="client_code" /> |
||||
|
<result property="printerName" column="printer_name" /> |
||||
|
<result property="printerUuid" column="printer_uuid" /> |
||||
|
<result property="printerNameBusy" column="printer_name_busy" /> |
||||
|
</resultMap> |
||||
|
<sql id="selectWinPrintClientPrintersVo"> |
||||
|
select tenant_id, revision, created_by, created_time, updated_by, updated_time, client_code, printer_name,printer_uuid,printer_name_busy,id,status from win_print_client_printers |
||||
|
</sql> |
||||
|
|
||||
|
<select id="selectWinPrintClientPrintersList" parameterType="WinPrintClientPrinters" resultMap="WinPrintClientPrintersResult"> |
||||
|
<include refid="selectWinPrintClientPrintersVo"/> |
||||
|
<where> |
||||
|
<if test="clientCode != null and clientCode != ''"> and client_code = #{clientCode}</if> |
||||
|
<if test="printerName != null and printerName != ''"> and printer_name like concat('%', #{printerName}, '%')</if> |
||||
|
<if test="printerNameBusy != null and printerNameBusy != ''"> and printer_name_busy like concat('%', #{printerNameBusy}, '%')</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
<select id="selectClientPrintersList" resultMap="WinPrintClientPrintersResultSimple"> |
||||
|
<include refid="selectWinPrintClientPrintersVo"/> |
||||
|
where status='0' |
||||
|
order by printer_uuid desc |
||||
|
</select> |
||||
|
<select id="selectClientPrinteByUuid" parameterType="String" resultMap="WinPrintClientPrintersResultSimple"> |
||||
|
<include refid="selectWinPrintClientPrintersVo"/> |
||||
|
where status='0' and printer_uuid=#{uuid} |
||||
|
</select> |
||||
|
<select id="selectWinPrintClientPrintersById" parameterType="Long" resultMap="WinPrintClientPrintersResult"> |
||||
|
<include refid="selectWinPrintClientPrintersVo"/> |
||||
|
where id = #{id} |
||||
|
</select> |
||||
|
|
||||
|
<insert id="insertWinPrintClientPrinters" parameterType="WinPrintClientPrinters"> |
||||
|
insert into win_print_client_printers |
||||
|
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
|
<if test="tenantId != null">tenant_id,</if> |
||||
|
<if test="revision != null">revision,</if> |
||||
|
<if test="createdBy != null">created_by,</if> |
||||
|
<if test="createdTime != null">created_time,</if> |
||||
|
<if test="updatedBy != null">updated_by,</if> |
||||
|
<if test="updatedTime != null">updated_time,</if> |
||||
|
<if test="clientCode != null">client_code,</if> |
||||
|
<if test="printerName != null">printer_name,</if> |
||||
|
<if test="printerUuid != null">printer_uuid,</if> |
||||
|
<if test="printerNameBusy != null">printer_name_busy,</if> |
||||
|
<if test="status != null">status,</if> |
||||
|
</trim> |
||||
|
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
|
<if test="tenantId != null">#{tenantId},</if> |
||||
|
<if test="revision != null">#{revision},</if> |
||||
|
<if test="createdBy != null">#{createdBy},</if> |
||||
|
<if test="createdTime != null">#{createdTime},</if> |
||||
|
<if test="updatedBy != null">#{updatedBy},</if> |
||||
|
<if test="updatedTime != null">#{updatedTime},</if> |
||||
|
<if test="clientCode != null">#{clientCode},</if> |
||||
|
<if test="printerName != null">#{printerName},</if> |
||||
|
<if test="printerUuid != null">#{printerUuid},</if> |
||||
|
<if test="printerNameBusy != null">#{printerNameBusy},</if> |
||||
|
<if test="status != null">#{status},</if> |
||||
|
</trim> |
||||
|
</insert> |
||||
|
|
||||
|
<update id="updateWinPrintClientPrinters" parameterType="WinPrintClientPrinters"> |
||||
|
update win_print_client_printers |
||||
|
<trim prefix="SET" suffixOverrides=","> |
||||
|
<if test="revision != null">revision = #{revision},</if> |
||||
|
<if test="createdBy != null">created_by = #{createdBy},</if> |
||||
|
<if test="createdTime != null">created_time = #{createdTime},</if> |
||||
|
<if test="updatedBy != null">updated_by = #{updatedBy},</if> |
||||
|
<if test="updatedTime != null">updated_time = #{updatedTime},</if> |
||||
|
<if test="clientCode != null">client_code = #{clientCode},</if> |
||||
|
<if test="printerName != null">printer_name = #{printerName},</if> |
||||
|
<if test="printerUuid != null">printer_uuid=#{printerUuid},</if> |
||||
|
<if test="printerNameBusy != null">printer_name_busy=#{printerNameBusy},</if> |
||||
|
<if test="status != null">status=#{status},</if> |
||||
|
</trim> |
||||
|
where id = #{id} |
||||
|
</update> |
||||
|
|
||||
|
<delete id="deleteWinPrintClientPrintersById" parameterType="Long"> |
||||
|
delete from win_print_client_printers where id = #{id} |
||||
|
</delete> |
||||
|
<delete id="deleteWinPrintClientPrintersByUuid" parameterType="String"> |
||||
|
delete from win_print_client_printers where printer_uuid = #{uuid} |
||||
|
</delete> |
||||
|
<delete id="deleteWinPrintClientPrintersByCode" parameterType="String"> |
||||
|
delete from win_print_client_printers where client_code = #{clientCode} |
||||
|
</delete> |
||||
|
|
||||
|
<delete id="deleteWinPrintClientPrintersByIds" parameterType="String"> |
||||
|
delete from win_print_client_printers where id in |
||||
|
<foreach item="ids" collection="array" open="(" separator="," close=")"> |
||||
|
#{id} |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,57 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
||||
|
<head> |
||||
|
<th:block th:include="include :: header('新增打印机')" /> |
||||
|
</head> |
||||
|
<body class="white-bg"> |
||||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
||||
|
<form class="form-horizontal m" id="form-clientPrinters-add"> |
||||
|
<div class="col-xs-12"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">客户端编码:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="clientCode" class="form-control" type="text" required> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-xs-12"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">打印机实体名:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="printerName" class="form-control" type="text" required> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-xs-12"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">打印机全局码:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="printerUuid" class="form-control" type="text" required> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-xs-12"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">打印机业务名:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="printerNameBusy" class="form-control" type="text" required> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
<th:block th:include="include :: footer" /> |
||||
|
<script th:inline="javascript"> |
||||
|
var prefix = ctx + "print/clientPrinters" |
||||
|
$("#form-clientPrinters-add").validate({ |
||||
|
focusCleanup: true |
||||
|
}); |
||||
|
|
||||
|
function submitHandler() { |
||||
|
if ($.validate.form()) { |
||||
|
$.operate.save(prefix + "/add", $('#form-clientPrinters-add').serialize()); |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
@ -0,0 +1,111 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> |
||||
|
<head> |
||||
|
<th:block th:include="include :: header('客户端打印机对照列表')" /> |
||||
|
</head> |
||||
|
<body class="gray-bg"> |
||||
|
<div class="container-div"> |
||||
|
<div class="row"> |
||||
|
<div class="col-sm-12 search-collapse"> |
||||
|
<form id="formId"> |
||||
|
<div class="select-list"> |
||||
|
<ul> |
||||
|
<li> |
||||
|
<label>客户端编码:</label> |
||||
|
<input type="text" name="clientCode"/> |
||||
|
</li> |
||||
|
<li> |
||||
|
<label>打印机实体名称:</label> |
||||
|
<input type="text" name="printerName"/> |
||||
|
</li> |
||||
|
<li> |
||||
|
<label>打印机业务名称:</label> |
||||
|
<input type="text" name="printerNameBusy"/> |
||||
|
</li> |
||||
|
<li> |
||||
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a> |
||||
|
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a> |
||||
|
</li> |
||||
|
</ul> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
|
||||
|
<div class="btn-group-sm" id="toolbar" role="group"> |
||||
|
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="print:clientPrinters:add"> |
||||
|
<i class="fa fa-plus"></i> 添加 |
||||
|
</a> |
||||
|
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="print:clientPrinters:edit"> |
||||
|
<i class="fa fa-edit"></i> 修改 |
||||
|
</a> |
||||
|
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="print:clientPrinters:remove"> |
||||
|
<i class="fa fa-remove"></i> 删除 |
||||
|
</a> |
||||
|
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="print:clientPrinters:export"> |
||||
|
<i class="fa fa-download"></i> 导出 |
||||
|
</a> |
||||
|
</div> |
||||
|
<div class="col-sm-12 select-table table-striped"> |
||||
|
<table id="bootstrap-table"></table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<th:block th:include="include :: footer" /> |
||||
|
<script th:inline="javascript"> |
||||
|
var editFlag = [[${@permission.hasPermi('print:clientPrinters:edit')}]]; |
||||
|
var removeFlag = [[${@permission.hasPermi('print:clientPrinters:remove')}]]; |
||||
|
var prefix = ctx + "print/clientPrinters"; |
||||
|
|
||||
|
$(function() { |
||||
|
var options = { |
||||
|
url: prefix + "/list", |
||||
|
createUrl: prefix + "/add", |
||||
|
updateUrl: prefix + "/edit/{id}", |
||||
|
removeUrl: prefix + "/remove", |
||||
|
exportUrl: prefix + "/export", |
||||
|
modalName: "客户端打印机对照", |
||||
|
columns: [{ |
||||
|
checkbox: true |
||||
|
}, |
||||
|
{ |
||||
|
field: 'clientCode', |
||||
|
title: '客户端编码' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'printerName', |
||||
|
title: '打印机实体名称' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'printerUuid', |
||||
|
title: '打印机编码', |
||||
|
visible: false |
||||
|
}, |
||||
|
{ |
||||
|
field: 'printerNameBusy', |
||||
|
title: '打印机业务名称' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'status', |
||||
|
title: '状态' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'id', |
||||
|
title: '', |
||||
|
visible: false |
||||
|
}, |
||||
|
{ |
||||
|
title: '操作', |
||||
|
align: 'center', |
||||
|
formatter: function(value, row, index) { |
||||
|
var actions = []; |
||||
|
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); |
||||
|
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>'); |
||||
|
return actions.join(''); |
||||
|
} |
||||
|
}] |
||||
|
}; |
||||
|
$.table.init(options); |
||||
|
}); |
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
@ -0,0 +1,58 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
||||
|
<head> |
||||
|
<th:block th:include="include :: header('修改打印机')" /> |
||||
|
</head> |
||||
|
<body class="white-bg"> |
||||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
||||
|
<form class="form-horizontal m" id="form-clientPrinters-edit" th:object="${winPrintClientPrinters}"> |
||||
|
<input name="id" th:field="*{id}" type="hidden"> |
||||
|
<div class="col-xs-12"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">客户端编码:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="clientCode" th:field="*{clientCode}" class="form-control" type="text" required> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-xs-12"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">打印机实体名称:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="printerName" th:field="*{printerName}" class="form-control" type="text" required> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-xs-12"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">打印机全局码:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="printerUuid" class="form-control" th:field="*{printerUuid}" type="text" readonly> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="col-xs-12"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">打印机业务名称:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="printerNameBusy" th:field="*{printerNameBusy}" class="form-control" type="text" required> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
<th:block th:include="include :: footer" /> |
||||
|
<script th:inline="javascript"> |
||||
|
var prefix = ctx + "print/clientPrinters"; |
||||
|
$("#form-clientPrinters-edit").validate({ |
||||
|
focusCleanup: true |
||||
|
}); |
||||
|
|
||||
|
function submitHandler() { |
||||
|
if ($.validate.form()) { |
||||
|
$.operate.save(prefix + "/edit", $('#form-clientPrinters-edit').serialize()); |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
Loading…
Reference in new issue