添加交班时间
This commit is contained in:
@@ -51,9 +51,10 @@ public class CloudPrinterController {
|
||||
@RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType,
|
||||
@RequestParam("tradeDay") String tradeDay,
|
||||
Integer id
|
||||
@RequestParam("id") Integer id
|
||||
|
||||
){
|
||||
return cloudPrinterService.handoverprintData(token,id,loginName);
|
||||
return cloudPrinterService.handoverprintData(token,id,loginName,false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,4 +25,16 @@ public class DataController {
|
||||
return dataService.handoverprintData(token,id);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "handoverprint")
|
||||
public Result handoverprint(@RequestHeader("token") String token,
|
||||
@RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType,
|
||||
Integer id,
|
||||
boolean isprintProduct){
|
||||
return dataService.handoverprint(id,isprintProduct);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.ShopUserDuty;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -43,4 +44,7 @@ public interface ShopUserDutyMapper {
|
||||
void updateStatusById(@Param("id") Integer id, @Param("staffId") Integer staffId);
|
||||
|
||||
// List<String> selectByShopIdAndTradeAll(@Param("shopId") Integer shopId,@Param("day") String day,@Param("tokenId") Integer tokenId);
|
||||
|
||||
|
||||
List<ProductInfo> selectByDutyId(Integer dutyId);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.ShopUserDutyPay;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfoPO;
|
||||
import com.chaozhanggui.system.cashierservice.model.HandoverInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -31,4 +32,6 @@ public interface ShopUserDutyPayMapper {
|
||||
|
||||
|
||||
List<Map<String,Object>> selectCetoryBydutyId(Integer dutyId);
|
||||
|
||||
List<ProductInfoPO> selectProductByDutyId(Integer dutyId);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class ProductInfo implements Serializable {
|
||||
|
||||
private String productName;
|
||||
private Integer num;
|
||||
private BigDecimal amount;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class ProductInfoPO implements Serializable {
|
||||
|
||||
private Integer productId;
|
||||
private String productName;
|
||||
private String skuName;
|
||||
private Integer num;
|
||||
private BigDecimal amount;
|
||||
}
|
||||
@@ -24,6 +24,7 @@ public class WebAppConfigurer implements WebMvcConfigurer {
|
||||
.excludePathPatterns("/order/getsendMessage")
|
||||
.excludePathPatterns("/qrcode/getscanCode")
|
||||
.excludePathPatterns("/order/sendMessage")
|
||||
.excludePathPatterns("/order/getOrderById");
|
||||
.excludePathPatterns("/order/getOrderById")
|
||||
.excludePathPatterns("/data/handoverprint");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.chaozhanggui.system.cashierservice.model;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfoPO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@@ -38,8 +41,12 @@ public class HandoverInfo implements Serializable {
|
||||
|
||||
private String quickAmount;
|
||||
|
||||
private List<ProductInfoPO> productInfoPOS;
|
||||
|
||||
private List<ProductInfo> productInfos;
|
||||
|
||||
public HandoverInfo(String merchantName, String startTime, String endTime, String staff, List<PayInfo> payInfos, List<HandoverInfo.MemberData> memberData, String totalAmount, String imprest, String payable, String handIn, String returnAmount,String orderNum
|
||||
,List<ProductCategory> productCategories,String quickAmount
|
||||
,List<ProductCategory> productCategories,String quickAmount,List<ProductInfoPO> productInfoPOS,List<ProductInfo> productInfos
|
||||
|
||||
) {
|
||||
this.merchantName = merchantName;
|
||||
@@ -56,6 +63,8 @@ public class HandoverInfo implements Serializable {
|
||||
this.orderNum = orderNum;
|
||||
this.productCategories=productCategories;
|
||||
this.quickAmount=quickAmount;
|
||||
this.productInfoPOS=productInfoPOS;
|
||||
this.productInfos=productInfos;
|
||||
}
|
||||
|
||||
@Data
|
||||
@@ -96,4 +105,6 @@ public class HandoverInfo implements Serializable {
|
||||
this.amount = amount;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfoPO;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.model.CategoryInfo;
|
||||
import com.chaozhanggui.system.cashierservice.model.HandoverInfo;
|
||||
@@ -562,7 +564,7 @@ public class CloudPrinterService {
|
||||
}
|
||||
|
||||
|
||||
public Result handoverprintData(String token,Integer id,String loginName){
|
||||
public Result handoverprintData(String token,Integer id,String loginName,boolean isprintProduct){
|
||||
|
||||
|
||||
JSONObject info= TokenUtil.parseParamFromToken(token);
|
||||
@@ -642,6 +644,13 @@ public class CloudPrinterService {
|
||||
productCategories=JSONUtil.parseJSONStr2TList(JSONUtil.toJSONString(categries),HandoverInfo.ProductCategory.class);
|
||||
}
|
||||
|
||||
List<ProductInfoPO> productInfoPOS=null;
|
||||
List<ProductInfo> productInfos=null;
|
||||
if(isprintProduct){
|
||||
// productInfoPOS=shopUserDutyPayMapper.selectProductByDutyId(shopUserDuty.getId());
|
||||
productInfos=shopUserDutyMapper.selectByDutyId(shopUserDuty.getId());
|
||||
}
|
||||
|
||||
|
||||
HandoverInfo handoverInfo=new HandoverInfo(tbShopInfo.getShopName(),
|
||||
ObjectUtil.isNotEmpty(shopUserDuty.getLoginTime())?DateUtils.getTime(shopUserDuty.getLoginTime()):null,
|
||||
@@ -653,7 +662,9 @@ public class CloudPrinterService {
|
||||
shopUserDuty.getAmount().add(ObjectUtil.isNull(shopUserDuty.getQuickAmount())?BigDecimal.ZERO:shopUserDuty.getQuickAmount()).toPlainString(),
|
||||
shopUserDuty.getReturnAmount().toPlainString(),
|
||||
shopUserDuty.getOrderNum().toString(),
|
||||
productCategories,ObjectUtil.isNull(shopUserDuty.getQuickAmount())?"0":shopUserDuty.getQuickAmount().toPlainString()
|
||||
productCategories,ObjectUtil.isNull(shopUserDuty.getQuickAmount())?"0":shopUserDuty.getQuickAmount().toPlainString(),
|
||||
productInfoPOS,
|
||||
productInfos
|
||||
|
||||
);
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
|
||||
@@ -4,6 +4,8 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfoPO;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.model.HandoverInfo;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
@@ -111,11 +113,108 @@ public class DataService {
|
||||
shopUserDuty.getAmount().add(ObjectUtil.isNull(shopUserDuty.getQuickAmount())?BigDecimal.ZERO:shopUserDuty.getQuickAmount()).toPlainString(),
|
||||
shopUserDuty.getReturnAmount().toPlainString(),
|
||||
shopUserDuty.getOrderNum().toString(),
|
||||
productCategories,ObjectUtil.isNull(shopUserDuty.getQuickAmount())?"0":shopUserDuty.getQuickAmount().toPlainString()
|
||||
productCategories,ObjectUtil.isNull(shopUserDuty.getQuickAmount())?"0":shopUserDuty.getQuickAmount().toPlainString(),
|
||||
null,null
|
||||
|
||||
);
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS,handoverInfo);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Result handoverprint(Integer id,boolean isprintProduct){
|
||||
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByPrimaryKey(id);
|
||||
// ShopUserDuty shopUserDuty=shopUserDutyMapper.selectByShopIdAndDay(tbShopInfo.getId(),tradeDay);
|
||||
MsgException.checkNull(shopUserDuty, "交班信息不存在");
|
||||
|
||||
TbShopInfo tbShopInfo= tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(shopUserDuty.getShopId()));
|
||||
MsgException.checkNull(tbShopInfo,"店铺信息不存在");
|
||||
|
||||
|
||||
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(tbShopInfo.getId());
|
||||
if (ObjectUtil.isEmpty(shopInfo)) {
|
||||
log.error("店铺信息不存在");
|
||||
return Result.fail(CodeEnum.SHOPINFONOEXIST);
|
||||
}
|
||||
|
||||
List<TbPrintMachineWithBLOBs> bloBsList = tbPrintMachineMapper.selectByShopId(tbShopInfo.getId().toString());
|
||||
|
||||
if (ObjectUtil.isEmpty(bloBsList) || bloBsList.size() <= 0) {
|
||||
log.error("此店铺没有对应的打印机设备");
|
||||
return Result.fail(CodeEnum.printmachinenoexsit);
|
||||
}
|
||||
|
||||
bloBsList.parallelStream().forEach(it-> {
|
||||
|
||||
if (!"network".equals(it.getConnectionType())) {
|
||||
log.error("非网络打印机");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!"1".equals(it.getStatus().toString())) {
|
||||
log.error("打印机状态异常");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!it.getSubType().equals("cash")) {
|
||||
log.error("非小票打印机");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
List<HandoverInfo.PayInfo> list = null;
|
||||
List<HandoverInfo.MemberData> memberData = null;
|
||||
List<HandoverInfo.ProductCategory> productCategories = null;
|
||||
List<Map<String, Object>> mapList = shopUserDutyPayMapper.selectByDutyId(shopUserDuty.getId());
|
||||
if (ObjectUtil.isNotEmpty(mapList) && mapList.size() > 0) {
|
||||
list = JSONUtil.parseJSONStr2TList(JSONUtil.toJSONString(mapList), HandoverInfo.PayInfo.class);
|
||||
}
|
||||
|
||||
memberData = new ArrayList<>();
|
||||
ShopUserDutyPay shopUserDutyPay = shopUserDutyPayMapper.selectByDuctIdAndType(shopUserDuty.getId(), "deposit");
|
||||
if (ObjectUtil.isNotEmpty(shopUserDutyPay)) {
|
||||
memberData.add(new HandoverInfo.MemberData(shopUserDutyPay.getAmount().toPlainString(), "会员卡消费"));
|
||||
}
|
||||
|
||||
memberData.add(new HandoverInfo.MemberData(ObjectUtil.isNull(shopUserDuty.getMemberInAmount()) ? BigDecimal.ZERO.toPlainString() : shopUserDuty.getMemberInAmount().toPlainString(), "会员卡充值"));
|
||||
|
||||
|
||||
List<Map<String, Object>> categries = shopUserDutyPayMapper.selectCetoryBydutyId(shopUserDuty.getId());
|
||||
if (ObjectUtil.isNotEmpty(categries) && categries.size() > 0) {
|
||||
productCategories = JSONUtil.parseJSONStr2TList(JSONUtil.toJSONString(categries), HandoverInfo.ProductCategory.class);
|
||||
}
|
||||
|
||||
|
||||
List<ProductInfoPO> productInfoPOS = null;
|
||||
List<ProductInfo> productInfos = null;
|
||||
if (isprintProduct) {
|
||||
// productInfoPOS=shopUserDutyPayMapper.selectProductByDutyId(shopUserDuty.getId());
|
||||
productInfos = shopUserDutyMapper.selectByDutyId(shopUserDuty.getId());
|
||||
}
|
||||
|
||||
HandoverInfo handoverInfo = new HandoverInfo(tbShopInfo.getShopName(),
|
||||
ObjectUtil.isNotEmpty(shopUserDuty.getLoginTime()) ? DateUtils.getTime(shopUserDuty.getLoginTime()) : null,
|
||||
ObjectUtil.isNotEmpty(shopUserDuty.getLoginOutTime()) ? DateUtils.getTime(shopUserDuty.getLoginOutTime()) : "",
|
||||
"",
|
||||
list, memberData, shopUserDuty.getAmount().add(ObjectUtil.isNull(shopUserDuty.getQuickAmount()) ? BigDecimal.ZERO : shopUserDuty.getQuickAmount()).toPlainString(),
|
||||
"0",
|
||||
shopUserDuty.getAmount().subtract(shopUserDuty.getReturnAmount()).toPlainString(),
|
||||
shopUserDuty.getAmount().add(ObjectUtil.isNull(shopUserDuty.getQuickAmount()) ? BigDecimal.ZERO : shopUserDuty.getQuickAmount()).toPlainString(),
|
||||
shopUserDuty.getReturnAmount().toPlainString(),
|
||||
shopUserDuty.getOrderNum().toString(),
|
||||
productCategories, ObjectUtil.isNull(shopUserDuty.getQuickAmount()) ? "0" : shopUserDuty.getQuickAmount().toPlainString(),
|
||||
null, productInfos
|
||||
|
||||
);
|
||||
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson, 1, 1, it.getAddress(), PrinterUtils.handoverprintData(handoverInfo));
|
||||
});
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -156,11 +156,11 @@ public class DutyService {
|
||||
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByTokenId(tokenId);
|
||||
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndStatus(shopId, "0");
|
||||
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndTrade(shopId, day);
|
||||
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByTokenIdAndTradeDay(tokenId, day, orderInfo.getShopId());
|
||||
// ShopUserDuty shopU serDuty = shopUserDutyMapper.selectByTokenIdAndTradeDay(tokenId, day, orderInfo.getShopId());
|
||||
BigDecimal cashAmount = BigDecimal.ZERO;
|
||||
|
||||
if (type.equals("create")) {
|
||||
if (orderInfo.getPayType().equals("cash")) {
|
||||
if ("cash".equals(orderInfo.getPayType())) {
|
||||
cashAmount = orderInfo.getPayAmount();
|
||||
}
|
||||
if (Objects.isNull(shopUserDuty)) {
|
||||
@@ -362,7 +362,7 @@ public class DutyService {
|
||||
Integer shopId = tokenJson.getInteger("shopId");
|
||||
Integer staffId = tokenJson.getInteger("staffId");
|
||||
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndStatus(shopId, "0");
|
||||
cloudPrinterService.handoverprintData(token, shopUserDuty.getId(), "");
|
||||
cloudPrinterService.handoverprintData(token, shopUserDuty.getId(), "",true);
|
||||
// shopUserDutyMapper.updateStatusByTokenId(day, shopId, staffId);
|
||||
shopUserDutyMapper.updateStatusById(shopUserDuty.getId(), staffId);
|
||||
}
|
||||
|
||||
@@ -173,6 +173,8 @@ public class LoginService {
|
||||
jsonObject.put("type", "close");
|
||||
jsonObject.put("token", token);
|
||||
rabbitProducer.putOrderCollect(jsonObject.toJSONString());
|
||||
|
||||
|
||||
return Result.success(SUCCESS);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.chaozhanggui.system.cashierservice.util;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfoPO;
|
||||
import com.chaozhanggui.system.cashierservice.model.HandoverInfo;
|
||||
import com.chaozhanggui.system.cashierservice.model.OrderDetailPO;
|
||||
import org.springframework.http.HttpEntity;
|
||||
@@ -199,6 +201,80 @@ public class PrinterUtils {
|
||||
}
|
||||
}
|
||||
|
||||
if(ObjectUtil.isNotEmpty(handoverInfo.getProductInfos())&&handoverInfo.getProductInfos().size()>0) {
|
||||
sb.append("<S>商品数据</S><BR>");
|
||||
|
||||
char paddingCharacter = ' ';
|
||||
|
||||
sb.append("<S> "+String.format("%-10s","品名").replace(' ', paddingCharacter)+String.format("%-4s","数量").replace(' ', paddingCharacter)+String.format("%4s","小计").replace(' ', paddingCharacter)+"</S><BR>");
|
||||
|
||||
for (ProductInfo productInfo : handoverInfo.getProductInfos()) {
|
||||
if(productInfo.getProductName().length()>4&&productInfo.getProductName().length()<=8){
|
||||
|
||||
int count=getProducrName(productInfo.getProductName());
|
||||
if(count<=0){
|
||||
int length=15-(productInfo.getProductName().length()-4);
|
||||
sb.append("<S> "+String.format("%-"+length+"s",productInfo.getProductName()).replace(' ', paddingCharacter)+String.format("%-4s",productInfo.getNum()).replace(' ', paddingCharacter)+String.format("%4s",productInfo.getAmount()).replace(' ', paddingCharacter)+"</S><BR>");
|
||||
}else {
|
||||
int length=15+count/2-(productInfo.getProductName().length()-4);
|
||||
sb.append("<S> "+String.format("%-"+length+"s",productInfo.getProductName()).replace(' ', paddingCharacter)+String.format("%-4s",productInfo.getNum()).replace(' ', paddingCharacter)+String.format("%4s",productInfo.getAmount()).replace(' ', paddingCharacter)+"</S><BR>");
|
||||
}
|
||||
|
||||
}else if(productInfo.getProductName().length()>10){
|
||||
|
||||
sb.append("<S> "+productInfo.getProductName()+"</S><BR>");
|
||||
sb.append("<S> "+String.format("%20s",productInfo.getNum()).replace(' ', paddingCharacter)+String.format("%11s",productInfo.getAmount()).replace(' ', paddingCharacter)+"</S><BR>");
|
||||
|
||||
}else {
|
||||
sb.append("<S> "+String.format("%-10s",productInfo.getProductName()).replace(' ', paddingCharacter)+String.format("%-4s",productInfo.getNum()).replace(' ', paddingCharacter)+String.format("%6s",productInfo.getAmount()).replace(' ', paddingCharacter)+"</S><BR>");
|
||||
}
|
||||
sb.append("<BR>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(ObjectUtil.isNotEmpty(handoverInfo.getProductInfoPOS())&&handoverInfo.getProductInfoPOS().size()>0){
|
||||
sb.append("<S>商品数据</S><BR>");
|
||||
char paddingCharacter = ' ';
|
||||
|
||||
for (ProductInfoPO productInfoPO : handoverInfo.getProductInfoPOS()) {
|
||||
|
||||
if(ObjectUtil.isNotEmpty(productInfoPO.getSkuName())){
|
||||
productInfoPO.setProductName(productInfoPO.getProductName().concat("(").concat(productInfoPO.getSkuName()).concat(")"));
|
||||
}
|
||||
if(productInfoPO.getProductName().length()>4&&productInfoPO.getProductName().length()<=10){
|
||||
|
||||
int count=getProducrName(productInfoPO.getProductName());
|
||||
if(count<=0){
|
||||
int length=15-(productInfoPO.getProductName().length()-4);
|
||||
sb.append("<S>"+String.format("%-"+length+"s",productInfoPO.getProductName()).replace(' ', paddingCharacter)+String.format("%-2s", productInfoPO.getNum()).replace(' ', paddingCharacter)+String.format("%8s",productInfoPO.getAmount()).replace(' ', paddingCharacter)+"</S><BR>");
|
||||
}else {
|
||||
int length=15+count-(productInfoPO.getProductName().length()-4);
|
||||
sb.append("<S>"+String.format("%-"+length+"s",productInfoPO.getProductName()).replace(' ', paddingCharacter)+String.format("%-2s",productInfoPO.getNum()).replace(' ', paddingCharacter)+String.format("%8s",productInfoPO.getAmount()).replace(' ', paddingCharacter)+"</S><BR>");
|
||||
}
|
||||
|
||||
}else if(productInfoPO.getProductName().length()>10){
|
||||
|
||||
sb.append("<S>"+productInfoPO.getProductName()+"</S><BR>");
|
||||
sb.append("<S>"+String.format("%20s",productInfoPO.getNum()).replace(' ', paddingCharacter)+String.format("%11s",productInfoPO.getAmount()).replace(' ', paddingCharacter)+"</S><BR>");
|
||||
|
||||
}else {
|
||||
sb.append("<S>"+String.format("%-15s",productInfoPO.getProductName()).replace(' ', paddingCharacter)+String.format("%-4s",productInfoPO.getNum()).replace(' ', paddingCharacter)+String.format("%8s",productInfoPO.getAmount()).replace(' ', paddingCharacter)+"</S><BR>");
|
||||
}
|
||||
|
||||
sb.append("<BR>");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
sb.append("<S>快捷收款金额 :".concat(ObjectUtil.isNull(handoverInfo.getQuickAmount())?"0":handoverInfo.getQuickAmount())+"</S><BR>");
|
||||
sb.append("<S>退款金额 :".concat(handoverInfo.getReturnAmount())+"</S><BR>");
|
||||
sb.append("<S>总收入: "+handoverInfo.getTotalAmount()+"</S><BR>");
|
||||
@@ -279,22 +355,35 @@ public class PrinterUtils {
|
||||
|
||||
|
||||
public static int getProducrName(String str){
|
||||
int count = 0;
|
||||
int digitCount=0;
|
||||
for (int i=0;i<str.length();i++){
|
||||
if ((str.charAt(i)>='a' && str.charAt(i)<='z') || (str.charAt(i)>='A' && str.charAt(i)<='Z')){
|
||||
int count=0;
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
char c = str.charAt(i);
|
||||
if (c >= '0' && c <= '9') {
|
||||
count++;
|
||||
} else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
|
||||
count++;
|
||||
}
|
||||
|
||||
if (Character.isDigit(str.charAt(i))) {
|
||||
digitCount++;
|
||||
}
|
||||
}
|
||||
return count+digitCount;
|
||||
return count;
|
||||
}
|
||||
|
||||
public static void main(String[] args)throws Exception {
|
||||
|
||||
|
||||
int t=0;
|
||||
|
||||
|
||||
String str="张三456987asdfg";
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
char c = str.charAt(i);
|
||||
if (c >= '0' && c <= '9') {
|
||||
t++;
|
||||
} else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
|
||||
t++;
|
||||
}
|
||||
}
|
||||
System.out.println(t);
|
||||
|
||||
//
|
||||
// List<HandoverInfo.PayInfo> payInfos=new ArrayList<>();
|
||||
//
|
||||
@@ -331,8 +420,8 @@ public class PrinterUtils {
|
||||
|
||||
|
||||
|
||||
String voiceJson = "{\"bizType\":\"1\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
printTickets(voiceJson,1,1,"ZF544PG03W00002", printInvoice("http://weixin.qq.com/q/020fVS8lcLeiG1ID3SxCcH","【30天内开票有效】","1000000"));
|
||||
// String voiceJson = "{\"bizType\":\"1\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
// printTickets(voiceJson,1,1,"ZF544PG03W00002", printInvoice("http://weixin.qq.com/q/020fVS8lcLeiG1ID3SxCcH","【30天内开票有效】","1000000"));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user