Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
7bb6e6dcc5
79
fuintAdmin/src/api/print.js
Normal file
79
fuintAdmin/src/api/print.js
Normal file
@ -0,0 +1,79 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 易联云打印相关接口
|
||||
|
||||
|
||||
// 网络下发付款
|
||||
export function sendPrintIndex(query) {
|
||||
return request({
|
||||
url: 'business/printer/printIndex',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 获取code(条码)
|
||||
export function getReturnCode(query) {
|
||||
return request({
|
||||
url: 'business/printer/returnCode',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 打印购物小票
|
||||
export function printOilOrderReport(data) {
|
||||
return request({
|
||||
url: 'business/printer/printOilOrderReport',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function printCardValueReport(data) {
|
||||
return request({
|
||||
url: 'business/printer/printCardValueReport',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
export function printFuelDieselReport(data) {
|
||||
return request({
|
||||
url: 'business/printer/printFuelDieselReport',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 打印设备增删改查接口
|
||||
export function getListByPageApi(query) {
|
||||
return request({
|
||||
url: 'business/printDeviceInfo/queryByPage',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
export function addPrintDeviceApi(data) {
|
||||
return request({
|
||||
url: 'business/printDeviceInfo',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function editPrintDeviceApi(data) {
|
||||
return request({
|
||||
url: 'business/printDeviceInfo',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
export function delPrintDeviceApi(query) {
|
||||
return request({
|
||||
url: 'business/printDeviceInfo',
|
||||
method: 'delete',
|
||||
params: query
|
||||
})
|
||||
}
|
287
fuintAdmin/src/views/setting/print/index.vue
Normal file
287
fuintAdmin/src/views/setting/print/index.vue
Normal file
@ -0,0 +1,287 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-card >
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
|
||||
<el-form-item label="设备名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.deviceName"
|
||||
placeholder="请输入设备名称"
|
||||
clearable
|
||||
style="width: 240px;"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<!-- 列表信息-->
|
||||
<el-card style="margin-top: 20px" >
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@click="handleAdd"
|
||||
>新增设备</el-button>
|
||||
</el-col>
|
||||
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
|
||||
</el-row>
|
||||
|
||||
<el-table :data="tableData" style="width: 100%">
|
||||
<el-table-column prop="id" label="自增id"></el-table-column>
|
||||
<el-table-column prop="machineCode" label="设备终端号"></el-table-column>
|
||||
<el-table-column prop="msign" label="设备密钥"></el-table-column>
|
||||
<el-table-column prop="deviceName" label="设备名称"></el-table-column>
|
||||
<el-table-column prop="userId" label="用户id"></el-table-column>
|
||||
<!-- <el-table-column prop="appKey" label="应用id(APP_KEY)"></el-table-column>-->
|
||||
<!-- <el-table-column prop="appSecret" label="应用密钥(APP_SECRET)"></el-table-column>-->
|
||||
<!-- <el-table-column prop="appPublicKey" label="应用公钥(key)"></el-table-column>-->
|
||||
<!-- <el-table-column prop="platformPublicKey" label="平台公钥(publicKey)"></el-table-column>-->
|
||||
<!-- <el-table-column prop="accessToken" label="token"></el-table-column>-->
|
||||
<!-- <el-table-column prop="isAcquiesce" label="isAcquiesce">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <el-switch-->
|
||||
<!-- v-model="scope.row.isAcquiesce"-->
|
||||
<!-- @change="submitDeviceInfo(scope.row)"-->
|
||||
<!-- active-color="#13ce66"-->
|
||||
<!-- inactive-color="#ff4949">-->
|
||||
<!-- </el-switch>-->
|
||||
<!-- </template>-->
|
||||
|
||||
<!-- </el-table-column>-->
|
||||
<el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-view"
|
||||
@click="edit(scope.row)"
|
||||
>编辑</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="del(scope.row)"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.page"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
</el-card>
|
||||
|
||||
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="50%" append-to-body>
|
||||
<el-form ref="form" :model="deviceInfo" label-width="80px">
|
||||
<el-form :model="deviceInfo" ref="deviceForm" label-width="120px">
|
||||
<el-form-item label="设备终端号" prop="machineCode">
|
||||
<el-input v-model="deviceInfo.machineCode" style="width: 300px"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备密钥" prop="msign">
|
||||
<el-input v-model="deviceInfo.msign"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称" prop="deviceName">
|
||||
<el-input v-model="deviceInfo.deviceName"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户id" prop="userId">
|
||||
<el-input v-model="deviceInfo.userId"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="应用id" prop="appKey">
|
||||
<el-input v-model="deviceInfo.appKey"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="应用密钥" prop="appSecret">
|
||||
<el-input v-model="deviceInfo.appSecret"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="应用公钥" prop="appPublicKey">
|
||||
<el-input v-model="deviceInfo.appPublicKey"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="平台公钥" prop="platformPublicKey">
|
||||
<el-input v-model="deviceInfo.platformPublicKey"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="token" prop="accessToken">
|
||||
<el-input v-model="deviceInfo.accessToken"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="isAcquiesce" prop="isAcquiesce">
|
||||
<el-switch
|
||||
v-model="deviceInfo.isAcquiesce"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitForm('deviceForm')">提交</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import {addPrintDeviceApi, delPrintDeviceApi, editPrintDeviceApi, getListByPageApi} from "@/api/print";
|
||||
|
||||
export default {
|
||||
name: "printIndex",
|
||||
|
||||
data() {
|
||||
return {
|
||||
tableData: [],
|
||||
deviceInfo: {
|
||||
id: null, // 自增id
|
||||
machineCode: '', // 设备终端号
|
||||
msign: '', // 设备密钥
|
||||
deviceName: '', // 设备名称
|
||||
userId: null, // 用户id
|
||||
appKey: '', // 应用id(APP_KEY)
|
||||
appSecret: '', // 应用密钥(APP_SECRET)
|
||||
appPublicKey: '', // 应用公钥(key)
|
||||
platformPublicKey: '', // 平台公钥(publicKey)
|
||||
accessToken: '', // token
|
||||
isAcquiesce: false // token
|
||||
},
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
title:"",
|
||||
total:0,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
deviceName:'',
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
getList(){
|
||||
getListByPageApi(this.queryParams).then(res=>{
|
||||
this.tableData = res.data.records;
|
||||
this.total = res.data.total
|
||||
})
|
||||
},
|
||||
getsSubmitDeviceInfo(){},
|
||||
|
||||
submitForm(formName) {
|
||||
this.$refs[formName].validate(valid => {
|
||||
if (valid) {
|
||||
// 表单验证通过,可以提交数据
|
||||
// 示例:调用 API 提交数据
|
||||
this.submitDeviceInfo();
|
||||
} else {
|
||||
// 表单验证失败,不执行任何操作
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
submitDeviceInfo() {
|
||||
// 在这里调用接口提交设备信息数据
|
||||
console.log('提交设备信息数据:', this.deviceInfo);
|
||||
if (this.deviceInfo.id) {
|
||||
editPrintDeviceApi(this.deviceInfo).then(res=>{
|
||||
if(res.code === 200) {
|
||||
this.getList()
|
||||
this.open = false
|
||||
}
|
||||
|
||||
})
|
||||
}else {
|
||||
addPrintDeviceApi(this.deviceInfo).then(res=>{
|
||||
if(res.code === 200) {
|
||||
this.getList()
|
||||
this.open = false
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
handleQuery(){
|
||||
this.getList()
|
||||
},
|
||||
resetQuery(){
|
||||
this.queryParams = {
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
deviceName:'',
|
||||
},
|
||||
this.getList()
|
||||
},
|
||||
handleAdd(e) {
|
||||
this.clean()
|
||||
this.open = true;
|
||||
this.title = "增加设备"
|
||||
},
|
||||
edit(e) {
|
||||
this.clean()
|
||||
this.open = true;
|
||||
this.title = "编辑设备"
|
||||
this.deviceInfo = e
|
||||
console.log('提交设备信息数据:', this.deviceInfo);
|
||||
|
||||
},
|
||||
del(e) {
|
||||
|
||||
this.$confirm('此操作将永久删除该设备, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
delPrintDeviceApi({id:e.id}).then(res=>{
|
||||
if (res.code == 200) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
},
|
||||
clean() {
|
||||
this.deviceInfo= {
|
||||
id: null, // 自增id
|
||||
machineCode: '', // 设备终端号
|
||||
msign: '', // 设备密钥
|
||||
deviceName: '', // 设备名称
|
||||
userId: null, // 用户id
|
||||
appKey: '', // 应用id(APP_KEY)
|
||||
appSecret: '', // 应用密钥(APP_SECRET)
|
||||
appPublicKey: '', // 应用公钥(key)
|
||||
platformPublicKey: '', // 平台公钥(publicKey)
|
||||
accessToken: '' , // token
|
||||
isAcquiesce: false // token
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.common-dialog >>> .el-upload--picture-card {
|
||||
width: 60px;
|
||||
height: 50px;
|
||||
line-height: 60px;
|
||||
}
|
||||
</style>
|
||||
|
@ -0,0 +1,163 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" class="main-search" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="会员ID" prop="userId">
|
||||
<el-input
|
||||
v-model="queryParams.userId"
|
||||
placeholder="请输入会员ID"
|
||||
clearable
|
||||
style="width: 240px;"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="mobile">
|
||||
<el-input
|
||||
v-model="queryParams.mobile"
|
||||
placeholder="请输入会员手机号"
|
||||
clearable
|
||||
style="width: 240px;"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="状态"
|
||||
clearable
|
||||
>
|
||||
<el-option key="A" label="有效" value="A"/>
|
||||
<el-option key="N" label="无效" value="N"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange">
|
||||
<el-table-column label="ID" prop="id" width="80"/>
|
||||
<el-table-column label="会员ID" align="center" prop="userId" />
|
||||
<el-table-column label="手机号" align="center" prop="userInfo.mobile">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.userInfo.mobile">{{ scope.row.userInfo.mobile }}</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="会员名称" align="center" prop="userInfo.name">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.userInfo.name">
|
||||
<span>{{ scope.row.userInfo.name }}</span>
|
||||
</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="变动数量" align="center" prop="amount">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.amount > 0" style="color:forestgreen">+{{ scope.row.amount }}</span>
|
||||
<span v-else style="color:red">{{ scope.row.amount }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.description">{{ scope.row.description }}</span>
|
||||
<span v-else>无</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="时间" align="center" prop="createTime">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.createTime">{{ parseTime(scope.row.createTime) }}</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作人" align="center" prop="createTime">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.operator">{{ scope.row.operator }}</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.page"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getBalanceList } from "@/api/balance";
|
||||
export default {
|
||||
name: "BalanceList",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 表格数据
|
||||
list: [],
|
||||
// 默认排序
|
||||
defaultSort: {prop: 'createTime', order: 'descending'},
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
mobile: '',
|
||||
userId: '',
|
||||
orderSn: '',
|
||||
status: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
// 查询列表
|
||||
getList() {
|
||||
this.loading = true;
|
||||
getBalanceList(this.queryParams).then( response => {
|
||||
this.list = response.data.paginationResponse.content;
|
||||
this.total = response.data.paginationResponse.totalElements;
|
||||
this.catchTypeList = response.data.catchTypeList
|
||||
this.loading = false;
|
||||
}
|
||||
);
|
||||
},
|
||||
// 搜索按钮操作
|
||||
handleQuery() {
|
||||
this.queryParams.page = 1;
|
||||
this.getList();
|
||||
},
|
||||
// 重置按钮操作
|
||||
resetQuery() {
|
||||
this.dateRange = [];
|
||||
this.resetForm("queryForm");
|
||||
this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order)
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
// 排序触发事件
|
||||
handleSortChange(column, prop, order) {
|
||||
this.queryParams.orderByColumn = column.prop;
|
||||
this.queryParams.isAsc = column.order;
|
||||
this.getList();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
163
fuintAdmin_zt/src/views/financialStatement/runningWater/list.vue
Normal file
163
fuintAdmin_zt/src/views/financialStatement/runningWater/list.vue
Normal file
@ -0,0 +1,163 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" class="main-search" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="会员ID" prop="userId">
|
||||
<el-input
|
||||
v-model="queryParams.userId"
|
||||
placeholder="请输入会员ID"
|
||||
clearable
|
||||
style="width: 240px;"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="mobile">
|
||||
<el-input
|
||||
v-model="queryParams.mobile"
|
||||
placeholder="请输入会员手机号"
|
||||
clearable
|
||||
style="width: 240px;"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="状态"
|
||||
clearable
|
||||
>
|
||||
<el-option key="A" label="有效" value="A"/>
|
||||
<el-option key="N" label="无效" value="N"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="handleSortChange">
|
||||
<el-table-column label="ID" prop="id" width="80"/>
|
||||
<el-table-column label="会员ID" align="center" prop="userId" />
|
||||
<el-table-column label="手机号" align="center" prop="userInfo.mobile">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.userInfo.mobile">{{ scope.row.userInfo.mobile }}</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="会员名称" align="center" prop="userInfo.name">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.userInfo.name">
|
||||
<span>{{ scope.row.userInfo.name }}</span>
|
||||
</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="变动数量" align="center" prop="amount">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.amount > 0" style="color:forestgreen">+{{ scope.row.amount }}</span>
|
||||
<span v-else style="color:red">{{ scope.row.amount }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.description">{{ scope.row.description }}</span>
|
||||
<span v-else>无</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="时间" align="center" prop="createTime">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.createTime">{{ parseTime(scope.row.createTime) }}</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作人" align="center" prop="createTime">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.operator">{{ scope.row.operator }}</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.page"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getBalanceList } from "@/api/balance";
|
||||
export default {
|
||||
name: "BalanceList",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 表格数据
|
||||
list: [],
|
||||
// 默认排序
|
||||
defaultSort: {prop: 'createTime', order: 'descending'},
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
mobile: '',
|
||||
userId: '',
|
||||
orderSn: '',
|
||||
status: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
// 查询列表
|
||||
getList() {
|
||||
this.loading = true;
|
||||
getBalanceList(this.queryParams).then( response => {
|
||||
this.list = response.data.paginationResponse.content;
|
||||
this.total = response.data.paginationResponse.totalElements;
|
||||
this.catchTypeList = response.data.catchTypeList
|
||||
this.loading = false;
|
||||
}
|
||||
);
|
||||
},
|
||||
// 搜索按钮操作
|
||||
handleQuery() {
|
||||
this.queryParams.page = 1;
|
||||
this.getList();
|
||||
},
|
||||
// 重置按钮操作
|
||||
resetQuery() {
|
||||
this.dateRange = [];
|
||||
this.resetForm("queryForm");
|
||||
this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order)
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
// 排序触发事件
|
||||
handleSortChange(column, prop, order) {
|
||||
this.queryParams.orderByColumn = column.prop;
|
||||
this.queryParams.isAsc = column.order;
|
||||
this.getList();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -501,11 +501,11 @@ public class HandoverRecordServiceImpl implements HandoverRecordService {
|
||||
TscLibDll.INSTANCE.sendcommand("");
|
||||
TscLibDll.INSTANCE.sendcommand("------------交班统计------------");
|
||||
TscLibDll.INSTANCE.sendcommand("");
|
||||
TscLibDll.INSTANCE.sendcommand("油站名称:\t"+Optional.ofNullable(baseInfo.get("storeName")).orElse("未知油站"));
|
||||
TscLibDll.INSTANCE.sendcommand("收银员:\t"+Optional.ofNullable(baseInfo.get("realName")).orElse("未知姓名"));
|
||||
TscLibDll.INSTANCE.sendcommand("交班方式:\t"+Optional.ofNullable(baseInfo.get("handoverType")).orElse("未知"));
|
||||
TscLibDll.INSTANCE.sendcommand("开始时间:\t"+Optional.ofNullable(baseInfo.get("startTime")).orElse("-"));
|
||||
TscLibDll.INSTANCE.sendcommand("结束时间:\t"+Optional.ofNullable(baseInfo.get("endTime")).orElse("-"));
|
||||
TscLibDll.INSTANCE.sendcommand("油站名称:\t"+ Optional.ofNullable(baseInfo.get("storeName")).orElse("未知油站"));
|
||||
TscLibDll.INSTANCE.sendcommand("收银员:\t"+ Optional.ofNullable(baseInfo.get("realName")).orElse("未知姓名"));
|
||||
TscLibDll.INSTANCE.sendcommand("交班方式:\t"+ Optional.ofNullable(baseInfo.get("handoverType")).orElse("未知"));
|
||||
TscLibDll.INSTANCE.sendcommand("开始时间:\t"+ Optional.ofNullable(baseInfo.get("startTime")).orElse("-"));
|
||||
TscLibDll.INSTANCE.sendcommand("结束时间:\t"+ Optional.ofNullable(baseInfo.get("endTime")).orElse("-"));
|
||||
TscLibDll.INSTANCE.sendcommand("--------------------------------");
|
||||
TscLibDll.INSTANCE.sendcommand("当前版本:\t"+"V1.0.1");
|
||||
TscLibDll.INSTANCE.sendcommand("--------------------------------");
|
||||
|
@ -0,0 +1,94 @@
|
||||
package com.fuint.business.printer.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.printer.entity.PrintDeviceInfo;
|
||||
import com.fuint.business.printer.service.PrintDeviceInfoService;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* (PrintDeviceInfo)表控制层
|
||||
*
|
||||
* @author wangh
|
||||
* @since 2024-04-29 17:31:02
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/business/printDeviceInfo")
|
||||
public class PrintDeviceInfoController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private PrintDeviceInfoService printDeviceInfoService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param printDeviceInfo 筛选条件
|
||||
* @param pageNo 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
@GetMapping("queryByPage")
|
||||
public ResponseObject queryByPage(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||
@Param("printDeviceInfo") PrintDeviceInfo printDeviceInfo) {
|
||||
Page page = new Page(pageNo, pageSize);
|
||||
IPage<PrintDeviceInfo> iPageList = this.printDeviceInfoService.queryByPage(page, printDeviceInfo);
|
||||
return getSuccessResult(iPageList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
public ResponseObject queryById(@PathVariable("id") Integer id) {
|
||||
return getSuccessResult(this.printDeviceInfoService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param printDeviceInfo 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseObject add(@RequestBody PrintDeviceInfo printDeviceInfo) {
|
||||
return getSuccessResult(this.printDeviceInfoService.insert(printDeviceInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
* @param printDeviceInfo 实体
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseObject edit(@RequestBody PrintDeviceInfo printDeviceInfo) {
|
||||
|
||||
return getSuccessResult(this.printDeviceInfoService.update(printDeviceInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
@DeleteMapping
|
||||
public ResponseObject deleteById(Integer id) {
|
||||
return getSuccessResult(this.printDeviceInfoService.deleteById(id));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,304 @@
|
||||
package com.fuint.business.printer.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alipay.api.internal.util.codec.Base64;
|
||||
import com.fuint.business.printer.entity.Test;
|
||||
import com.fuint.business.printer.service.PrinterService;
|
||||
import com.fuint.business.printer.template.*;
|
||||
import com.fuint.business.printer.unit.Methods;
|
||||
import com.fuint.business.printer.vo.OrderPayment;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.Constants;
|
||||
import com.fuint.common.util.RedisUtil;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.yly.print_sdk_library.RequestMethod;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.cache.CacheProperties;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.GCMParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.PublicKey;
|
||||
import java.security.Signature;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/business/printer")
|
||||
@EnableWebMvc
|
||||
@Slf4j
|
||||
public class printerController extends BaseController {
|
||||
|
||||
@Resource
|
||||
PrinterService printerService;
|
||||
|
||||
@GetMapping("callback")
|
||||
public ResponseObject callback(Map<String , String> map){
|
||||
log.info("------print/callback-------");
|
||||
return getSuccessResult("");
|
||||
}
|
||||
|
||||
@GetMapping("push")
|
||||
public Map<String, String> push( Map<String , String> map){
|
||||
log.info("------接收GET回调-------");
|
||||
Map<String, String> objectObjectHashMap = new HashMap<>();
|
||||
objectObjectHashMap.put("message","ok");
|
||||
return objectObjectHashMap;
|
||||
}
|
||||
|
||||
@PostMapping("push")
|
||||
public Map<String, String> PostPush(
|
||||
@RequestParam("ciphertext") String ciphertext,
|
||||
@RequestParam("nonce") String nonce,
|
||||
@RequestParam("tag") String tag,
|
||||
@RequestParam("additional_data") String additional_data,
|
||||
@RequestParam("iv") String iv,
|
||||
@RequestParam("signature") String signature){
|
||||
|
||||
|
||||
return printerService.PostPush(ciphertext,nonce,tag,additional_data,iv,signature);
|
||||
}
|
||||
|
||||
@GetMapping("returnCode")
|
||||
public ResponseObject returnCode(String payAmount) {
|
||||
return getSuccessResult(printerService.returnCode(payAmount));
|
||||
}
|
||||
|
||||
//
|
||||
// public static final String publicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuiQQsY9lbZhtRoZIaBVN\n" +
|
||||
// "XKuAme47UCUv3RG2AYJXKQ/TyXBBY0JULSf4637Ug7JqGR1ohHFpY9XotG5J/7Ne\n" +
|
||||
// "safQApAz8QHKOa6+jqS0edafegjE7P0KqfQWvjUIbhAl5iXmiGLA/R6zLXxk8+PU\n" +
|
||||
// "toRu1rmzMPCsbGRG0uHOZ0nYez1LSM4k4k8o4/dl7NDr2CqXrfYQCEvGAAJay/bg\n" +
|
||||
// "h1B05cqFNuhQGvv55EX377QVZX7V0ZipIZhlzoh8pA0ZpzW/KndZ+pRYw6cPLvey\n" +
|
||||
// "qymRnTlCSQUDYQRlxaDppPbZcU1Krb9tZUmhJp+R9l73tJX8yN5wzbq6HATZbD1v\n" +
|
||||
// "BwIDAQAB";
|
||||
|
||||
|
||||
// @GetMapping("getToken")
|
||||
// public ResponseObject getToken(){
|
||||
//// Methods.()
|
||||
// //初始化控制器类
|
||||
// Methods m=Methods.getInstance();
|
||||
// //初始化终端信息
|
||||
// m.init("1038835098", "1595cb28ea30e98908e6334e735f4b8a");
|
||||
// //获取token
|
||||
// m.getFreedomToken();
|
||||
// System.out.println("123123123123123");
|
||||
// return getSuccessResult("");
|
||||
// }
|
||||
private static final String APP_KEY = "1073000501";
|
||||
private static final String APP_SECRET = "e0292ae66d9d21feaa895370d3a875aa";
|
||||
|
||||
// 授权
|
||||
@GetMapping("scancodemodel")
|
||||
public ResponseObject scancodemodel(){
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
String token = printerService.getToken(nowAccountInfo.getStoreId());
|
||||
// String token = printerService.getToken(138);
|
||||
return getSuccessResult(token);
|
||||
|
||||
}
|
||||
|
||||
// 发起网络支付
|
||||
@GetMapping("printIndex")
|
||||
public ResponseObject printIndex(BigDecimal payAmount) {
|
||||
|
||||
|
||||
|
||||
// Methods m=Methods.getInstance();
|
||||
// m.init("26845ee50f13467cacbaa099489a2fc152abd6f5");
|
||||
//
|
||||
// m.init(APP_KEY, APP_SECRET);
|
||||
//
|
||||
//// m.addPrinter("4004872261", "628023865417");
|
||||
// Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
// HashMap<String, String> objectObjectHashMap = new HashMap<>();
|
||||
//// <JSON>{"order_payment":{"pay_amount":"支付金额","pay_amount_source":3},"processed_state":0}</JSON>
|
||||
//
|
||||
//
|
||||
// Map<String, Object> orderPaymentMap = new HashMap<>();
|
||||
// orderPaymentMap.put("pay_amount", payAmount);
|
||||
//// orderPaymentMap.put("pay_amount", 0.01);
|
||||
// orderPaymentMap.put("pay_amount_source", 3);
|
||||
//
|
||||
// Map<String, Integer> processedStateMap = new HashMap<>();
|
||||
// processedStateMap.put("processed_state", 0);
|
||||
//
|
||||
// Map<String, Object> jsonDataMap = new HashMap<>();
|
||||
// jsonDataMap.put("order_payment", orderPaymentMap);
|
||||
// jsonDataMap.putAll(processedStateMap);
|
||||
//
|
||||
// Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
// String json = gson.toJson(jsonDataMap);
|
||||
//
|
||||
// String a = "<JSON>"+json+"</JSON>";
|
||||
// log.info("json:{}",a);
|
||||
//
|
||||
// String url=m.print("4004872261",a, System.currentTimeMillis()+random6.toString());
|
||||
//
|
||||
// // 使用 Fastjson 将 JSON 字符串解析为 JSONObject
|
||||
// JSONObject jsonObject = JSON.parseObject(url);
|
||||
//
|
||||
// // 将 JSONObject 转换为 Map
|
||||
// Map<String, Object> map = jsonObject.getInnerMap();
|
||||
// //获取支付参数
|
||||
// log.info("url:{}",url);
|
||||
// return getSuccessResult(map.get("error_description"));
|
||||
String s = printerService.printIndex(payAmount, TokenUtil.getNowAccountInfo().getStoreId());
|
||||
return getSuccessResult(s);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("doGet")
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
|
||||
Methods m=Methods.getInstance();
|
||||
// m.init(APP_KEY,APP_SECRET);
|
||||
m.init("26845ee50f13467cacbaa099489a2fc152abd6f5");
|
||||
|
||||
|
||||
response.setContentType("text/html");
|
||||
PrintWriter out = response.getWriter();
|
||||
//测试数据
|
||||
List<Test> testList = new ArrayList<Test>();
|
||||
Test t1 = new Test("麻辣牛肉", 23.00, 1,"1");
|
||||
Test t2 = new Test("麻辣牛肉", 23.00, 2,"2");
|
||||
Test t3 = new Test("精品千层肚", 24.00, 3,"3");
|
||||
Test t4 = new Test("麻辣牛肉", 23.00, 2,"1");
|
||||
Test t5 = new Test("极品鲜毛肚", 26.00, 2,"1");
|
||||
Test t6 = new Test("极品鲜毛肚", 26.00, 1,"2");
|
||||
Test t7 = new Test("极品鲜毛肚", 26.00, 3,"2");
|
||||
Test t8 = new Test("极品鲜毛肚", 26.00, 1,"1");
|
||||
Test t9 = new Test("极品鲜毛肚", 26.00, 2,"3");
|
||||
testList.add(t1);
|
||||
testList.add(t2);
|
||||
testList.add(t3);
|
||||
testList.add(t4);
|
||||
testList.add(t5);
|
||||
testList.add(t6);
|
||||
testList.add(t7);
|
||||
testList.add(t8);
|
||||
testList.add(t9);
|
||||
Prient.setTestList(testList);
|
||||
|
||||
//关键代码,自己的程序发送请求
|
||||
//初始化控制器类
|
||||
// Methods m=Methods.getInstance();
|
||||
//初始化终端信息
|
||||
m.init(APP_KEY, APP_SECRET);
|
||||
//获取token
|
||||
// m.getFreedomToken();
|
||||
//刷新token
|
||||
// m.refreshToken();
|
||||
//添加授权
|
||||
m.addPrinter("4004872261", "628023865417");
|
||||
//打印
|
||||
//终端编号 打印内容 订单号
|
||||
//生成6位随机数
|
||||
Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
String url=m.print("4004872261", Prient.print(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
response.sendRedirect(url);
|
||||
out.flush();
|
||||
out.close();
|
||||
}
|
||||
|
||||
@PostMapping("getHandover")
|
||||
public void getHandover(@RequestBody Map<String, Object> handover) {
|
||||
// Methods m=Methods.getInstance();
|
||||
// m.init("26845ee50f13467cacbaa099489a2fc152abd6f5");
|
||||
//
|
||||
// m.init(APP_KEY, APP_SECRET);
|
||||
// Handover.setHandover(handover);
|
||||
// // m.addPrinter("4004872261", "628023865417");
|
||||
// Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
// String url=m.print("4004872261", Handover.printHandover(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
printerService.getHandover(handover,TokenUtil.getNowAccountInfo().getStoreId());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 收银台商品打印
|
||||
* @param oilOrder
|
||||
*/
|
||||
@PostMapping("printOilOrderReport")
|
||||
public void oilOrderReport(@RequestBody Map<String, Object> oilOrder) {
|
||||
// log.info("handover:{}",handover.toString());
|
||||
// Methods m=Methods.getInstance();
|
||||
// m.init("26845ee50f13467cacbaa099489a2fc152abd6f5");
|
||||
//
|
||||
// m.init(APP_KEY, APP_SECRET);
|
||||
// PrintOilOrderReport.setHandover(handover);
|
||||
// Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
// String url=m.print("4004872261", PrintOilOrderReport.printOilOrder(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
printerService.oilOrderReport(oilOrder,TokenUtil.getNowAccountInfo().getStoreId());
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("rePrintOilOrderReport")
|
||||
public void reOilOrderReport(@RequestBody Map<String, Object> oilOrder) {
|
||||
printerService.reOilOrderReport(oilOrder,TokenUtil.getNowAccountInfo().getStoreId());
|
||||
}
|
||||
/**
|
||||
* 余额充值订单
|
||||
* @param cardValue
|
||||
*/
|
||||
@PostMapping("printCardValueReport")
|
||||
public void printCardValueReport(@RequestBody Map<String, Object> cardValue) {
|
||||
// log.info("handover:{}",cardValue.toString());
|
||||
// Methods m=Methods.getInstance();
|
||||
// m.init("26845ee50f13467cacbaa099489a2fc152abd6f5");
|
||||
//
|
||||
// m.init(APP_KEY, APP_SECRET);
|
||||
// PrintCardValueReport.setHandover(cardValue);
|
||||
// Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
// String url=m.print("4004872261", PrintCardValueReport.printOilOrder(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
printerService.printCardValueReport(cardValue, TokenUtil.getNowAccountInfo().getStoreId());
|
||||
|
||||
}
|
||||
/**
|
||||
* 油卡充值订单
|
||||
* @param fuelDiesel
|
||||
*/
|
||||
@PostMapping("printFuelDieselReport")
|
||||
public void printFuelDieselReport(@RequestBody Map<String, Object> fuelDiesel) {
|
||||
// log.info("handover:{}",fuelDiesel.toString());
|
||||
// Methods m=Methods.getInstance();
|
||||
// m.init("26845ee50f13467cacbaa099489a2fc152abd6f5");
|
||||
//
|
||||
// m.init(APP_KEY, APP_SECRET);
|
||||
// PrintFuelDieselReport.setHandover(fuelDiesel);
|
||||
// Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
// String url=m.print("4004872261", PrintFuelDieselReport.printFeulOrder(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
printerService.printFuelDieselReport(fuelDiesel,TokenUtil.getNowAccountInfo().getStoreId());
|
||||
|
||||
}
|
||||
@PostMapping("printIntegralReport")
|
||||
public void printIntegralReport(@RequestBody Map<String, Object> integral) {
|
||||
printerService.printIntegralReport(integral,TokenUtil.getNowAccountInfo().getStoreId());
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
package com.fuint.business.printer.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fuint.repository.model.base.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* (PrintDeviceInfo)实体类
|
||||
*
|
||||
* @author wangh
|
||||
* @since 2024-04-29 17:31:03
|
||||
*/
|
||||
@Data
|
||||
public class PrintDeviceInfo extends BaseEntity {
|
||||
private static final long serialVersionUID = -94445696460905744L;
|
||||
|
||||
private Integer id;
|
||||
/**
|
||||
* 设备终端号
|
||||
*/
|
||||
private String machineCode;
|
||||
/**
|
||||
* 设备密钥
|
||||
*/
|
||||
private String msign;
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String deviceName;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private String userId;
|
||||
/**
|
||||
* 应用id(APP_KEY)
|
||||
*/
|
||||
private String appKey;
|
||||
/**
|
||||
* 应用密钥(APP_SECRET)
|
||||
*/
|
||||
private String appSecret;
|
||||
/**
|
||||
* 应用公钥(key)
|
||||
*/
|
||||
private String appPublicKey;
|
||||
/**
|
||||
* 平台公钥(publicKey)
|
||||
*/
|
||||
private String platformPublicKey;
|
||||
/**
|
||||
* token
|
||||
*/
|
||||
private String accessToken;
|
||||
/**
|
||||
* 付款二维码:域名+storeId
|
||||
*/
|
||||
private String payment;
|
||||
private Boolean isAcquiesce;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Integer storeId;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,51 @@
|
||||
package com.fuint.business.printer.entity;
|
||||
|
||||
/**
|
||||
* 菜品对象
|
||||
* @author admin
|
||||
*
|
||||
*/
|
||||
public class Test {
|
||||
// 菜品名称
|
||||
private String name;
|
||||
// 价格
|
||||
private double money;
|
||||
// 数量
|
||||
private Integer num;
|
||||
//菜品分类
|
||||
private String fenlei;
|
||||
public Test() {
|
||||
super();
|
||||
}
|
||||
public Test(String name, double money, Integer num,String fenlei) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.money = money;
|
||||
this.num = num;
|
||||
this.fenlei=fenlei;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public double getMoney() {
|
||||
return money;
|
||||
}
|
||||
public void setMoney(double money) {
|
||||
this.money = money;
|
||||
}
|
||||
public Integer getNum() {
|
||||
return num;
|
||||
}
|
||||
public void setNum(Integer num) {
|
||||
this.num = num;
|
||||
}
|
||||
public String getFenlei() {
|
||||
return fenlei;
|
||||
}
|
||||
public void setFenlei(String fenlei) {
|
||||
this.fenlei = fenlei;
|
||||
}
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
package com.fuint.business.printer.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.printer.entity.PrintDeviceInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (PrintDeviceInfo)表数据库访问层
|
||||
*
|
||||
* @author wangh
|
||||
* @since 2024-04-29 17:31:02
|
||||
*/
|
||||
public interface PrintDeviceInfoMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
PrintDeviceInfo queryById(Integer id);
|
||||
PrintDeviceInfo getInfoByStoreId(Integer storeId);
|
||||
|
||||
/**
|
||||
* 查询指定行数据
|
||||
*
|
||||
* @param printDeviceInfo 查询条件
|
||||
* @param page 分页对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
IPage<PrintDeviceInfo> queryAllByLimit(@Param("page") Page page, @Param("printDeviceInfo") PrintDeviceInfo printDeviceInfo);
|
||||
|
||||
/**
|
||||
* 统计总行数
|
||||
*
|
||||
* @param printDeviceInfo 查询条件
|
||||
* @return 总行数
|
||||
*/
|
||||
long count(PrintDeviceInfo printDeviceInfo);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param printDeviceInfo 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(PrintDeviceInfo printDeviceInfo);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<PrintDeviceInfo> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<PrintDeviceInfo> entities);
|
||||
|
||||
/**
|
||||
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<PrintDeviceInfo> 实例对象列表
|
||||
* @return 影响行数
|
||||
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
|
||||
*/
|
||||
int insertOrUpdateBatch(@Param("entities") List<PrintDeviceInfo> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param printDeviceInfo 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(PrintDeviceInfo printDeviceInfo);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
int updateIsAcquiesce(Integer storeId);
|
||||
int getIsAcquiesceByStoreId(Integer storeId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,217 @@
|
||||
<?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.fuint.business.printer.mapper.PrintDeviceInfoMapper">
|
||||
|
||||
<resultMap type="com.fuint.business.printer.entity.PrintDeviceInfo" id="PrintDeviceInfoMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="machineCode" column="machine_code" jdbcType="VARCHAR"/>
|
||||
<result property="msign" column="msign" jdbcType="VARCHAR"/>
|
||||
<result property="deviceName" column="device_name" jdbcType="VARCHAR"/>
|
||||
<result property="userId" column="user_id" jdbcType="VARCHAR"/>
|
||||
<result property="appKey" column="app_key" jdbcType="VARCHAR"/>
|
||||
<result property="appSecret" column="app_secret" jdbcType="VARCHAR"/>
|
||||
<result property="appPublicKey" column="app_public_key" jdbcType="VARCHAR"/>
|
||||
<result property="platformPublicKey" column="platform_public_key" jdbcType="VARCHAR"/>
|
||||
<result property="accessToken" column="access_token" jdbcType="VARCHAR"/>
|
||||
<result property="payment" column="payment" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
||||
<result property="isAcquiesce" column="is_acquiesce" jdbcType="VARCHAR"/>
|
||||
<result property="storeId" column="store_id" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="PrintDeviceInfoMap">
|
||||
select
|
||||
id,machine_code,msign,device_name,user_id,app_key,app_secret,app_public_key,platform_public_key,access_token,payment,create_time,update_time,create_by,update_by,store_id ,is_acquiesce from print_device_info
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAllByLimit" resultMap="PrintDeviceInfoMap">
|
||||
select
|
||||
id,machine_code,msign,device_name,user_id,app_key,app_secret,app_public_key,platform_public_key,access_token,payment,create_time,update_time,create_by,update_by,store_id,is_acquiesce from print_device_info
|
||||
<where>
|
||||
<if test="printDeviceInfo.id != null">
|
||||
and id = #{printDeviceInfo.id}
|
||||
</if>
|
||||
<if test="printDeviceInfo.machineCode != null and printDeviceInfo.machineCode != ''">
|
||||
and machine_code = #{printDeviceInfo.machineCode}
|
||||
</if>
|
||||
<if test="printDeviceInfo.msign != null and printDeviceInfo.msign != ''">
|
||||
and msign = #{printDeviceInfo.msign}
|
||||
</if>
|
||||
<if test="printDeviceInfo.deviceName != null and printDeviceInfo.deviceName != ''">
|
||||
and device_name = #{printDeviceInfo.deviceName}
|
||||
</if>
|
||||
<if test="printDeviceInfo.userId != null and printDeviceInfo.userId != ''">
|
||||
and user_id = #{printDeviceInfo.userId}
|
||||
</if>
|
||||
|
||||
<if test="printDeviceInfo.storeId != null">
|
||||
and store_id = #{printDeviceInfo.storeId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from print_device_info
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="machineCode != null and machineCode != ''">
|
||||
and machine_code = #{machineCode}
|
||||
</if>
|
||||
<if test="msign != null and msign != ''">
|
||||
and msign = #{msign}
|
||||
</if>
|
||||
<if test="deviceName != null and deviceName != ''">
|
||||
and device_name = #{deviceName}
|
||||
</if>
|
||||
<if test="userId != null and userId != ''">
|
||||
and user_id = #{userId}
|
||||
</if>
|
||||
<if test="appKey != null and appKey != ''">
|
||||
and app_key = #{appKey}
|
||||
</if>
|
||||
<if test="appSecret != null and appSecret != ''">
|
||||
and app_secret = #{appSecret}
|
||||
</if>
|
||||
<if test="appPublicKey != null and appPublicKey != ''">
|
||||
and app_public_key = #{appPublicKey}
|
||||
</if>
|
||||
<if test="platformPublicKey != null and platformPublicKey != ''">
|
||||
and platform_public_key = #{platformPublicKey}
|
||||
</if>
|
||||
<if test="accessToken != null and accessToken != ''">
|
||||
and access_token = #{accessToken}
|
||||
</if>
|
||||
<if test="payment != null and payment != ''">
|
||||
and payment = #{payment}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
<if test="storeId != null">
|
||||
and store_id = #{storeId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getInfoByStoreId" resultType="com.fuint.business.printer.entity.PrintDeviceInfo">
|
||||
select
|
||||
id,machine_code,msign,device_name,user_id,app_key,app_secret,app_public_key,platform_public_key,access_token,payment,create_time,update_time,create_by,update_by,store_id ,is_acquiesce from print_device_info
|
||||
where store_id = #{storeId} and is_acquiesce = true limit 1
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into print_device_info(is_acquiesce,machine_code,msign,device_name,user_id,app_key,app_secret,app_public_key,platform_public_key,access_token,payment,create_time,update_time,create_by,update_by,store_id )
|
||||
values (#{is_acquiesce},#{machineCode},#{msign},#{deviceName},#{userId},
|
||||
#{appKey},#{appSecret},#{appPublicKey},#{platformPublicKey},#{accessToken},#{payment},
|
||||
#{createTime},#{updateTime},#{createBy},#{updateBy},#{storeId})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into print_device_info(machine_code,msign,device_name,user_id,app_key,app_secret,app_public_key,platform_public_key,access_token,payment,create_time,update_time,create_by,update_by,store_id )
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(
|
||||
#{entity.machineCode}#{entity.msign}#{entity.deviceName}#{entity.userId}#{entity.appKey}#{entity.appSecret}#{entity.appPublicKey}#{entity.platformPublicKey}#{entity.accessToken}#{entity.payment}#{entity.createTime}#{entity.updateTime}#{entity.createBy}#{entity.updateBy}#{entity.storeId}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into print_device_info(machine_code,msign,device_name,user_id,app_key,app_secret,app_public_key,platform_public_key,access_token,payment,create_time,update_time,create_by,update_by,store_id )
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.machineCode}#{entity.msign}#{entity.deviceName}#{entity.userId}#{entity.appKey}#{entity.appSecret}#{entity.appPublicKey}#{entity.platformPublicKey}#{entity.accessToken}#{entity.payment}#{entity.createTime}#{entity.updateTime}#{entity.createBy}#{entity.updateBy}#{entity.storeId})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
machine_code = values(machine_code)msign = values(msign)device_name = values(device_name)user_id = values(user_id)app_key = values(app_key)app_secret = values(app_secret)app_public_key = values(app_public_key)platform_public_key = values(platform_public_key)access_token = values(access_token)payment = values(payment)create_time = values(create_time)update_time = values(update_time)create_by = values(create_by)update_by = values(update_by)store_id = values(store_id)
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update print_device_info
|
||||
<set>
|
||||
<if test="machineCode != null and machineCode != ''">
|
||||
machine_code = #{machineCode},
|
||||
</if>
|
||||
<if test="msign != null and msign != ''">
|
||||
msign = #{msign},
|
||||
</if>
|
||||
<if test="deviceName != null and deviceName != ''">
|
||||
device_name = #{deviceName},
|
||||
</if>
|
||||
<if test="userId != null and userId != ''">
|
||||
user_id = #{userId},
|
||||
</if>
|
||||
<if test="appKey != null and appKey != ''">
|
||||
app_key = #{appKey},
|
||||
</if>
|
||||
<if test="appSecret != null and appSecret != ''">
|
||||
app_secret = #{appSecret},
|
||||
</if>
|
||||
<if test="appPublicKey != null and appPublicKey != ''">
|
||||
app_public_key = #{appPublicKey},
|
||||
</if>
|
||||
<if test="platformPublicKey != null and platformPublicKey != ''">
|
||||
platform_public_key = #{platformPublicKey},
|
||||
</if>
|
||||
<if test="accessToken != null and accessToken != ''">
|
||||
access_token = #{accessToken},
|
||||
</if>
|
||||
<if test="payment != null and payment != ''">
|
||||
payment = #{payment},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
create_by = #{createBy},
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
update_by = #{updateBy},
|
||||
</if>
|
||||
<if test="storeId != null">
|
||||
store_id = #{storeId},
|
||||
</if>
|
||||
<if test="isAcquiesce != null">
|
||||
is_acquiesce = #{isAcquiesce},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete from print_device_info where id = #{id}
|
||||
</delete>
|
||||
<update id="updateIsAcquiesce">
|
||||
update print_device_info set is_acquiesce = false where store_id = #{storeId}
|
||||
</update>
|
||||
|
||||
<select id="getIsAcquiesceByStoreId" resultType="java.lang.Integer">
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -0,0 +1,58 @@
|
||||
package com.fuint.business.printer.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.printer.entity.PrintDeviceInfo;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
|
||||
|
||||
/**
|
||||
* (PrintDeviceInfo)表服务接口
|
||||
*
|
||||
* @author wangh
|
||||
* @since 2024-04-29 17:31:03
|
||||
*/
|
||||
public interface PrintDeviceInfoService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
PrintDeviceInfo queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param printDeviceInfo 筛选条件
|
||||
* @param page 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
IPage<PrintDeviceInfo> queryByPage(@Param("page") Page page, PrintDeviceInfo printDeviceInfo);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param printDeviceInfo 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
PrintDeviceInfo insert(PrintDeviceInfo printDeviceInfo);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param printDeviceInfo 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
PrintDeviceInfo update(PrintDeviceInfo printDeviceInfo);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteById(Integer id);
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.fuint.business.printer.service;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map;
|
||||
|
||||
public interface PrinterService {
|
||||
|
||||
Map<String, String> PostPush(
|
||||
@RequestParam("ciphertext") String ciphertext,
|
||||
@RequestParam("nonce") String nonce,
|
||||
@RequestParam("tag") String tag,
|
||||
@RequestParam("additional_data") String additional_data,
|
||||
@RequestParam("iv") String iv,
|
||||
@RequestParam("signature") String signature);
|
||||
|
||||
String returnCode(String payAmount);
|
||||
|
||||
String getToken(Integer storeId);
|
||||
|
||||
String printIndex(BigDecimal payAmount,Integer storeId);
|
||||
|
||||
void getHandover(Map<String, Object> handover,Integer storeId);
|
||||
void oilOrderReport(Map<String, Object> handover,Integer storeId);
|
||||
void reOilOrderReport(Map<String, Object> oilOrder, Integer storeId);
|
||||
|
||||
void printCardValueReport(Map<String, Object> printCardValue,Integer storeId);
|
||||
void printFuelDieselReport(Map<String, Object> printCardValue,Integer storeId);
|
||||
|
||||
|
||||
void printIntegralReport(Map<String, Object> integral, Integer storeId);
|
||||
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.fuint.business.printer.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.printer.entity.PrintDeviceInfo;
|
||||
import com.fuint.business.printer.mapper.PrintDeviceInfoMapper;
|
||||
import com.fuint.business.printer.service.PrintDeviceInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
|
||||
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* (PrintDeviceInfo)表服务实现类
|
||||
*
|
||||
* @author wangh
|
||||
* @since 2024-04-29 17:31:03
|
||||
*/
|
||||
@Service("printDeviceInfoService")
|
||||
public class PrintDeviceInfoServiceImpl implements PrintDeviceInfoService {
|
||||
@Resource
|
||||
private PrintDeviceInfoMapper printDeviceInfoMapper;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public PrintDeviceInfo queryById(Integer id) {
|
||||
return this.printDeviceInfoMapper.queryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param printDeviceInfo 筛选条件
|
||||
* @param page 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public IPage<PrintDeviceInfo> queryByPage(@Param("page") Page page, PrintDeviceInfo printDeviceInfo) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
printDeviceInfo.setStoreId(nowAccountInfo.getStoreId());
|
||||
return this.printDeviceInfoMapper.queryAllByLimit(page, printDeviceInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param printDeviceInfo 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public PrintDeviceInfo insert(PrintDeviceInfo printDeviceInfo) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
printDeviceInfo.setStoreId(nowAccountInfo.getStoreId());
|
||||
if (printDeviceInfo.getIsAcquiesce()) {
|
||||
printDeviceInfoMapper.updateIsAcquiesce(nowAccountInfo.getStoreId());
|
||||
}
|
||||
this.printDeviceInfoMapper.insert(printDeviceInfo);
|
||||
return printDeviceInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param printDeviceInfo 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public PrintDeviceInfo update(PrintDeviceInfo printDeviceInfo) {
|
||||
if (printDeviceInfo.getIsAcquiesce()) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
printDeviceInfoMapper.updateIsAcquiesce(nowAccountInfo.getStoreId());
|
||||
}
|
||||
this.printDeviceInfoMapper.update(printDeviceInfo);
|
||||
return this.queryById(printDeviceInfo.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteById(Integer id) {
|
||||
return this.printDeviceInfoMapper.deleteById(id) > 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,366 @@
|
||||
package com.fuint.business.printer.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alipay.api.internal.util.codec.Base64;
|
||||
import com.fuint.business.printer.entity.PrintDeviceInfo;
|
||||
import com.fuint.business.printer.mapper.PrintDeviceInfoMapper;
|
||||
import com.fuint.business.printer.service.PrintDeviceInfoService;
|
||||
import com.fuint.business.printer.service.PrinterService;
|
||||
import com.fuint.business.printer.template.*;
|
||||
import com.fuint.business.printer.unit.Methods;
|
||||
import com.fuint.business.printer.vo.OrderPayment;
|
||||
import com.fuint.common.util.RedisUtil;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.yly.print_sdk_library.RequestMethod;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.GCMParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.PublicKey;
|
||||
import java.security.Signature;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PrinterServiceImpl implements PrinterService {
|
||||
|
||||
private static String code = new String();
|
||||
|
||||
public static final String publicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuiQQsY9lbZhtRoZIaBVN\n" +
|
||||
"XKuAme47UCUv3RG2AYJXKQ/TyXBBY0JULSf4637Ug7JqGR1ohHFpY9XotG5J/7Ne\n" +
|
||||
"safQApAz8QHKOa6+jqS0edafegjE7P0KqfQWvjUIbhAl5iXmiGLA/R6zLXxk8+PU\n" +
|
||||
"toRu1rmzMPCsbGRG0uHOZ0nYez1LSM4k4k8o4/dl7NDr2CqXrfYQCEvGAAJay/bg\n" +
|
||||
"h1B05cqFNuhQGvv55EX377QVZX7V0ZipIZhlzoh8pA0ZpzW/KndZ+pRYw6cPLvey\n" +
|
||||
"qymRnTlCSQUDYQRlxaDppPbZcU1Krb9tZUmhJp+R9l73tJX8yN5wzbq6HATZbD1v\n" +
|
||||
"BwIDAQAB";
|
||||
|
||||
|
||||
@Resource
|
||||
PrintDeviceInfoService printDeviceInfoService;
|
||||
@Resource
|
||||
PrintDeviceInfoMapper printDeviceInfoMapper;
|
||||
|
||||
@Override
|
||||
public Map<String, String> PostPush(String ciphertext, String nonce, String tag, String additional_data, String iv, String signature) {
|
||||
System.out.println("PostMapping"+ciphertext);
|
||||
code = new String();
|
||||
Map<String, String> objectObjectHashMap = new HashMap<>();
|
||||
objectObjectHashMap.put("message","ok");
|
||||
verifySign(ciphertext,signature);
|
||||
try {
|
||||
String decrypte = decrypte(ciphertext, iv, tag);
|
||||
// 使用 Fastjson 将 JSON 字符串解析为 JSONObject
|
||||
JSONObject jsonObject = JSON.parseObject(decrypte);
|
||||
|
||||
// 将 JSONObject 转换为 Map
|
||||
Map<String, Object> map = jsonObject.getInnerMap();
|
||||
//获取支付参数
|
||||
Map<String, Object> orderPaymentMap = (Map<String, Object>) map.get("order_payment");
|
||||
OrderPayment orderPayment = new OrderPayment();
|
||||
orderPayment.setOrderPayment(orderPaymentMap.get("pay_amount").toString());
|
||||
orderPayment.setScannedCode(orderPaymentMap.get("scanned_code").toString());
|
||||
|
||||
RedisUtil.set(orderPaymentMap.get("scanned_code").toString(), orderPaymentMap.get("pay_amount").toString(), 100);
|
||||
code = orderPaymentMap.get("scanned_code").toString();
|
||||
log.info("--获取打印回调--{}",jsonObject);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return objectObjectHashMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String returnCode(String payAmount) {
|
||||
String thisCode = code;
|
||||
code = new String();
|
||||
if (ObjectUtil.isEmpty(thisCode)) {
|
||||
return "300";
|
||||
}
|
||||
// if (RedisUtil.get(thisCode)) {
|
||||
return thisCode;
|
||||
// }else {
|
||||
// return getSuccessResult("301");
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getToken(Integer storeId) {
|
||||
PrintDeviceInfo infoByStoreId = printDeviceInfoMapper.getInfoByStoreId(storeId);
|
||||
RequestMethod.getInstance().init(infoByStoreId.getAppKey(),infoByStoreId.getAppSecret());
|
||||
|
||||
try {
|
||||
// String resJson = RequestMethod.getInstance().scanCodeModel_msign("4004872261", "628023865417");
|
||||
String resJson = RequestMethod.getInstance().scanCodeModel_msign(infoByStoreId.getMachineCode(), infoByStoreId.getMsign());
|
||||
log.info("--yilianyunAccessToken--{}",resJson);
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(resJson);
|
||||
String errorDescription = jsonObject.getString("error_description"); // success
|
||||
if ("success".equals(errorDescription)) {
|
||||
JSONObject body = jsonObject.getJSONObject("body");
|
||||
String accessToken = body.getString("access_token");
|
||||
RedisUtil.set("scancodemodel+"+storeId,accessToken,60*60*24*20);
|
||||
return accessToken;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return "error";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String printIndex(BigDecimal payAmount,Integer storeId){
|
||||
Methods m=Methods.getInstance();
|
||||
Object accessToken = RedisUtil.get("scancodemodel+" + storeId);
|
||||
if (ObjectUtil.isNotEmpty(accessToken)) {
|
||||
m.init(accessToken.toString());
|
||||
} else {
|
||||
String token = getToken(storeId);
|
||||
if ("error".equals(token)) {
|
||||
throw new RuntimeException("获取参数失败,无法打印");
|
||||
}else {
|
||||
m.init(token);
|
||||
}
|
||||
}
|
||||
PrintDeviceInfo infoByStoreId = printDeviceInfoMapper.getInfoByStoreId(storeId);
|
||||
m.init(infoByStoreId.getAppKey(), infoByStoreId.getAppSecret());
|
||||
Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
|
||||
// HashMap<String, String> objectObjectHashMap = new HashMap<>();
|
||||
Map<String, Object> orderPaymentMap = new HashMap<>();
|
||||
orderPaymentMap.put("pay_amount", payAmount);
|
||||
// orderPaymentMap.put("pay_amount", 0.01);
|
||||
|
||||
orderPaymentMap.put("pay_amount_source", 3);
|
||||
Map<String, Integer> processedStateMap = new HashMap<>();
|
||||
processedStateMap.put("processed_state", 0);
|
||||
Map<String, Object> jsonDataMap = new HashMap<>();
|
||||
jsonDataMap.put("order_payment", orderPaymentMap);
|
||||
jsonDataMap.putAll(processedStateMap);
|
||||
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
String json = gson.toJson(jsonDataMap);
|
||||
|
||||
String jsonData = "<JSON>"+json+"</JSON>";
|
||||
log.info("json:{}",jsonData);
|
||||
|
||||
String url=m.print(infoByStoreId.getMachineCode(),jsonData, System.currentTimeMillis()+random6.toString());
|
||||
|
||||
// 使用 Fastjson 将 JSON 字符串解析为 JSONObject
|
||||
JSONObject jsonObject = JSON.parseObject(url);
|
||||
|
||||
// 将 JSONObject 转换为 Map
|
||||
Map<String, Object> map = jsonObject.getInnerMap();
|
||||
//获取支付参数
|
||||
log.info("url:{}",url);
|
||||
return map.get("error_description").toString();
|
||||
}
|
||||
|
||||
// 打印交接班
|
||||
public void getHandover(Map<String, Object> handover,Integer storeId) {
|
||||
PrintDeviceInfo infoByStoreId = printDeviceInfoMapper.getInfoByStoreId(storeId);
|
||||
|
||||
Methods m=Methods.getInstance();
|
||||
Object accessToken = RedisUtil.get("scancodemodel+" + storeId);
|
||||
if (ObjectUtil.isNotEmpty(accessToken)) {
|
||||
m.init(accessToken.toString());
|
||||
} else {
|
||||
String token = getToken(storeId);
|
||||
if ("error".equals(token)) {
|
||||
throw new RuntimeException("获取参数失败,无法打印");
|
||||
}else {
|
||||
m.init(token);
|
||||
}
|
||||
}
|
||||
m.init(infoByStoreId.getAppKey(), infoByStoreId.getAppSecret());
|
||||
Handover.setHandover(handover);
|
||||
Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
String url=m.print(infoByStoreId.getMachineCode(), Handover.printHandover(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
|
||||
}
|
||||
|
||||
public void oilOrderReport(Map<String, Object> oilOrder,Integer storeId) {
|
||||
PrintDeviceInfo infoByStoreId = printDeviceInfoMapper.getInfoByStoreId(storeId);
|
||||
|
||||
Methods m=Methods.getInstance();
|
||||
Object accessToken = RedisUtil.get("scancodemodel+" + storeId);
|
||||
if (ObjectUtil.isNotEmpty(accessToken)) {
|
||||
m.init(accessToken.toString());
|
||||
} else {
|
||||
String token = getToken(storeId);
|
||||
if ("error".equals(token)) {
|
||||
throw new RuntimeException("获取参数失败,无法打印");
|
||||
}else {
|
||||
m.init(token);
|
||||
} }
|
||||
m.init(infoByStoreId.getAppKey(), infoByStoreId.getAppSecret());
|
||||
PrintOilOrderReport.setHandover(oilOrder);
|
||||
Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
String url=m.print(infoByStoreId.getMachineCode(), PrintOilOrderReport.printOilOrder(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
}
|
||||
public void reOilOrderReport(Map<String, Object> oilOrder,Integer storeId) {
|
||||
PrintDeviceInfo infoByStoreId = printDeviceInfoMapper.getInfoByStoreId(storeId);
|
||||
|
||||
Methods m=Methods.getInstance();
|
||||
Object accessToken = RedisUtil.get("scancodemodel+" + storeId);
|
||||
if (ObjectUtil.isNotEmpty(accessToken)) {
|
||||
m.init(accessToken.toString());
|
||||
} else {
|
||||
String token = getToken(storeId);
|
||||
if ("error".equals(token)) {
|
||||
throw new RuntimeException("获取参数失败,无法打印");
|
||||
}else {
|
||||
m.init(token);
|
||||
} }
|
||||
m.init(infoByStoreId.getAppKey(), infoByStoreId.getAppSecret());
|
||||
RePrintOilOrderReport.setHandover(oilOrder);
|
||||
Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
String url=m.print(infoByStoreId.getMachineCode(), RePrintOilOrderReport.rePrintOilOrder(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
}
|
||||
|
||||
public void printCardValueReport(Map<String, Object> cardValue,Integer storeId) {
|
||||
PrintDeviceInfo infoByStoreId = printDeviceInfoMapper.getInfoByStoreId(storeId);
|
||||
|
||||
log.info("handover:{}",cardValue.toString());
|
||||
Methods m=Methods.getInstance();
|
||||
Object accessToken = RedisUtil.get("scancodemodel+" + storeId);
|
||||
if (ObjectUtil.isNotEmpty(accessToken)) {
|
||||
m.init(accessToken.toString());
|
||||
} else {
|
||||
String token = getToken(storeId);
|
||||
if ("error".equals(token)) {
|
||||
throw new RuntimeException("获取参数失败,无法打印");
|
||||
}else {
|
||||
m.init(token);
|
||||
}
|
||||
}
|
||||
m.init(infoByStoreId.getAppKey(), infoByStoreId.getAppSecret());
|
||||
PrintCardValueReport.setHandover(cardValue);
|
||||
Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
String url=m.print(infoByStoreId.getMachineCode(), PrintCardValueReport.printOilOrder(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
|
||||
}
|
||||
public void printFuelDieselReport(Map<String, Object> fuelDiesel,Integer storeId) {
|
||||
PrintDeviceInfo infoByStoreId = printDeviceInfoMapper.getInfoByStoreId(storeId);
|
||||
|
||||
log.info("handover:{}",fuelDiesel.toString());
|
||||
Methods m=Methods.getInstance();
|
||||
Object accessToken = RedisUtil.get("scancodemodel+" + storeId);
|
||||
if (ObjectUtil.isNotEmpty(accessToken)) {
|
||||
m.init(accessToken.toString());
|
||||
} else {
|
||||
String token = getToken(storeId);
|
||||
if ("error".equals(token)) {
|
||||
throw new RuntimeException("获取参数失败,无法打印");
|
||||
}else {
|
||||
m.init(token);
|
||||
}
|
||||
}
|
||||
m.init(infoByStoreId.getAppKey(), infoByStoreId.getAppSecret());
|
||||
PrintFuelDieselReport.setHandover(fuelDiesel);
|
||||
Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
String url=m.print(infoByStoreId.getMachineCode(), PrintFuelDieselReport.printFeulOrder(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
|
||||
}
|
||||
|
||||
public void printIntegralReport(Map<String, Object> integral,Integer storeId) {
|
||||
PrintDeviceInfo infoByStoreId = printDeviceInfoMapper.getInfoByStoreId(storeId);
|
||||
|
||||
log.info("handover:{}",integral.toString());
|
||||
Methods m=Methods.getInstance();
|
||||
Object accessToken = RedisUtil.get("scancodemodel+" + storeId);
|
||||
if (ObjectUtil.isNotEmpty(accessToken)) {
|
||||
m.init(accessToken.toString());
|
||||
} else {
|
||||
String token = getToken(storeId);
|
||||
if ("error".equals(token)) {
|
||||
throw new RuntimeException("获取参数失败,无法打印");
|
||||
}else {
|
||||
m.init(token);
|
||||
}
|
||||
}
|
||||
m.init(infoByStoreId.getAppKey(), infoByStoreId.getAppSecret());
|
||||
PrintIntegralReport.setHandover(integral);
|
||||
Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
String url=m.print(infoByStoreId.getMachineCode(), PrintIntegralReport.printIntegral(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
|
||||
}
|
||||
|
||||
public void verifySign(String ciphertext, String signature) {
|
||||
// 交易报文中ciphertext与signature
|
||||
byte[] signatureByte = Base64.decodeBase64String(signature);
|
||||
byte[] publicKeyByte = Base64.decodeBase64String(publicKey);
|
||||
try {
|
||||
System.out.println("验签结果:" + verify(ciphertext.getBytes(), signatureByte, publicKeyByte));
|
||||
boolean verify = verify(ciphertext.getBytes(), signatureByte, publicKeyByte);
|
||||
} catch (GeneralSecurityException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 第二步:解析参数
|
||||
*/
|
||||
public String decrypte(String ciphertext,
|
||||
String iv,
|
||||
String tag) throws Exception {
|
||||
// 交易报文中ciphertext与tag和iv
|
||||
// String ciphertext = "";
|
||||
// String tag = "";
|
||||
// String iv = "";
|
||||
// 应用设置 -> K8推送 -> 设置 -> 接口加签名方式(密钥) -> 应用公钥
|
||||
String key = "e0292ae66d9d21feaa895370d3a875aa";
|
||||
try {
|
||||
String plaintext = decrypte(Base64.decodeBase64String(ciphertext), key.getBytes(), iv.getBytes(), Base64.decodeBase64String(tag));
|
||||
System.out.println(plaintext);
|
||||
return plaintext;
|
||||
} catch (Exception e) {
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean verify(byte[] data, byte[] signature, byte[] publicKey) throws GeneralSecurityException {
|
||||
X509EncodedKeySpec pubKeySpec = new X509EncodedKeySpec(publicKey);
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
PublicKey pubKey = keyFactory.generatePublic(pubKeySpec);
|
||||
Signature sig = Signature.getInstance("SHA256withRSA");
|
||||
sig.initVerify(pubKey);
|
||||
sig.update(data);
|
||||
return sig.verify(signature);
|
||||
}
|
||||
|
||||
/**
|
||||
* AES-GCM-256对称解密
|
||||
*/
|
||||
private static String decrypte(byte[] encryptedBytes, byte[] keyBytes, byte[] ivBytes, byte[] tagBytes) throws Exception {
|
||||
|
||||
SecretKeySpec secretKey = new SecretKeySpec(keyBytes, "AES");
|
||||
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
|
||||
GCMParameterSpec gcmParameterSpec = new GCMParameterSpec(128, ivBytes);
|
||||
cipher.init(Cipher.DECRYPT_MODE, secretKey, gcmParameterSpec);
|
||||
cipher.updateAAD("transaction".getBytes(StandardCharsets.UTF_8));
|
||||
cipher.update(encryptedBytes);
|
||||
byte[] decryptedBytes = cipher.doFinal(tagBytes);
|
||||
String decryptedString = new String(decryptedBytes, StandardCharsets.UTF_8);
|
||||
byte[] content = Base64.decodeBase64String(decryptedString);
|
||||
return new String(content);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,599 @@
|
||||
package com.fuint.business.printer.template;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.fuint.business.printer.entity.Test;
|
||||
import com.fuint.common.util.TscLibDll;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 小票模板
|
||||
*
|
||||
* @author admin
|
||||
*
|
||||
*/
|
||||
public class Handover {
|
||||
// 菜品集合--传入一个商品集合
|
||||
public static List<Test> testList = new ArrayList<Test>();
|
||||
public static Map<String, Object> handover = new HashMap<>();
|
||||
public static double ZMoney=0;
|
||||
public static double YMoney=20;
|
||||
public static double SMoney=500;
|
||||
// 设置小票打印
|
||||
public static String printHandover(){
|
||||
//字符串拼接
|
||||
StringBuilder sb=new StringBuilder();
|
||||
sb.append("<center>交班统计\r\n</center>");
|
||||
// sb.append("<center>----------------------\r\n</center>");
|
||||
sb.append("--------------------------------\r\n");
|
||||
|
||||
sb.append(baseInfo());
|
||||
sb.append("--------------------------------\r\n");
|
||||
sb.append("--------------------------------\r\n");
|
||||
|
||||
sb.append(orderSummary());
|
||||
sb.append("--------------------------------\r\n");
|
||||
|
||||
sb.append(paymentAggregationMap());
|
||||
sb.append("--------------------------------\r\n");
|
||||
sb.append(oilNumberStatisticsMap());
|
||||
sb.append("--------------------------------\r\n");
|
||||
|
||||
sb.append(greaseGunStatisticsMap());
|
||||
sb.append("--------------------------------\r\n");
|
||||
|
||||
sb.append(employeeStatisticsMap());
|
||||
sb.append("--------------------------------\r\n");
|
||||
|
||||
sb.append(billingDetailsMap());
|
||||
sb.append("--------------------------------\r\n");
|
||||
|
||||
sb.append(returnedToTheAccountMap());
|
||||
sb.append("--------------------------------\r\n");
|
||||
|
||||
|
||||
|
||||
// sb.append("<center>----------------------\r\n</center>");
|
||||
sb.append("<center>谢谢惠顾,欢迎下次光临!</center>");
|
||||
return sb.toString();
|
||||
}
|
||||
public static List<Test> getTestList() {
|
||||
return testList;
|
||||
}
|
||||
public static void setTestList(List<Test> testList) {
|
||||
Handover.testList = testList;
|
||||
}
|
||||
|
||||
public static Map<String, Object> getHandover() {
|
||||
return handover;
|
||||
}
|
||||
public static void setHandover(Map<String, Object> handover) {
|
||||
Handover.handover = handover;
|
||||
}
|
||||
// 数据解析组装
|
||||
|
||||
public static String baseInfo() {
|
||||
StringBuilder sb=new StringBuilder();
|
||||
Map<String, Object> baseInfo = (Map<String, Object>)handover.get("baseInfo");
|
||||
sb.append("油站名称:\t" + Optional.ofNullable(baseInfo.get("storeName")).orElse("未知油站") + "\r\n");
|
||||
sb.append("收银员:\t"+ Optional.ofNullable(baseInfo.get("realName")).orElse("未知姓名")+"\r\n");
|
||||
sb.append("交班方式:\t"+Optional.ofNullable(baseInfo.get("handoverType")).orElse("未知")+"\r\n");
|
||||
sb.append("开始时间:\t"+Optional.ofNullable(baseInfo.get("startTime")).orElse("-")+"\r\n");
|
||||
sb.append("结束时间:\t"+Optional.ofNullable(baseInfo.get("endTime")).orElse("-")+"\r\n");
|
||||
sb.append("--------------------------------\r\n");
|
||||
sb.append("当前版本:\t"+"V1.0.1\r\n");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String orderSummary() {
|
||||
StringBuilder sb=new StringBuilder();
|
||||
sb.append("**订单汇总**\r\n");
|
||||
|
||||
Map<String, Object> orderSummary = (Map<String, Object>)handover.get("orderSummary");
|
||||
|
||||
sb.append("订单汇总\r\n");
|
||||
sb.append("<table><tr><td>类型</td><td>金额</td></tr>");
|
||||
|
||||
String[] type = {
|
||||
"油品订单(订单):", "油品订单(退款):¥", "油品订单(实收):¥",
|
||||
"会员储值(订单):¥", "会员储值(实收):¥", "储值赠送(订单):¥", "储值赠送(实际):¥",
|
||||
"存油储值(订单):¥", "存油储值(实收):¥",
|
||||
"普通收款(订单):¥", "普通收款(退款):¥", "普通收款(实收):¥",
|
||||
};
|
||||
String[] price = {
|
||||
"oilOrder", "oilRefund", "oilPaid",
|
||||
"cardOrder", "cardPaid", "cardGiftOrder","cardGiftPaid",
|
||||
"fuelOrder", "fuelPaid",
|
||||
"goodsOrder", "goodsRefund", "goodsPaid",
|
||||
};
|
||||
for (int i = 0; i < type.length; i++) {
|
||||
sb.append("<tr>");
|
||||
sb.append("<td>"+type[i]+"</td>");
|
||||
sb.append("<td>"+Optional.ofNullable(orderSummary.get(price[i])).orElse("0")+"</td>");
|
||||
sb.append("</tr>");
|
||||
}
|
||||
sb.append("</table>");
|
||||
return sb.toString();
|
||||
|
||||
}
|
||||
|
||||
public static String paymentAggregationMap() {
|
||||
StringBuilder sb=new StringBuilder();
|
||||
|
||||
List<Map<String, Object>> paymentAggregationMap = (List<Map<String, Object>>)handover.get("paymentAggregation");
|
||||
|
||||
List<Map<String, Object>> paymentAggregationAll = paymentAggregation("all", paymentAggregationMap);
|
||||
sb.append("**退款汇总**\r\n");
|
||||
|
||||
sb.append("<table><tr><td>支付方式</td><td>退款金额</td></tr>");
|
||||
|
||||
|
||||
if (ObjectUtil.isNotEmpty(paymentAggregationAll)) {
|
||||
for (Map<String, Object> stringObjectMap : paymentAggregationAll) {
|
||||
if (Double.parseDouble(stringObjectMap.get("refundAmount").toString()) > 0) {
|
||||
sb.append("<tr>");
|
||||
sb.append("<td>"+calculatePaymentMethod(stringObjectMap.get("payType").toString())+"</td>");
|
||||
sb.append("<td>"+Optional.ofNullable(stringObjectMap.get("refundAmount")).orElse("0")+"</td>");
|
||||
sb.append("</tr>");
|
||||
}
|
||||
}
|
||||
}
|
||||
sb.append("</table>");
|
||||
sb.append("合计:" + refundAggregateTotal(paymentAggregationAll) + "\r\n");
|
||||
sb.append("--------------------------------\r\n");
|
||||
|
||||
sb.append("**实收汇总**\r\n");
|
||||
|
||||
sb.append("<table><tr><td>支付方式</td><td>金额</td></tr>");
|
||||
if (ObjectUtil.isNotEmpty(paymentAggregationAll)) {
|
||||
for (Map<String, Object> stringObjectMap : paymentAggregationAll) {
|
||||
sb.append("<tr><td>"+calculatePaymentMethod(stringObjectMap.get("payType").toString()).toString()+"</td>");
|
||||
sb.append("<td>"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0").toString()+"</td></tr>");
|
||||
}
|
||||
}
|
||||
sb.append("</table>");
|
||||
sb.append("合计:\t" + totalTotalOfActualReceipts(paymentAggregationAll) + "\r\n");
|
||||
|
||||
|
||||
sb.append("--------------------------------\r\n");
|
||||
|
||||
sb.append("**油品订单**\r\n");
|
||||
|
||||
sb.append("<table><tr><td>支付方式</td><td>金额</td></tr>");
|
||||
List<Map<String, Object>> paymentAggregationOil = paymentAggregation("oil", paymentAggregationMap);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(paymentAggregationOil)) {
|
||||
for (Map<String, Object> stringObjectMap : paymentAggregationOil) {
|
||||
sb.append("<tr><td>"+calculatePaymentMethod(stringObjectMap.get("payType").toString())+"</td>");
|
||||
sb.append("<td>"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0")+"</td></tr>");
|
||||
}
|
||||
}
|
||||
sb.append("</table>");
|
||||
sb.append("合计:\t" + totalOilOrders(paymentAggregationOil)+ "\r\n");
|
||||
sb.append("--------------------------------\r\n");
|
||||
|
||||
sb.append("**商品订单**\r\n");
|
||||
sb.append("<table><tr><td>支付方式</td><td>金额</td></tr>");
|
||||
List<Map<String, Object>> paymentAggregationGoods = paymentAggregation("goods", paymentAggregationMap);
|
||||
if (ObjectUtil.isNotEmpty(paymentAggregationGoods)) {
|
||||
for (Map<String, Object> stringObjectMap : paymentAggregationGoods) {
|
||||
sb.append("<tr><td>"+calculatePaymentMethod(stringObjectMap.get("payType").toString())+""+"</td>");
|
||||
sb.append("<td>"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0")+"</td></tr>");
|
||||
|
||||
}
|
||||
}
|
||||
sb.append("</table>");
|
||||
sb.append("合计:\t" + totalOfProductOrders(paymentAggregationAll) + "\r\n");
|
||||
sb.append("--------------------------------\r\n");
|
||||
|
||||
sb.append("**会员储值**\r\n");
|
||||
sb.append("<table><tr><td>支付方式</td><td>金额</td></tr>");
|
||||
List<Map<String, Object>> paymentAggregationFg = paymentAggregation("fg", paymentAggregationMap);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(paymentAggregationFg)) {
|
||||
for (Map<String, Object> stringObjectMap : paymentAggregationFg) {
|
||||
sb.append("<tr><td>"+calculatePaymentMethod(stringObjectMap.get("payType").toString())+""+"</td>");
|
||||
sb.append("<td>"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0")+"</td></tr>");
|
||||
|
||||
}
|
||||
}
|
||||
sb.append("</table>");
|
||||
sb.append("合计:\t" + totalMemberStoredValue(paymentAggregationFg) + "\r\n");
|
||||
|
||||
sb.append("--------------------------------\r\n");
|
||||
|
||||
sb.append("**积分商城**\r\n");
|
||||
sb.append("<table><tr><td>支付方式</td><td>金额</td></tr>");
|
||||
List<Map<String, Object>> paymentAggregationPoint = paymentAggregation("point", paymentAggregationMap);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(paymentAggregationPoint)) {
|
||||
for (Map<String, Object> stringObjectMap : paymentAggregationPoint) {
|
||||
TscLibDll.INSTANCE.sendcommand(calculatePaymentMethod(stringObjectMap.get("payType").toString())+":\t¥"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0"));
|
||||
sb.append("<tr><td>"+calculatePaymentMethod(stringObjectMap.get("payType").toString())+""+"</td>");
|
||||
sb.append("<td>"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0")+"</td></tr>");
|
||||
|
||||
}
|
||||
}
|
||||
sb.append("</table>");
|
||||
sb.append("合计:\t" + pointsMallStatistics(paymentAggregationAll) + "\r\n");
|
||||
|
||||
return sb.toString();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static String oilNumberStatisticsMap() {
|
||||
StringBuilder sb=new StringBuilder();
|
||||
sb.append("**油号统计**\r\n");
|
||||
|
||||
List<Map<String, Object>> oilNumberStatisticsMap = (List<Map<String, Object>>)handover.get("oilNumberStatistics");
|
||||
sb.append("<table><tr><td>油号</td><td>笔数</td><td>升数</td><td>金额</td></tr>");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(oilNumberStatisticsMap)) {
|
||||
for (Map<String, Object> stringObjectMap : oilNumberStatisticsMap) {
|
||||
sb.append("<tr><td>"+Optional.ofNullable(stringObjectMap.get("oilName")).orElse("未知")+""+"</td>");
|
||||
sb.append("<td>"+Optional.ofNullable(stringObjectMap.get("numberOfDeals")).orElse("未知")+""+"</td>");
|
||||
sb.append("<td>"+Optional.ofNullable(stringObjectMap.get("oilNum")).orElse("未知")+""+"</td>");
|
||||
sb.append("<td>"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0")+"</td></tr>");
|
||||
}
|
||||
}
|
||||
sb.append("</table>");
|
||||
sb.append("合计:\t" + totalOilNumberStatistics(oilNumberStatisticsMap) + "\r\n");
|
||||
|
||||
|
||||
sb.append("<table><tr><td>油品</td><td>金额</td></tr>");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(oilNumberStatisticsMap)) {
|
||||
for (Map<String, Object> stringObjectMap : oilNumberStatisticsMap) {
|
||||
TscLibDll.INSTANCE.sendcommand(
|
||||
Optional.ofNullable(stringObjectMap.get("oilName")).orElse("未知")
|
||||
+"\t¥"+Optional.ofNullable(stringObjectMap.get("paidDiscount")).orElse("0"));
|
||||
|
||||
|
||||
sb.append("<tr><td>"+Optional.ofNullable(stringObjectMap.get("oilName")).orElse("未知")+""+"</td>");
|
||||
sb.append("<td>"+Optional.ofNullable(stringObjectMap.get("paidDiscount")).orElse("0")+"</td></tr>");
|
||||
|
||||
}
|
||||
}
|
||||
sb.append("</table>");
|
||||
sb.append("合计:\t" + discountStatisticsTotal(oilNumberStatisticsMap) + "\r\n");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
public static String greaseGunStatisticsMap() {
|
||||
StringBuilder sb=new StringBuilder();
|
||||
sb.append("**油号统计**\r\n");
|
||||
|
||||
// 油枪统计
|
||||
List<Map<String, Object>> greaseGunStatisticsMap = (List<Map<String, Object>>)handover.get("greaseGunStatistics");
|
||||
sb.append("<table><tr><td>油枪</td><td>笔数</td><td>升数</td><td>金额</td></tr>");
|
||||
if (ObjectUtil.isNotEmpty(greaseGunStatisticsMap)) {
|
||||
for (Map<String, Object> stringObjectMap : greaseGunStatisticsMap) {
|
||||
sb.append("<tr><td>"+Optional.ofNullable(stringObjectMap.get("gunName")).orElse("未知")+""+"</td>");
|
||||
sb.append("<td>"+Optional.ofNullable(stringObjectMap.get("numberOfDeals")).orElse("0")+""+"</td>");
|
||||
sb.append("<td>"+Optional.ofNullable(stringObjectMap.get("oilNum")).orElse("0")+""+"</td>");
|
||||
sb.append("<td>"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0")+"</td></tr>");
|
||||
}
|
||||
}
|
||||
|
||||
sb.append("</table>");
|
||||
sb.append("合计:\t" + totalOfOilGunStatistics(greaseGunStatisticsMap) + "\r\n");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String employeeStatisticsMap() {
|
||||
StringBuilder sb=new StringBuilder();
|
||||
|
||||
List<Map<String, Object>> employeeStatisticsMap = (List<Map<String, Object>>)handover.get("employeeStatistics");
|
||||
sb.append("**员工统计**\r\n");
|
||||
sb.append("<table><tr><td>员工姓名</td><td>笔数</td><td>金额</td></tr>");
|
||||
if (ObjectUtil.isNotEmpty(employeeStatisticsMap)) {
|
||||
for (Map<String, Object> stringObjectMap : employeeStatisticsMap) {
|
||||
sb.append("<tr><td>"+Optional.ofNullable(stringObjectMap.get("name")).orElse("未知")+""+"</td>");
|
||||
sb.append("<td>"+Optional.ofNullable(stringObjectMap.get("numberOfDeals")).orElse("0")+""+"</td>");
|
||||
sb.append("<td>"+Optional.ofNullable(stringObjectMap.get("paidAmount")).orElse("0")+"</td></tr>");
|
||||
}
|
||||
}
|
||||
|
||||
sb.append("</table>");
|
||||
sb.append("合计:\t" + totalOfEmployeeStatistics(employeeStatisticsMap) + "\r\n");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
public static String billingDetailsMap() {
|
||||
StringBuilder sb=new StringBuilder();
|
||||
|
||||
List<Map<String, Object>> billingDetailsMap = (List<Map<String, Object>>)handover.get("billingDetails");
|
||||
sb.append("**挂账统计**\r\n");
|
||||
sb.append("·····挂账详情·····\r\n");
|
||||
sb.append("<table><tr><td>挂账单位</td><td></td><td>笔数</td></tr>");
|
||||
if (ObjectUtil.isNotEmpty(billingDetailsMap)) {
|
||||
for (Map<String, Object> stringObjectMap : billingDetailsMap) {
|
||||
sb.append("<tr><td>"+Optional.ofNullable(stringObjectMap.get("name")).orElse("未知")+""+"</td>");
|
||||
sb.append("<td>"+Optional.ofNullable(stringObjectMap.get("numberOfDeals")).orElse("0")+""+"</td>");
|
||||
sb.append("<td>"+Optional.ofNullable(stringObjectMap.get("amount")).orElse("0")+"</td></tr>");
|
||||
}
|
||||
}
|
||||
|
||||
sb.append("</table>");
|
||||
sb.append("合计:\t" + statisticsOfAccountDetails(billingDetailsMap) + "\r\n");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
public static String returnedToTheAccountMap() {
|
||||
StringBuilder sb=new StringBuilder();
|
||||
|
||||
List<Map<String, Object>> returnedToTheAccountMap = (List<Map<String, Object>>)handover.get("returnedToTheAccount");
|
||||
sb.append("······归还详情······\r\n");
|
||||
sb.append("<table><tr><td>挂账单位</td><td>笔数</td><td>金额</td></tr>");
|
||||
if (ObjectUtil.isNotEmpty(returnedToTheAccountMap)) {
|
||||
for (Map<String, Object> stringObjectMap : returnedToTheAccountMap) {
|
||||
sb.append("<tr><td>"+Optional.ofNullable(stringObjectMap.get("name")).orElse("未知")+""+"</td>");
|
||||
sb.append("<td>"+Optional.ofNullable(stringObjectMap.get("numberOfDeals")).orElse("0")+""+"</td>");
|
||||
sb.append("<td>"+Optional.ofNullable(stringObjectMap.get("amount")).orElse("0")+"</td></tr>");
|
||||
}
|
||||
}
|
||||
|
||||
sb.append("</table>");
|
||||
sb.append("合计:\t" + postedAccountReturnStatistics(returnedToTheAccountMap) + "\r\n");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
public void printLocally() {
|
||||
|
||||
|
||||
// 支付方式汇总
|
||||
// 油号统计
|
||||
// 油枪统计
|
||||
// List<Map<String, Object>> greaseGunStatisticsMap = (List<Map<String, Object>>)handover.get("greaseGunStatistics");
|
||||
// 员工统计
|
||||
// 挂账详情
|
||||
List<Map<String, Object>> billingDetailsMap = (List<Map<String, Object>>)handover.get("billingDetails");
|
||||
// 挂账归还
|
||||
List<Map<String, Object>> returnedToTheAccountMap = (List<Map<String, Object>>)handover.get("returnedToTheAccount");
|
||||
|
||||
|
||||
|
||||
}
|
||||
// 订单汇总
|
||||
// 退款汇总
|
||||
public static List<Map<String, Object>> paymentAggregation(String flag, List<Map<String, Object>> paymentAggregation) {
|
||||
List<Map<String, Object>> count = new ArrayList<>();
|
||||
|
||||
if (ObjectUtil.isNotEmpty(paymentAggregation)) {
|
||||
for (Map<String, Object> res : paymentAggregation) {
|
||||
if ("fg".equals(flag)) {
|
||||
if ("card".equals(res.get("flag")) || "fuel".equals(res.get("flag"))) {
|
||||
boolean flag2 = false;
|
||||
for (Map<String, Object> coun : count) {
|
||||
if (Objects.equals(res.get("payType"), coun.get("payType"))) {
|
||||
coun.put("paidAmount", Double.valueOf(coun.get("paidAmount").toString()) + Double.valueOf(res.get("paidAmount").toString()));
|
||||
flag2 = true;
|
||||
}
|
||||
}
|
||||
if (!flag2) {
|
||||
// 创建新的对象,以防修改原始数据
|
||||
Map<String, Object> newRes = new HashMap<>(res);
|
||||
count.add(newRes);
|
||||
}
|
||||
}
|
||||
} else if (Objects.equals(res.get("flag"), flag)) {
|
||||
count.add(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
public static String calculatePaymentMethod(String payType) {
|
||||
switch (payType) {
|
||||
case "ALIPAY":
|
||||
return "支付宝";
|
||||
case "WECHAT":
|
||||
return "微信";
|
||||
case "UNIONPAY":
|
||||
return "银联二维码";
|
||||
case "CASH":
|
||||
return "现金";
|
||||
default:
|
||||
return "其他";
|
||||
}
|
||||
}
|
||||
|
||||
//退款汇总合计
|
||||
public static String refundAggregateTotal(List<Map<String, Object>> paymentAggregation) {
|
||||
BigDecimal totalRefundAmount = BigDecimal.ZERO;
|
||||
|
||||
if (paymentAggregation != null && !paymentAggregation.isEmpty()) {
|
||||
for (Map<String, Object> payment : paymentAggregation) {
|
||||
if ("all".equals(payment.get("flag"))) {
|
||||
BigDecimal refundAmount = new BigDecimal(String.valueOf(payment.get("refundAmount")));
|
||||
totalRefundAmount = totalRefundAmount.add(refundAmount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return totalRefundAmount.toString();
|
||||
}
|
||||
|
||||
//实收汇总合计
|
||||
public static BigDecimal totalTotalOfActualReceipts(List<Map<String, Object>> paymentAggregation) {
|
||||
BigDecimal totalPaidAmount = BigDecimal.ZERO;
|
||||
|
||||
if (paymentAggregation != null && !paymentAggregation.isEmpty()) {
|
||||
for (Map<String, Object> payment : paymentAggregation) {
|
||||
if ("all".equals(payment.get("flag"))) {
|
||||
BigDecimal paidAmount = new BigDecimal(String.valueOf(payment.get("paidAmount")));
|
||||
totalPaidAmount = totalPaidAmount.add(paidAmount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return totalPaidAmount;
|
||||
}
|
||||
|
||||
//油品订单合计
|
||||
public static String totalOilOrders(List<Map<String, Object>> paymentAggregation) {
|
||||
BigDecimal totalOilAmount = BigDecimal.ZERO;
|
||||
|
||||
if (paymentAggregation != null && !paymentAggregation.isEmpty()) {
|
||||
for (Map<String, Object> payment : paymentAggregation) {
|
||||
if ("oil".equals(payment.get("flag"))) {
|
||||
BigDecimal paidAmount = new BigDecimal(String.valueOf(payment.get("paidAmount")));
|
||||
totalOilAmount = totalOilAmount.add(paidAmount);
|
||||
}
|
||||
}
|
||||
}
|
||||
return totalOilAmount.toString();
|
||||
}
|
||||
|
||||
public static String totalOfProductOrders(List<Map<String, Object>> paymentAggregation) {
|
||||
BigDecimal totalProductAmount = BigDecimal.ZERO;
|
||||
|
||||
if (paymentAggregation != null && !paymentAggregation.isEmpty()) {
|
||||
for (Map<String, Object> payment : paymentAggregation) {
|
||||
if ("goods".equals(payment.get("flag"))) {
|
||||
BigDecimal paidAmount = new BigDecimal(String.valueOf(payment.get("paidAmount")));
|
||||
totalProductAmount = totalProductAmount.add(paidAmount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return totalProductAmount.toString();
|
||||
}
|
||||
// 会员储值合计
|
||||
public static BigDecimal totalMemberStoredValue(List<Map<String, Object>> paymentAggregation) {
|
||||
BigDecimal totalStoredValue = BigDecimal.ZERO;
|
||||
|
||||
if (paymentAggregation != null && !paymentAggregation.isEmpty()) {
|
||||
for (Map<String, Object> payment : paymentAggregation) {
|
||||
if ("card".equals(payment.get("flag")) || "fuel".equals(payment.get("flag"))) {
|
||||
BigDecimal paidAmount = new BigDecimal(String.valueOf(payment.get("paidAmount")));
|
||||
totalStoredValue = totalStoredValue.add(paidAmount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return totalStoredValue;
|
||||
}
|
||||
|
||||
// 积分商城统计
|
||||
public static BigDecimal pointsMallStatistics(List<Map<String, Object>> paymentAggregation) {
|
||||
BigDecimal totalPointsMallAmount = BigDecimal.ZERO;
|
||||
|
||||
if (paymentAggregation != null && !paymentAggregation.isEmpty()) {
|
||||
for (Map<String, Object> payment : paymentAggregation) {
|
||||
if ("point".equals(payment.get("flag"))) {
|
||||
BigDecimal paidAmount = new BigDecimal(String.valueOf(payment.get("paidAmount")));
|
||||
totalPointsMallAmount = totalPointsMallAmount.add(paidAmount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return totalPointsMallAmount;
|
||||
}
|
||||
|
||||
// 油号统计合计
|
||||
public static BigDecimal totalOilNumberStatistics(List<Map<String, Object>> oilNumberStatistics) {
|
||||
BigDecimal totalOilNumberAmount = BigDecimal.ZERO;
|
||||
|
||||
if (oilNumberStatistics != null && !oilNumberStatistics.isEmpty()) {
|
||||
for (Map<String, Object> statistics : oilNumberStatistics) {
|
||||
BigDecimal paidAmount = new BigDecimal(String.valueOf(statistics.get("paidAmount")));
|
||||
totalOilNumberAmount = totalOilNumberAmount.add(paidAmount);
|
||||
}
|
||||
}
|
||||
|
||||
return totalOilNumberAmount;
|
||||
}
|
||||
|
||||
// 优惠统计合计
|
||||
public static BigDecimal discountStatisticsTotal(List<Map<String, Object>> oilNumberStatistics) {
|
||||
BigDecimal totalDiscountAmount = BigDecimal.ZERO;
|
||||
|
||||
if (oilNumberStatistics != null && !oilNumberStatistics.isEmpty()) {
|
||||
for (Map<String, Object> statistics : oilNumberStatistics) {
|
||||
BigDecimal paidDiscount = new BigDecimal(String.valueOf(statistics.get("paidDiscount")));
|
||||
totalDiscountAmount = totalDiscountAmount.add(paidDiscount);
|
||||
}
|
||||
}
|
||||
|
||||
return totalDiscountAmount;
|
||||
}
|
||||
|
||||
// 油枪统计合计
|
||||
public static BigDecimal totalOfOilGunStatistics(List<Map<String, Object>> greaseGunStatistics) {
|
||||
BigDecimal totalOilGunAmount = BigDecimal.ZERO;
|
||||
|
||||
if (greaseGunStatistics != null && !greaseGunStatistics.isEmpty()) {
|
||||
for (Map<String, Object> statistics : greaseGunStatistics) {
|
||||
BigDecimal paidAmount = new BigDecimal(String.valueOf(statistics.get("paidAmount")));
|
||||
totalOilGunAmount = totalOilGunAmount.add(paidAmount);
|
||||
}
|
||||
}
|
||||
|
||||
return totalOilGunAmount;
|
||||
}
|
||||
|
||||
// 员工统计合计
|
||||
public static BigDecimal totalOfEmployeeStatistics(List<Map<String, Object>> employeeStatistics) {
|
||||
BigDecimal totalEmployeeAmount = BigDecimal.ZERO;
|
||||
|
||||
if (employeeStatistics != null && !employeeStatistics.isEmpty()) {
|
||||
for (Map<String, Object> statistics : employeeStatistics) {
|
||||
BigDecimal paidAmount = new BigDecimal(String.valueOf(statistics.get("paidAmount")));
|
||||
totalEmployeeAmount = totalEmployeeAmount.add(paidAmount);
|
||||
}
|
||||
}
|
||||
|
||||
return totalEmployeeAmount;
|
||||
}
|
||||
|
||||
// 挂账详情统计
|
||||
public static BigDecimal statisticsOfAccountDetails(List<Map<String, Object>> billingDetails) {
|
||||
BigDecimal totalAccountDetailsAmount = BigDecimal.ZERO;
|
||||
|
||||
if (billingDetails != null && !billingDetails.isEmpty()) {
|
||||
for (Map<String, Object> details : billingDetails) {
|
||||
BigDecimal amount = new BigDecimal(String.valueOf(details.get("amount")));
|
||||
totalAccountDetailsAmount = totalAccountDetailsAmount.add(amount);
|
||||
}
|
||||
}
|
||||
|
||||
return totalAccountDetailsAmount;
|
||||
}
|
||||
|
||||
// 挂账归还统计
|
||||
public static BigDecimal postedAccountReturnStatistics(List<Map<String, Object>> returnedToTheAccount) {
|
||||
BigDecimal totalReturnAmount = BigDecimal.ZERO;
|
||||
|
||||
if (returnedToTheAccount != null && !returnedToTheAccount.isEmpty()) {
|
||||
for (Map<String, Object> returnDetails : returnedToTheAccount) {
|
||||
BigDecimal amount = new BigDecimal(String.valueOf(returnDetails.get("amount")));
|
||||
totalReturnAmount = totalReturnAmount.add(amount);
|
||||
}
|
||||
}
|
||||
|
||||
return totalReturnAmount;
|
||||
}
|
||||
|
||||
// 实收汇总
|
||||
// 油品订单
|
||||
// 商品订单
|
||||
// 会员储值
|
||||
// 积分商城
|
||||
// 油号统计
|
||||
// 优惠统计
|
||||
// 油枪统计
|
||||
// 员工统计
|
||||
// 挂账统计
|
||||
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package com.fuint.business.printer.template;
|
||||
|
||||
import com.fuint.business.printer.entity.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 小票模板
|
||||
*
|
||||
* @author admin
|
||||
*
|
||||
*/
|
||||
public class Prient{
|
||||
// 菜品集合--传入一个商品集合
|
||||
public static List<Test> testList = new ArrayList<Test>();
|
||||
public static double ZMoney=0;
|
||||
public static double YMoney=20;
|
||||
public static double SMoney=500;
|
||||
// 设置小票打印
|
||||
public static String print(){
|
||||
//字符串拼接
|
||||
StringBuilder sb=new StringBuilder();
|
||||
sb.append("<center>点菜清单\r\n</center>");
|
||||
sb.append("------------------------------------\r\n");
|
||||
sb.append("点餐员:测试打印\r\n");
|
||||
sb.append("电话:13408086368\r\n");
|
||||
sb.append("用餐时间:2015-04-09 13:01-13:30\r\n");
|
||||
sb.append("用餐地址:打印测试\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
sb.append("<table>");
|
||||
sb.append("<tr>");
|
||||
sb.append("<td>");
|
||||
sb.append("菜品");
|
||||
sb.append("</td>");
|
||||
sb.append("<td>");
|
||||
sb.append("单价");
|
||||
sb.append("</td>");
|
||||
sb.append("<td>");
|
||||
sb.append("小计");
|
||||
sb.append("</td>");
|
||||
sb.append("</tr>");
|
||||
for (Test test : testList) {
|
||||
ZMoney=ZMoney+(test.getMoney()*test.getNum());
|
||||
sb.append("<tr>");
|
||||
sb.append("<td>"+test.getName()+"</td>");
|
||||
sb.append("<td>"+test.getMoney()+"</td>");
|
||||
sb.append("<td>"+test.getMoney()*test.getNum()+"</td>");
|
||||
sb.append("</tr>");
|
||||
}
|
||||
sb.append("</table>");
|
||||
sb.append("------------------------------------\r\n");
|
||||
sb.append("合计:¥"+ZMoney+"\r\n");
|
||||
sb.append("优惠金额:¥"+YMoney+"\r\n");
|
||||
sb.append("应收:¥"+(ZMoney-YMoney)+"\r\n");
|
||||
sb.append("实收:¥"+SMoney+"\r\n");
|
||||
sb.append("找零:¥"+(SMoney-YMoney)+"\r\n");
|
||||
sb.append("收银员:打印测试\r\n");
|
||||
sb.append("<center>谢谢惠顾,欢迎下次光临!</center>");
|
||||
return sb.toString();
|
||||
}
|
||||
public static List<Test> getTestList() {
|
||||
return testList;
|
||||
}
|
||||
public static void setTestList(List<Test> testList) {
|
||||
Prient.testList = testList;
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.fuint.business.printer.template;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class PrintCardValueReport {
|
||||
public static Map<String, Object> handover = new HashMap<>();
|
||||
public static String printOilOrder() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("<center>订单统计\r\n</center>");
|
||||
sb.append("------------------------------------\r\n");
|
||||
if (ObjectUtil.isNotEmpty(handover.get("realyPayBills"))) {
|
||||
sb.append("充值金额:¥"+handover.get("realyPayBills")+"\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("giftBalance"))) {
|
||||
sb.append("赠送金额:¥"+handover.get("giftBalance")+"\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("getAmount"))) {
|
||||
sb.append("到账金额:¥"+handover.get("getAmount")+"\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("payType"))) {
|
||||
sb.append("支付方式:"+handover.get("payType")+"\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("actualPay"))) {
|
||||
sb.append("实付款:¥"+handover.get("actualPay")+"\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("seekZero"))) {
|
||||
sb.append("找零:¥"+handover.get("seekZero")+"\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
}
|
||||
|
||||
sb.append("<center>谢谢惠顾,欢迎下次光临!</center>");
|
||||
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
public static Map<String, Object> getHandover() {
|
||||
return handover;
|
||||
}
|
||||
public static void setHandover(Map<String, Object> handover) {
|
||||
PrintCardValueReport.handover = handover;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.fuint.business.printer.template;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class PrintFuelDieselReport {
|
||||
public static Map<String, Object> handover = new HashMap<>();
|
||||
public static String printFeulOrder() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("<center>订单统计\r\n</center>");
|
||||
sb.append("------------------------------------\r\n");
|
||||
if (ObjectUtil.isNotEmpty(handover.get("oilType"))) {
|
||||
sb.append("充值油品:"+handover.get("oilType")+"\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("incomeLitres"))) {
|
||||
sb.append("充值升数:"+handover.get("incomeLitres")+"\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("realyPayBills"))) {
|
||||
sb.append("订单金额:¥"+handover.get("realyPayBills")+"\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("lockupPrice"))) {
|
||||
sb.append("锁价金额:¥"+handover.get("lockupPrice")+"\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("payType"))) {
|
||||
sb.append("支付方式:"+handover.get("payType")+"\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("realyPayBills"))) {
|
||||
sb.append("实付款:¥"+handover.get("realyPayBills")+"\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("seekZero"))) {
|
||||
sb.append("找零:¥"+handover.get("seekZero")+"\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
}
|
||||
|
||||
sb.append("<center>谢谢惠顾,欢迎下次光临!</center>");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static Map<String, Object> getHandover() {
|
||||
return handover;
|
||||
}
|
||||
public static void setHandover(Map<String, Object> handover) {
|
||||
PrintFuelDieselReport.handover = handover;
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.fuint.business.printer.template;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class PrintIntegralReport {
|
||||
public static Map<String, Object> handover = new HashMap<>();
|
||||
public static String printIntegral(){
|
||||
StringBuilder sb=new StringBuilder();
|
||||
|
||||
sb.append("<center>积分兑换订单\r\n</center>");
|
||||
sb.append("------------------------------------\r\n");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(handover.get("shoppingCart"))) {
|
||||
sb.append("<table><tr><td>商品名称</td><td>商品数量</td><td>价格</td></tr>");
|
||||
List<Map<String,String>> o = (List<Map<String,String>>)handover.get("oilOrder");
|
||||
for (Map<String, String> stringStringMap : o) {
|
||||
sb.append("<tr><td>"+stringStringMap.get("giftName")+"</td>");
|
||||
sb.append("<td>"+stringStringMap.get("markPurchases")+"</td>");
|
||||
sb.append("<td>"+ stringStringMap.get("price")+"</td></tr>");
|
||||
}
|
||||
sb.append("</table>");
|
||||
sb.append("------------------------------------\r\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (ObjectUtil.isNotEmpty(handover.get("allPoints"))) {
|
||||
sb.append("总积分:"+handover.get("allPoints")+"\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("allAmout"))) {
|
||||
sb.append("总价格:¥"+handover.get("allAmout")+"\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
|
||||
}
|
||||
|
||||
sb.append("<center>谢谢惠顾,欢迎下次光临!</center>");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static Map<String, Object> getHandover() {
|
||||
return handover;
|
||||
}
|
||||
public static void setHandover(Map<String, Object> handover) {
|
||||
PrintIntegralReport.handover = handover;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package com.fuint.business.printer.template;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public class PrintOilOrderReport {
|
||||
public static Map<String, Object> handover = new HashMap<>();
|
||||
public static String printOilOrder(){
|
||||
StringBuilder sb=new StringBuilder();
|
||||
|
||||
sb.append("<center>订单统计\r\n</center>");
|
||||
sb.append("------------------------------------\r\n");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(handover.get("oilOrder"))) {
|
||||
sb.append("<table><tr><td>油品</td><td>金额</td></tr>");
|
||||
List<Map<String,String>> o = (List<Map<String,String>>)handover.get("oilOrder");
|
||||
for (Map<String, String> stringStringMap : o) {
|
||||
sb.append("<tr><td>"+stringStringMap.get("oilName")+"</td>");
|
||||
sb.append("<td>"+ stringStringMap.get("amount")+"</td></tr>");
|
||||
}
|
||||
sb.append("</table>");
|
||||
sb.append("------------------------------------\r\n");
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("goodsOrder"))) {
|
||||
sb.append("<table><tr><td>商品</td><td>金额</td></tr>");
|
||||
List<Map<String,String>> o = (List<Map<String,String>>)handover.get("goodsOrder");
|
||||
for (Map<String, String> stringStringMap : o) {
|
||||
sb.append("<tr><td>"+stringStringMap.get("oilName")+"</td>");
|
||||
sb.append("<td>"+ stringStringMap.get("amount")+"</td></tr>");
|
||||
}
|
||||
sb.append("</table>");
|
||||
sb.append("------------------------------------\r\n");
|
||||
|
||||
}
|
||||
|
||||
sb.append("支付方式:"+handover.get("payType")+"\r\n");
|
||||
if ("credit".equals(handover.get("payType"))) {
|
||||
sb.append("挂账单位:"+handover.get("unitName")+"\r\n");
|
||||
sb.append("挂账金额:¥"+handover.get("creditAmount")+"\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
|
||||
}
|
||||
|
||||
// if (ObjectUtil.isNotEmpty(handover.get("discount"))) {
|
||||
// sb.append("订单总额:¥"+handover.get("discount")+"\r\n");
|
||||
// sb.append("------------------------------------\r\n");
|
||||
//
|
||||
// }
|
||||
if (ObjectUtil.isNotEmpty(handover.get("discount"))) {
|
||||
sb.append("优惠合计:¥"+handover.get("discount")+"\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("consumeAmount"))) {
|
||||
sb.append("储值卡付款:¥"+handover.get("consumeAmount")+"\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("consumeRefuelMoney"))) {
|
||||
sb.append("囤油卡付款:¥"+handover.get("consumeRefuelMoney")+"\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("actualPay"))) {
|
||||
sb.append("实付款:¥"+handover.get("actualPay")+"\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("seekZero"))) {
|
||||
sb.append("找零:¥"+handover.get("seekZero")+"\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
|
||||
}
|
||||
|
||||
sb.append("<center>谢谢惠顾,欢迎下次光临!</center>");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static Map<String, Object> getHandover() {
|
||||
return handover;
|
||||
}
|
||||
public static void setHandover(Map<String, Object> handover) {
|
||||
PrintOilOrderReport.handover = handover;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package com.fuint.business.printer.template;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class RePrintOilOrderReport {
|
||||
public static Map<String, Object> handover = new HashMap<>();
|
||||
public static String rePrintOilOrder(){
|
||||
StringBuilder sb=new StringBuilder();
|
||||
|
||||
sb.append("<center>订单统计\r\n</center>");
|
||||
sb.append("--------------------------------\r\n");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(handover.get("oilOrder"))) {
|
||||
sb.append("<table><tr><td>油品</td><td>加油升数</td><td>金额</td></tr>");
|
||||
List<Map<String,String>> o = (List<Map<String,String>>)handover.get("oilOrder");
|
||||
for (Map<String, String> stringStringMap : o) {
|
||||
sb.append("<tr><td>"+stringStringMap.get("oilName")+"</td>");
|
||||
sb.append("<td>"+stringStringMap.get("oilNum")+"</td>");
|
||||
sb.append("<td>"+ stringStringMap.get("amount")+"</td></tr>");
|
||||
}
|
||||
sb.append("</table>");
|
||||
sb.append("--------------------------------\r\n");
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("goodsOrder"))) {
|
||||
sb.append("<table><tr><td>商品</td><td>商品</td><td>单价</td></tr>");
|
||||
List<Map<String,String>> o = (List<Map<String,String>>)handover.get("goodsOrder");
|
||||
for (Map<String, String> stringStringMap : o) {
|
||||
sb.append("<tr><td>"+stringStringMap.get("oilName")+"</td>");
|
||||
sb.append("<td>"+stringStringMap.get("unit")+"</td>");
|
||||
sb.append("<td>"+ stringStringMap.get("amount")+"</td></tr>");
|
||||
}
|
||||
sb.append("</table>");
|
||||
sb.append("--------------------------------\r\n");
|
||||
|
||||
}
|
||||
|
||||
sb.append("支付方式:¥"+handover.get("payType")+"\r\n");
|
||||
|
||||
|
||||
if (ObjectUtil.isNotEmpty(handover.get("amount"))) {
|
||||
sb.append("合计:¥"+handover.get("amount")+"\r\n");
|
||||
sb.append("--------------------------------\r\n");
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("payAmount"))) {
|
||||
sb.append("实付款:¥"+handover.get("payAmount")+"\r\n");
|
||||
sb.append("--------------------------------\r\n");
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("discount"))) {
|
||||
sb.append("优惠:¥"+handover.get("discount")+"\r\n");
|
||||
sb.append("--------------------------------\r\n");
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("seekZero"))) {
|
||||
sb.append("找零:¥"+handover.get("seekZero")+"\r\n");
|
||||
sb.append("--------------------------------\r\n");
|
||||
|
||||
}
|
||||
|
||||
sb.append("<center>谢谢惠顾,欢迎下次光临!</center>");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static Map<String, Object> getHandover() {
|
||||
return handover;
|
||||
}
|
||||
public static void setHandover(Map<String, Object> handover) {
|
||||
RePrintOilOrderReport.handover = handover;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.fuint.business.printer.unit;
|
||||
|
||||
public class ApiConst {
|
||||
/**
|
||||
* 主站域名 1
|
||||
*/
|
||||
public static final String MAIN_HOST_DN_ONE = "open-api.10ss.net";
|
||||
|
||||
/**
|
||||
* 主站url
|
||||
*/
|
||||
public static final String MAIN_HOST_URL = "https://" + MAIN_HOST_DN_ONE;
|
||||
|
||||
/**
|
||||
* 获取token and refresh Token
|
||||
*/
|
||||
public static final String GET_TOKEN = "/oauth/oauth";
|
||||
|
||||
/**
|
||||
* 急速授权
|
||||
*/
|
||||
public static final String SPEED_AUTHORIZE = "/oauth/scancodemodel";
|
||||
|
||||
|
||||
/**
|
||||
* api 打印
|
||||
*/
|
||||
public static final String API_PRINT = "/print/index";
|
||||
|
||||
/**
|
||||
* api 添加终端授权
|
||||
*/
|
||||
public static final String API_ADD_PRINTER = "/printer/addprinter";
|
||||
|
||||
/**
|
||||
* api 删除终端授权
|
||||
*/
|
||||
public static final String API_DELET_PRINTER = "/printer/deleteprinter";
|
||||
|
||||
/**
|
||||
* api 添加应用菜单
|
||||
*/
|
||||
public static final String API_ADD_PRINT_MENU = "/printmenu/addprintmenu";
|
||||
|
||||
/**
|
||||
* api 关机重启接口
|
||||
*/
|
||||
public static final String API_SHUTDOWN_RESTART = "/printer/shutdownrestart";
|
||||
|
||||
/**
|
||||
* api 声音调节接口
|
||||
*/
|
||||
public static final String API_SET_SOUND = "/printer/setsound";
|
||||
|
||||
/**
|
||||
* api 获取机型打印宽度接口
|
||||
*/
|
||||
public static final String API_PRINT_INFO = "/printer/printinfo";
|
||||
|
||||
/**
|
||||
* api 获取机型软硬件版本接口
|
||||
*/
|
||||
public static final String API_GET_VIERSION = "/printer/getversion";
|
||||
|
||||
/**
|
||||
* api 取消所有未打印订单
|
||||
*/
|
||||
public static final String API_CANCEL_ALL = "/printer/cancelall";
|
||||
|
||||
/**
|
||||
* api 取消单条未打印订单
|
||||
*/
|
||||
public static final String API_CANCEL_ONE = "/printer/cancelone";
|
||||
|
||||
/**
|
||||
* api 设置logo接口
|
||||
*/
|
||||
public static final String API_SET_ICON = "/printer/seticon";
|
||||
|
||||
/**
|
||||
* api 取消logo接口
|
||||
*/
|
||||
public static final String API_DELET_ICON = "/printer/deleteicon";
|
||||
|
||||
/**
|
||||
* api 接单拒单设置接口
|
||||
*/
|
||||
public static final String API_GET_ORDER = "/printer/getorder";
|
||||
|
||||
/**
|
||||
* api 打印方式接口
|
||||
*/
|
||||
public static final String API_BTN_PRINT = "/printer/btnprint";
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package com.fuint.business.printer.unit;
|
||||
|
||||
public class DeCode {
|
||||
}
|
@ -0,0 +1,254 @@
|
||||
package com.fuint.business.printer.unit;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class HttpUtil {
|
||||
static String proxyHost = "127.0.0.1";
|
||||
static int proxyPort = 8080;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
public static String urlEncode(String source, String encode) {
|
||||
String result = source;
|
||||
try {
|
||||
result = java.net.URLEncoder.encode(source, encode);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
return "0";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String urlEncodeGBK(String source) {
|
||||
String result = source;
|
||||
try {
|
||||
result = java.net.URLEncoder.encode(source, "GBK");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
return "0";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起http请求获取返回结果
|
||||
*
|
||||
* @param req_url 请求地址
|
||||
* @return
|
||||
*/
|
||||
public static String httpRequest(String req_url) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
try {
|
||||
URL url = new URL(req_url);
|
||||
HttpURLConnection httpUrlConn = (HttpURLConnection) url.openConnection();
|
||||
|
||||
httpUrlConn.setDoOutput(false);
|
||||
httpUrlConn.setDoInput(true);
|
||||
httpUrlConn.setUseCaches(false);
|
||||
|
||||
httpUrlConn.setRequestMethod("GET");
|
||||
httpUrlConn.connect();
|
||||
|
||||
// 将返回的输入流转换成字符串
|
||||
InputStream inputStream = httpUrlConn.getInputStream();
|
||||
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "utf-8");
|
||||
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
|
||||
|
||||
String str = null;
|
||||
while ((str = bufferedReader.readLine()) != null) {
|
||||
buffer.append(str);
|
||||
}
|
||||
bufferedReader.close();
|
||||
inputStreamReader.close();
|
||||
// 释放资源
|
||||
inputStream.close();
|
||||
inputStream = null;
|
||||
httpUrlConn.disconnect();
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getStackTrace());
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送http请求取得返回的输入流
|
||||
*
|
||||
* @param requestUrl 请求地址
|
||||
* @return InputStream
|
||||
*/
|
||||
public static InputStream httpRequestIO(String requestUrl) {
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
URL url = new URL(requestUrl);
|
||||
HttpURLConnection httpUrlConn = (HttpURLConnection) url.openConnection();
|
||||
httpUrlConn.setDoInput(true);
|
||||
httpUrlConn.setRequestMethod("GET");
|
||||
httpUrlConn.connect();
|
||||
// 获得返回的输入流
|
||||
inputStream = httpUrlConn.getInputStream();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return inputStream;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 向指定URL发送GET方法的请求
|
||||
*
|
||||
* @param url 发送请求的URL
|
||||
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
|
||||
* @return URL 所代表远程资源的响应结果
|
||||
*/
|
||||
public static String sendGet(String url, String param) {
|
||||
String result = "";
|
||||
BufferedReader in = null;
|
||||
try {
|
||||
String urlNameString = url + "?" + param;
|
||||
URL realUrl = new URL(urlNameString);
|
||||
// 打开和URL之间的连接
|
||||
URLConnection connection = realUrl.openConnection();
|
||||
// 设置通用的请求属性
|
||||
connection.setRequestProperty("accept", "*/*");
|
||||
connection.setRequestProperty("connection", "Keep-Alive");
|
||||
connection.setRequestProperty("user-agent",
|
||||
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
// 建立实际的连接
|
||||
connection.connect();
|
||||
// 获取所有响应头字段
|
||||
Map<String, List<String>> map = connection.getHeaderFields();
|
||||
// 遍历所有的响应头字段
|
||||
for (String key : map.keySet()) {
|
||||
System.out.println(key + "--->" + map.get(key));
|
||||
}
|
||||
// 定义 BufferedReader输入流来读取URL的响应
|
||||
in = new BufferedReader(new InputStreamReader(
|
||||
connection.getInputStream()));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
result += line;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("发送GET请求出现异常!" + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 使用finally块来关闭输入流
|
||||
finally {
|
||||
try {
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定 URL 发送POST方法的请求
|
||||
*
|
||||
* @param url 发送请求的 URL
|
||||
* @param map 请求参数,请求参数应该是 map 的形式。
|
||||
* @param isproxy 是否使用代理模式
|
||||
* @return 所代表远程资源的响应结果
|
||||
*/
|
||||
public static String sendPost(String url, Map<String, String> map, boolean isproxy) {
|
||||
OutputStreamWriter out = null;
|
||||
BufferedReader in = null;
|
||||
String result = "";
|
||||
try {
|
||||
URL realUrl = new URL(url);
|
||||
HttpURLConnection conn = null;
|
||||
|
||||
// 打开和URL之间的连接
|
||||
if (isproxy) {//是否使用代理模式
|
||||
@SuppressWarnings("static-access")
|
||||
Proxy proxy = new Proxy(Proxy.Type.DIRECT.HTTP, new InetSocketAddress(proxyHost, proxyPort));
|
||||
conn = (HttpURLConnection) realUrl.openConnection(proxy);
|
||||
} else {
|
||||
conn = (HttpURLConnection) realUrl.openConnection();
|
||||
}
|
||||
|
||||
// 发送POST请求必须设置如下两行
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
conn.setRequestMethod("POST"); // POST方法
|
||||
// 设置通用的请求属性
|
||||
conn.setRequestProperty("accept", "*/*");
|
||||
conn.setRequestProperty("connection", "Keep-Alive");
|
||||
conn.setRequestProperty("user-agent",
|
||||
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
conn.connect();
|
||||
// 获取URLConnection对象对应的输出流
|
||||
out = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
|
||||
// 发送请求参数
|
||||
out.write(getUrlParamsFromMap(map));
|
||||
// flush输出流的缓冲
|
||||
out.flush();
|
||||
// 定义BufferedReader输入流来读取URL的响应
|
||||
in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
result += line;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("发送 POST 请求出现异常!" + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
//使用finally块来关闭输出流、输入流
|
||||
finally {
|
||||
try {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* description:将map转换成url参数格式: name1=value1&name2=value2
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
public static String getUrlParamsFromMap(Map<String, String> map) {
|
||||
try {
|
||||
if (null != map) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
stringBuilder.append(URLEncoder.encode(entry.getKey(), "UTF-8"))
|
||||
.append("=")
|
||||
.append(URLEncoder.encode(entry.getValue(), "UTF-8"))
|
||||
.append("&");
|
||||
}
|
||||
String content = stringBuilder.toString();
|
||||
if (content.endsWith("&")) {
|
||||
content = content.substring(0, content.length() - 1);
|
||||
}
|
||||
return content;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("map数据异常!" + e);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,476 @@
|
||||
package com.fuint.business.printer.unit;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class LAVApi {
|
||||
/**
|
||||
* 获取token 开放应用服务模式所需参数
|
||||
*
|
||||
* @param client_id 易联云颁发给开发者的应用ID 非空值
|
||||
* @param grant_type 授与方式(固定为 “authorization_code”)
|
||||
* @param sign 签名 详见API文档列表-接口签名
|
||||
* @param code 详见商户授权-获取code
|
||||
* @param scope 授权权限,传all
|
||||
* @param timestamp 当前服务器时间戳(10位)
|
||||
* @param id UUID4 详见API文档列表-uuid4
|
||||
* @return
|
||||
*/
|
||||
public static String getToken(String client_id, String grant_type, String sign, String code, String scope, String timestamp, String id) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("client_id", client_id);
|
||||
hashMap.put("grant_type", grant_type);
|
||||
hashMap.put("sign", sign);
|
||||
hashMap.put("code", code);
|
||||
hashMap.put("scope", scope);
|
||||
hashMap.put("timestamp", timestamp);
|
||||
hashMap.put("id", id);
|
||||
return HttpUtil.sendPost(ApiConst.MAIN_HOST_URL + ApiConst.GET_TOKEN, hashMap, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取token 自有应用服务模式所需参数
|
||||
*
|
||||
* @param client_id 平台id 非空值
|
||||
* @param grant_type 授与方式(固定为’client_credentials’)
|
||||
* @param sign 签名 详见API文档列表-接口签名
|
||||
* @param scope 授权权限,传all
|
||||
* @param timestamp 当前服务器时间戳(10位)
|
||||
* @param id UUID4 详见API文档列表-uuid4
|
||||
* @return
|
||||
*/
|
||||
public static String getToken(String client_id, String grant_type, String sign, String scope, String timestamp, String id) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("client_id", client_id);
|
||||
hashMap.put("grant_type", grant_type);
|
||||
hashMap.put("sign", sign);
|
||||
hashMap.put("scope", scope);
|
||||
hashMap.put("timestamp", timestamp);
|
||||
hashMap.put("id", id);
|
||||
return HttpUtil.sendPost(ApiConst.MAIN_HOST_URL + ApiConst.GET_TOKEN, hashMap, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新access_token
|
||||
*
|
||||
* @param client_id 易联云颁发给开发者的应用ID 非空值
|
||||
* @param grant_type 授与方式(固定为 “refresh_token”)
|
||||
* @param scope 授权权限,传all
|
||||
* @param sign 签名 详见API文档列表-接口签名
|
||||
* @param refresh_token 更新access_token所需
|
||||
* @param id UUID4 详见API文档列表-uuid4
|
||||
* @param timestamp 当前服务器时间戳(10位)
|
||||
* @return
|
||||
*/
|
||||
public static String refreshToken(String client_id, String grant_type, String scope, String sign, String refresh_token, String id, String timestamp) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("client_id", client_id);
|
||||
hashMap.put("grant_type", grant_type);
|
||||
hashMap.put("scope", scope);
|
||||
hashMap.put("sign", sign);
|
||||
hashMap.put("refresh_token", refresh_token);
|
||||
hashMap.put("id", id);
|
||||
hashMap.put("timestamp", timestamp);
|
||||
return HttpUtil.sendPost(ApiConst.MAIN_HOST_URL + ApiConst.GET_TOKEN, hashMap, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 极速授权
|
||||
*
|
||||
* @param client_id 易联云颁发给开发者的应用ID 非空值
|
||||
* @param machine_code 易联云打印机终端号
|
||||
* @param qr_key 特殊密钥(有效期为300秒)
|
||||
* @param scope 授权权限,传all
|
||||
* @param sign 签名 详见API文档列表
|
||||
* @param id UUID4 详见API文档列表-uuid4
|
||||
* @param timestamp 当前服务器时间戳(10位)
|
||||
* @return
|
||||
*/
|
||||
public static String speedAu(String client_id, String machine_code, String qr_key, String scope, String sign, String id, String timestamp) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("client_id", client_id);
|
||||
hashMap.put("machine_code", machine_code);
|
||||
hashMap.put("qr_key", qr_key);
|
||||
hashMap.put("scope", scope);
|
||||
hashMap.put("sign", sign);
|
||||
hashMap.put("id", id);
|
||||
hashMap.put("timestamp", timestamp);
|
||||
return HttpUtil.sendPost(ApiConst.MAIN_HOST_URL + ApiConst.SPEED_AUTHORIZE, hashMap, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印
|
||||
*
|
||||
* @param client_id 易联云颁发给开发者的应用ID 非空值
|
||||
* @param access_token 授权的token 必要参数
|
||||
* @param machine_code 易联云打印机终端号
|
||||
* @param content 打印内容(需要urlencode)
|
||||
* @param origin_id 商户系统内部订单号,要求32个字符内,只能是数字、大小写字母 ,且在同一个client_id下唯一。详见商户订单号
|
||||
* @param sign 签名 详见API文档列表
|
||||
* @param id UUID4 详见API文档列表-uuid4
|
||||
* @param timestamp 当前服务器时间戳(10位)
|
||||
* @return
|
||||
*/
|
||||
public static String print(String client_id, String access_token, String machine_code, String content, String origin_id, String sign, String id, String timestamp) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("client_id", client_id);
|
||||
hashMap.put("access_token", access_token);
|
||||
hashMap.put("machine_code", machine_code);
|
||||
hashMap.put("content", content);
|
||||
hashMap.put("origin_id", origin_id);
|
||||
hashMap.put("sign", sign);
|
||||
hashMap.put("id", id);
|
||||
hashMap.put("timestamp", timestamp);
|
||||
return HttpUtil.sendPost(ApiConst.MAIN_HOST_URL + ApiConst.API_PRINT, hashMap, false);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加终端授权 开放应用服务模式不需要此接口 ,自有应用服务模式所需参数
|
||||
*
|
||||
* @param client_id 易联云颁发给开发者的应用ID 非空值
|
||||
* @param machine_code 易联云打印机终端号
|
||||
* @param msign 易联云终端密钥(如何快速获取终端号和终端秘钥)
|
||||
* @param access_token 授权的token 必要参数
|
||||
* @param sign 签名 详见API文档列表-接口签名
|
||||
* @param id UUID4 详见API文档列表-uuid4
|
||||
* @param timestamp 当前服务器时间戳(10位)
|
||||
* @return
|
||||
*/
|
||||
public static String addPrinter(String client_id, String machine_code, String msign, String access_token, String sign, String id, String timestamp) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("client_id", client_id);
|
||||
hashMap.put("machine_code", machine_code);
|
||||
hashMap.put("msign", msign);
|
||||
hashMap.put("access_token", access_token);
|
||||
hashMap.put("sign", sign);
|
||||
hashMap.put("id", id);
|
||||
hashMap.put("timestamp", timestamp);
|
||||
return HttpUtil.sendPost(ApiConst.MAIN_HOST_URL + ApiConst.API_ADD_PRINTER, hashMap, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除终端授权 开放应用服务模式、自有应用服务模式所需参数
|
||||
* ps 一旦删除,意味着开发者将失去此台打印机的接口权限,请谨慎操作
|
||||
*
|
||||
* @param client_id 易联云颁发给开发者的应用ID 非空值
|
||||
* @param access_token 授权的token 必要参数
|
||||
* @param machine_code 易联云打印机终端号
|
||||
* @param sign 签名 详见API文档列表-接口签名
|
||||
* @param id UUID4 详见API文档列表-uuid4
|
||||
* @param timestamp 当前服务器时间戳(10位)
|
||||
* @return
|
||||
*/
|
||||
public static String deletePrinter(String client_id, String access_token, String machine_code, String sign, String id, String timestamp) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("client_id", client_id);
|
||||
hashMap.put("access_token", access_token);
|
||||
hashMap.put("machine_code", machine_code);
|
||||
hashMap.put("sign", sign);
|
||||
hashMap.put("id", id);
|
||||
hashMap.put("timestamp", timestamp);
|
||||
return HttpUtil.sendPost(ApiConst.MAIN_HOST_URL + ApiConst.API_DELET_PRINTER, hashMap, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加应用菜单
|
||||
*
|
||||
* @param client_id 易联云颁发给开发者的应用ID 非空值
|
||||
* @param access_token 授权的token 必要参数
|
||||
* @param machine_code 易联云打印机终端号
|
||||
* @param content json格式的应用菜单(其中url和菜单名称需要urlencode)
|
||||
* @param sign 签名 详见API文档列表-接口签名
|
||||
* @param id UUID4 详见API文档列表-uuid4
|
||||
* @param timestamp 当前服务器时间戳(10位)
|
||||
* @return
|
||||
*/
|
||||
public static String addPrintMenu(String client_id, String access_token, String machine_code, String content, String sign, String id, String timestamp) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("client_id", client_id);
|
||||
hashMap.put("access_token", access_token);
|
||||
hashMap.put("machine_code", machine_code);
|
||||
hashMap.put("content", content);
|
||||
hashMap.put("sign", sign);
|
||||
hashMap.put("id", id);
|
||||
hashMap.put("timestamp", timestamp);
|
||||
return HttpUtil.sendPost(ApiConst.MAIN_HOST_URL + ApiConst.API_ADD_PRINT_MENU, hashMap, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关机重启接口
|
||||
*
|
||||
* @param client_id 易联云颁发给开发者的应用ID 非空值
|
||||
* @param access_token 授权的token 必要参数
|
||||
* @param machine_code 易联云打印机终端号
|
||||
* @param response_type 重启:restart,关闭:shutdown
|
||||
* @param sign 签名 详见API文档列表-接口签名
|
||||
* @param id UUID4 详见API文档列表-uuid4
|
||||
* @param timestamp 当前服务器时间戳(10位)
|
||||
* @return
|
||||
*/
|
||||
public static String shutDownRestart(String client_id, String access_token, String machine_code, String response_type, String sign, String id, String timestamp) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("client_id", client_id);
|
||||
hashMap.put("access_token", access_token);
|
||||
hashMap.put("machine_code", machine_code);
|
||||
hashMap.put("response_type", response_type);
|
||||
hashMap.put("sign", sign);
|
||||
hashMap.put("id", id);
|
||||
hashMap.put("timestamp", timestamp);
|
||||
return HttpUtil.sendPost(ApiConst.MAIN_HOST_URL + ApiConst.API_SHUTDOWN_RESTART, hashMap, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 声音调节接口
|
||||
*
|
||||
* @param client_id 易联云颁发给开发者的应用ID 非空值
|
||||
* @param access_token 授权的token 必要参数
|
||||
* @param machine_code 易联云打印机终端号
|
||||
* @param response_type 蜂鸣器:buzzer,喇叭:horn
|
||||
* @param voice [1,2,3] 3种音量设置
|
||||
* @param sign 签名 详见API文档列表-接口签名
|
||||
* @param id UUID4 详见API文档列表-uuid4
|
||||
* @param timestamp 当前服务器时间戳(10位)
|
||||
* @return
|
||||
*/
|
||||
public static String setSound(String client_id, String access_token, String machine_code, String response_type, String voice, String sign, String id, String timestamp) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("client_id", client_id);
|
||||
hashMap.put("access_token", access_token);
|
||||
hashMap.put("machine_code", machine_code);
|
||||
hashMap.put("response_type", response_type);
|
||||
hashMap.put("voice", voice);
|
||||
hashMap.put("sign", sign);
|
||||
hashMap.put("id", id);
|
||||
hashMap.put("timestamp", timestamp);
|
||||
return HttpUtil.sendPost(ApiConst.MAIN_HOST_URL + ApiConst.API_SET_SOUND, hashMap, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机型打印宽度接口
|
||||
*
|
||||
* @param client_id 易联云颁发给开发者的应用ID 非空值
|
||||
* @param access_token 授权的token 必要参数
|
||||
* @param machine_code 易联云打印机终端号
|
||||
* @param sign 签名 详见API文档列表-接口签名
|
||||
* @param id UUID4 详见API文档列表-uuid4
|
||||
* @param timestamp 当前服务器时间戳(10位)
|
||||
* @return
|
||||
*/
|
||||
public static String getPrintInfo(String client_id, String access_token, String machine_code, String sign, String id, String timestamp) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("client_id", client_id);
|
||||
hashMap.put("access_token", access_token);
|
||||
hashMap.put("machine_code", machine_code);
|
||||
hashMap.put("sign", sign);
|
||||
hashMap.put("id", id);
|
||||
hashMap.put("timestamp", timestamp);
|
||||
return HttpUtil.sendPost(ApiConst.MAIN_HOST_URL + ApiConst.API_PRINT_INFO, hashMap, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机型软硬件版本接口
|
||||
*
|
||||
* @param client_id 易联云颁发给开发者的应用ID 非空值
|
||||
* @param access_token 授权的token 必要参数
|
||||
* @param machine_code 易联云打印机终端号
|
||||
* @param sign 签名 详见API文档列表-接口签名
|
||||
* @param id UUID4 详见API文档列表-uuid4
|
||||
* @param timestamp 当前服务器时间戳(10位)
|
||||
* @return
|
||||
*/
|
||||
public static String getVersion(String client_id, String access_token, String machine_code, String sign, String id, String timestamp) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("client_id", client_id);
|
||||
hashMap.put("access_token", access_token);
|
||||
hashMap.put("machine_code", machine_code);
|
||||
hashMap.put("sign", sign);
|
||||
hashMap.put("id", id);
|
||||
hashMap.put("timestamp", timestamp);
|
||||
return HttpUtil.sendPost(ApiConst.MAIN_HOST_URL + ApiConst.API_GET_VIERSION, hashMap, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消所有未打印订单
|
||||
*
|
||||
* @param client_id 易联云颁发给开发者的应用ID 非空值
|
||||
* @param access_token 授权的token 必要参数
|
||||
* @param machine_code 易联云打印机终端号
|
||||
* @param sign 签名 详见API文档列表-接口签名
|
||||
* @param id UUID4 详见API文档列表-uuid4
|
||||
* @param timestamp 当前服务器时间戳(10位)
|
||||
* @return
|
||||
*/
|
||||
public static String cancelAll(String client_id, String access_token, String machine_code, String sign, String id, String timestamp) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("client_id", client_id);
|
||||
hashMap.put("access_token", access_token);
|
||||
hashMap.put("machine_code", machine_code);
|
||||
hashMap.put("sign", sign);
|
||||
hashMap.put("id", id);
|
||||
hashMap.put("timestamp", timestamp);
|
||||
return HttpUtil.sendPost(ApiConst.MAIN_HOST_URL + ApiConst.API_CANCEL_ALL, hashMap, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消单条未打印订单
|
||||
*
|
||||
* @param client_id 易联云颁发给开发者的应用ID 非空值
|
||||
* @param access_token 授权的token 必要参数
|
||||
* @param machine_code 易联云打印机终端号
|
||||
* @param order_id 通过打印接口返回的订单号 详见API文档列表-打印接口
|
||||
* @param sign 签名 详见API文档列表-接口签名
|
||||
* @param id UUID4 详见API文档列表-uuid4
|
||||
* @param timestamp 当前服务器时间戳(10位)
|
||||
* @return
|
||||
*/
|
||||
public static String cancelOne(String client_id, String access_token, String machine_code, String order_id, String sign, String id, String timestamp) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("client_id", client_id);
|
||||
hashMap.put("access_token", access_token);
|
||||
hashMap.put("machine_code", machine_code);
|
||||
hashMap.put("order_id", order_id);
|
||||
hashMap.put("sign", sign);
|
||||
hashMap.put("id", id);
|
||||
hashMap.put("timestamp", timestamp);
|
||||
return HttpUtil.sendPost(ApiConst.MAIN_HOST_URL + ApiConst.API_CANCEL_ONE, hashMap, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置logo接口
|
||||
*
|
||||
* @param client_id 易联云颁发给开发者的应用ID 非空值
|
||||
* @param access_token 授权的token 必要参数
|
||||
* @param machine_code 易联云打印机终端号
|
||||
* @param img_url 图片地址,图片宽度最大为350px,文件大小不能超过40Kb
|
||||
* @param sign 签名 详见API文档列表-接口签名
|
||||
* @param id UUID4 详见API文档列表-uuid4
|
||||
* @param timestamp 当前服务器时间戳(10位)
|
||||
* @return
|
||||
*/
|
||||
public static String setIcon(String client_id, String access_token, String machine_code, String img_url, String sign, String id, String timestamp) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("client_id", client_id);
|
||||
hashMap.put("access_token", access_token);
|
||||
hashMap.put("machine_code", machine_code);
|
||||
hashMap.put("img_url", img_url);
|
||||
hashMap.put("sign", sign);
|
||||
hashMap.put("id", id);
|
||||
hashMap.put("timestamp", timestamp);
|
||||
return HttpUtil.sendPost(ApiConst.MAIN_HOST_URL + ApiConst.API_SET_ICON, hashMap, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消logo接口
|
||||
*
|
||||
* @param client_id 易联云颁发给开发者的应用ID 非空值
|
||||
* @param access_token 授权的token 必要参数
|
||||
* @param machine_code 易联云打印机终端号
|
||||
* @param sign 签名 详见API文档列表-接口签名
|
||||
* @param id UUID4 详见API文档列表-uuid4
|
||||
* @param timestamp 当前服务器时间戳(10位)
|
||||
* @return
|
||||
*/
|
||||
public static String deleteIcon(String client_id, String access_token, String machine_code, String sign, String id, String timestamp) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("client_id", client_id);
|
||||
hashMap.put("access_token", access_token);
|
||||
hashMap.put("machine_code", machine_code);
|
||||
hashMap.put("sign", sign);
|
||||
hashMap.put("id", id);
|
||||
hashMap.put("timestamp", timestamp);
|
||||
return HttpUtil.sendPost(ApiConst.MAIN_HOST_URL + ApiConst.API_DELET_ICON, hashMap, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 接单拒单设置接口
|
||||
*
|
||||
* @param client_id 易联云颁发给开发者的应用ID 非空值
|
||||
* @param access_token 授权的token 必要参数
|
||||
* @param machine_code 易联云打印机终端号
|
||||
* @param response_type 开启:open,关闭:close
|
||||
* @param sign 签名 详见API文档列表-接口签名
|
||||
* @param id UUID4 详见API文档列表-uuid4
|
||||
* @param timestamp 当前服务器时间戳(10位)
|
||||
* @return
|
||||
*/
|
||||
public static String getOrder(String client_id, String access_token, String machine_code, String response_type, String sign, String id, String timestamp) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("client_id", client_id);
|
||||
hashMap.put("access_token", access_token);
|
||||
hashMap.put("machine_code", machine_code);
|
||||
hashMap.put("response_type", response_type);
|
||||
hashMap.put("sign", sign);
|
||||
hashMap.put("id", id);
|
||||
hashMap.put("timestamp", timestamp);
|
||||
return HttpUtil.sendPost(ApiConst.MAIN_HOST_URL + ApiConst.API_GET_ORDER, hashMap, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印方式接口
|
||||
*
|
||||
* @param client_id 易联云颁发给开发者的应用ID 非空值
|
||||
* @param access_token 授权的token 必要参数
|
||||
* @param machine_code 易联云打印机终端号
|
||||
* @param response_type 开启:btnopen,关闭:btnclose; 按键打印
|
||||
* @param sign 签名 详见API文档列表-接口签名
|
||||
* @param id UUID4 详见API文档列表-uuid4
|
||||
* @param timestamp 当前服务器时间戳(10位)
|
||||
* @return
|
||||
*/
|
||||
public static String btnPrint(String client_id, String access_token, String machine_code, String response_type, String sign, String id, String timestamp) {
|
||||
HashMap hashMap = new HashMap();
|
||||
hashMap.put("client_id", client_id);
|
||||
hashMap.put("access_token", access_token);
|
||||
hashMap.put("machine_code", machine_code);
|
||||
hashMap.put("response_type", response_type);
|
||||
hashMap.put("sign", sign);
|
||||
hashMap.put("id", id);
|
||||
hashMap.put("timestamp", timestamp);
|
||||
return HttpUtil.sendPost(ApiConst.MAIN_HOST_URL + ApiConst.API_BTN_PRINT, hashMap, false);
|
||||
}
|
||||
|
||||
public static String getSin(String timestamp) {
|
||||
try {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append(Methods.CLIENT_ID);
|
||||
stringBuilder.append(timestamp);
|
||||
stringBuilder.append(Methods.CLIENT_SECRET);
|
||||
return getMd5(stringBuilder.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static String getuuid() {
|
||||
return UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param str
|
||||
* @return
|
||||
* @Description: 32位小写MD5
|
||||
*/
|
||||
public static String getMd5(String str) {
|
||||
String reStr = "";
|
||||
try {
|
||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||
byte[] bytes = md5.digest(str.getBytes());
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
for (byte b : bytes) {
|
||||
int bt = b & 0xff;
|
||||
if (bt < 16) {
|
||||
stringBuffer.append(0);
|
||||
}
|
||||
stringBuffer.append(Integer.toHexString(bt));
|
||||
}
|
||||
reStr = stringBuffer.toString();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return reStr;
|
||||
}
|
||||
}
|
@ -0,0 +1,352 @@
|
||||
package com.fuint.business.printer.unit;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
/**
|
||||
* 易联云接口工具类
|
||||
*/
|
||||
public class Methods {
|
||||
/**
|
||||
* 易联云颁发给开发者的应用ID 非空值
|
||||
*/
|
||||
public static String CLIENT_ID;
|
||||
|
||||
/**
|
||||
* 易联云颁发给开发者的应用secret 非空值
|
||||
*/
|
||||
public static String CLIENT_SECRET;
|
||||
|
||||
/**
|
||||
* token
|
||||
*/
|
||||
public static String token;
|
||||
|
||||
/**
|
||||
* 刷新token需要的 refreshtoken
|
||||
*/
|
||||
public static String refresh_token;
|
||||
|
||||
/**
|
||||
* code
|
||||
*/
|
||||
public static String CODE;
|
||||
|
||||
private Methods() {
|
||||
}
|
||||
|
||||
private static class SingleMethods {
|
||||
private static final Methods COCOS_MANGER = new Methods();
|
||||
}
|
||||
|
||||
public static final Methods getInstance() {
|
||||
return SingleMethods.COCOS_MANGER;
|
||||
}
|
||||
|
||||
/**
|
||||
* 开放式初始化
|
||||
*
|
||||
* @param client_id
|
||||
* @param client_secret
|
||||
* @param code
|
||||
*/
|
||||
public void init(String client_id, String client_secret, String code) {
|
||||
CLIENT_ID = client_id;
|
||||
CLIENT_SECRET = client_secret;
|
||||
CODE = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自有初始化
|
||||
*
|
||||
* @param client_id
|
||||
* @param client_secret
|
||||
*/
|
||||
public void init(String client_id, String client_secret) {
|
||||
CLIENT_ID = client_id;
|
||||
CLIENT_SECRET = client_secret;
|
||||
}
|
||||
|
||||
public void init(String a_token) {
|
||||
|
||||
token = a_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* 开放应用
|
||||
*/
|
||||
public String getToken() {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
String result = LAVApi.getToken(CLIENT_ID,
|
||||
"authorization_code",
|
||||
LAVApi.getSin(timestamp),
|
||||
CODE,
|
||||
"all",
|
||||
timestamp,
|
||||
LAVApi.getuuid());
|
||||
try {
|
||||
JSONObject json = new JSONObject(result);
|
||||
JSONObject body = json.getJSONObject("body");
|
||||
token = body.getString("access_token");
|
||||
refresh_token = body.getString("refresh_token");
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("getToken出现Json异常!" + e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自有应用服务
|
||||
*/
|
||||
public String getFreedomToken() {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
String result = LAVApi.getToken(CLIENT_ID,
|
||||
"client_credentials",
|
||||
LAVApi.getSin(timestamp),
|
||||
"all",
|
||||
timestamp,
|
||||
LAVApi.getuuid());
|
||||
try {
|
||||
JSONObject json = new JSONObject(result);
|
||||
JSONObject body = json.getJSONObject("body");
|
||||
token = body.getString("access_token");
|
||||
refresh_token = body.getString("refresh_token");
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("getFreedomToken出现Json异常!" + e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新token
|
||||
*/
|
||||
public String refreshToken() {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
String result = LAVApi.refreshToken(CLIENT_ID,
|
||||
"refresh_token",
|
||||
"all",
|
||||
LAVApi.getSin(timestamp),
|
||||
refresh_token,
|
||||
LAVApi.getuuid(),
|
||||
timestamp);
|
||||
try {
|
||||
JSONObject json = new JSONObject(result);
|
||||
JSONObject body = json.getJSONObject("body");
|
||||
token = body.getString("access_token");
|
||||
refresh_token = body.getString("refresh_token");
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("refreshToken出现Json异常!" + e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加终端授权 开放应用服务模式不需要此接口 ,自有应用服务模式所需参数
|
||||
*/
|
||||
public String addPrinter(String machine_code, String msign) {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
return LAVApi.addPrinter(CLIENT_ID,
|
||||
machine_code,
|
||||
msign,
|
||||
token,
|
||||
LAVApi.getSin(timestamp),
|
||||
LAVApi.getuuid(),
|
||||
timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 极速授权
|
||||
*/
|
||||
public String speedAu(String machine_code, String qr_key) {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
return LAVApi.speedAu(CLIENT_ID,
|
||||
machine_code,
|
||||
qr_key,
|
||||
"all",
|
||||
LAVApi.getSin(timestamp),
|
||||
LAVApi.getuuid(),
|
||||
timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印
|
||||
*/
|
||||
public String print(String machine_code, String content, String origin_id) {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
return LAVApi.print(CLIENT_ID,
|
||||
token,
|
||||
machine_code,
|
||||
content,
|
||||
origin_id,
|
||||
LAVApi.getSin(timestamp),
|
||||
LAVApi.getuuid(),
|
||||
timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除终端授权
|
||||
*/
|
||||
public String deletePrinter(String machine_code) {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
return LAVApi.deletePrinter(CLIENT_ID,
|
||||
token,
|
||||
machine_code,
|
||||
LAVApi.getSin(timestamp),
|
||||
LAVApi.getuuid(),
|
||||
timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加应用菜单
|
||||
*/
|
||||
public String addPrintMenu(String machine_code, String content) {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
return LAVApi.addPrintMenu(CLIENT_ID,
|
||||
token,
|
||||
machine_code,
|
||||
content,
|
||||
LAVApi.getSin(timestamp),
|
||||
LAVApi.getuuid(),
|
||||
timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关机重启接口
|
||||
*/
|
||||
public String shutDownRestart(String machine_code, String response_type) {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
return LAVApi.shutDownRestart(CLIENT_ID,
|
||||
token,
|
||||
machine_code,
|
||||
response_type,
|
||||
LAVApi.getSin(timestamp),
|
||||
LAVApi.getuuid(),
|
||||
timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 声音调节
|
||||
*/
|
||||
public String setSound(String machine_code, String response_type, String voice) {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
return LAVApi.setSound(CLIENT_ID,
|
||||
token,
|
||||
machine_code,
|
||||
response_type,
|
||||
voice,
|
||||
LAVApi.getSin(timestamp),
|
||||
LAVApi.getuuid(),
|
||||
timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机型打印宽度接口
|
||||
*/
|
||||
public String getPrintInfo(String machine_code) {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
return LAVApi.getPrintInfo(CLIENT_ID,
|
||||
token,
|
||||
machine_code,
|
||||
LAVApi.getSin(timestamp),
|
||||
LAVApi.getuuid(),
|
||||
timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机型软硬件版本接口
|
||||
*/
|
||||
public String getVersion(String machine_code) {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
return LAVApi.getVersion(CLIENT_ID,
|
||||
token,
|
||||
machine_code,
|
||||
LAVApi.getSin(timestamp),
|
||||
LAVApi.getuuid(),
|
||||
timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消所有未打印订单
|
||||
*/
|
||||
public String cancelAll(String machine_code) {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
return LAVApi.cancelAll(CLIENT_ID,
|
||||
token,
|
||||
machine_code,
|
||||
LAVApi.getSin(timestamp),
|
||||
LAVApi.getuuid(),
|
||||
timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消单条未打印订单
|
||||
*/
|
||||
public String cancelOne(String machine_code, String order_id) {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
return LAVApi.cancelOne(CLIENT_ID,
|
||||
token,
|
||||
machine_code,
|
||||
order_id,
|
||||
LAVApi.getSin(timestamp),
|
||||
LAVApi.getuuid(),
|
||||
timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置logo
|
||||
*/
|
||||
public String setIcon(String machine_code, String img_url) {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
return LAVApi.setIcon(CLIENT_ID,
|
||||
token,
|
||||
machine_code,
|
||||
img_url,
|
||||
LAVApi.getSin(timestamp),
|
||||
LAVApi.getuuid(),
|
||||
timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除logo
|
||||
*/
|
||||
public String deleteIcon(String machine_code) {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
return LAVApi.deleteIcon(CLIENT_ID,
|
||||
token,
|
||||
machine_code,
|
||||
LAVApi.getSin(timestamp),
|
||||
LAVApi.getuuid(),
|
||||
timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印方式
|
||||
*/
|
||||
public String btnPrint(String machine_code, String response_type) {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
return LAVApi.btnPrint(CLIENT_ID,
|
||||
token,
|
||||
machine_code,
|
||||
response_type,
|
||||
LAVApi.getSin(timestamp),
|
||||
LAVApi.getuuid(),
|
||||
timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 接单拒单设置接口
|
||||
*/
|
||||
public String getOrder(String machine_code, String response_type) {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
return LAVApi.getOrder(CLIENT_ID,
|
||||
token,
|
||||
machine_code,
|
||||
response_type,
|
||||
LAVApi.getSin(timestamp),
|
||||
LAVApi.getuuid(),
|
||||
timestamp);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
package com.fuint.business.printer.unit;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.fuint.business.printer.entity.Test;
|
||||
import com.fuint.business.printer.template.Prient;
|
||||
|
||||
/**
|
||||
* 控制器
|
||||
* @author admin
|
||||
*
|
||||
*/
|
||||
public class TestSrvlet extends HttpServlet {
|
||||
/**
|
||||
* Constructor of the object.
|
||||
*/
|
||||
public TestSrvlet() {
|
||||
super();
|
||||
}
|
||||
/**
|
||||
* Destruction of the servlet. <br>
|
||||
*/
|
||||
public void destroy() {
|
||||
super.destroy(); // Just puts "destroy" string in log
|
||||
// Put your code here
|
||||
}
|
||||
|
||||
/**
|
||||
* The doGet method of the servlet. <br>
|
||||
*
|
||||
* This method is called when a form has its tag value method equals to get.
|
||||
*
|
||||
* @param request the request send by the client to the server
|
||||
* @param response the response send by the server to the client
|
||||
* @throws ServletException if an error occurred
|
||||
* @throws IOException if an error occurred
|
||||
*/
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
|
||||
|
||||
|
||||
response.setContentType("text/html");
|
||||
PrintWriter out = response.getWriter();
|
||||
//测试数据
|
||||
List<Test> testList = new ArrayList<Test>();
|
||||
Test t1 = new Test("麻辣牛肉", 23.00, 1,"1");
|
||||
Test t2 = new Test("麻辣牛肉", 23.00, 2,"2");
|
||||
Test t3 = new Test("精品千层肚", 24.00, 3,"3");
|
||||
Test t4 = new Test("麻辣牛肉", 23.00, 2,"1");
|
||||
Test t5 = new Test("极品鲜毛肚", 26.00, 2,"1");
|
||||
Test t6 = new Test("极品鲜毛肚", 26.00, 1,"2");
|
||||
Test t7 = new Test("极品鲜毛肚", 26.00, 3,"2");
|
||||
Test t8 = new Test("极品鲜毛肚", 26.00, 1,"1");
|
||||
Test t9 = new Test("极品鲜毛肚", 26.00, 2,"3");
|
||||
testList.add(t1);
|
||||
testList.add(t2);
|
||||
testList.add(t3);
|
||||
testList.add(t4);
|
||||
testList.add(t5);
|
||||
testList.add(t6);
|
||||
testList.add(t7);
|
||||
testList.add(t8);
|
||||
testList.add(t9);
|
||||
Prient.setTestList(testList);
|
||||
|
||||
//关键代码,自己的程序发送请求
|
||||
//初始化控制器类
|
||||
Methods m=Methods.getInstance();
|
||||
//初始化终端信息
|
||||
m.init("1038835098", "1595cb28ea30e98908e6334e735f4b8a");
|
||||
//获取token
|
||||
m.getFreedomToken();
|
||||
//刷新token
|
||||
m.refreshToken();
|
||||
//添加授权
|
||||
m.addPrinter("4004557406", "zqvfw2v5p3fn");
|
||||
//打印
|
||||
//终端编号 打印内容 订单号
|
||||
//生成6位随机数
|
||||
Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
String url=m.print("4004557406", Prient.print(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
response.sendRedirect(url);
|
||||
out.flush();
|
||||
out.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* The doPost method of the servlet. <br>
|
||||
*
|
||||
* This method is called when a form has its tag value method equals to post.
|
||||
*
|
||||
* @param request the request send by the client to the server
|
||||
* @param response the response send by the server to the client
|
||||
* @throws ServletException if an error occurred
|
||||
* @throws IOException if an error occurred
|
||||
*/
|
||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
|
||||
this.doGet(request, response);
|
||||
}
|
||||
/**
|
||||
* Initialization of the servlet. <br>
|
||||
*
|
||||
* @throws ServletException if an error occurs
|
||||
*/
|
||||
public void init() throws ServletException {
|
||||
// Put your code here
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.fuint.business.printer.vo;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class OrderPayment {
|
||||
private String scannedCode; // 条码
|
||||
private String payAmountSource; // 支付来源
|
||||
private String orderPayment; // 金额
|
||||
}
|
@ -80,6 +80,9 @@ public class ShiroConfig {
|
||||
filterMap.put("/business/marketingActivity/activeExchange/getPaymentActive","anon"); // 查询用户油品订单的优惠信息
|
||||
filterMap.put("/business/oilOrder/oilOrderNo","anon"); // 获取油品订单
|
||||
filterMap.put("/business/petrolStationManagement/oilNumber/getOilNumberName/**","anon"); // 获取店铺油号信息
|
||||
filterMap.put("/business/printer/**","anon");
|
||||
// filterMap.put("/business/printer/callback","anon");
|
||||
// filterMap.put("/business/printer/push","anon");
|
||||
|
||||
|
||||
|
||||
|
@ -285,7 +285,7 @@ public class BackendCouponGroupController extends BaseController {
|
||||
|
||||
ExcelExportDto excelExportDto = new ExcelExportDto();
|
||||
excelExportDto.setSrcPath(srcTemplateFilePath);
|
||||
excelExportDto.setSrcTemplateFileName("template" + File.separator + "importTemplate.xlsx");
|
||||
excelExportDto.setSrcTemplateFileName("com/fuint/business/printer/template" + File.separator + "importTemplate.xlsx");
|
||||
|
||||
String filename = "批量发券模板" + ".xlsx";
|
||||
try {
|
||||
|
@ -11,7 +11,7 @@ import com.fuint.business.storeInformation.entity.LJStore;
|
||||
import com.fuint.business.storeInformation.service.ILJStoreService;
|
||||
import com.fuint.business.userManager.entity.LJUser;
|
||||
import com.fuint.business.userManager.service.LJUserService;
|
||||
import com.fuint.common.annotation.ExpirationCheck;
|
||||
//import com.fuint.common.annotation.ExpirationCheck;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.dto.UserDto;
|
||||
import com.fuint.common.enums.AdminRoleEnum;
|
||||
@ -170,7 +170,7 @@ public class BackendLoginController extends BaseController {
|
||||
@ApiOperation(value = "终台登录")
|
||||
@RequestMapping(value="/doLogins", method = RequestMethod.POST)
|
||||
@OperationServiceLog(description = "登录后台系统")
|
||||
@ExpirationCheck
|
||||
// @ExpirationCheck
|
||||
public ResponseObject doLogins(HttpServletRequest request, @RequestBody LoginRequest loginRequest) {
|
||||
String userAgent = request.getHeader("user-agent");
|
||||
String accountName = loginRequest.getUsername();
|
||||
|
@ -195,6 +195,7 @@ public class BackendSourceController extends BaseController {
|
||||
editSource.setSourceStyle(sort);
|
||||
editSource.setIsMenu(isMenu);
|
||||
editSource.setSourceCode(editSource.getPath());
|
||||
editSource.setMerchantId(Integer.valueOf(param.get("merchantId").toString()));
|
||||
|
||||
String eName = "";
|
||||
String[] paths = path.split("/");
|
||||
|
@ -31,6 +31,9 @@ public class BaseController {
|
||||
public ResponseObject getSuccessResult(String message, Object data) {
|
||||
return new ResponseObject(FrameworkConstants.HTTP_RESPONSE_CODE_SUCCESS, message, data);
|
||||
}
|
||||
public ResponseObject getSuccessResult2() {
|
||||
return new ResponseObject(FrameworkConstants.HTTP_RESPONSE_CODE_SUCCESS, "ok", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取成功返回结果
|
||||
|
102
fuintCashierWeb/src/api/print.js
Normal file
102
fuintCashierWeb/src/api/print.js
Normal file
@ -0,0 +1,102 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 易联云打印相关接口
|
||||
|
||||
|
||||
// 网络下发付款
|
||||
export function sendPrintIndex(query) {
|
||||
return request({
|
||||
url: 'business/printer/printIndex',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 获取code(条码)
|
||||
export function getReturnCode(query) {
|
||||
return request({
|
||||
url: 'business/printer/returnCode',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
// 打印交接班
|
||||
export function printGetHandoverReport(data) {
|
||||
return request({
|
||||
url: 'business/printer/getHandover',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 打印购物小票
|
||||
export function printOilOrderReport(data) {
|
||||
return request({
|
||||
url: 'business/printer/printOilOrderReport',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function rePrintOilOrderReport(data) {
|
||||
return request({
|
||||
url: 'business/printer/rePrintOilOrderReport',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function printCardValueReport(data) {
|
||||
return request({
|
||||
url: 'business/printer/printCardValueReport',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
export function printFuelDieselReport(data) {
|
||||
return request({
|
||||
url: 'business/printer/printFuelDieselReport',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function printIntegralReport(data) {
|
||||
return request({
|
||||
url: 'business/printer/printIntegralReport',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 打印设备增删改查接口
|
||||
export function getListByPageApi(query) {
|
||||
return request({
|
||||
url: 'business/printDeviceInfo/queryByPage',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
export function addPrintDeviceApi(data) {
|
||||
return request({
|
||||
url: 'business/printDeviceInfo',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function editPrintDeviceApi(data) {
|
||||
return request({
|
||||
url: 'business/printDeviceInfo',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
export function delPrintDeviceApi(query) {
|
||||
return request({
|
||||
url: 'business/printDeviceInfo',
|
||||
method: 'delete',
|
||||
params: query
|
||||
})
|
||||
}
|
@ -2,8 +2,8 @@
|
||||
<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>
|
||||
<!-- <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">
|
||||
@ -389,7 +389,7 @@
|
||||
<i v-if="staff.staffName" class="el-icon-close" @click="clean()"></i>
|
||||
</div>
|
||||
<!-- <div class="anniu-lv">云打印</div> -->
|
||||
<div class="anniu-lv" @click="printLocally()">本地打印</div>
|
||||
<div class="anniu-lv" @click="oilOrderReport()">云打印</div>
|
||||
<div ><el-link type="primary" @click="recording">交班记录</el-link></div>
|
||||
</div>
|
||||
</el-card>
|
||||
@ -410,6 +410,7 @@ import {removeUserId} from "@/utils/auth";
|
||||
import { getLodop } from "@/api/LodopFuncs";
|
||||
import Vue from 'vue';
|
||||
import SelectStaff from "@/components/local/selectStaff.vue";
|
||||
import {printGetHandoverReport, rePrintOilOrderReport} from "@/api/print";
|
||||
|
||||
export default {
|
||||
name: "Handover",
|
||||
@ -549,7 +550,13 @@ import SelectStaff from "@/components/local/selectStaff.vue";
|
||||
}
|
||||
});
|
||||
},
|
||||
async printLocally() {
|
||||
oilOrderReport () {
|
||||
printGetHandoverReport(this.handoverList).then(res=>{
|
||||
|
||||
})
|
||||
},
|
||||
|
||||
async printLocally() {
|
||||
//初始化打印函数
|
||||
let LODOP = getLodop(); // 初始化打印
|
||||
LODOP.PRINT_INIT();
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!--发票-->
|
||||
<template>
|
||||
<div class="app-center">
|
||||
<el-button style="float: left ;margin-left: 5px" size="mini" type="primary" @click="printLocally()" plain>打印交班单</el-button>
|
||||
<el-button style="float: left ;margin-left: 5px" size="mini" type="primary" @click="oilOrderReport()" plain>打印交班单</el-button>
|
||||
|
||||
<div id="report" ref="report" class="box-center">
|
||||
<div class="box-title">
|
||||
@ -374,6 +374,7 @@
|
||||
import {printLocallyApi,addHandoverApis} from "@/api/cashier/handover";
|
||||
import BigNumber from "bignumber.js";
|
||||
import {getLodop} from "@/api/LodopFuncs";
|
||||
import {printGetHandoverReport} from "@/api/print";
|
||||
|
||||
export default {
|
||||
name: "HandoverOnly",
|
||||
@ -392,7 +393,11 @@ import {getLodop} from "@/api/LodopFuncs";
|
||||
// this.getHandover();
|
||||
},
|
||||
methods: {
|
||||
oilOrderReport () {
|
||||
printGetHandoverReport(this.handoverList).then(res=>{
|
||||
|
||||
})
|
||||
},
|
||||
printLocally() {
|
||||
// const printHTML = document.querySelector('#report').innerHTML
|
||||
// // 将打印的区域赋值,进行打印
|
||||
|
@ -466,6 +466,7 @@ import {getUserGrade, listUserGrade} from "@/api/cashier/usergrade";
|
||||
import {queryStaffs, staffInfo} from "@/api/cashier/staff";
|
||||
import {connectFlag, getLodop} from "@/api/LodopFuncs";
|
||||
import {listCardFavorableRecord} from "@/api/cashier/cardfavorablerecord";
|
||||
import {getReturnCode, printIntegralReport, sendPrintIndex} from "@/api/print";
|
||||
|
||||
export default {
|
||||
name: "Integral",
|
||||
@ -987,7 +988,7 @@ import {listCardFavorableRecord} from "@/api/cashier/cardfavorablerecord";
|
||||
this.openOrderHistory = true
|
||||
},
|
||||
// 立即结算
|
||||
settlement(){
|
||||
async settlement(){
|
||||
if (this.shoppingCart.length <1){
|
||||
this.$message.error('请先选择商品');
|
||||
return
|
||||
@ -997,7 +998,76 @@ import {listCardFavorableRecord} from "@/api/cashier/cardfavorablerecord";
|
||||
}
|
||||
this.isPay = true;
|
||||
this.dialogVisiblej = true
|
||||
if (this.paymentType !== 'CASH') {
|
||||
if (this.allAmout != 0) {
|
||||
// 发送扫码机请求(易联云网络下发)
|
||||
await this.getSendPrintIndex(this.allAmout);
|
||||
this.getCode(this.allAmout)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
// 网络下发之后获取条码
|
||||
getCode(amount) {
|
||||
this.jishuqi++;
|
||||
if (this.jishuqi == 30) {
|
||||
this.jishuqi = 0
|
||||
return
|
||||
}
|
||||
getReturnCode ({payAmount:amount}).then(res=>{
|
||||
if (res.data === "300") {
|
||||
setTimeout(() => {
|
||||
this.getCode(amount); // 重新发起请求
|
||||
}, 1000); // 停顿一秒
|
||||
}else {
|
||||
this.authCode = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
getSendPrintIndex(amount) {
|
||||
sendPrintIndex({payAmount:amount}).then(ress=>{
|
||||
if (ress.data != "success") {
|
||||
this.$modal.msgError("扫码机发起付款失败!")
|
||||
return;
|
||||
}
|
||||
})
|
||||
},
|
||||
integralReport() {
|
||||
let shoppingCart = []
|
||||
this.shoppingCart.forEach(res=>{
|
||||
let price = ''
|
||||
if (res.exchangeMethod == '积分' || res.exchangeMethod == '积分+金额' || res.exchangeMethod == '积分+加钱购') {
|
||||
price = res.exchangePoints+"积分"
|
||||
}
|
||||
if (res.exchangeMethod == '积分+金额'){
|
||||
price = price+"+"
|
||||
}
|
||||
if (res.exchangeMethod == '金额' || res.exchangeMethod == '积分+金额'){
|
||||
price = price+"¥"+res.exchangeAmount
|
||||
}
|
||||
if (res.exchangeMethod == '积分+加钱购'){
|
||||
price = price +"+"+res.moneyRatio+"加钱比例"
|
||||
}
|
||||
let a = {
|
||||
giftName:res.giftName,
|
||||
markPurchases:res.markPurchases,
|
||||
price:price
|
||||
}
|
||||
shoppingCart.push(a)
|
||||
})
|
||||
let f = {
|
||||
shoppingCart:shoppingCart,
|
||||
allPoints:this.allPoints,
|
||||
allAmout:this.allAmout
|
||||
}
|
||||
printIntegralReport(f).then(res=>{
|
||||
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
|
||||
// 确定收款
|
||||
async collection() {
|
||||
let isPayFlag = false
|
||||
@ -1078,7 +1148,8 @@ import {listCardFavorableRecord} from "@/api/cashier/cardfavorablerecord";
|
||||
this_.isPay = false;
|
||||
console.log("isPayFlag",isPayFlag)
|
||||
if (isPayFlag) {
|
||||
this_.printLocally()
|
||||
// this_.printLocally()
|
||||
this_.integralReport()
|
||||
isPayFlag = false
|
||||
}
|
||||
clearInterval(timer);
|
||||
@ -1154,7 +1225,6 @@ import {listCardFavorableRecord} from "@/api/cashier/cardfavorablerecord";
|
||||
this.authCode = '';
|
||||
},
|
||||
async printLocally(data) {
|
||||
console.log("111111111111111111111111111111111111111111111")
|
||||
if (!connectFlag){
|
||||
return
|
||||
}
|
||||
|
@ -1264,6 +1264,13 @@
|
||||
getPrepaidCardTopUpApi, getPrepaidFuelTopUpApi
|
||||
} from "@/api/cashier/cardSet";
|
||||
import SelectStaff from "@/components/local/selectStaff.vue";
|
||||
import {
|
||||
getReturnCode,
|
||||
printCardValueReport,
|
||||
printFuelDieselReport,
|
||||
printOilOrderReport,
|
||||
sendPrintIndex
|
||||
} from "@/api/print";
|
||||
|
||||
const cityOptions = ['上海', '北京'];
|
||||
export default {
|
||||
@ -1600,6 +1607,7 @@
|
||||
oilPrice:"",
|
||||
oilLiters:"",
|
||||
},
|
||||
jishuqi:0,
|
||||
preferentialData1:{},
|
||||
oilPreferentialData:[],
|
||||
// 挂账单位信息
|
||||
@ -1907,7 +1915,8 @@
|
||||
this_.isPaySuccess = true;
|
||||
this_.isQuery = false;
|
||||
this_.rechargeBalCard = true
|
||||
await this_.printLocally1()
|
||||
// await this_.printLocally1()
|
||||
await this_.cardValueReport()
|
||||
await this_.getMemberAfter();
|
||||
clearInterval(timer);
|
||||
} else if (payStatus === "payFail") {
|
||||
@ -1982,7 +1991,8 @@
|
||||
this_.isPaySuccess = true;
|
||||
this_.isQuery = false;
|
||||
this_.rechargeOilCard = true
|
||||
await this.printLocally2()
|
||||
// await this.printLocally2()
|
||||
await this.fuelDieselReport()
|
||||
await this.getMemberAfter();
|
||||
clearInterval(timer);
|
||||
}
|
||||
@ -2156,7 +2166,10 @@
|
||||
|
||||
},
|
||||
// 确认充值
|
||||
confirm(flag) {
|
||||
async confirm(flag) {
|
||||
|
||||
|
||||
|
||||
this.flag = flag
|
||||
|
||||
if (flag === 1) {
|
||||
@ -2183,9 +2196,15 @@
|
||||
|
||||
this.realyPayBills = this.cardFuelDieselForm.rechargeBalance
|
||||
}
|
||||
|
||||
// 发送扫码机请求(易联云网络下发)
|
||||
await this.getSendPrintIndex(this.realyPayBills);
|
||||
|
||||
this.openConfirm = true;
|
||||
this.isPay = true
|
||||
|
||||
this.getCode(this.realyPayBills)
|
||||
|
||||
},
|
||||
printLocally() {
|
||||
if (!connectFlag){
|
||||
@ -2547,6 +2566,8 @@
|
||||
this.$modal.msgSuccess("挂账记录添加成功");
|
||||
this.dialogVisibleCredit = false;
|
||||
this.printLocally()
|
||||
this.oilOrderReport()
|
||||
|
||||
this.form1.unitName = ""
|
||||
this.payType = "WECHAT"
|
||||
this.resetMember();
|
||||
@ -3584,7 +3605,9 @@
|
||||
this.goods = ""
|
||||
},
|
||||
// 立即结算
|
||||
settlement(){
|
||||
async settlement(){
|
||||
// 发送扫码机请求(易联云网络下发)this.realyPayBills
|
||||
await this.getSendPrintIndex(((+this.oilActualPay) + (+this.goodsActualPay)).toFixed(2));
|
||||
// this.autofocus = true
|
||||
if (this.payType=="APPLET_CODE") {
|
||||
if (this.goodsOrder.length > 0) {
|
||||
@ -3603,10 +3626,161 @@
|
||||
}
|
||||
|
||||
this.dialogVisiblej = true
|
||||
|
||||
this.getCode(((+this.oilActualPay) + (+this.goodsActualPay)).toFixed(2));
|
||||
// this.getStaff()
|
||||
},
|
||||
// 重置油品订单
|
||||
// 网络下发之后获取条码
|
||||
getCode(amount) {
|
||||
this.jishuqi++;
|
||||
if (this.jishuqi == 30) {
|
||||
this.jishuqi = 0
|
||||
return
|
||||
}
|
||||
getReturnCode ({payAmount:amount}).then(res=>{
|
||||
if (res.data === "300") {
|
||||
setTimeout(() => {
|
||||
this.getCode(amount); // 重新发起请求
|
||||
}, 1000); // 停顿一秒
|
||||
}else {
|
||||
this.authCode = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
getSendPrintIndex(amount) {
|
||||
sendPrintIndex({payAmount:amount}).then(ress=>{
|
||||
if (ress.data != "success") {
|
||||
this.$modal.msgError("扫码机发起付款失败!")
|
||||
return;
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
// 打印商品支付后的订单
|
||||
oilOrderReport () {
|
||||
let oilOrderR = []
|
||||
this.oilOrder.forEach(order=>{
|
||||
let o = {
|
||||
oilName : this.getName(this.oilNameList, order.oilName) + "-" + this.getName1(this.gunList, order.gunName),
|
||||
amount : order.amount.toString()
|
||||
}
|
||||
oilOrderR.push(o)
|
||||
})
|
||||
|
||||
let goodsOrderR = []
|
||||
this.goodsOrder.forEach(order=>{
|
||||
let o = {
|
||||
oilName : order.name,
|
||||
amount : order.memberPrice.toString()
|
||||
}
|
||||
goodsOrderR.push(o)
|
||||
})
|
||||
// 支付方式
|
||||
const payTypeMap = {
|
||||
'CASH': '现金',
|
||||
'WECHAT': '微信',
|
||||
'ALIPAY': '支付宝',
|
||||
'UNIONPAY': '银联二维码',
|
||||
'credit': '挂账',
|
||||
'oilCard': '囤油卡',
|
||||
'balance': '储值卡'
|
||||
};
|
||||
let payTypeText = payTypeMap[this.payType] || '小程序码';
|
||||
|
||||
let f ={
|
||||
oilOrder:oilOrderR,
|
||||
goodsOrder:goodsOrderR,
|
||||
payType:payTypeText,
|
||||
unitName:this.form1.unitName, // 挂账单位
|
||||
|
||||
// consumeAmount:this.consumeAmount,
|
||||
creditAmount: (this.oilAmount+(+this.goodsAmount)).toFixed(2),//挂账金额
|
||||
// 优惠合计
|
||||
discount:(this.oilDiscount + this.goodsDiscount + this.fullReduction + this.couponAmount).toFixed(2), // 油惠合计
|
||||
// 储值卡付款
|
||||
consumeAmount:this.consumeAmount,
|
||||
// 屯油卡付款
|
||||
consumeRefuelMoney:this.consumeRefuelMoney.toFixed(2),
|
||||
// 实付款
|
||||
actualPay : ((+this.oilActualPay)+(+this.goodsActualPay)).toFixed(2),
|
||||
// 找零
|
||||
seekZero:this.seekZero.toFixed(2),
|
||||
}
|
||||
printOilOrderReport(f).then(res=>{
|
||||
|
||||
})
|
||||
},
|
||||
|
||||
cardValueReport() {
|
||||
// 支付方式
|
||||
const payTypeMap = {
|
||||
'CASH': '现金',
|
||||
'WECHAT': '微信',
|
||||
'ALIPAY': '支付宝',
|
||||
'UNIONPAY': '银联二维码',
|
||||
'credit': '挂账',
|
||||
'oilCard': '囤油卡',
|
||||
'balance': '储值卡'
|
||||
};
|
||||
let payTypeText = payTypeMap[this.cardValueForm.paymentType]
|
||||
let actualPay = this.cardValueForm.paymentType == 'CASH' ? this.authCode:this.realyPayBills
|
||||
|
||||
let a = {
|
||||
// 充值金额
|
||||
realyPayBills:this.realyPayBills,
|
||||
//赠送金额
|
||||
giftBalance:this.cardValueForm.giftBalance,
|
||||
// 到账金额
|
||||
getAmount:this.cardValueForm.giftBalance + this.realyPayBills,
|
||||
payType:payTypeText,
|
||||
|
||||
// 实付款
|
||||
actualPay: actualPay,
|
||||
// 找零
|
||||
seekZero:this.seekZero.toFixed(2),
|
||||
}
|
||||
|
||||
printCardValueReport(a).then(res=>{
|
||||
|
||||
})
|
||||
|
||||
},
|
||||
fuelDieselReport() {
|
||||
|
||||
// 支付方式
|
||||
const payTypeMap = {
|
||||
'CASH': '现金',
|
||||
'WECHAT': '微信',
|
||||
'ALIPAY': '支付宝',
|
||||
'UNIONPAY': '银联二维码',
|
||||
'credit': '挂账',
|
||||
'oilCard': '囤油卡',
|
||||
'balance': '储值卡'
|
||||
};
|
||||
let payTypeText = payTypeMap[this.cardFuelDieselForm.paymentType]
|
||||
|
||||
let a = {
|
||||
// 充值油品
|
||||
oilType:this.cardFuelDieselForm.type,
|
||||
// 充值升数
|
||||
incomeLitres:this.cardFuelDieselForm.incomeLitres,
|
||||
// 订单金额
|
||||
realyPayBills:this.realyPayBills,
|
||||
// 锁价金额
|
||||
lockupPrice:cardFuelDieselForm.lockupPrice,
|
||||
// 支付方式
|
||||
payType:payTypeText,
|
||||
// 实付款
|
||||
|
||||
// 找零
|
||||
seekZero:this.seekZero.toFixed(2),
|
||||
}
|
||||
|
||||
printFuelDieselReport(a).then(res=>{
|
||||
|
||||
})
|
||||
},
|
||||
// 重置油品订单
|
||||
resetting(){
|
||||
this.seekZero = 0;
|
||||
this.oilOrder = [];
|
||||
@ -3947,7 +4121,8 @@
|
||||
_this.loading = false;
|
||||
_this.isPaySuccess = true;
|
||||
_this.isPay = true;
|
||||
_this.printLocally()
|
||||
// _this.printLocally()
|
||||
_this.oilOrderReport()
|
||||
_this.resetting1();
|
||||
},3000)
|
||||
}else {
|
||||
@ -3975,6 +4150,8 @@
|
||||
_this.isPay = true;
|
||||
_this.loading = false;
|
||||
_this.printLocally()
|
||||
_this.oilOrderReport()
|
||||
|
||||
_this.resetting1()
|
||||
return;
|
||||
}
|
||||
@ -3986,6 +4163,8 @@
|
||||
_this.isPay = true;
|
||||
_this.loading = false;
|
||||
_this.printLocally()
|
||||
_this.oilOrderReport()
|
||||
|
||||
_this.resetting1()
|
||||
return;
|
||||
}
|
||||
@ -4116,6 +4295,8 @@
|
||||
|
||||
_this.loading = false;
|
||||
_this.printLocally()
|
||||
_this.oilOrderReport()
|
||||
|
||||
_this.resetting1();
|
||||
|
||||
if (response.data.oilOrderAmount>0){
|
||||
|
@ -523,6 +523,7 @@ import {connectFlag, getLodop} from "@/api/LodopFuncs";
|
||||
import {getOilNumberGun} from "@/api/cashier/oilGuns";
|
||||
import {formatDate} from "@/utils";
|
||||
import ScanPayCodeDialog from "@/views/cashier/components/scanPayCodeDialog.vue";
|
||||
import {rePrintOilOrderReport} from "@/api/print";
|
||||
|
||||
export default {
|
||||
name: "order_Cashier",
|
||||
@ -731,6 +732,62 @@ import ScanPayCodeDialog from "@/views/cashier/components/scanPayCodeDialog.vue"
|
||||
LODOP.PRINT();
|
||||
|
||||
},
|
||||
|
||||
// 打印商品支付后的订单
|
||||
oilOrderReport () {
|
||||
let oilOrderR = []
|
||||
this.oilInfo.forEach(order=>{
|
||||
let o = {
|
||||
oilName : this.getName(this.oilNameList, order.oils) + "-" + this.getName1(this.oilGunList, order.oilGunNum),
|
||||
amount : order.orderAmount.toString(),
|
||||
oilNum : order.oilNum.toString()
|
||||
}
|
||||
oilOrderR.push(o)
|
||||
})
|
||||
console.log("111111111111111111111111111")
|
||||
|
||||
let goodsOrderR = []
|
||||
if (this.goodsInfo) {
|
||||
this.goodsInfo.forEach(order=>{
|
||||
console.log("111111111111111111111111111")
|
||||
|
||||
let o = {
|
||||
oilName : order.name,
|
||||
unit : order.num+""+order.unit,
|
||||
amount : order.memberPrice.toString()
|
||||
}
|
||||
goodsOrderR.push(o)
|
||||
})
|
||||
}
|
||||
|
||||
console.log("111111111111111111111111112")
|
||||
|
||||
// 支付方式
|
||||
const payTypeMap = {
|
||||
'CASH': '现金',
|
||||
'WECHAT': '微信',
|
||||
'ALIPAY': '支付宝',
|
||||
'UNIONPAY': '银联二维码',
|
||||
'credit': '挂账',
|
||||
'oilCard': '囤油卡',
|
||||
'balance': '储值卡'
|
||||
};
|
||||
let payTypeText = payTypeMap[this.payType] || '小程序码';
|
||||
console.log("111111111111111111111111113")
|
||||
|
||||
let f ={
|
||||
oilOrder:oilOrderR,
|
||||
goodsOrder:goodsOrderR,
|
||||
payType:payTypeText,
|
||||
amount:this.cashierOrder.amount,
|
||||
payAmount:this.cashierOrder.amount,
|
||||
seekZero:this.cashierOrder.payAmount
|
||||
}
|
||||
rePrintOilOrderReport(f).then(res=>{
|
||||
|
||||
})
|
||||
},
|
||||
|
||||
// 补打
|
||||
patchwork(data){
|
||||
const orderNo = data.orderNo
|
||||
@ -743,7 +800,8 @@ import ScanPayCodeDialog from "@/views/cashier/components/scanPayCodeDialog.vue"
|
||||
})
|
||||
await this.getOilList(this.cashierOrder.orderNo)
|
||||
await this.getGoodsLists(this.cashierOrder.goodsOrderId)
|
||||
this.printLocally('report')
|
||||
// this.printLocally('report')
|
||||
this.oilOrderReport()
|
||||
}).catch(() => {});
|
||||
},
|
||||
// 退款
|
||||
@ -847,7 +905,8 @@ import ScanPayCodeDialog from "@/views/cashier/components/scanPayCodeDialog.vue"
|
||||
type: 'info',
|
||||
message: '退款成功'
|
||||
});
|
||||
this.printLocally()
|
||||
// this.printLocally()
|
||||
this.oilOrderReport()
|
||||
}
|
||||
|
||||
})
|
||||
|
@ -312,6 +312,7 @@ import { exportExcelGoodsOrderApi } from "@/api/order/exportExcel";
|
||||
import {cashierOrder} from "@/api/cashier/cashierorder";
|
||||
import {refundApi, getOrderInfoApi} from "@/api/cashier/refund";
|
||||
import {connectFlag, getLodop} from "@/api/LodopFuncs";
|
||||
import {rePrintOilOrderReport} from "@/api/print";
|
||||
|
||||
export default {
|
||||
name: "order_Cashier",
|
||||
@ -491,6 +492,48 @@ export default {
|
||||
LODOP.PRINT();
|
||||
|
||||
},
|
||||
|
||||
// 打印商品支付后的订单
|
||||
oilOrderReport () {
|
||||
let oilOrderR = []
|
||||
|
||||
let goodsOrderR = []
|
||||
if (this.goodsList) {
|
||||
this.goodsList.forEach(order=>{
|
||||
let o = {
|
||||
oilName : order.name,
|
||||
unit : order.num+""+order.unit,
|
||||
amount : order.memberPrice.toString()
|
||||
}
|
||||
goodsOrderR.push(o)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 支付方式
|
||||
const payTypeMap = {
|
||||
'CASH': '现金',
|
||||
'WECHAT': '微信',
|
||||
'ALIPAY': '支付宝',
|
||||
'UNIONPAY': '银联二维码',
|
||||
'credit': '挂账',
|
||||
'oilCard': '囤油卡',
|
||||
'balance': '储值卡'
|
||||
};
|
||||
let payTypeText = payTypeMap[this.goods.payType] || '小程序码';
|
||||
|
||||
let f ={
|
||||
oilOrder:oilOrderR,
|
||||
goodsOrder:goodsOrderR,
|
||||
payType:payTypeText,
|
||||
amount:this.goods.amount,
|
||||
discount:this.goods.discount,
|
||||
// seekZero:""
|
||||
}
|
||||
rePrintOilOrderReport(f).then(res=>{
|
||||
|
||||
})
|
||||
},
|
||||
// 补打
|
||||
patchwork(data){
|
||||
const orderNo = data.orderNo
|
||||
@ -504,7 +547,8 @@ export default {
|
||||
this.goodsList = response.data
|
||||
this.$modal.msgSuccess("打印指令已发送打印机,请查看打印结果");
|
||||
})
|
||||
this.printLocally()
|
||||
// this.printLocally()
|
||||
this.oilOrderReport()
|
||||
|
||||
}).catch(() => {});
|
||||
},
|
||||
|
@ -352,6 +352,7 @@
|
||||
import {exportExcelOilOrderApi} from "@/api/order/exportExcel";
|
||||
import {connectFlag, getLodop} from "@/api/LodopFuncs";
|
||||
import {getInfoByIdApi} from "@/api/cashier/cardfavorablerecord";
|
||||
import {printOilOrderReport} from "@/api/print";
|
||||
|
||||
export default {
|
||||
name: "order_Cashier",
|
||||
@ -512,6 +513,55 @@
|
||||
LODOP.PRINT();
|
||||
|
||||
},
|
||||
|
||||
// 打印商品支付后的订单
|
||||
oilOrderReport () {
|
||||
console.log("22222222222222222")
|
||||
let oilOrderR = []
|
||||
let o = {
|
||||
oilName : this.getName(this.oilNameList, this.oilOrder.oils) + "-" + this.getName1(this.oilGunList, this.oilOrder.oilGunNum),
|
||||
amount : this.oilOrder.orderAmount.toString()
|
||||
}
|
||||
oilOrderR.push(o)
|
||||
|
||||
let goodsOrderR = []
|
||||
|
||||
// 支付方式
|
||||
const payTypeMap = {
|
||||
'CASH': '现金',
|
||||
'WECHAT': '微信',
|
||||
'ALIPAY': '支付宝',
|
||||
'UNIONPAY': '银联二维码',
|
||||
'credit': '挂账',
|
||||
'oilCard': '囤油卡',
|
||||
'balance': '储值卡'
|
||||
};
|
||||
let payTypeText = payTypeMap[this.payType] || '小程序码';
|
||||
|
||||
let f ={
|
||||
oilOrder:oilOrderR,
|
||||
goodsOrder:goodsOrderR,
|
||||
payType:payTypeText,
|
||||
unitName:"", // 挂账单位
|
||||
|
||||
// 订单总额
|
||||
|
||||
// consumeAmount:this.consumeAmount,
|
||||
creditAmount: "",//挂账金额
|
||||
// 优惠合计
|
||||
discount:this.oilOrder.discountAmount, // 油惠合计
|
||||
// 储值卡付款
|
||||
consumeAmount:this.oilOrder.balanceAmount,
|
||||
// 屯油卡付款
|
||||
consumeRefuelMoney:this.oilOrder.oilCardAmount,
|
||||
// 实付款
|
||||
actualPay : this.oilOrder.payAmount,
|
||||
}
|
||||
printOilOrderReport(f).then(res=>{
|
||||
|
||||
})
|
||||
},
|
||||
|
||||
exportExcelOilOrder() {
|
||||
let dateRange = []
|
||||
if (this.beginTime && this.endTime) {
|
||||
@ -574,7 +624,8 @@
|
||||
this.oilOrder = response.data
|
||||
this.$modal.msgSuccess("打印指令已发送打印机,请查看打印结果");
|
||||
})
|
||||
this.printLocally()
|
||||
// this.printLocally()
|
||||
this.oilOrderReport()
|
||||
}).catch(() => {});
|
||||
},
|
||||
// 退款
|
||||
|
@ -282,6 +282,7 @@ import {queryStaffs} from "@/api/cashier/staff";
|
||||
import {refundApi} from "@/api/cashier/refund";
|
||||
import {exportExcelVipApi} from "@/api/order/exportExcel";
|
||||
import {connectFlag, getLodop} from "@/api/LodopFuncs";
|
||||
import {printCardValueReport} from "@/api/print";
|
||||
|
||||
export default {
|
||||
name: "order_Cashier",
|
||||
@ -460,6 +461,41 @@ export default {
|
||||
// console.log("preview",preview);
|
||||
LODOP.PRINT();
|
||||
|
||||
},
|
||||
|
||||
cardValueReport() {
|
||||
// 支付方式
|
||||
const payTypeMap = {
|
||||
'CASH': '现金',
|
||||
'WECHAT': '微信',
|
||||
'ALIPAY': '支付宝',
|
||||
'UNIONPAY': '银联二维码',
|
||||
'credit': '挂账',
|
||||
'oilCard': '囤油卡',
|
||||
'balance': '储值卡'
|
||||
};
|
||||
let payTypeText = payTypeMap[this.oilOrder.paymentType]
|
||||
// let actualPay = this.cardValueForm.paymentType == 'CASH' ? this.authCode:this.realyPayBills
|
||||
|
||||
let a = {
|
||||
// 充值金额
|
||||
realyPayBills:this.oilOrder.amount ? this.oilOrder.amount : this.oilOrder.rechargeBalance,
|
||||
//赠送金额
|
||||
giftBalance:this.oilOrder.giftBalance,
|
||||
// 到账金额
|
||||
getAmount:this.oilOrder.amount ? this.oilOrder.giftBalance + this.oilOrder.amount : this.oilOrder.giftBalance + this.oilOrder.rechargeBalance,
|
||||
payType:payTypeText,
|
||||
|
||||
// 实付款
|
||||
actualPay: this.oilOrder.amount ? this.oilOrder.amount : this.oilOrder.rechargeBalance,
|
||||
// 找零
|
||||
// seekZero:this.seekZero.toFixed(2),
|
||||
}
|
||||
|
||||
printCardValueReport(a).then(res=>{
|
||||
|
||||
})
|
||||
|
||||
},
|
||||
// 补打
|
||||
patchwork(data){
|
||||
@ -470,7 +506,8 @@ export default {
|
||||
await cardValueRecordInfo(data.id).then( response => {
|
||||
this.oilOrder = response.data
|
||||
})
|
||||
this.printLocally()
|
||||
// this.printLocally()
|
||||
this.cardValueReport()
|
||||
this.$modal.msgSuccess("打印指令已发送打印机,请查看打印结果");
|
||||
}).catch(() => {});
|
||||
},
|
||||
|
@ -929,6 +929,7 @@ import {getDicts} from "@/api/dict/data";
|
||||
import {getSysConfig} from "@/api/cashier/user/sysconfig";
|
||||
import {giftCardExchange} from "@/api/cashier/giftCard/giftcard";
|
||||
import {connectFlag, getLodop} from "@/api/LodopFuncs";
|
||||
import {getReturnCode, printCardValueReport, printFuelDieselReport, sendPrintIndex} from "@/api/print";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@ -1476,7 +1477,7 @@ export default {
|
||||
// 存油卡列表
|
||||
},
|
||||
// 确认充值
|
||||
confirm(flag) {
|
||||
async confirm(flag) {
|
||||
this.flag = flag
|
||||
|
||||
if (flag === 1) {
|
||||
@ -1503,8 +1504,11 @@ export default {
|
||||
|
||||
this.realyPayBills = this.cardFuelDieselForm.rechargeBalance
|
||||
}
|
||||
// 发送扫码机请求(易联云网络下发)
|
||||
await this.getSendPrintIndex(this.realyPayBills);
|
||||
this.openConfirm = true;
|
||||
this.isPay = true
|
||||
this.getCode(this.realyPayBills)
|
||||
|
||||
this.title = this.payment
|
||||
},
|
||||
@ -1867,7 +1871,9 @@ export default {
|
||||
this_.isPaySuccess = true;
|
||||
this_.isQuery = false;
|
||||
this_.rechargeBalCard = true
|
||||
await this_.printLocally1()
|
||||
// await this_.printLocally1()
|
||||
this_.cardValueReport()
|
||||
|
||||
await this_.getUserInfo()
|
||||
clearInterval(timer);
|
||||
} else if (payStatus === "payFail") {
|
||||
@ -1944,7 +1950,9 @@ export default {
|
||||
this_.isPaySuccess = true;
|
||||
this_.isQuery = false;
|
||||
this_.rechargeOilCard = true
|
||||
await this_.printLocally2()
|
||||
// await this_.printLocally2()
|
||||
await this.fuelDieselReport()
|
||||
|
||||
await this_.getUserInfo()
|
||||
clearInterval(timer);
|
||||
}
|
||||
@ -2108,8 +2116,105 @@ export default {
|
||||
// 返回
|
||||
goBack() {
|
||||
this.$router.back(-1);
|
||||
}
|
||||
},
|
||||
// 积分表、储值卡详情表、积分详情表、储值卡表、储值卡模板表、用户储值卡关联表、
|
||||
|
||||
cardValueReport() {
|
||||
// 支付方式
|
||||
const payTypeMap = {
|
||||
'CASH': '现金',
|
||||
'WECHAT': '微信',
|
||||
'ALIPAY': '支付宝',
|
||||
'UNIONPAY': '银联二维码',
|
||||
'credit': '挂账',
|
||||
'oilCard': '囤油卡',
|
||||
'balance': '储值卡'
|
||||
};
|
||||
let payTypeText = payTypeMap[this.cardValueForm.paymentType]
|
||||
let actualPay = this.cardValueForm.paymentType == 'CASH' ? this.authCode:this.realyPayBills
|
||||
|
||||
let a = {
|
||||
// 充值金额
|
||||
realyPayBills:this.realyPayBills,
|
||||
//赠送金额
|
||||
giftBalance:this.cardValueForm.giftBalance,
|
||||
// 到账金额
|
||||
getAmount:this.cardValueForm.giftBalance + this.realyPayBills,
|
||||
payType:payTypeText,
|
||||
|
||||
// 实付款
|
||||
actualPay: actualPay,
|
||||
// 找零
|
||||
seekZero:this.seekZero.toFixed(2),
|
||||
}
|
||||
|
||||
printCardValueReport(a).then(res=>{
|
||||
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
// 网络下发之后获取条码
|
||||
getCode(amount) {
|
||||
this.jishuqi++;
|
||||
if (this.jishuqi == 30) {
|
||||
this.jishuqi = 0
|
||||
return
|
||||
}
|
||||
getReturnCode ({payAmount:amount}).then(res=>{
|
||||
if (res.data === "300") {
|
||||
setTimeout(() => {
|
||||
this.getCode(amount); // 重新发起请求
|
||||
}, 1000); // 停顿一秒
|
||||
}else {
|
||||
this.authCode = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
getSendPrintIndex(amount) {
|
||||
sendPrintIndex({payAmount:amount}).then(ress=>{
|
||||
if (ress.data != "success") {
|
||||
this.$modal.msgError("扫码机发起付款失败!")
|
||||
return;
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
fuelDieselReport() {
|
||||
|
||||
// 支付方式
|
||||
const payTypeMap = {
|
||||
'CASH': '现金',
|
||||
'WECHAT': '微信',
|
||||
'ALIPAY': '支付宝',
|
||||
'UNIONPAY': '银联二维码',
|
||||
'credit': '挂账',
|
||||
'oilCard': '囤油卡',
|
||||
'balance': '储值卡'
|
||||
};
|
||||
let payTypeText = payTypeMap[this.cardFuelDieselForm.paymentType]
|
||||
|
||||
let a = {
|
||||
// 充值油品
|
||||
oilType:this.cardFuelDieselForm.type,
|
||||
// 充值升数
|
||||
incomeLitres:this.cardFuelDieselForm.incomeLitres,
|
||||
// 订单金额
|
||||
realyPayBills:this.realyPayBills,
|
||||
// 锁价金额
|
||||
lockupPrice:cardFuelDieselForm.lockupPrice,
|
||||
// 支付方式
|
||||
payType:payTypeText,
|
||||
// 实付款
|
||||
|
||||
// 找零
|
||||
seekZero:this.seekZero.toFixed(2),
|
||||
}
|
||||
|
||||
printFuelDieselReport(a).then(res=>{
|
||||
|
||||
})
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
openConfirm(newValue) {
|
||||
|
Loading…
Reference in New Issue
Block a user