打印工单
This commit is contained in:
parent
db87951161
commit
0f51329be6
@ -16,6 +16,18 @@
|
||||
</description>
|
||||
<dependencies>
|
||||
|
||||
<!-- 生成二维码 -->
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>${zxing.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>javase</artifactId>
|
||||
<version>${zxing.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 百度富文本-->
|
||||
<dependency>
|
||||
<groupId>com.blingblingbang</groupId>
|
||||
|
@ -66,5 +66,8 @@ public class Company extends TenantBaseDO {
|
||||
private String loginAccount ;
|
||||
/** 关联的服务编号(多个以英文逗号隔开)(实际就是这个企业的用户登录后有哪些系统权限) */
|
||||
private String serviceCodes ;
|
||||
|
||||
/** 开户行 */
|
||||
private String bankAccount;
|
||||
/** 收款账号 */
|
||||
private String account;
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package cn.iocoder.yudao.util;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.MultiFormatWriter;
|
||||
import com.google.zxing.WriterException;
|
||||
import com.google.zxing.client.j2se.MatrixToImageWriter;
|
||||
import com.google.zxing.common.BitMatrix;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 用于生成二维码的工具类
|
||||
*
|
||||
* @author 小李
|
||||
* @date 14:56 2024/10/30
|
||||
**/
|
||||
public class CreateQRCodeUtil {
|
||||
|
||||
/**
|
||||
* 生成二维码的方法
|
||||
*
|
||||
* @author 小李
|
||||
* @date 15:00 2024/10/30
|
||||
* @param text 二维码的内容
|
||||
* @param width 二维码的宽度
|
||||
* @param height 二维码的高度
|
||||
**/
|
||||
public static byte[] GenerateQRCode(String text, int width, int height) {
|
||||
try {
|
||||
BitMatrix bitMatrix = new MultiFormatWriter().encode(text, BarcodeFormat.QR_CODE, width, height);
|
||||
|
||||
try (ByteArrayOutputStream pngOutputStream = new ByteArrayOutputStream()) {
|
||||
MatrixToImageWriter.writeToStream(bitMatrix, "PNG", pngOutputStream);
|
||||
return pngOutputStream.toByteArray();
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -53,6 +53,7 @@ import cn.iocoder.yudao.module.tickets.service.DlTicketWaresService;
|
||||
import cn.iocoder.yudao.module.tickets.service.DlTwItemService;
|
||||
import cn.iocoder.yudao.module.tickets.tools.WordUtil;
|
||||
import cn.iocoder.yudao.module.tickets.vo.*;
|
||||
import cn.iocoder.yudao.util.CreateQRCodeUtil;
|
||||
import cn.iocoder.yudao.util.SendSmsUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -63,6 +64,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.config.ConfigureBuilder;
|
||||
import com.deepoove.poi.data.PictureRenderData;
|
||||
import com.deepoove.poi.data.PictureType;
|
||||
import com.deepoove.poi.plugin.table.HackLoopTableRenderPolicy;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
@ -692,11 +695,10 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
if (ObjectUtil.isNotEmpty(adviser) && ObjectUtil.isNotEmpty(adviser.getMobile())) {
|
||||
params.put("serviceTelephone", adviser.getMobile());
|
||||
}
|
||||
// 结算日期
|
||||
params.put("settleDate", date.format(LocalDateTime.now()));
|
||||
RepairOrderInfo orderInfo = repairOrderInfoService.getOne(new LambdaQueryWrapper<RepairOrderInfo>().eq(RepairOrderInfo::getGoodsId, tickets.getId()));
|
||||
if (ObjectUtil.isNotEmpty(orderInfo)) {
|
||||
if (ObjectUtil.isNotEmpty(orderInfo.getPayTime())) {
|
||||
params.put("settleDate", date.format(orderInfo.getPayTime()));
|
||||
}
|
||||
// 付款情况
|
||||
// 先取支付字典
|
||||
List<DictDataRespDTO> payTypes = dictDataApi.getDictDataList(DICT_REPAIR_PAY_TYPE);
|
||||
@ -731,15 +733,22 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
if (company != null){
|
||||
corporation = company.getCorpName();
|
||||
bankAddress = company.getAddress();
|
||||
bank = company.getBankAccount();
|
||||
account = company.getAccount();
|
||||
}
|
||||
// 取不到的先给未知
|
||||
params.put("corporation", corporation);
|
||||
// todo
|
||||
params.put("bank", bank);
|
||||
params.put("bankAddress", bankAddress);
|
||||
// todo
|
||||
params.put("account", account);
|
||||
|
||||
// 生成收款二维码
|
||||
int width = 100, height = 100;
|
||||
byte[] texts = CreateQRCodeUtil.GenerateQRCode("hello world", width, height);
|
||||
if (ObjectUtil.isNotEmpty(texts)){
|
||||
params.put("qrCode", new PictureRenderData(width, height, PictureType.PNG, texts));
|
||||
}
|
||||
|
||||
Configure config = configureBuilder.build();
|
||||
try {
|
||||
InputStream inputStream = XWPFTemplate.class.getResourceAsStream("/templates/ticketTemplate.docx");
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user