Merge branch '1.0.1' into dev

This commit is contained in:
韩鹏辉 2024-06-26 14:28:36 +08:00
commit abc5ea04e4
32 changed files with 1440 additions and 23 deletions

View File

@ -0,0 +1,26 @@
package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.TbConsInfoFlow;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
@Mapper
public interface TbConsInfoFlowMapper {
int deleteByPrimaryKey(Integer id);
int insert(TbConsInfoFlow record);
int insertSelective(TbConsInfoFlow record);
TbConsInfoFlow selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(TbConsInfoFlow record);
int updateByPrimaryKey(TbConsInfoFlow record);
void insertBatch(@Param("list")List<TbConsInfoFlow> list);
}

View File

@ -0,0 +1,25 @@
package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.TbConsInfo;
import com.chaozhanggui.system.cashierservice.entity.po.ConsInfoPO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public interface TbConsInfoMapper {
int deleteByPrimaryKey(Integer id);
int insert(TbConsInfo record);
int insertSelective(TbConsInfo record);
TbConsInfo selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(TbConsInfo record);
int updateByPrimaryKey(TbConsInfo record);
void batchStock(@Param("list")List<ConsInfoPO> list);
}

View File

@ -0,0 +1,17 @@
package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.TbCouponCategory;
public interface TbCouponCategoryMapper {
int deleteByPrimaryKey(Integer id);
int insert(TbCouponCategory record);
int insertSelective(TbCouponCategory record);
TbCouponCategory selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(TbCouponCategory record);
int updateByPrimaryKey(TbCouponCategory record);
}

View File

@ -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);
}

View File

@ -0,0 +1,26 @@
package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.TbProskuCon;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
@Mapper
public interface TbProskuConMapper {
int deleteByPrimaryKey(Integer id);
int insert(TbProskuCon record);
int insertSelective(TbProskuCon record);
TbProskuCon selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(TbProskuCon record);
int updateByPrimaryKey(TbProskuCon record);
List<TbProskuCon> selectBySkuIdAndShopId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
}

View File

@ -21,4 +21,6 @@ public interface TbUserInfoMapper {
TbUserInfo selectByCardNo(String cardNo);
TbUserInfo selectByPhone(String phone);
int selectCountByPhone(String phone);
}

View File

@ -0,0 +1,129 @@
package com.chaozhanggui.system.cashierservice.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
public class TbConsInfo implements Serializable {
private Integer id;
private Integer shopId;
private Integer conTypeId;
private String conTypeName;
private String conCode;
private String conName;
private BigDecimal stockNumber;
private String conUnit;
private BigDecimal surplusStock;
private BigDecimal lasterInStock;
private Date createTime;
private Date updateTime;
private static final long serialVersionUID = 1L;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getShopId() {
return shopId;
}
public void setShopId(Integer shopId) {
this.shopId = shopId;
}
public Integer getConTypeId() {
return conTypeId;
}
public void setConTypeId(Integer conTypeId) {
this.conTypeId = conTypeId;
}
public String getConTypeName() {
return conTypeName;
}
public void setConTypeName(String conTypeName) {
this.conTypeName = conTypeName == null ? null : conTypeName.trim();
}
public String getConCode() {
return conCode;
}
public void setConCode(String conCode) {
this.conCode = conCode == null ? null : conCode.trim();
}
public String getConName() {
return conName;
}
public void setConName(String conName) {
this.conName = conName == null ? null : conName.trim();
}
public BigDecimal getStockNumber() {
return stockNumber;
}
public void setStockNumber(BigDecimal stockNumber) {
this.stockNumber = stockNumber;
}
public String getConUnit() {
return conUnit;
}
public void setConUnit(String conUnit) {
this.conUnit = conUnit == null ? null : conUnit.trim();
}
public BigDecimal getSurplusStock() {
return surplusStock;
}
public void setSurplusStock(BigDecimal surplusStock) {
this.surplusStock = surplusStock;
}
public BigDecimal getLasterInStock() {
return lasterInStock;
}
public void setLasterInStock(BigDecimal lasterInStock) {
this.lasterInStock = lasterInStock;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -0,0 +1,119 @@
package com.chaozhanggui.system.cashierservice.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
public class TbConsInfoFlow implements Serializable {
private Integer id;
private Integer shopId;
private Integer consId;
private String conName;
private BigDecimal amount;
private BigDecimal balance;
private String bizCode;
private String bizName;
private String bizType;
private Date createTime;
private Date updateTime;
private static final long serialVersionUID = 1L;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getShopId() {
return shopId;
}
public void setShopId(Integer shopId) {
this.shopId = shopId;
}
public Integer getConsId() {
return consId;
}
public void setConsId(Integer consId) {
this.consId = consId;
}
public String getConName() {
return conName;
}
public void setConName(String conName) {
this.conName = conName == null ? null : conName.trim();
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public BigDecimal getBalance() {
return balance;
}
public void setBalance(BigDecimal balance) {
this.balance = balance;
}
public String getBizCode() {
return bizCode;
}
public void setBizCode(String bizCode) {
this.bizCode = bizCode == null ? null : bizCode.trim();
}
public String getBizName() {
return bizName;
}
public void setBizName(String bizName) {
this.bizName = bizName == null ? null : bizName.trim();
}
public String getBizType() {
return bizType;
}
public void setBizType(String bizType) {
this.bizType = bizType == null ? null : bizType.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -0,0 +1,58 @@
package com.chaozhanggui.system.cashierservice.entity;
import java.io.Serializable;
import java.util.Date;
public class TbCouponCategory implements Serializable {
private Integer id;
private String name;
private Date createTime;
private Date updateTime;
private Integer status;
private static final long serialVersionUID = 1L;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
}

View File

@ -0,0 +1,68 @@
package com.chaozhanggui.system.cashierservice.entity;
import java.io.Serializable;
import java.util.Date;
public class TbProskuCon implements Serializable {
private Integer id;
private Integer shopId;
private Integer productSkuId;
private Integer conInfoId;
private String status;
private Date createTime;
private static final long serialVersionUID = 1L;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getShopId() {
return shopId;
}
public void setShopId(Integer shopId) {
this.shopId = shopId;
}
public Integer getProductSkuId() {
return productSkuId;
}
public void setProductSkuId(Integer productSkuId) {
this.productSkuId = productSkuId;
}
public Integer getConInfoId() {
return conInfoId;
}
public void setConInfoId(Integer conInfoId) {
this.conInfoId = conInfoId;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -0,0 +1,46 @@
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();
}
}
}

View File

@ -53,9 +53,6 @@ public class PrintMechineConsumer {
@RabbitHandler
public void listener(String message) {
String orderId = message;
@ -227,7 +224,7 @@ public class PrintMechineConsumer {
if(ObjectUtil.isNotEmpty(detailList)&&detailList.size()>0){
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getOrderType().equals("miniapp")?orderInfo.getTableName():orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance,(ObjectUtil.isEmpty(orderInfo.getPayType())||ObjectUtil.isNull(orderInfo.getPayType())?"":orderInfo.getPayType() ), "0", detailList,orderInfo.getRemark());
// OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0", detailList);
detailPO.setOutNumber(orderInfo.getOutNumber());
String printType="结算单";
String data= PrinterUtils.getCashPrintData(detailPO,printType,orderInfo.getOrderType());

View File

@ -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);
}

View File

@ -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";
}

View File

@ -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);

View File

@ -188,7 +188,7 @@ public class CloudPrinterService {
if(ObjectUtil.isNotEmpty(detailList)&&detailList.size()>0){
// OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0", detailList);
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", ObjectUtil.isEmpty(orderInfo.getMasterId())||ObjectUtil.isNull(orderInfo.getMasterId())?orderInfo.getTableName():orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0", detailList,orderInfo.getRemark());
detailPO.setOutNumber(orderInfo.getOutNumber());
String printType="退款单";
String data= PrinterUtils.getCashPrintData(detailPO,printType,"return");

View File

@ -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;
}
}
}
}

View File

@ -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){

View File

@ -6,11 +6,9 @@ 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.*;
@ -62,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<>();
@ -198,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);
}
@ -290,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);
}
@ -424,6 +443,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);
}
@ -671,15 +711,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) {
@ -696,6 +740,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);
}
@ -714,14 +767,23 @@ 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);
}
@ -984,6 +1046,10 @@ public class OrderService {
}
if(!"miniapp".equals(orderInfo.getOrderType())){
return Result.fail(CodeEnum.ISNOTAPPORDER);
}
if("refund".equals(orderInfo.getStatus())){
return Result.fail(CodeEnum.ORDERRETURN);
}

View File

@ -504,7 +504,7 @@ public class PayService {
orderInfo.setPayAmount(orderInfo.getOrderAmount());
orderInfo.setUserId(user.getUserId());
orderInfo.setMemberId(memberId);
orderInfo.setMemberId(user.getId().toString());
orderInfo.setPayType("deposit");
orderInfo.setStatus("closed");
orderInfo.setPayOrderNo("deposit".concat(SnowFlakeUtil.generateOrderNo()));
@ -1014,16 +1014,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);
}

View File

@ -89,6 +89,13 @@ public enum CodeEnum {
ORDERRETURN("100033",false,"订单已退款","fail"),
SAMEUSER("100034",false,"相同的手机号已存在多个记录","fail"),
ISNOTAPPORDER("100035",false,"不是小程序订单","fail"),

View File

@ -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>

View File

@ -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,

View File

@ -0,0 +1,178 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbConsInfoFlowMapper">
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbConsInfoFlow">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
<result column="cons_id" jdbcType="INTEGER" property="consId" />
<result column="con_name" jdbcType="VARCHAR" property="conName" />
<result column="amount" jdbcType="DECIMAL" property="amount" />
<result column="balance" jdbcType="DECIMAL" property="balance" />
<result column="biz_code" jdbcType="VARCHAR" property="bizCode" />
<result column="biz_name" jdbcType="VARCHAR" property="bizName" />
<result column="biz_type" jdbcType="VARCHAR" property="bizType" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</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
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tb_cons_info_flow
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_cons_info_flow
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfoFlow">
insert into tb_cons_info_flow (id, shop_id, cons_id,
con_name, amount, balance,
biz_code, biz_name, biz_type,
create_time, update_time)
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{consId,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})
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfoFlow">
insert into tb_cons_info_flow
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="shopId != null">
shop_id,
</if>
<if test="consId != null">
cons_id,
</if>
<if test="conName != null">
con_name,
</if>
<if test="amount != null">
amount,
</if>
<if test="balance != null">
balance,
</if>
<if test="bizCode != null">
biz_code,
</if>
<if test="bizName != null">
biz_name,
</if>
<if test="bizType != null">
biz_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="shopId != null">
#{shopId,jdbcType=INTEGER},
</if>
<if test="consId != null">
#{consId,jdbcType=INTEGER},
</if>
<if test="conName != null">
#{conName,jdbcType=VARCHAR},
</if>
<if test="amount != null">
#{amount,jdbcType=DECIMAL},
</if>
<if test="balance != null">
#{balance,jdbcType=DECIMAL},
</if>
<if test="bizCode != null">
#{bizCode,jdbcType=VARCHAR},
</if>
<if test="bizName != null">
#{bizName,jdbcType=VARCHAR},
</if>
<if test="bizType != null">
#{bizType,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfoFlow">
update tb_cons_info_flow
<set>
<if test="shopId != null">
shop_id = #{shopId,jdbcType=INTEGER},
</if>
<if test="consId != null">
cons_id = #{consId,jdbcType=INTEGER},
</if>
<if test="conName != null">
con_name = #{conName,jdbcType=VARCHAR},
</if>
<if test="amount != null">
amount = #{amount,jdbcType=DECIMAL},
</if>
<if test="balance != null">
balance = #{balance,jdbcType=DECIMAL},
</if>
<if test="bizCode != null">
biz_code = #{bizCode,jdbcType=VARCHAR},
</if>
<if test="bizName != null">
biz_name = #{bizName,jdbcType=VARCHAR},
</if>
<if test="bizType != null">
biz_type = #{bizType,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfoFlow">
update tb_cons_info_flow
set shop_id = #{shopId,jdbcType=INTEGER},
cons_id = #{consId,jdbcType=INTEGER},
con_name = #{conName,jdbcType=VARCHAR},
amount = #{amount,jdbcType=DECIMAL},
balance = #{balance,jdbcType=DECIMAL},
biz_code = #{bizCode,jdbcType=VARCHAR},
biz_name = #{bizName,jdbcType=VARCHAR},
biz_type = #{bizType,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<insert id="insertBatch">
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
insert into tb_cons_info_flow (shop_id, cons_id,
con_name, amount, balance,
biz_code, biz_name, biz_type,
create_time, update_time)
values #{item.shopId,jdbcType=INTEGER}, #{item.consId,jdbcType=INTEGER},
#{item.conName,jdbcType=VARCHAR}, #{item.amount,jdbcType=DECIMAL}, #{item.balance,jdbcType=DECIMAL},
#{item.bizCode,jdbcType=VARCHAR}, #{item.bizName,jdbcType=VARCHAR}, #{item.bizType,jdbcType=VARCHAR},
#{item.createTime,jdbcType=TIMESTAMP}, #{item.updateTime,jdbcType=TIMESTAMP})
</foreach>
</insert>
</mapper>

View File

@ -0,0 +1,187 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbConsInfoMapper">
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
<result column="con_type_id" jdbcType="INTEGER" property="conTypeId" />
<result column="con_type_name" jdbcType="VARCHAR" property="conTypeName" />
<result column="con_code" jdbcType="VARCHAR" property="conCode" />
<result column="con_name" jdbcType="VARCHAR" property="conName" />
<result column="stock_number" jdbcType="DECIMAL" property="stockNumber" />
<result column="con_unit" jdbcType="VARCHAR" property="conUnit" />
<result column="surplus_stock" jdbcType="DECIMAL" property="surplusStock" />
<result column="laster_in_stock" jdbcType="DECIMAL" property="lasterInStock" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
id, shop_id, con_type_id, con_type_name, con_code, con_name, stock_number, con_unit,
surplus_stock, laster_in_stock, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tb_cons_info
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_cons_info
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
insert into tb_cons_info (id, shop_id, con_type_id,
con_type_name, con_code, con_name,
stock_number, con_unit, surplus_stock,
laster_in_stock, create_time, update_time
)
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{conTypeId,jdbcType=INTEGER},
#{conTypeName,jdbcType=VARCHAR}, #{conCode,jdbcType=VARCHAR}, #{conName,jdbcType=VARCHAR},
#{stockNumber,jdbcType=DECIMAL}, #{conUnit,jdbcType=VARCHAR}, #{surplusStock,jdbcType=DECIMAL},
#{lasterInStock,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
insert into tb_cons_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="shopId != null">
shop_id,
</if>
<if test="conTypeId != null">
con_type_id,
</if>
<if test="conTypeName != null">
con_type_name,
</if>
<if test="conCode != null">
con_code,
</if>
<if test="conName != null">
con_name,
</if>
<if test="stockNumber != null">
stock_number,
</if>
<if test="conUnit != null">
con_unit,
</if>
<if test="surplusStock != null">
surplus_stock,
</if>
<if test="lasterInStock != null">
laster_in_stock,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="shopId != null">
#{shopId,jdbcType=INTEGER},
</if>
<if test="conTypeId != null">
#{conTypeId,jdbcType=INTEGER},
</if>
<if test="conTypeName != null">
#{conTypeName,jdbcType=VARCHAR},
</if>
<if test="conCode != null">
#{conCode,jdbcType=VARCHAR},
</if>
<if test="conName != null">
#{conName,jdbcType=VARCHAR},
</if>
<if test="stockNumber != null">
#{stockNumber,jdbcType=DECIMAL},
</if>
<if test="conUnit != null">
#{conUnit,jdbcType=VARCHAR},
</if>
<if test="surplusStock != null">
#{surplusStock,jdbcType=DECIMAL},
</if>
<if test="lasterInStock != null">
#{lasterInStock,jdbcType=DECIMAL},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
update tb_cons_info
<set>
<if test="shopId != null">
shop_id = #{shopId,jdbcType=INTEGER},
</if>
<if test="conTypeId != null">
con_type_id = #{conTypeId,jdbcType=INTEGER},
</if>
<if test="conTypeName != null">
con_type_name = #{conTypeName,jdbcType=VARCHAR},
</if>
<if test="conCode != null">
con_code = #{conCode,jdbcType=VARCHAR},
</if>
<if test="conName != null">
con_name = #{conName,jdbcType=VARCHAR},
</if>
<if test="stockNumber != null">
stock_number = #{stockNumber,jdbcType=DECIMAL},
</if>
<if test="conUnit != null">
con_unit = #{conUnit,jdbcType=VARCHAR},
</if>
<if test="surplusStock != null">
surplus_stock = #{surplusStock,jdbcType=DECIMAL},
</if>
<if test="lasterInStock != null">
laster_in_stock = #{lasterInStock,jdbcType=DECIMAL},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
update tb_cons_info
set shop_id = #{shopId,jdbcType=INTEGER},
con_type_id = #{conTypeId,jdbcType=INTEGER},
con_type_name = #{conTypeName,jdbcType=VARCHAR},
con_code = #{conCode,jdbcType=VARCHAR},
con_name = #{conName,jdbcType=VARCHAR},
stock_number = #{stockNumber,jdbcType=DECIMAL},
con_unit = #{conUnit,jdbcType=VARCHAR},
surplus_stock = #{surplusStock,jdbcType=DECIMAL},
laster_in_stock = #{lasterInStock,jdbcType=DECIMAL},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="batchStock">
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
update tb_cons_info
set stock_number= stock_number- #{item.amount},
update_time = now()
where id = #{item.id}
</foreach>
</update>
</mapper>

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbCouponCategoryMapper">
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbCouponCategory">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="status" jdbcType="INTEGER" property="status" />
</resultMap>
<sql id="Base_Column_List">
id, name, create_time, update_time, status
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tb_coupon_category
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_coupon_category
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbCouponCategory">
insert into tb_coupon_category (id, name, create_time,
update_time, status)
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbCouponCategory">
insert into tb_coupon_category
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="status != null">
status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbCouponCategory">
update tb_coupon_category
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
status = #{status,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbCouponCategory">
update tb_coupon_category
set name = #{name,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -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">
@ -566,4 +579,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>

View File

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbProskuConMapper">
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
<result column="product_sku_id" jdbcType="INTEGER" property="productSkuId" />
<result column="con_info_id" jdbcType="INTEGER" property="conInfoId" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<sql id="Base_Column_List">
id, shop_id, product_sku_id, con_info_id, status, create_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tb_prosku_con
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_prosku_con
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
insert into tb_prosku_con (id, shop_id, product_sku_id,
con_info_id, status, create_time
)
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{productSkuId,jdbcType=INTEGER},
#{conInfoId,jdbcType=INTEGER}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
insert into tb_prosku_con
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="shopId != null">
shop_id,
</if>
<if test="productSkuId != null">
product_sku_id,
</if>
<if test="conInfoId != null">
con_info_id,
</if>
<if test="status != null">
status,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="shopId != null">
#{shopId,jdbcType=INTEGER},
</if>
<if test="productSkuId != null">
#{productSkuId,jdbcType=INTEGER},
</if>
<if test="conInfoId != null">
#{conInfoId,jdbcType=INTEGER},
</if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
update tb_prosku_con
<set>
<if test="shopId != null">
shop_id = #{shopId,jdbcType=INTEGER},
</if>
<if test="productSkuId != null">
product_sku_id = #{productSkuId,jdbcType=INTEGER},
</if>
<if test="conInfoId != null">
con_info_id = #{conInfoId,jdbcType=INTEGER},
</if>
<if test="status != null">
status = #{status,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
update tb_prosku_con
set shop_id = #{shopId,jdbcType=INTEGER},
product_sku_id = #{productSkuId,jdbcType=INTEGER},
con_info_id = #{conInfoId,jdbcType=INTEGER},
status = #{status,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectBySkuIdAndShopId" resultMap="BaseResultMap">
select * from tb_prosku_con where product_sku_id=#{shopId} and shop_id=#{shopId} and status=1
</select>
</mapper>

View File

@ -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>