This commit is contained in:
cun-nan 2024-02-26 15:05:21 +08:00
parent e98e5bf217
commit a69b4d806e
12 changed files with 237 additions and 148 deletions

View File

@ -61,4 +61,11 @@ public interface LJOrderService extends IService<LJOrder> {
Map<String, String> orderStatistics(LJOrder order);
LJOrder getStatisticsByTime(Date time ,Integer goodsId);
/**
* 添加商品订单信息
* @param order
* @param goodsId 商品id
*/
void addGoodOrder(LJOrder order,Integer goodsId);
}

View File

@ -1,26 +1,37 @@
package com.fuint.business.order.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.order.entity.LJOrder;
import com.fuint.business.order.entity.OrderGoods;
import com.fuint.business.order.mapper.LJOrderMapper;
import com.fuint.business.order.service.LJOrderService;
import com.fuint.business.order.service.OrderGoodsService;
import com.fuint.business.order.vo.Excel.LJOrderExcel;
import com.fuint.business.order.vo.LJOrderVo;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@Service
public class LJOrderServiceImpl extends ServiceImpl<LJOrderMapper, LJOrder> implements LJOrderService {
@Autowired
@Lazy
private OrderGoodsService orderGoodsService;
@Override
public IPage<LJOrder> selectOrderList(Page page, LJOrder order) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
@ -110,4 +121,23 @@ public class LJOrderServiceImpl extends ServiceImpl<LJOrderMapper, LJOrder> impl
public LJOrder getStatisticsByTime(Date time, Integer goodsId) {
return baseMapper.getStatisticsByTime(time, goodsId);
}
@Override
public void addGoodOrder(LJOrder order,Integer goodsId) {
if (ObjectUtil.isEmpty(order.getOrderNo())){
// 根据日期生成订单信息
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String timestamp = dateFormat.format(new Date());
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
String orderNo = "2345"+timestamp+randomString;
order.setOrderNo(orderNo);
}
baseMapper.insert(order);
LJOrder ljOrder = this.selectGoodsOrder(order.getOrderNo());
OrderGoods orderGoods = new OrderGoods();
orderGoods.setGoodsId(goodsId);
orderGoods.setOrderId(ljOrder.getId());
orderGoods.setNum(ljOrder.getGoodsNum());
orderGoodsService.save(orderGoods);
}
}

View File

@ -62,10 +62,11 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
trackService.insertStockTrack(stockTrack);
// 修改库存数量
LJGoods ljGoods = goodsService.selectLJGoodsById(goods.getGoodsId());
Integer stock = ljGoods.getStock();
ljGoods.setStock(stock-goods.getNum());
goodsService.updateLJGoods(ljGoods);
// LJGoods ljGoods = goodsService.selectLJGoodsById(goods.getGoodsId());
// Integer stock = ljGoods.getStock();
// ljGoods.setStock(stock-goods.getNum());
// goodsService.updateLJGoods(ljGoods);
goodsService.subtractGoodesStockByLock(goods.getGoodsId(),goods.getNum());
// 添加销售统计信息
SaleDetail saleDetail = new SaleDetail();

View File

@ -7,7 +7,7 @@ var MainJS = "CLodopfuncs.js",
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 connectFlag = false;
var CreatedOKLodopObject, CLodopIsLocal, LoadJsState;
//==判断是否需要CLodop(那些不支持插件的浏览器):==
@ -68,6 +68,10 @@ function checkOrTryHttp() {
}
head.insertBefore(JS1, head.firstChild);
}
// 判断本地是否存在 CLodopfuncs.js 文件的函数
function isLocalFileExist() {
return typeof window['getLodop'] === 'undefined'; // getLodop为CLodopfuncs.js提供的全局变量名称
}
//==加载Lodop对象的主过程:==
(function loadCLodop() {
@ -77,14 +81,27 @@ function checkOrTryHttp() {
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(); }
if (isLocalFileExist()) {
var WSK1 = new WebSocket(URL_WS1);
WSK1.onopen = function (e) {
connectFlag = true
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();
@ -93,6 +110,7 @@ function checkOrTryHttp() {
//==获取LODOP对象主过程,判断是否安装、需否升级:==
function getLodop(oOBJECT, oEMBED) {
try {
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>";
@ -110,7 +128,7 @@ function getLodop(oOBJECT, oEMBED) {
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));
@ -186,4 +204,4 @@ function getLodop(oOBJECT, oEMBED) {
alert("getLodop出错:" + err);
}
}
export { getLodop };
export { getLodop,connectFlag };

View File

@ -49,7 +49,7 @@ service.interceptors.request.use(config => {
const s_url = sessionObj.url; // 请求地址
const s_data = sessionObj.data; // 请求数据
const s_time = sessionObj.time; // 请求时间
const interval = 2000; // 间隔时间(ms),小于此时间视为重复提交
const interval = 999; // 间隔时间(ms),小于此时间视为重复提交
if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
const message = '数据正在处理,请耐心等待';
console.warn(`[${s_url}]: ` + message)

View File

@ -1248,7 +1248,7 @@
import {addHangBill} from "@/api/cashier/hangbill";
import {addCreditUnit, listCreditUnit} from "@/api/cashier/creditunit";
import {cashierOrderByOrderNo} from "@/api/cashier/cashierorder";
import {getLodop} from "@/api/LodopFuncs";
import {getLodop,connectFlag} from "@/api/LodopFuncs";
import {giftCardExchange} from "@/api/cashier/giftCard/giftcard";
import BigNumber from "bignumber.js";
import {
@ -2183,11 +2183,16 @@
this.isPay = true
},
async printLocally() {
printLocally() {
if (!connectFlag){
return
}
try {
//
let LODOP = getLodop(); //
LODOP.PRINT_INIT();
var bodyStyle = `<style>
if (LODOP) {
LODOP.PRINT_INIT();
var bodyStyle = `<style>
.input-box{
width: 100%;
display: flex;
@ -2255,24 +2260,33 @@
}
</style>
`
var fromHtml = bodyStyle+this.$refs.report.innerHTML
var fromHtml = bodyStyle + this.$refs.report.innerHTML
LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", fromHtml);
LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", fromHtml);
LODOP.SET_PRINT_MODE("FULL_WIDTH_FOR_OVERFLOW",true);
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();
// LODOP.ADD_PRINT_BARCODE(10,40,100,100,'QRCode','123456789');
// let preview = LODOP.PREVIEW();
// console.log("preview",preview);
LODOP.PRINT();
}
}catch (e){
console.log(e,'打印机报错')
}
},
async printLocally1() {
if (!connectFlag){
return
}
//
let LODOP = getLodop(); //
LODOP.PRINT_INIT();
var bodyStyle = `<style>
console.log(LODOP)
if (LODOP) {
LODOP.PRINT_INIT();
var bodyStyle = `<style>
.input-box{
width: 100%;
display: flex;
@ -2340,103 +2354,108 @@
}
</style>
`
var fromHtml = bodyStyle+this.$refs.report1.innerHTML
var fromHtml = bodyStyle + this.$refs.report1.innerHTML
LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", fromHtml);
LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", fromHtml);
LODOP.SET_PRINT_MODE("FULL_WIDTH_FOR_OVERFLOW",true);
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();
// LODOP.ADD_PRINT_BARCODE(10,40,100,100,'QRCode','123456789');
// let preview = LODOP.PREVIEW();
// console.log("preview",preview);
LODOP.PRINT();
}
},
async printLocally2() {
if (!connectFlag){
return
}
//
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;
}
.input-box1{
width: 100%;
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;
if (LODOP) {
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;
}
}
.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;
.input-box1{
width: 100%;
font-size: 14px;
margin: 5px 0px;
}
}
.box-center{
height: 500px;
}
</style>
`
var fromHtml = bodyStyle+this.$refs.report2.innerHTML
.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;
}
}
.box-center{
height: 500px;
}
</style>
`
var fromHtml = bodyStyle+this.$refs.report2.innerHTML
LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", fromHtml);
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();
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();
}
},
clear(){
// this.autofocus = false
@ -3854,24 +3873,15 @@
let isPaySuccess = false;
await addLJGoods(_this.map).then( response => {
console.log('3867386738673867')
_this.orderNo = response.data.orderNo;
if (response.data.oilOrder!=null){
if (response.data.oilOrder.orderStatus == "paid"){
_this.isPaySuccess = true;
isPaySuccess = true
_this.isPay = true;
_this.seekZero = 0
_this.loading = false;
_this.amount = 0
// for (let i =0;i<_this.oilPreferentialData.length;i++){
// _this.oilPreferentialData[i].oilPreferential.storeId = response.data.oilOrder.storeId
// _this.oilPreferentialData[i].oilPreferential.orderAmount = response.data.oilOrder.orderAmount
// _this.oilPreferentialData[i].oilPreferential.userId = response.data.oilOrder.userId
// _this.oilPreferentialData[i].oilPreferential.oilId = response.data.oilOrder.oils
// _this.oilPreferentialData[i].oilPreferential.mtUserLevel = _this.member.gradeId
// _this.oilPreferentialData[i].oilPreferential.cardFavorableId = _this.cardFavorableId
// usePaymentActive(_this.oilPreferentialData[i].oilPreferential).then(res => {})
// }
_this.printLocally()
_this.resetting1()
return;
@ -3882,8 +3892,6 @@
_this.isPaySuccess = true;
isPaySuccess = true
_this.isPay = true;
_this.seekZero = 0
_this.amount = 0
_this.loading = false;
_this.printLocally()
_this.resetting1()

View File

@ -443,7 +443,7 @@ import {getOilNameList} from "@/api/cashier/oilnumgun";
import {getOrderGoods} from "@/api/cashier/goodsorder";
import {exportExcelCashierApi} from "@/api/order/exportExcel";
import {refundApi} from "@/api/cashier/refund";
import {getLodop} from "@/api/LodopFuncs";
import {connectFlag, getLodop} from "@/api/LodopFuncs";
import {getOilNumberGun} from "@/api/cashier/oilGuns";
import {formatDate} from "@/utils";
import ScanPayCodeDialog from "@/views/cashier/components/scanPayCodeDialog.vue";
@ -564,6 +564,9 @@ import ScanPayCodeDialog from "@/views/cashier/components/scanPayCodeDialog.vue"
},
async printLocally() {
if (!connectFlag){
return
}
//
let LODOP = getLodop(); //
LODOP.PRINT_INIT();

View File

@ -301,7 +301,7 @@ import {getDicts} from "@/api/dict/data";
import { exportExcelGoodsOrderApi } from "@/api/order/exportExcel";
import {cashierOrder} from "@/api/cashier/cashierorder";
import {refundApi, getOrderInfoApi} from "@/api/cashier/refund";
import {getLodop} from "@/api/LodopFuncs";
import {connectFlag, getLodop} from "@/api/LodopFuncs";
export default {
name: "order_Cashier",
@ -399,6 +399,9 @@ export default {
},
async printLocally() {
if (!connectFlag){
return
}
//
let LODOP = getLodop(); //
LODOP.PRINT_INIT();

View File

@ -349,7 +349,7 @@
import {cashierOrder} from "@/api/cashier/cashierorder";
import {getOrderInfoApi, refundApi} from "@/api/cashier/refund";
import {exportExcelOilOrderApi} from "@/api/order/exportExcel";
import {getLodop} from "@/api/LodopFuncs";
import {connectFlag, getLodop} from "@/api/LodopFuncs";
import {getInfoByIdApi} from "@/api/cashier/cardfavorablerecord";
export default {
@ -429,6 +429,9 @@
},
methods:{
async printLocally() {
if (!connectFlag){
return
}
//
let LODOP = getLodop(); //
LODOP.PRINT_INIT();

View File

@ -260,7 +260,7 @@ import {listOilOrder, oilOrderInfo} from "@/api/cashier/oilorder";
import {getOilNameList} from "@/api/cashier/oilnumgun";
import {getOilNumberGun} from "@/api/cashier/oilGuns";
import {refundApi} from "@/api/cashier/refund";
import {getLodop} from "@/api/LodopFuncs";
import {connectFlag, getLodop} from "@/api/LodopFuncs";
export default {
name: "order_Cashier",
@ -390,6 +390,9 @@ import {getLodop} from "@/api/LodopFuncs";
},
async printLocally() {
if (!connectFlag){
return
}
//
let LODOP = getLodop(); //
LODOP.PRINT_INIT();

View File

@ -281,7 +281,7 @@ import {getDicts} from "@/api/dict/data";
import {queryStaffs} from "@/api/cashier/staff";
import {refundApi} from "@/api/cashier/refund";
import {exportExcelVipApi} from "@/api/order/exportExcel";
import {getLodop} from "@/api/LodopFuncs";
import {connectFlag, getLodop} from "@/api/LodopFuncs";
export default {
name: "order_Cashier",
@ -379,6 +379,9 @@ export default {
},
async printLocally() {
if (!connectFlag){
return
}
//
let LODOP = getLodop(); //
LODOP.PRINT_INIT();

View File

@ -927,7 +927,7 @@ import {getUserGradeInfo} from "@/api/cashier/usergrade";
import {getDicts} from "@/api/dict/data";
import {getSysConfig} from "@/api/cashier/user/sysconfig";
import {giftCardExchange} from "@/api/cashier/giftCard/giftcard";
import {getLodop} from "@/api/LodopFuncs";
import {connectFlag, getLodop} from "@/api/LodopFuncs";
export default {
components: {
@ -1630,10 +1630,14 @@ export default {
},
async printLocally1() {
if (!connectFlag){
return
}
//
let LODOP = getLodop(); //
LODOP.PRINT_INIT();
var bodyStyle = `<style>
if (LODOP) {
LODOP.PRINT_INIT();
var bodyStyle = `<style>
.input-box{
width: 100%;
display: flex;
@ -1701,24 +1705,29 @@ export default {
}
</style>
`
var fromHtml = bodyStyle+this.$refs.report1.innerHTML
var fromHtml = bodyStyle + this.$refs.report1.innerHTML
LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", fromHtml);
LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", fromHtml);
LODOP.SET_PRINT_MODE("FULL_WIDTH_FOR_OVERFLOW",true);
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();
// LODOP.ADD_PRINT_BARCODE(10,40,100,100,'QRCode','123456789');
// let preview = LODOP.PREVIEW();
// console.log("preview",preview);
LODOP.PRINT();
}
},
async printLocally2() {
if (!connectFlag){
return
}
//
let LODOP = getLodop(); //
LODOP.PRINT_INIT();
var bodyStyle = `<style>
if (LODOP) {
LODOP.PRINT_INIT();
var bodyStyle = `<style>
.input-box{
width: 100%;
display: flex;
@ -1786,17 +1795,18 @@ export default {
}
</style>
`
var fromHtml = bodyStyle+this.$refs.report2.innerHTML
var fromHtml = bodyStyle + this.$refs.report2.innerHTML
LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", fromHtml);
LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", fromHtml);
LODOP.SET_PRINT_MODE("FULL_WIDTH_FOR_OVERFLOW",true);
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();
// LODOP.ADD_PRINT_BARCODE(10,40,100,100,'QRCode','123456789');
// let preview = LODOP.PREVIEW();
// console.log("preview",preview);
LODOP.PRINT();
}
},
async collection() {