修改库存
This commit is contained in:
parent
c1790a3198
commit
86bdcbe3c5
|
|
@ -2,6 +2,7 @@ package com.chaozhanggui.system.cashierservice.dao;
|
|||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbOrderInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.OrderPo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.SkuInfoPo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -42,4 +43,6 @@ public interface TbOrderInfoMapper {
|
|||
|
||||
|
||||
Map<String,String> selectByOrderId(String orderId);
|
||||
|
||||
List<SkuInfoPo> selectSkuByOrderId(String orderId);
|
||||
}
|
||||
|
|
@ -21,4 +21,6 @@ public interface TbUserInfoMapper {
|
|||
|
||||
TbUserInfo selectByCardNo(String cardNo);
|
||||
TbUserInfo selectByPhone(String phone);
|
||||
|
||||
int selectCountByPhone(String phone);
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.chaozhanggui.system.cashierservice.entity.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class ConsInfoPO implements Serializable {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private BigDecimal amount;
|
||||
|
||||
|
||||
public ConsInfoPO(Integer id, BigDecimal amount) {
|
||||
this.id = id;
|
||||
this.amount = amount;
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import com.chaozhanggui.system.cashierservice.entity.TbOrderDetail;
|
|||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class OrderPo {
|
||||
|
|
@ -21,5 +22,9 @@ public class OrderPo {
|
|||
private Integer productNum;
|
||||
private BigDecimal orderAmount;
|
||||
private TbOrderDetail orderDetail;
|
||||
private String outNumber;
|
||||
private String tableName;
|
||||
private List<SkuInfoPo> skuInfos;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
package com.chaozhanggui.system.cashierservice.entity.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SkuInfoPo {
|
||||
|
||||
private String productName;
|
||||
private String productSkuName;
|
||||
private Integer num;
|
||||
private String categoryId;
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.chaozhanggui.system.cashierservice.rabbit;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbCashierCartMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbConsInfoMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbProskuConMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbCashierCart;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbConsInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbProskuCon;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ConsInfoPO;
|
||||
import com.chaozhanggui.system.cashierservice.service.ConsService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.Time;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RabbitListener(queues = {RabbitConstants.CONS_COLLECT_QUEUE_PUT})
|
||||
@Service
|
||||
|
||||
public class ConsConsumer {
|
||||
|
||||
|
||||
@Autowired
|
||||
ConsService consService;
|
||||
|
||||
@RabbitHandler
|
||||
public void listener(String message) {
|
||||
try {
|
||||
consService.exect(message);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -53,9 +53,6 @@ public class PrintMechineConsumer {
|
|||
@RabbitHandler
|
||||
public void listener(String message) {
|
||||
|
||||
|
||||
|
||||
|
||||
String orderId = message;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -89,6 +89,22 @@ public class RabbitConfig {
|
|||
|
||||
|
||||
|
||||
@Bean
|
||||
public DirectExchange consExchange_Register() {
|
||||
return new DirectExchange(RabbitConstants.CONS_COLLECT_PUT);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Queue queuecons_Register() {
|
||||
return new Queue(RabbitConstants.CONS_COLLECT_QUEUE_PUT, true); //队列持久
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding bindingcons_Register() {
|
||||
return BindingBuilder.bind(queuePrint_Register()).to(printExchange_Register()).with(RabbitConstants.CONS_COLLECT_ROUTINGKEY_PUT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -19,4 +19,16 @@ public interface RabbitConstants {
|
|||
public static final String PRINT_MECHINE_COLLECT_ROUTINGKEY_PUT = "print_mechine_collect_routingkey_put";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static final String CONS_COLLECT_PUT="cons_collect_put";
|
||||
|
||||
public static final String CONS_COLLECT_QUEUE_PUT = "cons_collect_queue_put";
|
||||
|
||||
|
||||
public static final String CONS_COLLECT_ROUTINGKEY_PUT = "cons_collect_routingkey_put";
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,15 @@ public class RabbitProducer implements RabbitTemplate.ConfirmCallback {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void cons(String content){
|
||||
CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
|
||||
rabbitTemplate.convertAndSend(RabbitConstants.CONS_COLLECT_PUT, RabbitConstants.CONS_COLLECT_ROUTINGKEY_PUT, content, correlationId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void confirm(CorrelationData correlationData, boolean ack, String cause) {
|
||||
logger.info(" 回调id:" + correlationData);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,153 @@
|
|||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbCashierCartMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbConsInfoFlowMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbConsInfoMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbProskuConMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbCashierCart;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbConsInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbConsInfoFlow;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbProskuCon;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ConsInfoPO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ConsService {
|
||||
|
||||
@Autowired
|
||||
TbCashierCartMapper tbCashierCartMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
TbProskuConMapper tbProskuConMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
TbConsInfoMapper tbConsInfoMapper;
|
||||
|
||||
@Autowired
|
||||
TbConsInfoFlowMapper tbConsInfoFlowMapper;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void exect(String message) throws Exception {
|
||||
log.info("耗材信息更新开始:{}",message);
|
||||
JSONObject jsonObject = JSON.parseObject(message);
|
||||
|
||||
String type=jsonObject.getString("type");
|
||||
|
||||
if(Objects.nonNull(type)){
|
||||
|
||||
if("create".equals(type)){
|
||||
|
||||
String cartId=jsonObject.getString("cartId");
|
||||
|
||||
TbCashierCart cart= tbCashierCartMapper.selectByPrimaryKey(Integer.valueOf(cartId));
|
||||
if(Objects.isNull(cart)){
|
||||
log.info("不存在的购物车信息::{}",cartId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//减少耗材库存信息
|
||||
List<TbProskuCon> tbProskuCons= tbProskuConMapper.selectBySkuIdAndShopId(Integer.valueOf(cart.getSkuId()),Integer.valueOf(cart.getShopId()));
|
||||
if(Objects.isNull(tbProskuCons)||tbProskuCons.size()<=0){
|
||||
log.info("没有对应的耗材配置: skuId:{},shopId:{}",cart.getSkuId(),cart.getShopId());
|
||||
return;
|
||||
}
|
||||
|
||||
List<ConsInfoPO> consInfoPOS=new ArrayList<>();
|
||||
List<TbConsInfoFlow> consInfoFlows=new ArrayList<>();
|
||||
for (TbProskuCon tbProskuCon : tbProskuCons) {
|
||||
TbConsInfo tbConsInfo= tbConsInfoMapper.selectByPrimaryKey(tbProskuCon.getConInfoId());
|
||||
if(Objects.nonNull(tbConsInfo)){
|
||||
ConsInfoPO consInfoPO=new ConsInfoPO(tbConsInfo.getId(),tbConsInfo.getSurplusStock());
|
||||
consInfoPOS.add(consInfoPO);
|
||||
|
||||
TbConsInfoFlow flow=new TbConsInfoFlow();
|
||||
flow.setConsId(tbConsInfo.getId());
|
||||
flow.setShopId(tbConsInfo.getShopId());
|
||||
flow.setConName(tbConsInfo.getConName());
|
||||
flow.setAmount(tbConsInfo.getSurplusStock());
|
||||
flow.setBalance(tbConsInfo.getStockNumber().subtract(tbConsInfo.getSurplusStock()));
|
||||
flow.setBizCode("createCart");
|
||||
flow.setBizName("加入购物陈消耗");
|
||||
flow.setBizType("-");
|
||||
flow.setCreateTime(new Date());
|
||||
flow.setUpdateTime(new Date());
|
||||
consInfoFlows.add(flow);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//更新耗材信息
|
||||
tbConsInfoMapper.batchStock(consInfoPOS);
|
||||
//记录更新日志
|
||||
tbConsInfoFlowMapper.insertBatch(consInfoFlows);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if("delete".equals(type)){
|
||||
|
||||
List jsonArray= Arrays.asList(jsonObject.getJSONArray("skuIds"));
|
||||
|
||||
String shopId= jsonObject.getString("shopId");
|
||||
if(Objects.isNull(jsonArray)||jsonArray.size()<=0){
|
||||
log.info("错误的商品规格信息");
|
||||
return;
|
||||
}
|
||||
List<ConsInfoPO> consInfoPOS=new ArrayList<>();
|
||||
List<TbConsInfoFlow> consInfoFlows=new ArrayList<>();
|
||||
|
||||
for(int i=0;i<jsonArray.size();i++){
|
||||
//减少耗材库存信息
|
||||
List<TbProskuCon> tbProskuCons= tbProskuConMapper.selectBySkuIdAndShopId(Integer.valueOf(jsonArray.get(i)+""),Integer.valueOf(shopId));
|
||||
if(Objects.isNull(tbProskuCons)||tbProskuCons.size()<=0){
|
||||
log.info("没有对应的耗材配置: skuId:{},shopId:{}",jsonArray.get(i),shopId);
|
||||
return;
|
||||
}
|
||||
|
||||
for (TbProskuCon tbProskuCon : tbProskuCons) {
|
||||
TbConsInfo tbConsInfo= tbConsInfoMapper.selectByPrimaryKey(tbProskuCon.getConInfoId());
|
||||
if(Objects.nonNull(tbConsInfo)){
|
||||
ConsInfoPO consInfoPO=new ConsInfoPO(tbConsInfo.getId(),tbConsInfo.getSurplusStock().negate());
|
||||
consInfoPOS.add(consInfoPO);
|
||||
|
||||
TbConsInfoFlow flow=new TbConsInfoFlow();
|
||||
flow.setConsId(tbConsInfo.getId());
|
||||
flow.setShopId(tbConsInfo.getShopId());
|
||||
flow.setConName(tbConsInfo.getConName());
|
||||
flow.setAmount(tbConsInfo.getSurplusStock());
|
||||
flow.setBalance(tbConsInfo.getStockNumber().add(tbConsInfo.getSurplusStock()));
|
||||
flow.setBizCode("cancelCart");
|
||||
flow.setBizName("取消购物车返回");
|
||||
flow.setBizType("+");
|
||||
flow.setCreateTime(new Date());
|
||||
flow.setUpdateTime(new Date());
|
||||
consInfoFlows.add(flow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//更新耗材信息
|
||||
tbConsInfoMapper.batchStock(consInfoPOS);
|
||||
//记录更新日志
|
||||
tbConsInfoFlowMapper.insertBatch(consInfoFlows);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -106,6 +106,11 @@ public class MemberService {
|
|||
return Result.fail(CodeEnum.MEMBERHAVED);
|
||||
}
|
||||
|
||||
|
||||
if(tbUserInfoMapper.selectCountByPhone(phone)>1){
|
||||
return Result.fail(CodeEnum.SAMEUSER);
|
||||
}
|
||||
|
||||
// for (TbShopUser tbShopUser : tbShopUsers) {
|
||||
// if("1".equals(tbShopUser.getIsVip().toString())){
|
||||
// return Result.fail(CodeEnum.MEMBERHAVED);
|
||||
|
|
@ -126,6 +131,7 @@ public class MemberService {
|
|||
tbShopUserMapper.updateByPrimaryKeySelective(tbShopUser);
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
TbShopUser tbShopUser = new TbShopUser();
|
||||
TbUserInfo tbUserInfo = tbUserInfoMapper.selectByPhone(phone);
|
||||
if(tbUserInfo!=null){
|
||||
|
|
|
|||
|
|
@ -6,17 +6,12 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.CartPo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.OrderPo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductSkuPo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.QueryCartPo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.CartVo;
|
||||
import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
||||
import com.chaozhanggui.system.cashierservice.util.HttpClientUtil;
|
||||
import com.chaozhanggui.system.cashierservice.util.RedisUtil;
|
||||
import com.chaozhanggui.system.cashierservice.util.RedisUtils;
|
||||
import com.chaozhanggui.system.cashierservice.util.*;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -65,6 +60,9 @@ public class OrderService {
|
|||
TbTokenMapper tokenMapper;
|
||||
@Autowired
|
||||
RedisUtil redisUtil;
|
||||
|
||||
@Autowired
|
||||
RabbitProducer producer;
|
||||
private static ConcurrentHashMap<String, HashSet<Integer>> codeMap = new ConcurrentHashMap<>();
|
||||
private static ConcurrentHashMap<String, HashSet<String>> userMap = new ConcurrentHashMap<>();
|
||||
|
||||
|
|
@ -201,11 +199,19 @@ public class OrderService {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
skuWithBLOBs.setStockNumber(skuWithBLOBs.getStockNumber()-number);
|
||||
skuWithBLOBs.setUpdatedAt(System.currentTimeMillis());
|
||||
tbProductSkuMapper.updateByPrimaryKey(skuWithBLOBs);
|
||||
|
||||
redisUtil.saveMessage("SHOP:CODE:SET" + clientType + ":" + shopId + ":" + DateUtils.getDay(),masterId.substring(1,masterId.length()));
|
||||
|
||||
//修改耗材数据
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put("cartId",cart.getId());
|
||||
jsonObject.put("type","create");
|
||||
producer.cons(jsonObject.toString());
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS, masterId);
|
||||
}
|
||||
|
||||
|
|
@ -293,9 +299,19 @@ public class OrderService {
|
|||
tbProductSkuMapper.updateByPrimaryKey(skuWithBLOBs);
|
||||
}
|
||||
|
||||
List<String> skuIds=new ArrayList<>();
|
||||
skuIds.add(cashierCart.getSkuId());
|
||||
|
||||
cashierCartMapper.deleteByCartId(masterId, cartId);
|
||||
|
||||
//修改耗材数据
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put("type","delete");
|
||||
jsonObject.put("skuIds",skuIds);
|
||||
jsonObject.put("shopId",cashierCart.getShopId());
|
||||
producer.cons(jsonObject.toString());
|
||||
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
|
|
@ -404,6 +420,27 @@ public class OrderService {
|
|||
if (flag) {
|
||||
redisUtil.deleteByKey("SHOP:CODE:USER:" + clientType + ":" + orderVo.getShopId() + ":" + day + orderVo.getUserId());
|
||||
}
|
||||
|
||||
JSONObject object=new JSONObject();
|
||||
String outNumber= redisUtil.getMessage(RedisCst.OUT_NUMBER.concat(orderInfo.getShopId().toString()));
|
||||
Integer number=1;
|
||||
if(Objects.isNull(outNumber)){
|
||||
object.put("outNumber",number);
|
||||
object.put("times",DateUtils.getDay());
|
||||
}else {
|
||||
object=JSONObject.parseObject(outNumber);
|
||||
if(object.getString("times").equals(DateUtils.getDay())){
|
||||
number=object.getInteger("outNumber")+1;
|
||||
object.put("outNumber",number);
|
||||
}else {
|
||||
object.put("outNumber",number);
|
||||
object.put("times",DateUtils.getDay());
|
||||
}
|
||||
}
|
||||
orderInfo.setOutNumber(number+"");
|
||||
redisUtil.saveMessage(RedisCst.OUT_NUMBER.concat(orderInfo.getShopId().toString()),object.toString());
|
||||
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS, orderInfo);
|
||||
}
|
||||
|
||||
|
|
@ -651,15 +688,19 @@ public class OrderService {
|
|||
List<TbCashierCart> list = cashierCartMapper.selectAllCreateOrder(cartVo.getMasterId(), Integer.valueOf(cartVo.getShopId()), day, "create", cartVo.getUuid());
|
||||
int orderId = 0;
|
||||
List<ProductSkuPo> productSkuPos=new ArrayList<>();
|
||||
List<String> skuIds=new ArrayList<>();
|
||||
for (TbCashierCart cashierCart : list) {
|
||||
if (StringUtils.isNotEmpty(cashierCart.getOrderId())) {
|
||||
orderId = Integer.valueOf(cashierCart.getOrderId());
|
||||
skuIds.add(cashierCart.getSkuId());
|
||||
}
|
||||
TbProductWithBLOBs product= tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
|
||||
if(ObjectUtil.isNotEmpty(product)&&"1".equals(product.getIsStock().toString())){
|
||||
ProductSkuPo skuPo=new ProductSkuPo(Integer.valueOf(cashierCart.getSkuId()),cashierCart.getTotalNumber());
|
||||
productSkuPos.add(skuPo);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (orderId > 0) {
|
||||
|
|
@ -676,6 +717,15 @@ public class OrderService {
|
|||
tbProductSkuMapper.batchStockNum(productSkuPos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//修改耗材数据
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put("type","delete");
|
||||
jsonObject.put("skuIds",skuIds);
|
||||
jsonObject.put("shopId",cartVo.getShopId());
|
||||
producer.cons(jsonObject.toString());
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
|
|
@ -694,14 +744,22 @@ public class OrderService {
|
|||
log.info("orderType:" + orderType);
|
||||
log.info("status:" + status);
|
||||
List<OrderPo> list = tbOrderInfoMapper.selectAllByShop(shopId, orderType, day, orderNo);
|
||||
|
||||
for (OrderPo orderInfo : list) {
|
||||
if (StringUtils.isEmpty(orderInfo.getImgUrl())) {
|
||||
orderInfo.setImgUrl("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240223/a04e0d3beef74d099ebd0fd1f7c41873.jpg");
|
||||
}
|
||||
orderInfo.setZdNo("POS");
|
||||
orderInfo.setNames(orderInfo.getProductName().split(","));
|
||||
|
||||
List<SkuInfoPo> skuInfoPos=tbOrderInfoMapper.selectSkuByOrderId(orderInfo.getId().toString());
|
||||
if(Objects.isNull(skuInfoPos)||skuInfoPos.size()<0){
|
||||
skuInfoPos=new ArrayList<>();
|
||||
}
|
||||
orderInfo.setSkuInfos(skuInfoPos);
|
||||
}
|
||||
PageInfo pageInfo = new PageInfo(list);
|
||||
log.info("获取订单:{}", JSONUtil.toJSONString(pageInfo));
|
||||
return Result.success(CodeEnum.SUCCESS, pageInfo);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1003,16 +1003,11 @@ public class PayService {
|
|||
tbQuickPayMapper.insert(tbQuickPay);
|
||||
|
||||
|
||||
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("token", token);
|
||||
jsonObject.put("type", "quick");
|
||||
jsonObject.put("amount",tbQuickPay.getAmount());
|
||||
producer.putOrderCollect(jsonObject.toJSONString());
|
||||
|
||||
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS, tbQuickPay);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,6 +90,10 @@ public enum CodeEnum {
|
|||
|
||||
|
||||
|
||||
SAMEUSER("100034",false,"相同的手机号已存在多个记录","fail"),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ public class PrinterUtils {
|
|||
|
||||
sb.append("<C><B>"+detailPO.getMerchantName()+"</B></C><BR><BR>");
|
||||
sb.append("<C><BOLD>"+type+"【"+detailPO.getMasterId()+"】</BOLD></C><BR><BR>");
|
||||
sb.append("<CB><BOLD>"+detailPO.getOutNumber()+"</BOLD></CB><BR><BR>");
|
||||
sb.append("<S><L>订单号: "+detailPO.getOrderNo()+" </L></S><BR>");
|
||||
sb.append("<S><L>交易时间: "+detailPO.getTradeDate()+" </L></S><BR>");
|
||||
sb.append("<S><L>收银员: "+detailPO.getOperator()+" </L></S><BR><BR><BR>");
|
||||
|
|
@ -103,7 +104,7 @@ public class PrinterUtils {
|
|||
char paddingCharacter = ' ';
|
||||
sb.append("<S>"+String.format("%-15s","品名").replace(' ', paddingCharacter)+String.format("%-4s","数量").replace(' ', paddingCharacter)+String.format("%4s","小计").replace(' ', paddingCharacter)+"</S><BR>");
|
||||
for (OrderDetailPO.Detail detail : detailPO.getDetailList()) {
|
||||
if(detail.getProductName().length()>4){
|
||||
if(detail.getProductName().length()>4&&detail.getProductName().length()<=10){
|
||||
|
||||
int count=getProducrName(detail.getProductName());
|
||||
if(count<=0){
|
||||
|
|
@ -114,6 +115,11 @@ public class PrinterUtils {
|
|||
sb.append("<S>"+String.format("%-"+length+"s",detail.getProductName()).replace(' ', paddingCharacter)+String.format("%-4s",detail.getNumber()).replace(' ', paddingCharacter)+String.format("%8s",detail.getAmount()).replace(' ', paddingCharacter)+"</S><BR>");
|
||||
}
|
||||
|
||||
}else if(detail.getProductName().length()>10){
|
||||
|
||||
sb.append("<S>"+detail.getProductName()+"</S><BR>");
|
||||
sb.append("<S>"+String.format("%20s",detail.getNumber()).replace(' ', paddingCharacter)+String.format("%11s",detail.getAmount()).replace(' ', paddingCharacter)+"</S><BR>");
|
||||
|
||||
}else {
|
||||
sb.append("<S>"+String.format("%-15s",detail.getProductName()).replace(' ', paddingCharacter)+String.format("%-4s",detail.getNumber()).replace(' ', paddingCharacter)+String.format("%8s",detail.getAmount()).replace(' ', paddingCharacter)+"</S><BR>");
|
||||
}
|
||||
|
|
@ -299,7 +305,7 @@ public class PrinterUtils {
|
|||
|
||||
|
||||
List<OrderDetailPO.Detail> detailList= new ArrayList<>();
|
||||
OrderDetailPO.Detail detail=new OrderDetailPO.Detail("花香水牛拿铁","1","19000.90","不甜,麻辣");
|
||||
OrderDetailPO.Detail detail=new OrderDetailPO.Detail("小萄(7.5*微气泡葡萄酒)","1","19000.90","不甜,麻辣");
|
||||
|
||||
OrderDetailPO.Detail detail3=new OrderDetailPO.Detail("单位iiii","4","40000.00",null);
|
||||
OrderDetailPO.Detail detail4=new OrderDetailPO.Detail("喔喔奶茶","1","19000.90","微甜,微辣");
|
||||
|
|
@ -307,6 +313,7 @@ public class PrinterUtils {
|
|||
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,"变态辣");
|
||||
detailPO.setOutNumber("1");
|
||||
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
printTickets(voiceJson,1,1,"ZF544PG03W00002",getCashPrintData(detailPO,"结算单",""));
|
||||
|
|
|
|||
|
|
@ -14,4 +14,6 @@ public class RedisCst {
|
|||
public static final String CART = "CZG:CART:";
|
||||
|
||||
public static final Object PRODUCT = "PRODUCT:";
|
||||
|
||||
public static final String OUT_NUMBER="ORDER:NUMBER:";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,9 +52,10 @@
|
|||
|
||||
<!-- 要生成的表tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
|
||||
<!-- <table tableName="%" schema="fycashier" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" ></table>-->
|
||||
<table tableName="tb_order_out_number" domainObjectName="TbOrderOutNumber"
|
||||
<table tableName="tb_prosku_con" domainObjectName="TbProskuCon"
|
||||
enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
|
||||
enableSelectByExample="false" selectByExampleQueryId="false" >
|
||||
</table>
|
||||
|
||||
</context>
|
||||
</generatorConfiguration>
|
||||
|
|
@ -102,7 +102,7 @@
|
|||
and uuid = #{uuid}
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into tb_cashier_cart (id, master_id, order_id,
|
||||
ref_order_id, total_amount, product_id,
|
||||
cover_img, is_sku, sku_id,
|
||||
|
|
|
|||
|
|
@ -65,11 +65,24 @@
|
|||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<select id="selectAllByShop" resultType="com.chaozhanggui.system.cashierservice.entity.po.OrderPo">
|
||||
select toi.created_at as createAt,toi.id,toi.order_no as orderNo,toi.order_amount as orderAmount,count(*) as
|
||||
productNum,toi.order_type as orderType,
|
||||
ifnull(TRIM(TRAILING ', ' FROM GROUP_CONCAT(tod.product_name ORDER BY tod.id SEPARATOR ', ')),'') AS productName,
|
||||
toi.status from tb_order_info toi left join tb_order_detail tod on tod.order_id = toi.id
|
||||
where toi.shop_id = #{shopId}
|
||||
SELECT
|
||||
toi.created_at AS createAt,
|
||||
toi.id,
|
||||
toi.order_no AS orderNo,
|
||||
toi.order_amount AS orderAmount,
|
||||
count(*) AS productNum,
|
||||
toi.order_type AS orderType,
|
||||
GROUP_CONCAT(tod.product_name) AS productName,
|
||||
toi.STATUS,
|
||||
toi.out_number AS outNumber,
|
||||
toi.table_name AS tableName
|
||||
|
||||
FROM
|
||||
tb_order_info toi
|
||||
LEFT JOIN tb_order_detail tod ON tod.order_id = toi.id
|
||||
|
||||
WHERE
|
||||
toi.shop_id = #{shopId}
|
||||
<choose>
|
||||
<when test="orderType == 'return'">
|
||||
and toi.order_type = 'return' and toi.status in ('refund','closed')
|
||||
|
|
@ -87,7 +100,7 @@
|
|||
<if test="orderNo != null and orderNo != ''">
|
||||
and toi.order_no = #{orderNo}
|
||||
</if>
|
||||
group by toi.shop_id,toi.order_no
|
||||
group by toi.id,toi.shop_id
|
||||
order by toi.id desc
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
|
|
@ -565,4 +578,17 @@ select * from tb_order_info where trade_day = #{day} and table_id = #{masterId}
|
|||
GROUP BY
|
||||
d.order_id
|
||||
</select>
|
||||
|
||||
<select id="selectSkuByOrderId" resultType="com.chaozhanggui.system.cashierservice.entity.po.SkuInfoPo">
|
||||
SELECT
|
||||
d.product_name AS productName,
|
||||
d.num,
|
||||
d.product_sku_name AS productSkuName,
|
||||
c.category_id AS categoryId
|
||||
FROM
|
||||
tb_order_detail d
|
||||
LEFT JOIN tb_cashier_cart c ON d.order_id = c.order_id
|
||||
AND d.product_sku_id = c.sku_id
|
||||
where c.order_id=#{orderId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -572,4 +572,8 @@
|
|||
<select id="selectByCardNo" resultMap="BaseResultMap">
|
||||
select * from tb_user_info where card_no=#{cardNo}
|
||||
</select>
|
||||
|
||||
<select id="selectCountByPhone" resultType="int">
|
||||
select count(0) from tb_user_info where telephone=#{phone,jdbcType=VARCHAR}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue