This commit is contained in:
wangh 2024-01-24 15:07:26 +08:00
parent 3646bc94b9
commit 13af4ffd80
10 changed files with 456 additions and 40 deletions

Binary file not shown.

View File

@ -160,6 +160,13 @@ import {cleanTankApi} from "@/api/oilConfig/oilTank";
let this_ = this
await this_.getList()
},
watch: {
dialogVisible: function (newValue, oldValue) {
if (oldValue) {
this.$refs["gunForm"].resetFields();
}
}
},
methods:{
handleIsopenSelect() {
this.$forceUpdate()
@ -172,6 +179,11 @@ import {cleanTankApi} from "@/api/oilConfig/oilTank";
},
//
gunAdd(numberId){
// this.$refs["gunForm"].validate
// formRules
// this.$refs.gunForm.clearValidate(); //
// this.$set(this, 'formRules', {}); //
let this_ = this;
this_.dialogVisible = true;
this_.judgement = false;

View File

@ -58,7 +58,7 @@
</div>
</el-row>
<el-table ref="tables"
<el-table key="2" ref="tables"
v-loading="loading"
:data="statisticsList"
:default-sort="defaultSort">
@ -141,7 +141,8 @@
<el-table ref="tables"
v-loading="loading"
:data="trackList"
:default-sort="defaultSort">
:default-sort="defaultSort"
key="1">
<el-table-column
lable="#"
type="index"
@ -258,7 +259,7 @@ export default {
})
},
getTrackingList(data) {
this.queryParams2.tankId = data.id,
// this.queryParams2.tankId = data.id
getTrackingApi(this.queryParams2).then(res=>{
this.trackList = res.data.records
this.total2 = res.data.total;
@ -273,7 +274,7 @@ export default {
this_.statisticsForm.storedQuantity = data.storedQuantity,
this_.statisticsForm.updateTime = data.updateTime,
this_.statisticsForm.unit = data.unit,
this_.queryParams2.tankId = data.id
this.trackList = []
this_.getTrackingList(data)
this.drawer=true

View File

@ -535,6 +535,8 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
cardExchangeRecordService.addCardExchangeRecord(cardExchangeRecord);
}
}catch (Exception e) {
redisLock.unlock(lockKey);
e.printStackTrace();
continue;
}
@ -550,10 +552,10 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
redisLock.unlock(lockKey);
} else {
redisLock.unlock(lockKey);
return cardValueRecord;
}
// else {
// return cardValueRecord;
// }
return cardValueRecord;
}
//添加余额明细表
@ -562,7 +564,11 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
cardBalanceChange.setUserId(cardValueRecord.getMtUserId());
cardBalanceChange.setChangeType("1");
cardBalanceChange.setFromType("余额充值");
cardBalanceChange.setBalance(cardValueRecord.getRechargeBalance());
if ("1".equals(cardValueRecord.getRechargeType())) {
cardBalanceChange.setBalance(cardValueRecord.getAmount());
}
cardBalanceChange.setStoreId(cardValueRecord.getStoreId());
cardBalanceChange.setOrderNo(cardValueRecord.getPaymentNo());
cardBalanceChange.setChainStoreId(cardValueRecord.getChainStoreId());
@ -583,8 +589,15 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
if (ObjectUtil.isEmpty(ljUserVos.getGrowthValue())) ljUserVos.setGrowthValue(0);
String rechargeBalance =cardValueRecordDTO.getRechargeBalance().toString();
if ("1".equals(cardValueRecordDTO.getRechargeType())) {
rechargeBalance = cardValueRecordDTO.getAmount().toString();
}
// 计算之后修改对应余额
BigDecimal bigBidBalance = new BigDecimal(cardValueRecordDTO.getRechargeBalance());
BigDecimal bigBidBalance = new BigDecimal(rechargeBalance);
BigDecimal addCardValance = bigBidBalance.add(new BigDecimal(ljUserVos.getCardBalance())); //

View File

@ -1,16 +1,24 @@
package com.fuint.business.order.controller;
import cn.hutool.core.io.resource.InputStreamResource;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.order.entity.HandoverRecord;
import com.fuint.business.order.service.HandoverRecordService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import io.lettuce.core.dynamic.annotation.Param;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Map;
/**
@ -118,5 +126,45 @@ public class HandoverRecordController extends BaseController {
return getSuccessResult(true);
}
// @GetMapping("/downloadFile")
// public ResponseObject downloadFile() throws IOException {
// // 从根目录读取文件这里仅为示例
// File file = new File("path/to/your/file.txt");
// InputStreamResource resource = new InputStreamResource(new FileInputStream(file));
//
// HttpHeaders headers = new HttpHeaders();
// headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + file.getName());
//
// return getSuccessResult.ok()
// .headers(headers)
// .contentLength(file.length())
// .contentType(MediaType.APPLICATION_OCTET_STREAM)
// .body(resource);
// }
@GetMapping("/downloadFile")
public void downloadFile(HttpServletResponse response) throws IOException {
File file = new File("CLodop_Setup_for_Win32NT.exe");
if (!file.exists()) {
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
}
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + file.getName());
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
response.setContentLength((int) file.length());
try (FileInputStream fis = new FileInputStream(file); OutputStream os = response.getOutputStream()) {
byte[] buffer = new byte[1024];
int bytesRead;
while ((bytesRead = fis.read(buffer)) != -1) {
os.write(buffer, 0, bytesRead);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@ -63,6 +63,7 @@ public class ShiroConfig {
filterMap.put("/business/member/staff/queryStaffList/**","anon"); // 获取员工信息
filterMap.put("/business/indexBanner/list/**","anon"); // 获取员工信息
filterMap.put("/business/storeInformation/store/queryStores","anon"); // 切换站点
filterMap.put("/business/handoverRecord/downloadFile","anon"); // 切换站点

View File

@ -0,0 +1,189 @@
//==本JS是加载Lodop插件或Web打印服务CLodop/Lodop7的综合示例可直接使用建议理解后融入自己程序==
// http://www.c-lodop.com/LodopDemo.html 地址
//用双端口加载主JS文件Lodop.js(或CLodopfuncs.js兼容老版本)以防其中某端口被占:
var MainJS = "CLodopfuncs.js",
URL_WS1 = "ws://localhost:8000/" + MainJS, //ws用8000/18000
URL_WS2 = "ws://localhost:18000/" + MainJS,
URL_HTTP1 = "http://localhost:8000/" + MainJS, //http用8000/18000
URL_HTTP2 = "http://localhost:18000/" + MainJS,
URL_HTTP3 = "https://localhost.lodop.net:8443/" + MainJS; //https用8000/8443
var CreatedOKLodopObject, CLodopIsLocal, LoadJsState;
//==判断是否需要CLodop(那些不支持插件的浏览器):==
function needCLodop() {
try {
var ua = navigator.userAgent;
if (ua.match(/Windows\sPhone/i) ||
ua.match(/iPhone|iPod|iPad/i) ||
ua.match(/Android/i) ||
ua.match(/Edge\D?\d+/i))
return true;
var verTrident = ua.match(/Trident\D?\d+/i);
var verIE = ua.match(/MSIE\D?\d+/i);
var verOPR = ua.match(/OPR\D?\d+/i);
var verFF = ua.match(/Firefox\D?\d+/i);
var x64 = ua.match(/x64/i);
if ((!verTrident) && (!verIE) && (x64)) return true;
else if (verFF) {
verFF = verFF[0].match(/\d+/);
if ((verFF[0] >= 41) || (x64)) return true;
} else if (verOPR) {
verOPR = verOPR[0].match(/\d+/);
if (verOPR[0] >= 32) return true;
} else if ((!verTrident) && (!verIE)) {
var verChrome = ua.match(/Chrome\D?\d+/i);
if (verChrome) {
verChrome = verChrome[0].match(/\d+/);
if (verChrome[0] >= 41) return true;
}
}
return false;
} catch (err) {
return true;
}
}
//==检查加载成功与否如没成功则用http(s)再试==
//==低版本CLODOP6.561/Lodop7.043及前)用本方法==
function checkOrTryHttp() {
if (window.getCLodop) {
LoadJsState = "complete";
return true;
}
if (LoadJsState == "loadingB" || LoadJsState == "complete") return;
LoadJsState = "loadingB";
var head = document.head || document.getElementsByTagName("head")[0] || document.documentElement;
var JS1 = document.createElement("script")
, JS2 = document.createElement("script")
, JS3 = document.createElement("script");
JS1.src = URL_HTTP1;
JS2.src = URL_HTTP2;
JS3.src = URL_HTTP3;
JS1.onload = JS2.onload = JS3.onload = JS2.onerror = JS3.onerror = function () { LoadJsState = "complete"; }
JS1.onerror = function (e) {
if (window.location.protocol !== 'https:')
head.insertBefore(JS2, head.firstChild); else
head.insertBefore(JS3, head.firstChild);
}
head.insertBefore(JS1, head.firstChild);
}
//==加载Lodop对象的主过程:==
(function loadCLodop() {
if (!needCLodop()) return;
CLodopIsLocal = !!((URL_WS1 + URL_WS2).match(/\/\/localho|\/\/127.0.0./i));
LoadJsState = "loadingA";
if (!window.WebSocket && window.MozWebSocket) window.WebSocket = window.MozWebSocket;
//ws方式速度快(小于200ms)且可避免CORS错误,但要求Lodop版本足够新:
try {
var WSK1 = new WebSocket(URL_WS1);
WSK1.onopen = function (e) { setTimeout("checkOrTryHttp();", 200); }
WSK1.onmessage = function (e) { if (!window.getCLodop) eval(e.data); }
WSK1.onerror = function (e) {
var WSK2 = new WebSocket(URL_WS2);
WSK2.onopen = function (e) { setTimeout("checkOrTryHttp();", 200); }
WSK2.onmessage = function (e) { if (!window.getCLodop) eval(e.data); }
WSK2.onerror = function (e) { checkOrTryHttp(); }
}
} catch (e) {
checkOrTryHttp();
}
})();
//==获取LODOP对象主过程,判断是否安装、需否升级:==
function getLodop(oOBJECT, oEMBED) {
var strFontTag = "<br><font color='#FF00FF'>打印控件";
var strLodopInstall = strFontTag + "未安装!点击这里<a href='install_lodop32.exe' target='_self'>执行安装</a>";
var strLodopUpdate = strFontTag + "需要升级!点击这里<a href='install_lodop32.exe' target='_self'>执行升级</a>";
var strLodop64Install = strFontTag + "未安装!点击这里<a href='install_lodop64.exe' target='_self'>执行安装</a>";
var strLodop64Update = strFontTag + "需要升级!点击这里<a href='install_lodop64.exe' target='_self'>执行升级</a>";
var strCLodopInstallA = "<br><font color='#FF00FF'>Web打印服务CLodop未安装启动点击这里<a href='CLodop_Setup_for_Win32NT.exe' target='_self'>下载执行安装</a>";
var strCLodopInstallB = "<br>(若此前已安装过,可<a href='CLodop.protocol:setup' target='_self'>点这里直接再次启动</a>";
var strCLodopUpdate = "<br><font color='#FF00FF'>Web打印服务CLodop需升级!点击这里<a href='CLodop_Setup_for_Win32NT.exe' target='_self'>执行升级</a>";
var strLodop7FontTag = "<br><font color='#FF00FF'>Web打印服务Lodop7";
var strLodop7HrefX86 = "点击这里<a href='Lodop7_Linux_X86_64.tar.gz' target='_self'>下载安装</a>(下载后解压点击lodop文件开始执行)";
var strLodop7HrefARM = "点击这里<a href='Lodop7_Linux_ARM64.tar.gz' target='_self'>下载安装</a>(下载后解压点击lodop文件开始执行)";
var strLodop7Install_X86 = strLodop7FontTag + "未安装启动," + strLodop7HrefX86;
var strLodop7Install_ARM = strLodop7FontTag + "未安装启动," + strLodop7HrefARM;
var strLodop7Update_X86 = strLodop7FontTag + "需升级," + strLodop7HrefX86;
var strLodop7Update_ARM = strLodop7FontTag + "需升级," + strLodop7HrefARM;
var strInstallOK = ",成功后请刷新本页面或重启浏览器。</font>";
var LODOP;
try {
var isWinIE = (/MSIE/i.test(navigator.userAgent)) || (/Trident/i.test(navigator.userAgent));
var isWinIE64 = isWinIE && (/x64/i.test(navigator.userAgent));
var isLinuxX86 = (/Linux/i.test(navigator.platform)) && (/x86/i.test(navigator.platform));
var isLinuxARM = (/Linux/i.test(navigator.platform)) && (/aarch/i.test(navigator.platform));
if (needCLodop() || isLinuxX86 || isLinuxARM) {
try {
LODOP = window.getCLodop();
} catch (err) { }
if (!LODOP && LoadJsState !== "complete") {
if (!LoadJsState)
alert("未曾加载Lodop主JS文件请先调用loadCLodop过程."); else
alert("网页还没下载完毕,请稍等一下再操作.");
return;
}
var strAlertMessage;
if (!LODOP) {
if (isLinuxX86)
strAlertMessage = strLodop7Install_X86;
else if (isLinuxARM)
strAlertMessage = strLodop7Install_ARM;
else
strAlertMessage = strCLodopInstallA + (CLodopIsLocal ? strCLodopInstallB : "");
document.body.innerHTML = strAlertMessage + strInstallOK + document.body.innerHTML;
return;
} else {
if (isLinuxX86 && LODOP.CVERSION < "7.0.4.3")
strAlertMessage = strLodop7Update_X86;
else if (isLinuxARM && LODOP.CVERSION < "7.0.4.3")
strAlertMessage = strLodop7Update_ARM;
else if (CLODOP.CVERSION < "6.5.7.1")
strAlertMessage = strCLodopUpdate;
if (strAlertMessage)
document.body.innerHTML = strAlertMessage + strInstallOK + document.body.innerHTML;
}
// LODOP.SET_LICENSES("", "EE0887D00FCC7D29375A695F728489A6", "C94CEE276DB2187AE6B65D56B3FC2848", "");
} else {
//==如果页面有Lodop插件就直接使用,否则新建:==
if (oOBJECT || oEMBED) {
if (isWinIE)
LODOP = oOBJECT;
else
LODOP = oEMBED;
} else if (!CreatedOKLodopObject) {
LODOP = document.createElement("object");
LODOP.setAttribute("width", 0);
LODOP.setAttribute("height", 0);
LODOP.setAttribute("style", "position:absolute;left:0px;top:-100px;width:0px;height:0px;");
if (isWinIE)
LODOP.setAttribute("classid", "clsid:2105C259-1E0C-4534-8141-A753534CB4CA");
else
LODOP.setAttribute("type", "application/x-print-lodop");
document.documentElement.appendChild(LODOP);
CreatedOKLodopObject = LODOP;
} else
LODOP = CreatedOKLodopObject;
//==Lodop插件未安装时提示下载地址:==
if ((!LODOP) || (!LODOP.VERSION)) {
document.body.innerHTML = (isWinIE64 ? strLodop64Install : strLodopInstall) + strInstallOK + document.body.innerHTML;
return LODOP;
}
if (LODOP.VERSION < "6.2.2.6") {
document.body.innerHTML = (isWinIE64 ? strLodop64Update : strLodopUpdate) + strInstallOK + document.body.innerHTML;
}
}
//===如下空白位置适合调用统一功能(如注册语句、语言选择等):=======================
LODOP.SET_LICENSES("", "EE0887D00FCC7D29375A695F728489A6", "C94CEE276DB2187AE6B65D56B3FC2848", "");
//===============================================================================
return LODOP;
} catch (err) {
alert("getLodop出错:" + err);
}
}
export { getLodop };

View File

@ -1,9 +1,14 @@
<!--发票-->
<template>
<div class="app-center">
<div style="float: right;">
<span style="font-size: 5px">点击下载打印服务</span>
<el-button @click="downloadFile()" type="primary" icon="el-icon-download" circle></el-button>
</div>
<div id="report" ref="report" class="box-center">
<div class="box-title">交班统计</div>
<div class="box-ge">
<div class="box-ge" >
<div class="input-box">
<div>油站名称:</div>
<div>{{ handoverList && handoverList.baseInfo ? handoverList.baseInfo.storeName : '未知油站' }}</div>
@ -385,6 +390,8 @@
import {addHandoverApi, getHandoverApi, printLocallyApi} from "@/api/cashier/handover";
import BigNumber from "bignumber.js";
import {removeUserId} from "@/utils/auth";
import { getLodop } from "@/api/LodopFuncs";
import Vue from 'vue';
export default {
name: "Handover",
@ -496,15 +503,88 @@ import {removeUserId} from "@/utils/auth";
});
},
async printLocally() {
const printHTML = document.querySelector('#report').innerHTML
//
window.document.body.innerHTML = printHTML
window.print() // window
window.location.reload() //
//
let LODOP = getLodop(); //
LODOP.PRINT_INIT();
var bodyStyle = `<style>
.input-box{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 5px 0px;
}
.box-ge{
border-bottom: 1px solid #000000 ;
box-sizing: border-box;
padding: 10px;
}
.box-title{
font-size: 18px;
text-align: center;
align-items: center;
margin-top: 15px;
}
.input-hui{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 15px 0px;
background: #b2b2b2;
box-sizing: border-box;
padding: 5px 0px;
}
.input-hui-frou{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 15px 0px;
background: #b2b2b2;
box-sizing: border-box;
padding: 5px 0px;
div{
width: 25%;
text-align: left;
}
}
.input-box-frou{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 5px 0px;
div{
width: 25%;
text-align: left;
}
}
</style>
`
var fromHtml = bodyStyle+this.$refs.report.innerHTML
LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", fromHtml);
LODOP.SET_PRINT_MODE("FULL_WIDTH_FOR_OVERFLOW",true);
// LODOP.ADD_PRINT_BARCODE(10,40,100,100,'QRCode','123456789');
// let preview = LODOP.PREVIEW();
console.log("preview",preview);
LODOP.PRINT();
},
downloadFile() {
window.location.href = process.env.VUE_APP_SERVER_URL+"business/handoverRecord/downloadFile";
},
//
@ -714,24 +794,19 @@ import {removeUserId} from "@/utils/auth";
@media print {
@page {
margin: 1000px;
//landscape,portrait;
// size: A4 portrait;
// GB/T 9704-2012
// margin: 3.7cm 2.6cm 3.5cm;
//margin: 0;
//margin: -1mm;
//zoom: 0.1;
/* size: A4 landscape; size: landscape横向size: portrait;纵向,如果不设置,则页面有横向和纵向的选择框 */
}
//.box-center{
// margin: 20cm;
// zoom: 0.1;
//.cover{
// display: block;
//}
//#report {
// //margin: 20cm;
// margin: 0 auto;
// /* */
// zoom: 0.5;
//
//}
.cover{
display: block;
}
//
}

View File

@ -69,11 +69,11 @@
type="text"
@click="handleDetail(scope.row)"
>交班数据</el-button>
<el-button
size="mini"
type="text"
@click="printLocally(scope.row.recordData)"
>补打交班单</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- @click="printLocally(scope.row.recordData)"-->
<!-- >补打交班单</el-button>-->
</template>
</el-table-column>
</el-table>

View File

@ -1,10 +1,11 @@
<!--发票-->
<template>
<div class="app-center">
<div class="box-center">
<el-button style="float: left ;margin-left: 5px" size="mini" type="primary" @click="printLocally()" plain>打印交班单</el-button>
<div id="report" ref="report" class="box-center">
<div class="box-title">
交班统计
<el-button style="float: right ;margin-left: 5px" size="mini" type="primary" @click="printLocally()" plain>打印交班单</el-button>
</div>
<div class="box-ge">
<div class="input-box">
@ -372,6 +373,7 @@
<script>
import {printLocallyApi,addHandoverApis} from "@/api/cashier/handover";
import BigNumber from "bignumber.js";
import {getLodop} from "@/api/LodopFuncs";
export default {
name: "HandoverOnly",
@ -392,10 +394,85 @@ import BigNumber from "bignumber.js";
methods: {
printLocally() {
console.log("12312312312312312313213122222")
printLocallyApi(this.recordData).then(res=>{
// const printHTML = document.querySelector('#report').innerHTML
// //
// window.document.body.innerHTML = printHTML
// window.print() // window
// window.location.reload() //
//
let LODOP = getLodop(); //
LODOP.PRINT_INIT();
var bodyStyle = `<style>
.input-box{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 5px 0px;
}
.box-ge{
border-bottom: 1px solid #000000 ;
box-sizing: border-box;
padding: 10px;
}
.box-title{
font-size: 18px;
text-align: center;
align-items: center;
margin-top: 15px;
}
.input-hui{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 15px 0px;
background: #b2b2b2;
box-sizing: border-box;
padding: 5px 0px;
}
.input-hui-frou{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 15px 0px;
background: #b2b2b2;
box-sizing: border-box;
padding: 5px 0px;
div{
width: 25%;
text-align: left;
}
}
.input-box-frou{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
margin: 5px 0px;
div{
width: 25%;
text-align: left;
}
}
</style>
`
var fromHtml = bodyStyle+this.$refs.report.innerHTML
})
LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", fromHtml);
LODOP.SET_PRINT_MODE("FULL_WIDTH_FOR_OVERFLOW",true);
// LODOP.ADD_PRINT_BARCODE(10,40,100,100,'QRCode','123456789');
let preview = LODOP.PREVIEW();
// console.log("preview",preview);
LODOP.PRINT();
},
// getHandover() {
// getHandoverApi().then(res=>{
@ -422,7 +499,7 @@ import BigNumber from "bignumber.js";
});
},
paymentAggregation(flag) {
let count = [];
if (this.handoverList && this.handoverList.paymentAggregation) {