Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
ef215ce5b1
@ -21,9 +21,12 @@ import com.fuint.business.marketingActivity.cardFule.entity.CardFuelRecord;
|
||||
import com.fuint.business.marketingActivity.cardFule.service.CardFuelRecordService;
|
||||
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
|
||||
import com.fuint.business.marketingActivity.cardValue.service.CardValueRecordService;
|
||||
import com.fuint.business.marketingActivity.cardValueOrders.service.CardValueOrdersService;
|
||||
import com.fuint.business.order.entity.*;
|
||||
import com.fuint.business.order.service.*;
|
||||
import com.fuint.business.userManager.entity.UserBalance;
|
||||
import com.fuint.business.userManager.service.LJUserService;
|
||||
import com.fuint.business.userManager.service.UserBalanceService;
|
||||
import com.fuint.business.userManager.vo.LJUserVo;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
@ -57,6 +60,12 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
@Resource
|
||||
private IntegralSettingsService integralSettingsService;
|
||||
|
||||
@Resource
|
||||
private UserBalanceService userBalanceService;
|
||||
|
||||
@Resource
|
||||
private CardValueOrdersService cardValueOrdersService;
|
||||
|
||||
/**
|
||||
* 条码支付
|
||||
*
|
||||
@ -185,6 +194,7 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
List<ReturnRecord> returnRecords = returnRecordService.selectReturnRecordByOrderNo(orderNo);
|
||||
Date date = new Date();
|
||||
if (reqMap.get("trans_stat").equals("SUCCESS")) {
|
||||
|
||||
payStatus = "paid";
|
||||
if (!ObjectUtil.isEmpty(oilOrder)) {
|
||||
// 油品订单
|
||||
@ -281,6 +291,7 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
if ("CVR".equals(type)) {
|
||||
payStates = "paid";
|
||||
receiveParameter.setType("2");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(goodsOrder) && ObjectUtil.isNotEmpty(goodsOrder.getUserId())) {
|
||||
receiveParameter.setUserId(goodsOrder.getUserId());
|
||||
}
|
||||
@ -290,6 +301,7 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
}
|
||||
if ("CFR".equals(type)) {
|
||||
payStates = "paid";
|
||||
cardValueOrdersService.updateBalance(orderNo,payStatus);
|
||||
}
|
||||
if ("IOS".equals(type)) { // 积分商城
|
||||
payStates = "paid";
|
||||
@ -338,6 +350,7 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
}
|
||||
if ("CFR".equals(type)) {
|
||||
payStates = "payFail";
|
||||
cardValueOrdersService.updateBalance(orderNo,payStatus);
|
||||
}
|
||||
if ("IOS".equals(type)) {
|
||||
payStates = "payFail";
|
||||
@ -383,6 +396,8 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
}
|
||||
if ("CVR".equals(type) && !ObjectUtil.isEmpty(map1.get("orderId"))) {
|
||||
// 储值卡
|
||||
|
||||
|
||||
Integer id = Integer.parseInt(map1.get("orderId"));
|
||||
cardValueRecordService.editPayStatus(id, payStates);
|
||||
|
||||
@ -397,7 +412,7 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
// 囤油卡
|
||||
Integer id = Integer.parseInt(map1.get("orderId"));
|
||||
cardFuelRecordService.editPayStatus(id, payStates);
|
||||
|
||||
cardValueOrdersService.updateBalance(orderNo,payStatus);
|
||||
CardFuelRecord cardFuelRecord = cardFuelRecordService.queryById(id);
|
||||
receiveParameter.setType("5");
|
||||
if (cardFuelRecord.getMtUserId() != null) {
|
||||
|
@ -221,8 +221,16 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
|
||||
CardFuelRecord cardFuelRecord = new CardFuelRecord();
|
||||
|
||||
if (ObjectUtils.isNotEmpty(cardFuelRecords)){
|
||||
Optional<CardFuelRecord> max = cardFuelRecords.stream().max(Comparator.comparing(CardFuelRecord::getLockupPrice));
|
||||
cardFuelRecord = max.get();
|
||||
ArrayList<CardFuelRecord> list = new ArrayList<>();
|
||||
for (CardFuelRecord fuelRecord : cardFuelRecords) {
|
||||
if (ObjectUtils.isNotEmpty(fuelRecord.getLockupPrice())){
|
||||
list.add(fuelRecord);
|
||||
}
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(list)){
|
||||
Optional<CardFuelRecord> max = list.stream().max(Comparator.comparing(CardFuelRecord::getLockupPrice));
|
||||
cardFuelRecord = max.get();
|
||||
}
|
||||
}
|
||||
CardFuelDiesel cardFuelDiesel = cardFuelDieselService.getById(cardFuelRecord.getCardFuelId());
|
||||
|
||||
@ -292,6 +300,9 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
|
||||
map.put("privateKey", merchantConfig.getPrivateKey());
|
||||
map.put("type", "CFR");
|
||||
map.put("orderId", cardFuelRecordDTO.getId().toString());
|
||||
map.put("userId", cardFuelRecordDTO.getMtUserId().toString());
|
||||
map.put("storeId", cardFuelRecordDTO.getStoreId().toString());
|
||||
map.put("storeId", nowAccountInfo.getStoreId().toString());
|
||||
// 调用支付接口
|
||||
try {
|
||||
fyPayService.pay(map);
|
||||
|
@ -33,5 +33,7 @@ public interface CardValueOrdersService extends IService<CardValueOrders> {
|
||||
* @param status 支付状态
|
||||
*/
|
||||
void updateOrderStatus(String orderNo,String status);
|
||||
|
||||
void updateBalance(String orderNo,String status);
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders;
|
||||
import com.fuint.business.marketingActivity.cardValueOrders.mapper.CardValueOrdersMapper;
|
||||
import com.fuint.business.marketingActivity.cardValueOrders.service.CardValueOrdersService;
|
||||
import com.fuint.business.userManager.entity.UserBalance;
|
||||
import com.fuint.business.userManager.service.UserBalanceService;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -24,6 +26,9 @@ public class CardValueOrdersServiceImpl extends ServiceImpl<CardValueOrdersMappe
|
||||
|
||||
@Resource
|
||||
private CardValueOrdersMapper cardValueOrdersMapper;
|
||||
|
||||
@Resource
|
||||
private UserBalanceService userBalanceService;
|
||||
/**
|
||||
* 根据订单编号返回订单信息
|
||||
* @param orderNo
|
||||
@ -49,5 +54,26 @@ public class CardValueOrdersServiceImpl extends ServiceImpl<CardValueOrdersMappe
|
||||
baseMapper.updateById(oneByOrderNo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBalance(String orderNo, String status) {
|
||||
CardValueOrders oneByOrderNo = cardValueOrdersMapper.getOneByOrderNo(orderNo);
|
||||
if (ObjectUtil.isNotEmpty(oneByOrderNo)){
|
||||
|
||||
if ("paid".equals(status)){
|
||||
UserBalance userBalance = userBalanceService.selectUserBalanceByStorId(oneByOrderNo.getMtUserId(),oneByOrderNo.getStoreId());
|
||||
Double cardBalance = 0.0;
|
||||
if ("1".equals(oneByOrderNo.getRechargeType())){
|
||||
cardBalance = oneByOrderNo.getRechargeBalance() + oneByOrderNo.getGiftBalance();
|
||||
}else {
|
||||
cardBalance = userBalance.getCardBalance() + oneByOrderNo.getBidBalance() + oneByOrderNo.getGiftBalance();
|
||||
}
|
||||
userBalance.setCardBalance(cardBalance);
|
||||
userBalanceService.updateUserBalance(userBalance);
|
||||
}
|
||||
oneByOrderNo.setStatus(status);
|
||||
baseMapper.updateById(oneByOrderNo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,7 @@
|
||||
package com.fuint.business.marketingActivity.favorableRecords.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders;
|
||||
import com.fuint.business.marketingActivity.favorableRecords.entity.FavorableRecords;
|
||||
import com.fuint.business.marketingActivity.favorableRecords.service.FavorableRecordsService;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
|
@ -17,6 +17,7 @@ import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.HashMap;
|
||||
@ -52,6 +53,7 @@ public class FavorableRecordsServiceImpl extends ServiceImpl<FavorableRecordsMap
|
||||
return save(favorableRecords);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IPage selectList(Page page, FavorableRecords favorableRecords) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
@ -65,6 +67,10 @@ public class FavorableRecordsServiceImpl extends ServiceImpl<FavorableRecordsMap
|
||||
if (ObjectUtil.isNotEmpty(favorableRecords.getFavConsumptionType()))
|
||||
queryWrapper.eq(FavorableRecords::getFavConsumptionType, favorableRecords.getFavConsumptionType());
|
||||
IPage page1 = page(page, queryWrapper);
|
||||
List<FavorableRecords> favorableRecordsList = page1.getRecords();
|
||||
for (FavorableRecords favorableRecords1 : favorableRecordsList) {
|
||||
|
||||
}
|
||||
return page1;
|
||||
}
|
||||
|
||||
|
@ -1,94 +0,0 @@
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public class printerController extends BaseController {
|
||||
@RequestParam("additional_data") String additional_data,
|
||||
@RequestParam("iv") String iv,
|
||||
@RequestParam("signature") String signature){
|
||||
log.info("12222222222222222222222222");
|
||||
log.info("------push-------");
|
||||
|
||||
return printerService.PostPush(ciphertext,nonce,tag,additional_data,iv,signature);
|
||||
}
|
||||
|
@ -1,83 +0,0 @@
|
||||
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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,51 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
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);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,217 +0,0 @@
|
||||
<?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>
|
||||
|
@ -1,58 +0,0 @@
|
||||
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);
|
||||
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
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 printTagReport(Map<String, Object> integral,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);
|
||||
|
||||
}
|
@ -1,96 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -66,15 +66,20 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
// 使用 Fastjson 将 JSON 字符串解析为 JSONObject
|
||||
JSONObject jsonObject = JSON.parseObject(decrypte);
|
||||
|
||||
log.info("--回调支付--{}",jsonObject);
|
||||
// 将 JSONObject 转换为 Map
|
||||
Map<String, Object> map = jsonObject.getInnerMap();
|
||||
//获取支付参数
|
||||
Map<String, Object> orderPaymentMap = (Map<String, Object>) map.get("order_payment");
|
||||
// Map<String, Object> orderPaymentMap = (Map<String, Object>) map.get("order_payment");
|
||||
Map<String, Object> orderPaymentMap = (Map<String, Object>) map.get("order_other");
|
||||
log.info("--回调支付--{}",orderPaymentMap.get("scanned_code").toString());
|
||||
|
||||
OrderPayment orderPayment = new OrderPayment();
|
||||
orderPayment.setOrderPayment(orderPaymentMap.get("pay_amount").toString());
|
||||
// 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);
|
||||
// RedisUtil.set(orderPaymentMap.get("scanned_code").toString(), orderPaymentMap.get("pay_amount").toString(), 100);
|
||||
RedisUtil.set(orderPaymentMap.get("scanned_code").toString(), 100);
|
||||
code = orderPaymentMap.get("scanned_code").toString();
|
||||
log.info("--获取打印回调--{}",jsonObject);
|
||||
} catch (Exception e) {
|
||||
@ -148,7 +153,7 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
|
||||
// HashMap<String, String> objectObjectHashMap = new HashMap<>();
|
||||
Map<String, Object> orderPaymentMap = new HashMap<>();
|
||||
orderPaymentMap.put("pay_amount", payAmount);
|
||||
orderPaymentMap.put("pay_amount", payAmount.toString());
|
||||
// orderPaymentMap.put("pay_amount", 0.01);
|
||||
|
||||
orderPaymentMap.put("pay_amount_source", 3);
|
||||
@ -162,6 +167,7 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
String json = gson.toJson(jsonDataMap);
|
||||
|
||||
String jsonData = "<JSON>"+json+"</JSON>";
|
||||
// String jsonData = "<JSON>{\"order_payment\":{\"pay_amount\":\"1\",\"pay_amount_source\":3},\"processed_state\":0}</JSON>";
|
||||
log.info("json:{}",jsonData);
|
||||
|
||||
String url=m.print(infoByStoreId.getMachineCode(),jsonData, System.currentTimeMillis()+random6.toString());
|
||||
|
@ -1,599 +0,0 @@
|
||||
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;
|
||||
}
|
||||
|
||||
// 实收汇总
|
||||
// 油品订单
|
||||
// 商品订单
|
||||
// 会员储值
|
||||
// 积分商城
|
||||
// 油号统计
|
||||
// 优惠统计
|
||||
// 油枪统计
|
||||
// 员工统计
|
||||
// 挂账统计
|
||||
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
@ -1,100 +0,0 @@
|
||||
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><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 ("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("amount"))) {
|
||||
sb.append("总金额:¥"+handover.get("amount")+"\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")+"L\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;
|
||||
}
|
||||
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
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");
|
||||
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(handover.get("type")) && "2".equals(handover.get("type"))) {
|
||||
if (ObjectUtil.isNotEmpty(handover.get("balanceAmount"))) {
|
||||
sb.append("储值卡:¥"+handover.get("balanceAmount")+"\r\n");
|
||||
sb.append("--------------------------------\r\n");
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("oilCardAmount"))) {
|
||||
sb.append("屯油卡:"+handover.get("oilCardAmount")+"L\r\n");
|
||||
sb.append("--------------------------------\r\n");
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(handover.get("calculateRefundsV"))) {
|
||||
sb.append("退款:¥"+handover.get("calculateRefundsV")+"\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;
|
||||
}
|
||||
|
||||
}
|
@ -1,96 +0,0 @@
|
||||
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";
|
||||
|
||||
|
||||
}
|
@ -1,254 +0,0 @@
|
||||
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 = URLEncoder.encode(source, encode);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
return "0";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String urlEncodeGBK(String source) {
|
||||
String result = source;
|
||||
try {
|
||||
result = 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 "";
|
||||
}
|
||||
|
||||
}
|
@ -1,476 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,352 +0,0 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
@ -1,118 +0,0 @@
|
||||
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
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package com.fuint.business.printer.vo;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class OrderPayment {
|
||||
private String scannedCode; // 条码
|
||||
private String payAmountSource; // 支付来源
|
||||
private String orderPayment; // 金额
|
||||
}
|
@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -27,7 +28,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 字典 业务层处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
@ -48,7 +49,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
||||
|
||||
/**
|
||||
* 根据条件分页查询字典类型
|
||||
*
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 字典类型集合信息
|
||||
*/
|
||||
@ -60,7 +61,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
||||
|
||||
/**
|
||||
* 根据所有字典类型
|
||||
*
|
||||
*
|
||||
* @return 字典类型集合信息
|
||||
*/
|
||||
@Override
|
||||
@ -71,18 +72,19 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典数据
|
||||
*
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 字典数据集合信息
|
||||
*/
|
||||
@Override
|
||||
public List<SysDictData> selectDictDataByType(String dictType)
|
||||
{
|
||||
List<SysDictData> dictDatas = DictUtils.getDictCache(dictType);
|
||||
List<SysDictData> dictDatas = new ArrayList<>();
|
||||
/* List<SysDictData> dictDatas = DictUtils.getDictCache(dictType);
|
||||
if (CollectionUtils.isNotEmpty(dictDatas))
|
||||
{
|
||||
return dictDatas;
|
||||
}
|
||||
}*/
|
||||
dictDatas = dictDataMapper.selectDictDataByType(dictType);
|
||||
if (CollectionUtils.isNotEmpty(dictDatas))
|
||||
{
|
||||
@ -94,7 +96,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
||||
|
||||
/**
|
||||
* 根据字典类型ID查询信息
|
||||
*
|
||||
*
|
||||
* @param dictId 字典类型ID
|
||||
* @return 字典类型
|
||||
*/
|
||||
@ -106,7 +108,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
||||
|
||||
/**
|
||||
* 根据字典类型查询信息
|
||||
*
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 字典类型
|
||||
*/
|
||||
@ -118,7 +120,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
||||
|
||||
/**
|
||||
* 批量删除字典类型信息
|
||||
*
|
||||
*
|
||||
* @param dictIds 需要删除的字典ID
|
||||
*/
|
||||
@Override
|
||||
@ -172,7 +174,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
||||
|
||||
/**
|
||||
* 新增保存字典类型信息
|
||||
*
|
||||
*
|
||||
* @param dict 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -189,7 +191,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
||||
|
||||
/**
|
||||
* 修改保存字典类型信息
|
||||
*
|
||||
*
|
||||
* @param dict 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -210,7 +212,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
||||
|
||||
/**
|
||||
* 校验字典类型称是否唯一
|
||||
*
|
||||
*
|
||||
* @param dict 字典类型
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -175,7 +175,6 @@
|
||||
<div>赠送<span class="amount">{{ item.giftBalance }}</span>元</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="width: 30%;margin-left: 13px;margin-top: 8px;"
|
||||
:class="activeKey === cardValueList.length ? 'select' : ''"
|
||||
@click="rechargeCard(cardValueList.length,-1)">
|
||||
|
@ -25,7 +25,7 @@
|
||||
<view class="h-box" @click="goServiceList()">
|
||||
=======
|
||||
</view> -->
|
||||
<view class="h-box">
|
||||
<view class="h-box" @click="goServiceList()">
|
||||
|
||||
<view class="">服务条款</view>
|
||||
<u-icon name="arrow-right" size="18"></u-icon>
|
||||
|
@ -91,7 +91,6 @@
|
||||
],
|
||||
orderList: [],
|
||||
baseUrl: config.baseUrl,
|
||||
// baseUrl: 'https://www.tuofeng.cc/oilAdmin/static/uploadImages/20240529/e776bf37b3f843028846cbdf3fbd958d.jpg',
|
||||
form: {
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
|
@ -4,7 +4,9 @@
|
||||
<headers :titles="titles"><u-icon name="arrow-left" color="#fff" size="22"></u-icon></headers>
|
||||
<view class="box_">
|
||||
<view class="title_">服务条款</view>
|
||||
<view class="size_">委托方(甲方):
|
||||
|
||||
<p>
|
||||
委托方(甲方):
|
||||
|
||||
法定代表人:
|
||||
|
||||
@ -143,7 +145,9 @@
|
||||
|
||||
签约时间: 签约时间:
|
||||
|
||||
签订地点: 签订地点:</view>
|
||||
签订地点: 签订地点:
|
||||
</p>
|
||||
<view class="size_"></view>
|
||||
|
||||
|
||||
</view>
|
||||
|
Loading…
Reference in New Issue
Block a user