Merge branch 'refs/heads/dev'

This commit is contained in:
GYJ
2024-07-19 14:53:46 +08:00
21 changed files with 321 additions and 103 deletions

View File

@@ -11,7 +11,7 @@ public @interface LimitSubmit {
/**
* 默认 10s
*/
int limit() default 7200;
int limit() default 10;
/**
* 请求完成后 是否一直等待
@@ -19,4 +19,4 @@ public @interface LimitSubmit {
* @return
*/
boolean needAllWait() default true;
}
}

View File

@@ -55,4 +55,17 @@ public class CloudPrinterController {
){
return cloudPrinterService.handoverprintData(token,id,loginName);
}
@GetMapping("printInvoice")
public Result printInvoice(@RequestHeader("token") String token,
@RequestHeader("loginName") String loginName,
@RequestHeader("clientType") String clientType,
@RequestParam("content") String content,
@RequestParam("remark") String remark,
@RequestParam("amount") String amount,
@RequestParam("shopId") String shopId
){
return cloudPrinterService.printInvoice(shopId, content, remark, amount);
}
}

View File

@@ -154,4 +154,11 @@ public class OrderController {
@RequestParam("pageSize") int pageSize){
return orderService.getOutNumber(shopId,page,pageSize);
}
@GetMapping("getOrderById")
public Result getOrderById(@RequestParam("orderId") Integer orderId){
return orderService.getOrder(orderId);
}
}

View File

@@ -211,15 +211,17 @@ public class PayController {
@RequestMapping("returnOrder")
@LimitSubmit(key = "returnOrder:%s")
@LimitSubmit(key = "returnOrder:%s", limit = 10)
public Result returnOrder(@RequestHeader("token") String token,
@RequestHeader("loginName") String loginName,
@RequestHeader("clientType") String clientType,
@RequestBody List<TbOrderDetail> list
@RequestBody List<TbOrderDetail> list,
@RequestParam("pwd") String pwd,
@RequestParam(defaultValue = "true") boolean isOnline
){
return payService.returnOrder(list,token,null);
return payService.returnOrder(list,token,null, isOnline);
}

View File

@@ -47,4 +47,7 @@ public interface TbOrderInfoMapper {
Map<String,String> selectByOrderId(String orderId);
List<SkuInfoPo> selectSkuByOrderId(String orderId);
TbOrderInfo selectById(Integer id);
}

View File

@@ -29,10 +29,12 @@ public interface TbProductMapper {
List<TbProductWithBLOBs> selectByShopId(@Param("shopId") String shopId,@Param("commdityName") String commdityName);
List<TbProductWithBLOBs> selectByShopIdAndCheckGrounding(@Param("shopId") String shopId,@Param("commdityName") String commdityName);
List<TbProductWithBLOBs> selectByShopIdAndShopType(@Param("shopId") String shopId, @Param("categoryId") String categoryId,@Param("commdityName") String commdityName);
List<TbProductWithBLOBs> selectByShopIdAndShopTypeCheckGrounding(@Param("shopId") String shopId, @Param("categoryId") String categoryId,@Param("commdityName") String commdityName);

View File

@@ -5,6 +5,7 @@ import com.chaozhanggui.system.cashierservice.entity.TbProductSkuWithBLOBs;
import com.chaozhanggui.system.cashierservice.entity.po.ProductSkuPo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;
@@ -49,4 +50,7 @@ public interface TbProductSkuMapper {
@Update("update tb_product_sku set stock_number=stock_number-#{num} WHERE id=#{id} ")
int decrStockUnCheck(String id, int num);
@Select("select * from tb_product_sku where is_grounding=1 and product_id=#{id}")
List<TbProductSku> selectByProductCheckGrounding(@Param("id") Integer id);
}

View File

@@ -25,6 +25,12 @@ public class TbConsInfoFlow implements Serializable {
private String bizType;
private Integer orderId;
private String orderNo;
private Date createTime;
private Date updateTime;
@@ -126,4 +132,20 @@ public class TbConsInfoFlow implements Serializable {
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getOrderId() {
return orderId;
}
public void setOrderId(Integer orderId) {
this.orderId = orderId;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
}

View File

@@ -1,6 +1,7 @@
package com.chaozhanggui.system.cashierservice.entity;
import java.io.Serializable;
import java.util.List;
public class TbProductWithBLOBs extends TbProduct implements Serializable {
private String images;
@@ -15,8 +16,18 @@ public class TbProductWithBLOBs extends TbProduct implements Serializable {
private String selectSpec;
private List<?> skuList;
private static final long serialVersionUID = 1L;
public List<?> getSkuList() {
return skuList;
}
public void setSkuList(List<?> skuList) {
this.skuList = skuList;
}
public String getImages() {
return images;
}
@@ -64,4 +75,4 @@ public class TbProductWithBLOBs extends TbProduct implements Serializable {
public void setSelectSpec(String selectSpec) {
this.selectSpec = selectSpec == null ? null : selectSpec.trim();
}
}
}

View File

@@ -1,7 +1,6 @@
package com.chaozhanggui.system.cashierservice.interceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@@ -24,6 +23,7 @@ public class WebAppConfigurer implements WebMvcConfigurer {
.excludePathPatterns("/order/scanSendMessage")
.excludePathPatterns("/order/getsendMessage")
.excludePathPatterns("/qrcode/getscanCode")
.excludePathPatterns("/order/sendMessage");
.excludePathPatterns("/order/sendMessage")
.excludePathPatterns("/order/getOrderById");
}
}

View File

@@ -45,4 +45,6 @@ public interface RabbitConstants {
public static final String CONS_MSG_COLLECT_ROUTINGKEY_PUT = "cons_msg_collect_routingkey_put";
String EXCHANGE_STOCK_RECORD = "exchange.stock.record";
String ROUTING_STOCK_RECORD_SALE = "routing.stock.record.sale";
}

View File

@@ -1,5 +1,6 @@
package com.chaozhanggui.system.cashierservice.rabbit;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.connection.CorrelationData;
@@ -12,7 +13,7 @@ import java.util.UUID;
@Component
public class RabbitProducer implements RabbitTemplate.ConfirmCallback {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
private RabbitTemplate rabbitTemplate;
@@ -22,7 +23,7 @@ public class RabbitProducer implements RabbitTemplate.ConfirmCallback {
this.rabbitTemplate = rabbitTemplate;
rabbitTemplate.setConfirmCallback(this); //rabbitTemplate如果为单例的话那回调就是最后设置的内容
}
public void putOrderCollect(String content) {
CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
rabbitTemplate.convertAndSend(RabbitConstants.CART_ORDER_COLLECT_PUT, RabbitConstants.CART_ORDER_COLLECT_ROUTINGKEY_PUT, content, correlationId);
@@ -61,4 +62,13 @@ public class RabbitProducer implements RabbitTemplate.ConfirmCallback {
}
}
}
private <T> void sendMsg(String exchange, String routingKey, T data, String note) {
CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
logger.info("开始发送{}mq消息, msgId: {}, exchange: {}, routingKey: {}, data: {}", correlationId.getId(), note, exchange, routingKey, data);
rabbitTemplate.convertAndSend(exchange, routingKey, JSONObject.toJSONString(data), correlationId);
}
public <T> void sendStockSaleMsg(T data) {
sendMsg(RabbitConstants.EXCHANGE_STOCK_RECORD, RabbitConstants.ROUTING_STOCK_RECORD_SALE, data, "商品售出增加库存记录");
}
}

View File

@@ -666,4 +666,40 @@ public class CloudPrinterService {
public Result printInvoice(String shopId,String content,String remark,String amount){
List<TbPrintMachineWithBLOBs> bloBsList = tbPrintMachineMapper.selectByShopId(shopId);
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;
}
String voiceJson = "{\"bizType\":\"1\",\"content\":\"您有一笔新的订单,请及时处理\"}";
PrinterUtils.printTickets(voiceJson,1,1,it.getAddress(),PrinterUtils.printInvoice(content, remark, amount));
});
return Result.success(CodeEnum.SUCCESS);
}
}

View File

@@ -35,6 +35,9 @@ public class ConsService {
@Autowired
TbOrderDetailMapper tbOrderDetailMapper;
@Autowired
TbOrderInfoMapper tbOrderInfoMapper;
@Transactional(rollbackFor = Exception.class)
public void exect(String message) throws Exception {
log.info("耗材信息更新开始:{}",message);
@@ -47,7 +50,11 @@ public class ConsService {
Thread.sleep(1000L);
TbOrderInfo tbOrderInfo=tbOrderInfoMapper.selectByPrimaryKey(Integer.valueOf(orderId));
if(Objects.isNull(tbOrderInfo)){
log.info("订单信息不存在");
return;
}
List<TbOrderDetail> orderDetails= tbOrderDetailMapper.selectAllByOrderId(Integer.valueOf(orderId));
if(Objects.isNull(orderDetails)||orderDetails.size()<=0){
@@ -102,10 +109,18 @@ public class ConsService {
// ConsInfoPO consInfoPO=new ConsInfoPO(tbConsInfo.getId(),amount);
// consInfoPOS.add(consInfoPO);
flow.setOrderId(tbOrderInfo.getId());
flow.setOrderNo(tbOrderInfo.getOrderNo());
flow.setCreateTime(new Date());
// flow.setUpdateTime(new Date());
// consInfoFlows.add(flow);
if(amount.equals(BigDecimal.ZERO)){
log.info("变动金额为 0:{}",amount);
continue;
}
tbConsInfoMapper.updateByPrimaryKey(tbConsInfo);
tbConsInfoFlowMapper.insert(flow);

View File

@@ -1064,6 +1064,13 @@ public class OrderService {
}
public Result getOrder(Integer orderId){
return Result.success(CodeEnum.SUCCESS, tbOrderInfoMapper.selectById(orderId)) ;
}
@Autowired
TbUserInfoMapper tbUserInfoMapper;
@@ -1154,6 +1161,9 @@ public class OrderService {
@Autowired
TbOrderOutNumberMapper tbOrderOutNumberMapper;
public Result scanSendMessage(String outNumber,String shopId){

View File

@@ -17,11 +17,9 @@ import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.thirdpay.resp.*;
import com.chaozhanggui.system.cashierservice.thirdpay.service.ThirdPayService;
import com.chaozhanggui.system.cashierservice.util.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
@@ -538,6 +536,12 @@ public class PayService {
producer.printMechine(orderId);
// 发送库存记录mq消息
JSONObject mqData = new JSONObject();
mqData.put("orderId", orderId);
mqData.put("type", "pc");
producer.sendStockSaleMsg(mqData);
return Result.success(CodeEnum.SUCCESS);
}
@@ -623,6 +627,12 @@ public class PayService {
producer.printMechine(orderId);
// 发送库存记录mq消息
JSONObject mqData = new JSONObject();
mqData.put("orderId", orderId);
mqData.put("type", "pc");
producer.sendStockSaleMsg(mqData);
return Result.success(CodeEnum.SUCCESS);
}
@@ -671,6 +681,12 @@ public class PayService {
producer.printMechine(orderId);
// 发送库存记录mq消息
JSONObject mqData = new JSONObject();
mqData.put("orderId", orderId);
mqData.put("type", "pc");
producer.sendStockSaleMsg(mqData);
return Result.success(CodeEnum.SUCCESS);
}
@@ -718,11 +734,17 @@ public class PayService {
producer.printMechine(orderId);
// 发送库存记录mq消息
JSONObject mqData = new JSONObject();
mqData.put("orderId", orderId);
mqData.put("type", "pc");
producer.sendStockSaleMsg(mqData);
return Result.success(CodeEnum.SUCCESS);
}
@Transactional(rollbackFor = Exception.class)
public Result returnOrder(List<TbOrderDetail> list, String token,String pwd) {
public Result returnOrder(List<TbOrderDetail> list, String token, String pwd, boolean isOnline) {
if (ObjectUtil.isEmpty(list) || list.size() <= 0) {
return Result.fail(CodeEnum.PARAM);
}
@@ -762,6 +784,9 @@ public class PayService {
String masterId = orderInfo.getMasterId();
String payType = orderInfo.getPayType();
String orderNo = generateReturnOrderNumber();
if (!isOnline) {
orderNo = "XX" + orderNo;
}
BigDecimal orderAmount = orderInfo.getPayAmount();
@@ -808,7 +833,8 @@ public class PayService {
// totalAmount = totalAmount.add(it.getPriceAmount());
totalAmount = totalAmount.add(it.getPriceAmount().divide(new BigDecimal(it.getNum()), 2, RoundingMode.DOWN).multiply(new BigDecimal(map1.get(it.getId()))));
saleAmount = saleAmount.add(it.getPrice());
payAmount = payAmount.add(it.getPriceAmount().divide(new BigDecimal(it.getNum()), 2, RoundingMode.DOWN).multiply(new BigDecimal(map1.get(it.getId()))));
payAmount = payAmount.add(it.getPriceAmount().divide(new BigDecimal(it.getNum()), 2, RoundingMode.DOWN)
.multiply(new BigDecimal(map1.get(it.getId()))));
// payAmount=payAmount.add(it.getPriceAmount());
packAMount = packAMount.add(it.getPackAmount().divide(new BigDecimal(it.getNum()), 2, RoundingMode.DOWN).multiply(new BigDecimal(map1.get(it.getId()))));
@@ -839,86 +865,88 @@ public class PayService {
"table", "return", merchantId, shopId,
"", (byte) 1, day, masterId, "refund", payAmount, orderInfo.getPayType(), orderInfo.getTableName());
if ("scanCode".equals(payType) || "wx_lite".equals(payType)) {
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(merchantId));
MsgException.checkNull(thirdApply, "支付参数配置错误");
// 线上退款
if (isOnline) {
if ("scanCode".equals(payType) || "wx_lite".equals(payType)) {
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(Integer.valueOf(merchantId));
MsgException.checkNull(thirdApply, "支付参数配置错误");
if ("ysk".equals(thirdPayType)) {
ReturnOrderReq req = new ReturnOrderReq();
req.setAppId(thirdApply.getAppId());
req.setTimestamp(System.currentTimeMillis());
req.setOrderNumber(orderInfo.getPayOrderNo());
req.setAmount(String.format("%.2f", newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN)));
req.setMercRefundNo(orderInfo.getOrderNo());
req.setRefundReason("退货");
req.setPayPassword(thirdApply.getPayPassword());
Map<String, Object> map = BeanUtil.transBean2Map(req);
req.setSign(MD5Util.encrypt(map, thirdApply.getAppToken(), true));
log.info("merchantOrderReturn req:{}", JSONUtil.toJsonStr(req));
ResponseEntity<String> response = restTemplate.postForEntity(gateWayUrl.concat("merchantOrder/returnOrder"), req, String.class);
log.info("merchantOrderReturn:{}", response.getBody());
if (response.getStatusCodeValue() == 200 && ObjectUtil.isNotEmpty(response.getBody())) {
JSONObject object = JSONObject.parseObject(response.getBody());
if (!object.get("code").equals("0")) {
MsgException.check(true, "退款渠道调用失败");
}
// newOrderInfo.setPayOrderNo(object.getJSONObject("data").getString("refundOrderNumber"));
}
} else {
TbOrderPayment payment= tbOrderPaymentMapper.selectByOrderId(orderId+"");
PublicResp<OrderReturnResp> publicResp = thirdPayService.returnOrder(url, thirdApply.getAppId(), newOrderInfo.getOrderNo(), payment.getTradeNumber(), null, "订单退款", newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN).multiply(new BigDecimal(100)).longValue(), callBack, null, thirdApply.getAppToken());
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
if ("000000".equals(publicResp.getCode())) {
if (!"SUCCESS".equals(publicResp.getObjData().getState())&&!publicResp.getObjData().getState().equals("ING")) {
if ("ysk".equals(thirdPayType)) {
ReturnOrderReq req = new ReturnOrderReq();
req.setAppId(thirdApply.getAppId());
req.setTimestamp(System.currentTimeMillis());
req.setOrderNumber(orderInfo.getPayOrderNo());
req.setAmount(String.format("%.2f", newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN)));
req.setMercRefundNo(orderInfo.getOrderNo());
req.setRefundReason("退货");
req.setPayPassword(thirdApply.getPayPassword());
Map<String, Object> map = BeanUtil.transBean2Map(req);
req.setSign(MD5Util.encrypt(map, thirdApply.getAppToken(), true));
log.info("merchantOrderReturn req:{}", JSONUtil.toJsonStr(req));
ResponseEntity<String> response = restTemplate.postForEntity(gateWayUrl.concat("merchantOrder/returnOrder"), req, String.class);
log.info("merchantOrderReturn:{}", response.getBody());
if (response.getStatusCodeValue() == 200 && ObjectUtil.isNotEmpty(response.getBody())) {
JSONObject object = JSONObject.parseObject(response.getBody());
if (!object.get("code").equals("0")) {
MsgException.check(true, "退款渠道调用失败");
}
} else {
MsgException.check(true, "退款渠道调用失败");
// newOrderInfo.setPayOrderNo(object.getJSONObject("data").getString("refundOrderNumber"));
}
} else {
TbOrderPayment payment= tbOrderPaymentMapper.selectByOrderId(orderId+"");
PublicResp<OrderReturnResp> publicResp = thirdPayService.returnOrder(url, thirdApply.getAppId(), newOrderInfo.getOrderNo(), payment.getTradeNumber(), null, "订单退款", newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN).multiply(new BigDecimal(100)).longValue(), callBack, null, thirdApply.getAppToken());
if (ObjectUtil.isNotNull(publicResp) && ObjectUtil.isNotEmpty(publicResp)) {
if ("000000".equals(publicResp.getCode())) {
if (!"SUCCESS".equals(publicResp.getObjData().getState())&&!publicResp.getObjData().getState().equals("ING")) {
MsgException.check(true, "退款渠道调用失败");
}
} else {
MsgException.check(true, "退款渠道调用失败");
}
}
}
}else if("deposit".equals(payType)){
TbShopUser user= tbShopUserMapper.selectByUserIdAndShopId(orderInfo.getUserId(),orderInfo.getShopId());
if(ObjectUtil.isNull(user)||ObjectUtil.isEmpty(user)){
user=tbShopUserMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getMemberId()));
}
if(ObjectUtil.isNull(user)||ObjectUtil.isEmpty(user)){
return Result.fail(ACCOUNTEIXST);
}
if(!user.getShopId().equals(orderInfo.getShopId())){
return Result.fail(ACCOUNTEIXST);
}
newOrderInfo.setMemberId(orderInfo.getMemberId());
newOrderInfo.setUserId(orderInfo.getUserId());
user.setAmount(user.getAmount().add( newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN)));
user.setConsumeAmount(user.getConsumeAmount().subtract( newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN)));
user.setUpdatedAt(System.currentTimeMillis());
tbShopUserMapper.updateByPrimaryKeySelective(user);
TbShopUserFlow flow = new TbShopUserFlow();
flow.setShopUserId(user.getId());
flow.setBizCode("accountReturnPay");
flow.setBizName("会员储值卡退款");
flow.setType("+");
flow.setAmount(newOrderInfo.getOrderAmount());
flow.setBalance(user.getAmount());
flow.setCreateTime(new Date());
tbShopUserFlowMapper.insert(flow);
}
}else if("deposit".equals(payType)){
TbShopUser user= tbShopUserMapper.selectByUserIdAndShopId(orderInfo.getUserId(),orderInfo.getShopId());
if(ObjectUtil.isNull(user)||ObjectUtil.isEmpty(user)){
user=tbShopUserMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getMemberId()));
}
if(ObjectUtil.isNull(user)||ObjectUtil.isEmpty(user)){
return Result.fail(ACCOUNTEIXST);
}
if(!user.getShopId().equals(orderInfo.getShopId())){
return Result.fail(ACCOUNTEIXST);
}
newOrderInfo.setMemberId(orderInfo.getMemberId());
newOrderInfo.setUserId(orderInfo.getUserId());
user.setAmount(user.getAmount().add( newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN)));
user.setConsumeAmount(user.getConsumeAmount().subtract( newOrderInfo.getPayAmount().setScale(2, RoundingMode.DOWN)));
user.setUpdatedAt(System.currentTimeMillis());
tbShopUserMapper.updateByPrimaryKeySelective(user);
TbShopUserFlow flow = new TbShopUserFlow();
flow.setShopUserId(user.getId());
flow.setBizCode("accountReturnPay");
flow.setBizName("会员储值卡退款");
flow.setType("+");
flow.setAmount(newOrderInfo.getOrderAmount());
flow.setBalance(user.getAmount());
flow.setCreateTime(new Date());
tbShopUserFlowMapper.insert(flow);
}
//判断是否修改主单状态
BigDecimal returnAmount = tbOrderDetailMapper.selectByOrderId(orderId.toString());
if (N.egt(returnAmount.add(payAmount), orderAmount)) {

View File

@@ -1,6 +1,10 @@
package com.chaozhanggui.system.cashierservice.service;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.entity.vo.ShopCategoryVo;
@@ -14,6 +18,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
@@ -97,9 +102,9 @@ public class ProductService {
List<TbProductWithBLOBs> tbProductWithBLOBs=null;
PageHelperUtil.startPage(page,pageSize);
if(ObjectUtil.isEmpty(categoryId)){
tbProductWithBLOBs=tbProductMapper.selectByShopId(shopId,commdityName);
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndCheckGrounding(shopId,commdityName);
}else {
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndShopType(shopId,categoryId,commdityName);
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndShopTypeCheckGrounding(shopId,categoryId,commdityName);
}
String day = DateUtils.getDay();
@@ -118,6 +123,11 @@ public class ProductService {
skuResult=new TbProductSkuResult();
}
it.setProductSkuResult(skuResult);
// 查询sku信息
List<TbProductSku> skuWithBLOBs = tbProductSkuMapper.selectByProductCheckGrounding(it.getId());
it.setSkuList(skuWithBLOBs);
});
}
PageInfo pageInfo=new PageInfo(tbProductWithBLOBs);

View File

@@ -222,6 +222,15 @@ public class PrinterUtils {
public static String printInvoice(String content,String remark,String amount){
StringBuilder sb=new StringBuilder();
sb.append("<C><QR>".concat(content.concat("</QR></C><BR>")));
sb.append("<C><BOLD>".concat(remark).concat("</BOLD></C><BR>"));
sb.append("<C><BOLD>【开票金额:".concat(amount).concat("】</BOLD></C>"));
sb.append("<OUT:200>");
sb.append("<PCUT>");
return sb.toString();
}
@@ -306,20 +315,24 @@ public class PrinterUtils {
//
// printTickets(3,1,"ZF544PG03W00002",handoverprintData(handoverInfo));
//
// List<OrderDetailPO.Detail> detailList= new ArrayList<>();
// OrderDetailPO.Detail detail=new OrderDetailPO.Detail("花香水牛拿铁","1","19000.90","不甜,麻辣");
//
// OrderDetailPO.Detail detail3=new OrderDetailPO.Detail("单位iiii","4","40000.00",null);
// OrderDetailPO.Detail detail4=new OrderDetailPO.Detail("喔喔奶茶","1","19000.90","微甜,微辣");
// detailList.add(detail);
// detailList.add(detail3);
// detailList.add(detail4);
// OrderDetailPO detailPO=new OrderDetailPO("牛叉闪闪","普通打印","#365","DD20240306134718468","2024-03-06 15:00:00","【POS-1】001","79000.80","5049758.96","deposit","0",detailList,"变态辣");
//
// String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
// printTickets(voiceJson,1,1,"ZF544PG03W00002",getCashPrintData(detailPO,"结算单",""));\\
List<OrderDetailPO.Detail> detailList= new ArrayList<>();
OrderDetailPO.Detail detail=new OrderDetailPO.Detail("花香水牛拿铁","1","19000.90","不甜,麻辣");
OrderDetailPO.Detail detail3=new OrderDetailPO.Detail("单位iiii","4","40000.00",null);
OrderDetailPO.Detail detail4=new OrderDetailPO.Detail("喔喔奶茶","1","19000.90","微甜,微辣");
detailList.add(detail);
detailList.add(detail3);
detailList.add(detail4);
OrderDetailPO detailPO=new OrderDetailPO("牛叉闪闪","普通打印","#365","DD20240306134718468","2024-03-06 15:00:00","【POS-1】001","79000.80","5049758.96","deposit","0",detailList,"变态辣");
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
printTickets(voiceJson,1,1,"ZF544PG03W00002",getCashPrintData(detailPO,"结算单",""));
String voiceJson = "{\"bizType\":\"1\",\"content\":\"您有一笔新的订单,请及时处理\"}";
printTickets(voiceJson,1,1,"ZF544PG03W00002", printInvoice("http://weixin.qq.com/q/020fVS8lcLeiG1ID3SxCcH","【30天内开票有效】","1000000"));
}
}

View File

@@ -14,10 +14,12 @@
<result column="biz_type" jdbcType="VARCHAR" property="bizType" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="order_id" jdbcType="INTEGER" property="orderId" />
<result column="order_no" jdbcType="VARCHAR" property="orderNo" />
</resultMap>
<sql id="Base_Column_List">
id, shop_id, cons_id, con_name, amount, balance, biz_code, biz_name, biz_type, create_time,
update_time
update_time,order_id,order_no
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
@@ -33,11 +35,11 @@
insert into tb_cons_info_flow (id, shop_id, cons_id, pro_sku_id,
con_name, amount, balance,
biz_code, biz_name, biz_type,
create_time, update_time)
create_time, update_time,order_id,order_no)
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{consId,jdbcType=INTEGER}, #{proSkuId,jdbcType=INTEGER},
#{conName,jdbcType=VARCHAR}, #{amount,jdbcType=DECIMAL}, #{balance,jdbcType=DECIMAL},
#{bizCode,jdbcType=VARCHAR}, #{bizName,jdbcType=VARCHAR}, #{bizType,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},#{orderId,jdbcType=INTEGER},#{orderNo,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfoFlow">
insert into tb_cons_info_flow

View File

@@ -599,4 +599,8 @@ select * from tb_order_info where trade_day = #{day} and table_id = #{masterId}
AND d.product_sku_id = c.sku_id
where c.order_id=#{orderId}
</select>
<select id="selectById" resultMap="BaseResultMap">
select * from tb_order_info where id=#{id} and status='closed'
</select>
</mapper>

View File

@@ -902,6 +902,17 @@
</if>
order by `sort` asc
</select>
<select id="selectByShopIdAndCheckGrounding" resultMap="ResultMapWithBLOBs">
select a.* from tb_product as a
left join tb_product_sku as b on a.id = b.product_id
where a.shop_id=#{shopId} and a.status=1 and a.is_show_cash = 1 and a.type_enum in ('normal','sku','currentPrice','weight')
<if test="commdityName != null and commdityName!='' ">
and a.name like CONCAT('%',#{commdityName},'%')
</if>
and b.is_grounding=1 GROUP BY a.id ORDER BY a.`sort`
</select>
<select id="selectByShopIdAndShopType" resultMap="ResultMapWithBLOBs">
@@ -916,6 +927,19 @@
</select>
<select id="selectByShopIdAndShopTypeCheckGrounding" resultMap="ResultMapWithBLOBs">
select a.* from tb_product as a
left join tb_product_sku as b on a.id = b.product_id
where a.shop_id=#{shopId} and a.status=1 and a.category_id=#{categoryId} and a.is_show_cash = 1 and a.type_enum in ('normal','sku','currentPrice','weight')
<if test="commdityName != null and commdityName!='' ">
and a.name like CONCAT('%',#{commdityName},'%')
</if>
and b.is_grounding=1 GROUP BY a.id ORDER BY a.`sort`
</select>
<select id="countOrderByshopIdAndProductId" resultType="INTEGER">
SELECT
IFNULL(sum( number ) ,0)