Merge branch 'dev'
This commit is contained in:
commit
6228f6398e
|
|
@ -28,7 +28,7 @@ public class CloudPrinterController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("print")
|
@GetMapping("print")
|
||||||
public Result print( @RequestHeader("token") String token,
|
public Result print(@RequestHeader("token") String token,
|
||||||
@RequestHeader("loginName") String loginName,
|
@RequestHeader("loginName") String loginName,
|
||||||
@RequestHeader("clientType") String clientType,
|
@RequestHeader("clientType") String clientType,
|
||||||
@RequestParam("type") String type,
|
@RequestParam("type") String type,
|
||||||
|
|
@ -51,9 +51,10 @@ public class CloudPrinterController {
|
||||||
@RequestHeader("loginName") String loginName,
|
@RequestHeader("loginName") String loginName,
|
||||||
@RequestHeader("clientType") String clientType,
|
@RequestHeader("clientType") String clientType,
|
||||||
@RequestParam("tradeDay") String tradeDay,
|
@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);
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,11 @@ import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
import com.chaozhanggui.system.cashierservice.util.IpUtil;
|
import com.chaozhanggui.system.cashierservice.util.IpUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@CrossOrigin(origins = "*")
|
@CrossOrigin(origins = "*")
|
||||||
@RestController
|
@RestController
|
||||||
|
|
@ -50,4 +52,12 @@ public class LoginContoller {
|
||||||
return loginService.getShopInfo(token);
|
return loginService.getShopInfo(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "getPhone")
|
||||||
|
public Result getPhone( @RequestBody Map<String, String> map){
|
||||||
|
if (CollectionUtils.isEmpty(map) || !map.containsKey("userId")) {
|
||||||
|
return Result.fail("id不允许为空");
|
||||||
|
}
|
||||||
|
return loginService.getPhone(Integer.valueOf(map.get("userId").toString()));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.chaozhanggui.system.cashierservice.dao;
|
package com.chaozhanggui.system.cashierservice.dao;
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.ShopUserDuty;
|
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.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
@ -43,4 +44,7 @@ public interface ShopUserDutyMapper {
|
||||||
void updateStatusById(@Param("id") Integer id, @Param("staffId") Integer staffId);
|
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<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;
|
package com.chaozhanggui.system.cashierservice.dao;
|
||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.ShopUserDutyPay;
|
import com.chaozhanggui.system.cashierservice.entity.ShopUserDutyPay;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfoPO;
|
||||||
import com.chaozhanggui.system.cashierservice.model.HandoverInfo;
|
import com.chaozhanggui.system.cashierservice.model.HandoverInfo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
@ -31,4 +32,6 @@ public interface ShopUserDutyPayMapper {
|
||||||
|
|
||||||
|
|
||||||
List<Map<String,Object>> selectCetoryBydutyId(Integer dutyId);
|
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;
|
||||||
|
}
|
||||||
|
|
@ -17,6 +17,7 @@ public class WebAppConfigurer implements WebMvcConfigurer {
|
||||||
registry.addInterceptor(signInterceptor)
|
registry.addInterceptor(signInterceptor)
|
||||||
.addPathPatterns("/**")
|
.addPathPatterns("/**")
|
||||||
.excludePathPatterns("/login/login")
|
.excludePathPatterns("/login/login")
|
||||||
|
.excludePathPatterns("/login/getPhone")
|
||||||
.excludePathPatterns("/cloudPrinter/print")
|
.excludePathPatterns("/cloudPrinter/print")
|
||||||
.excludePathPatterns("/cloudPrinter/handoverPrint")
|
.excludePathPatterns("/cloudPrinter/handoverPrint")
|
||||||
.excludePathPatterns("/data/handoverData")
|
.excludePathPatterns("/data/handoverData")
|
||||||
|
|
@ -24,6 +25,7 @@ public class WebAppConfigurer implements WebMvcConfigurer {
|
||||||
.excludePathPatterns("/order/getsendMessage")
|
.excludePathPatterns("/order/getsendMessage")
|
||||||
.excludePathPatterns("/qrcode/getscanCode")
|
.excludePathPatterns("/qrcode/getscanCode")
|
||||||
.excludePathPatterns("/order/sendMessage")
|
.excludePathPatterns("/order/sendMessage")
|
||||||
.excludePathPatterns("/order/getOrderById");
|
.excludePathPatterns("/order/getOrderById")
|
||||||
|
.excludePathPatterns("/data/handoverprint");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
package com.chaozhanggui.system.cashierservice.model;
|
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 lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
|
@ -38,8 +41,12 @@ public class HandoverInfo implements Serializable {
|
||||||
|
|
||||||
private String quickAmount;
|
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
|
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;
|
this.merchantName = merchantName;
|
||||||
|
|
@ -56,6 +63,8 @@ public class HandoverInfo implements Serializable {
|
||||||
this.orderNum = orderNum;
|
this.orderNum = orderNum;
|
||||||
this.productCategories=productCategories;
|
this.productCategories=productCategories;
|
||||||
this.quickAmount=quickAmount;
|
this.quickAmount=quickAmount;
|
||||||
|
this.productInfoPOS=productInfoPOS;
|
||||||
|
this.productInfos=productInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
|
@ -96,4 +105,6 @@ public class HandoverInfo implements Serializable {
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
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.exception.MsgException;
|
||||||
import com.chaozhanggui.system.cashierservice.model.CategoryInfo;
|
import com.chaozhanggui.system.cashierservice.model.CategoryInfo;
|
||||||
import com.chaozhanggui.system.cashierservice.model.HandoverInfo;
|
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);
|
JSONObject info= TokenUtil.parseParamFromToken(token);
|
||||||
|
|
@ -642,10 +644,17 @@ public class CloudPrinterService {
|
||||||
productCategories=JSONUtil.parseJSONStr2TList(JSONUtil.toJSONString(categries),HandoverInfo.ProductCategory.class);
|
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(),
|
HandoverInfo handoverInfo=new HandoverInfo(tbShopInfo.getShopName(),
|
||||||
ObjectUtil.isNotEmpty(shopUserDuty.getLoginTime())?DateUtils.getTime(shopUserDuty.getLoginTime()):null,
|
ObjectUtil.isNotEmpty(shopUserDuty.getLoginTime())?DateUtils.getTime(shopUserDuty.getLoginTime()):null,
|
||||||
ObjectUtil.isNotEmpty(shopUserDuty.getLoginOutTime())?DateUtils.getTime(shopUserDuty.getLoginOutTime()):"",
|
ObjectUtil.isNotEmpty(shopUserDuty.getLoginOutTime())?DateUtils.getTime(shopUserDuty.getLoginOutTime()):DateUtils.getTime(new Date()),
|
||||||
ObjectUtil.isNull(shopStaff.getName())?"":shopStaff.getName(),
|
ObjectUtil.isNull(shopStaff.getName())?"":shopStaff.getName(),
|
||||||
list,memberData,shopUserDuty.getAmount().add(ObjectUtil.isNull(shopUserDuty.getQuickAmount())?BigDecimal.ZERO:shopUserDuty.getQuickAmount()).toPlainString(),
|
list,memberData,shopUserDuty.getAmount().add(ObjectUtil.isNull(shopUserDuty.getQuickAmount())?BigDecimal.ZERO:shopUserDuty.getQuickAmount()).toPlainString(),
|
||||||
"0",
|
"0",
|
||||||
|
|
@ -653,7 +662,9 @@ public class CloudPrinterService {
|
||||||
shopUserDuty.getAmount().add(ObjectUtil.isNull(shopUserDuty.getQuickAmount())?BigDecimal.ZERO:shopUserDuty.getQuickAmount()).toPlainString(),
|
shopUserDuty.getAmount().add(ObjectUtil.isNull(shopUserDuty.getQuickAmount())?BigDecimal.ZERO:shopUserDuty.getQuickAmount()).toPlainString(),
|
||||||
shopUserDuty.getReturnAmount().toPlainString(),
|
shopUserDuty.getReturnAmount().toPlainString(),
|
||||||
shopUserDuty.getOrderNum().toString(),
|
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\":\"您有一笔新的订单,请及时处理\"}";
|
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
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.exception.MsgException;
|
||||||
import com.chaozhanggui.system.cashierservice.model.HandoverInfo;
|
import com.chaozhanggui.system.cashierservice.model.HandoverInfo;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
|
|
@ -18,6 +20,7 @@ import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -111,11 +114,114 @@ public class DataService {
|
||||||
shopUserDuty.getAmount().add(ObjectUtil.isNull(shopUserDuty.getQuickAmount())?BigDecimal.ZERO:shopUserDuty.getQuickAmount()).toPlainString(),
|
shopUserDuty.getAmount().add(ObjectUtil.isNull(shopUserDuty.getQuickAmount())?BigDecimal.ZERO:shopUserDuty.getQuickAmount()).toPlainString(),
|
||||||
shopUserDuty.getReturnAmount().toPlainString(),
|
shopUserDuty.getReturnAmount().toPlainString(),
|
||||||
shopUserDuty.getOrderNum().toString(),
|
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);
|
return Result.success(CodeEnum.SUCCESS,handoverInfo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Result handoverprint(Integer id,boolean isprintProduct){
|
||||||
|
if(ObjectUtil.isNotEmpty(id)){
|
||||||
|
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByPrimaryKey(id);
|
||||||
|
if(ObjectUtil.isNotEmpty(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,
|
||||||
|
DateUtils.getTime(new Date()),
|
||||||
|
"",
|
||||||
|
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.selectByTokenId(tokenId);
|
||||||
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndStatus(shopId, "0");
|
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndStatus(shopId, "0");
|
||||||
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndTrade(shopId, day);
|
// 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;
|
BigDecimal cashAmount = BigDecimal.ZERO;
|
||||||
|
|
||||||
if (type.equals("create")) {
|
if (type.equals("create")) {
|
||||||
if (orderInfo.getPayType().equals("cash")) {
|
if ("cash".equals(orderInfo.getPayType())) {
|
||||||
cashAmount = orderInfo.getPayAmount();
|
cashAmount = orderInfo.getPayAmount();
|
||||||
}
|
}
|
||||||
if (Objects.isNull(shopUserDuty)) {
|
if (Objects.isNull(shopUserDuty)) {
|
||||||
|
|
@ -362,7 +362,7 @@ public class DutyService {
|
||||||
Integer shopId = tokenJson.getInteger("shopId");
|
Integer shopId = tokenJson.getInteger("shopId");
|
||||||
Integer staffId = tokenJson.getInteger("staffId");
|
Integer staffId = tokenJson.getInteger("staffId");
|
||||||
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndStatus(shopId, "0");
|
ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndStatus(shopId, "0");
|
||||||
cloudPrinterService.handoverprintData(token, shopUserDuty.getId(), "");
|
// cloudPrinterService.handoverprintData(token, shopUserDuty.getId(), "",true);
|
||||||
// shopUserDutyMapper.updateStatusByTokenId(day, shopId, staffId);
|
// shopUserDutyMapper.updateStatusByTokenId(day, shopId, staffId);
|
||||||
shopUserDutyMapper.updateStatusById(shopUserDuty.getId(), staffId);
|
shopUserDutyMapper.updateStatusById(shopUserDuty.getId(), staffId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbPlussShopStaff;
|
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbShopInfo;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbToken;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbmerchantAccount;
|
|
||||||
import com.chaozhanggui.system.cashierservice.model.LoginReq;
|
import com.chaozhanggui.system.cashierservice.model.LoginReq;
|
||||||
import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
|
import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
|
|
@ -35,6 +32,8 @@ public class LoginService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
TbShopInfoMapper tbShopInfoMapper;
|
TbShopInfoMapper tbShopInfoMapper;
|
||||||
|
@Autowired
|
||||||
|
TbUserInfoMapper userInfoMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
TbProductMapper tbProductMapper;
|
TbProductMapper tbProductMapper;
|
||||||
|
|
@ -173,6 +172,8 @@ public class LoginService {
|
||||||
jsonObject.put("type", "close");
|
jsonObject.put("type", "close");
|
||||||
jsonObject.put("token", token);
|
jsonObject.put("token", token);
|
||||||
rabbitProducer.putOrderCollect(jsonObject.toJSONString());
|
rabbitProducer.putOrderCollect(jsonObject.toJSONString());
|
||||||
|
|
||||||
|
|
||||||
return Result.success(SUCCESS);
|
return Result.success(SUCCESS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -187,4 +188,12 @@ public class LoginService {
|
||||||
|
|
||||||
return Result.success(SUCCESS,shopInfo);
|
return Result.success(SUCCESS,shopInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Result getPhone(Integer userId) {
|
||||||
|
TbUserInfo userInfo = userInfoMapper.selectByPrimaryKey(userId);
|
||||||
|
if (userInfo != null) {
|
||||||
|
return Result.success(SUCCESS, userInfo.getTelephone());
|
||||||
|
}
|
||||||
|
return Result.success(SUCCESS, "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -624,14 +624,15 @@ public class MemberService {
|
||||||
tbShopUserFlowMapper.insert(flow);
|
tbShopUserFlowMapper.insert(flow);
|
||||||
|
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
|
||||||
jsonObject.put("token", token);
|
|
||||||
jsonObject.put("type", "memberIn");
|
|
||||||
jsonObject.put("amount", memberIn.getAmount());
|
|
||||||
|
|
||||||
producer.putOrderCollect(jsonObject.toJSONString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("token", token);
|
||||||
|
jsonObject.put("type", "memberIn");
|
||||||
|
jsonObject.put("amount", memberIn.getAmount());
|
||||||
|
|
||||||
|
producer.putOrderCollect(jsonObject.toJSONString());
|
||||||
|
|
||||||
|
|
||||||
return Result.success(CodeEnum.SUCCESS);
|
return Result.success(CodeEnum.SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.chaozhanggui.system.cashierservice.util;
|
package com.chaozhanggui.system.cashierservice.util;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
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.HandoverInfo;
|
||||||
import com.chaozhanggui.system.cashierservice.model.OrderDetailPO;
|
import com.chaozhanggui.system.cashierservice.model.OrderDetailPO;
|
||||||
import org.springframework.http.HttpEntity;
|
import org.springframework.http.HttpEntity;
|
||||||
|
|
@ -199,6 +201,97 @@ public class PrinterUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ObjectUtil.isNotEmpty(handoverInfo.getProductInfos())&&handoverInfo.getProductInfos().size()>0) {
|
||||||
|
sb.append("<S>商品数据</S><BR>");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<ProductInfo> productInfo1=handoverInfo.getProductInfos();
|
||||||
|
|
||||||
|
|
||||||
|
Integer max= productInfo1.stream().max(Comparator.comparing(it->it.getProductName().length())).get().getProductName().length();
|
||||||
|
|
||||||
|
|
||||||
|
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 {
|
||||||
|
if(productInfo.getProductName().length()<max){
|
||||||
|
|
||||||
|
int tt=max-productInfo.getProductName().length()+10;
|
||||||
|
|
||||||
|
sb.append("<S> "+String.format("%-"+tt+"s",productInfo.getProductName()).replace(' ', paddingCharacter)+String.format("%-4s",productInfo.getNum()).replace(' ', paddingCharacter)+String.format("%6s",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(ObjectUtil.isNull(handoverInfo.getQuickAmount())?"0":handoverInfo.getQuickAmount())+"</S><BR>");
|
||||||
sb.append("<S>退款金额 :".concat(handoverInfo.getReturnAmount())+"</S><BR>");
|
sb.append("<S>退款金额 :".concat(handoverInfo.getReturnAmount())+"</S><BR>");
|
||||||
sb.append("<S>总收入: "+handoverInfo.getTotalAmount()+"</S><BR>");
|
sb.append("<S>总收入: "+handoverInfo.getTotalAmount()+"</S><BR>");
|
||||||
|
|
@ -279,22 +372,35 @@ public class PrinterUtils {
|
||||||
|
|
||||||
|
|
||||||
public static int getProducrName(String str){
|
public static int getProducrName(String str){
|
||||||
int count = 0;
|
int count=0;
|
||||||
int digitCount=0;
|
for (int i = 0; i < str.length(); i++) {
|
||||||
for (int i=0;i<str.length();i++){
|
char c = str.charAt(i);
|
||||||
if ((str.charAt(i)>='a' && str.charAt(i)<='z') || (str.charAt(i)>='A' && str.charAt(i)<='Z')){
|
if (c >= '0' && c <= '9') {
|
||||||
|
count++;
|
||||||
|
} else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Character.isDigit(str.charAt(i))) {
|
|
||||||
digitCount++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return count+digitCount;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args)throws Exception {
|
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<>();
|
// List<HandoverInfo.PayInfo> payInfos=new ArrayList<>();
|
||||||
//
|
//
|
||||||
|
|
@ -331,8 +437,8 @@ public class PrinterUtils {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String voiceJson = "{\"bizType\":\"1\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
// String voiceJson = "{\"bizType\":\"1\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||||
printTickets(voiceJson,1,1,"ZF544PG03W00002", printInvoice("http://weixin.qq.com/q/020fVS8lcLeiG1ID3SxCcH","【30天内开票有效】","1000000"));
|
// printTickets(voiceJson,1,1,"ZF544PG03W00002", printInvoice("http://weixin.qq.com/q/020fVS8lcLeiG1ID3SxCcH","【30天内开票有效】","1000000"));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -250,4 +250,18 @@
|
||||||
select * from tb_shop_user_duty where status = #{status} and shop_id = #{shopId} order by id desc limit 1
|
select * from tb_shop_user_duty where status = #{status} and shop_id = #{shopId} order by id desc limit 1
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByDutyId" resultType="com.chaozhanggui.system.cashierservice.entity.po.ProductInfo">
|
||||||
|
SELECT
|
||||||
|
d.product_name,
|
||||||
|
sum( d.num ) AS num,
|
||||||
|
sum( d.amount ) AS amount
|
||||||
|
FROM
|
||||||
|
tb_shop_user_duty_detail d
|
||||||
|
WHERE
|
||||||
|
d.duty_id = #{dutyId}
|
||||||
|
GROUP BY
|
||||||
|
d.product_id;
|
||||||
|
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -118,4 +118,17 @@
|
||||||
ORDER BY
|
ORDER BY
|
||||||
c.sort DESC
|
c.sort DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectProductByDutyId" resultType="com.chaozhanggui.system.cashierservice.entity.po.ProductInfoPO">
|
||||||
|
SELECT
|
||||||
|
d.product_id,
|
||||||
|
d.product_name,
|
||||||
|
d.sku_name,
|
||||||
|
d.num,
|
||||||
|
d.amount
|
||||||
|
FROM
|
||||||
|
tb_shop_user_duty_detail d
|
||||||
|
WHERE
|
||||||
|
d.duty_id = #{dutyId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue