Compare commits
76 Commits
1.0.2
...
2024071616
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c798e5e854 | ||
| 48b609a407 | |||
| 34e3cb9cb0 | |||
|
|
c67d7f20a2 | ||
|
|
d042b14c6a | ||
|
|
7a6de2388c | ||
|
|
01f85e2d8e | ||
|
|
36e8aeaaa0 | ||
|
|
a7206b4506 | ||
|
|
e8418e3baf | ||
|
|
2a0cd395d7 | ||
|
|
0a0d009b2c | ||
|
|
944b1102e5 | ||
|
|
67228079c2 | ||
|
|
5963f18425 | ||
|
|
2a28151139 | ||
|
|
01db36ac04 | ||
|
|
25b2fde2bb | ||
|
|
81158431c8 | ||
|
|
63ae10c971 | ||
|
|
d72af13b2c | ||
|
|
6e7ee2137b | ||
| ef73fe192a | |||
| 4691b12fb3 | |||
| 2818f8afff | |||
| 61fe12c087 | |||
|
|
007a7a47a7 | ||
|
|
707f846af0 | ||
|
|
c353e03dbf | ||
|
|
65fe019b9e | ||
|
|
6b230eaa1b | ||
|
|
52921d88f6 | ||
|
|
7daa596d31 | ||
| 8f5ee47c19 | |||
| dcec5e01f3 | |||
|
|
08197e7a20 | ||
|
|
7efa1f3f3b | ||
|
|
14dd00e732 | ||
|
|
ee20f1244b | ||
|
|
d3c8360168 | ||
|
|
1287f103df | ||
|
|
eb4bc4ecfd | ||
| b1199d80ae | |||
| 7e911d37b8 | |||
| b3a17aa9d7 | |||
|
|
bfbeda25df | ||
|
|
f3e7eaa832 | ||
|
|
d32f868397 | ||
|
|
b9fd6aed7a | ||
|
|
cbb0276958 | ||
|
|
c8ebe7fcfb | ||
| 314df236f1 | |||
|
|
33a9b969d0 | ||
| f572c3de88 | |||
| 6ef9a10639 | |||
|
|
4d526525a5 | ||
| cae6555d87 | |||
| 109b047a88 | |||
| e0359be0dc | |||
|
|
d772c63ee5 | ||
| 2b086ef923 | |||
| 47e176b45a | |||
| b02f92c54f | |||
|
|
8dfd31c58c | ||
|
|
e54a236dab | ||
|
|
781a4baa81 | ||
|
|
f7b44edf0d | ||
| 8da3d036b1 | |||
| e31f3c831a | |||
|
|
d35a5f2cc0 | ||
|
|
5a8af7f0bb | ||
|
|
286b9af051 | ||
|
|
8f4afed929 | ||
|
|
4e27eb87b5 | ||
|
|
5a61e994a1 | ||
| d82387e9d1 |
12
.gitignore
vendored
12
.gitignore
vendored
@@ -1 +1,11 @@
|
||||
/target/
|
||||
### IDEA ###
|
||||
/target/**/*
|
||||
/log/*
|
||||
.idea/*
|
||||
*.iml
|
||||
*/target/*
|
||||
*/*.iml
|
||||
/.gradle/
|
||||
/application.pid
|
||||
/target/*
|
||||
**.jar
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.entity.OrderVo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.CartVo;
|
||||
@@ -10,6 +11,9 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@@ -113,9 +117,13 @@ public class OrderController {
|
||||
@GetMapping("/findOrder")
|
||||
public Result findOrder(@RequestHeader("token") String token, @RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType, @RequestParam("shopId") Integer shopId,
|
||||
@RequestParam("status") String status,@RequestParam("orderNo") String orderNo,@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
|
||||
@RequestParam("status") String status,
|
||||
@RequestParam(value = "orderNo", required = false) String orderNo,
|
||||
@RequestParam(value = "startTime", required = false) String startTime,
|
||||
@RequestParam(value = "endTime", required = false) String endTime,
|
||||
@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
|
||||
@RequestParam(value = "size", required = false, defaultValue = "1") Integer size){
|
||||
return orderService.findOrder(shopId,status,page,size,orderNo);
|
||||
return orderService.findOrder(shopId,status,page,size,orderNo, DateUtil.parse(startTime), DateUtil.parse(endTime));
|
||||
}
|
||||
|
||||
@GetMapping("/orderDetail")
|
||||
|
||||
@@ -217,7 +217,9 @@ public class PayController {
|
||||
@RequestHeader("clientType") String clientType,
|
||||
@RequestBody List<TbOrderDetail> list
|
||||
){
|
||||
return payService.returnOrder(list,token);
|
||||
|
||||
|
||||
return payService.returnOrder(list,token,null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbUserShopMsgMapper;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.mp.api.WxMpConfigStorage;
|
||||
import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage;
|
||||
import me.chanjar.weixin.mp.api.WxMpQrcodeService;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket;
|
||||
@@ -19,7 +16,6 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -31,7 +33,7 @@ public interface TbOrderInfoMapper {
|
||||
List<TbOrderInfo> selectAllByStatus(String status);
|
||||
|
||||
List<OrderPo> selectAllByShop(@Param("shopId") Integer shopId, @Param("orderType") String orderType,
|
||||
@Param("day") String day, @Param("orderNo") String orderNo);
|
||||
@Param("day") String day, @Param("orderNo") String orderNo, Long startTime, Long endTime);
|
||||
|
||||
TbOrderInfo selectByTradeAndMasterId(@Param("day")String day, @Param("masterId")String masterId, @Param("shopId")Integer shopId);
|
||||
|
||||
@@ -45,4 +47,4 @@ public interface TbOrderInfoMapper {
|
||||
Map<String,String> selectByOrderId(String orderId);
|
||||
|
||||
List<SkuInfoPo> selectSkuByOrderId(String orderId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProConsSkuInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
@@ -41,4 +42,13 @@ public interface TbProductMapper {
|
||||
|
||||
|
||||
List<ProConsSkuInfo> selectBySkuId(Integer skuId);
|
||||
|
||||
@Update("update tb_product set stock_number=stock_number+#{num} WHERE id=#{id}")
|
||||
int incrStock(String id, int num);
|
||||
|
||||
@Update("update tb_product set stock_number=stock_number-#{num} WHERE id=#{id} and stock_number-#{num} >= 0")
|
||||
int decrStock(String id, int num);
|
||||
|
||||
@Update("update tb_product set stock_number=stock_number-#{num} WHERE id=#{id}")
|
||||
int decrStockUnCheck(String id, int num);
|
||||
}
|
||||
|
||||
@@ -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.Update;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
@@ -39,4 +40,13 @@ public interface TbProductSkuMapper {
|
||||
|
||||
|
||||
void batchStockNum(@Param("list")List<ProductSkuPo> list);
|
||||
}
|
||||
|
||||
@Update("update tb_product_sku set stock_number=stock_number+#{num} WHERE id=#{skuId}")
|
||||
int incrStock(String skuId, int num);
|
||||
|
||||
@Update("update tb_product_sku set stock_number=stock_number-#{num} WHERE id=#{id} and stock_number-#{num} >= 0")
|
||||
int decrStock(String id, int num);
|
||||
|
||||
@Update("update tb_product_sku set stock_number=stock_number-#{num} WHERE id=#{id} ")
|
||||
int decrStockUnCheck(String id, int num);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ public interface TbProskuConMapper {
|
||||
|
||||
List<Integer> selectIdBySkuIdAndShopId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
|
||||
|
||||
List<TbProskuCon> selectByShopIdAndSkuIdAndProductId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId,@Param("productId") Integer productId);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopOpenId;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【tb_shop_open_id(商家openid信息表)】的数据库操作Mapper
|
||||
* @createDate 2024-07-02 14:37:08
|
||||
* @Entity com.chaozhanggui.system.cashierservice.entity.TbShopOpenId
|
||||
*/
|
||||
public interface TbShopOpenIdMapper {
|
||||
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int insert(TbShopOpenId record);
|
||||
|
||||
int insertSelective(TbShopOpenId record);
|
||||
|
||||
TbShopOpenId selectByPrimaryKey(Long id);
|
||||
|
||||
int updateByPrimaryKeySelective(TbShopOpenId record);
|
||||
|
||||
int updateByPrimaryKey(TbShopOpenId record);
|
||||
|
||||
@Select("select * from tb_shop_open_id where shop_id=#{shopId} and status=1")
|
||||
List<TbShopOpenId> selectByShopId(Integer integer);
|
||||
}
|
||||
@@ -2,20 +2,30 @@ package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Mapper
|
||||
public interface TbUserShopMsgMapper {
|
||||
int deleteByPrimaryKey(Integer shopId);
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(TbUserShopMsg record);
|
||||
|
||||
int insertSelective(TbUserShopMsg record);
|
||||
|
||||
TbUserShopMsg selectByPrimaryKey(Integer shopId);
|
||||
TbUserShopMsg selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByPrimaryKeySelective(TbUserShopMsg record);
|
||||
|
||||
int updateByPrimaryKey(TbUserShopMsg record);
|
||||
|
||||
@Select("select * from tb_user_shop_msg where shop_id=#{shopId}")
|
||||
TbUserShopMsg selectByShopId(@Param("shopId") String shopId);
|
||||
|
||||
|
||||
List<TbUserShopMsg> selectAllByShopId(@Param("shopId") Integer shopId);
|
||||
}
|
||||
@@ -25,6 +25,12 @@ public class TbConsInfo implements Serializable {
|
||||
|
||||
private BigDecimal conWarning;
|
||||
|
||||
private BigDecimal stockConsume;
|
||||
|
||||
private String status;
|
||||
|
||||
private BigDecimal price;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
@@ -126,4 +132,28 @@ public class TbConsInfo implements Serializable {
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public BigDecimal getStockConsume() {
|
||||
return stockConsume;
|
||||
}
|
||||
|
||||
public void setStockConsume(BigDecimal stockConsume) {
|
||||
this.stockConsume = stockConsume;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(BigDecimal price) {
|
||||
this.price = price;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,8 @@ public class TbConsInfoFlow implements Serializable {
|
||||
|
||||
private Integer consId;
|
||||
|
||||
private Integer proSkuId;
|
||||
|
||||
private String conName;
|
||||
|
||||
private BigDecimal amount;
|
||||
@@ -53,6 +55,14 @@ public class TbConsInfoFlow implements Serializable {
|
||||
this.consId = consId;
|
||||
}
|
||||
|
||||
public Integer getProSkuId() {
|
||||
return proSkuId;
|
||||
}
|
||||
|
||||
public void setProSkuId(Integer proSkuId) {
|
||||
this.proSkuId = proSkuId;
|
||||
}
|
||||
|
||||
public String getConName() {
|
||||
return conName;
|
||||
}
|
||||
|
||||
@@ -64,6 +64,9 @@ public class TbProduct implements Serializable {
|
||||
|
||||
private String typeEnum;
|
||||
|
||||
/**
|
||||
* 是否共享库存
|
||||
*/
|
||||
private Byte isDistribute;
|
||||
|
||||
private Byte isDel;
|
||||
|
||||
@@ -29,6 +29,8 @@ public class TbProductSku implements Serializable {
|
||||
|
||||
private BigDecimal strategyPrice;
|
||||
|
||||
private Integer suit;
|
||||
|
||||
private Double stockNumber;
|
||||
|
||||
private String coverImg;
|
||||
@@ -50,6 +52,7 @@ public class TbProductSku implements Serializable {
|
||||
private Long updatedAt;
|
||||
|
||||
private Integer isPauseSale = 0;
|
||||
private Integer isDel;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ public class TbProskuCon implements Serializable {
|
||||
|
||||
private Integer shopId;
|
||||
|
||||
private Integer productId;
|
||||
|
||||
private Integer productSkuId;
|
||||
|
||||
private Integer conInfoId;
|
||||
@@ -37,6 +39,14 @@ public class TbProskuCon implements Serializable {
|
||||
this.shopId = shopId;
|
||||
}
|
||||
|
||||
public Integer getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(Integer productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Integer getProductSkuId() {
|
||||
return productSkuId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 商家openid信息表
|
||||
* @TableName tb_shop_open_id
|
||||
*/
|
||||
public class TbShopOpenId implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Integer shopId;
|
||||
|
||||
/**
|
||||
* 已经订阅消息的商家微信号
|
||||
*/
|
||||
private String openId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
public Integer getShopId() {
|
||||
return shopId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
public void setShopId(Integer shopId) {
|
||||
this.shopId = shopId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 已经订阅消息的商家微信号
|
||||
*/
|
||||
public String getOpenId() {
|
||||
return openId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 已经订阅消息的商家微信号
|
||||
*/
|
||||
public void setOpenId(String openId) {
|
||||
this.openId = openId;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
TbShopOpenId other = (TbShopOpenId) that;
|
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||
&& (this.getShopId() == null ? other.getShopId() == null : this.getShopId().equals(other.getShopId()))
|
||||
&& (this.getOpenId() == null ? other.getOpenId() == null : this.getOpenId().equals(other.getOpenId()))
|
||||
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
|
||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
|
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
||||
result = prime * result + ((getShopId() == null) ? 0 : getShopId().hashCode());
|
||||
result = prime * result + ((getOpenId() == null) ? 0 : getOpenId().hashCode());
|
||||
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
|
||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
|
||||
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", id=").append(id);
|
||||
sb.append(", shopId=").append(shopId);
|
||||
sb.append(", openId=").append(openId);
|
||||
sb.append(", status=").append(status);
|
||||
sb.append(", createTime=").append(createTime);
|
||||
sb.append(", updateTime=").append(updateTime);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class TbUserShopMsg implements Serializable {
|
||||
private Integer id;
|
||||
|
||||
private Integer shopId;
|
||||
|
||||
private String openId;
|
||||
@@ -18,6 +20,14 @@ public class TbUserShopMsg implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getShopId() {
|
||||
return shopId;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,8 @@ public class TbmerchantAccount implements Serializable {
|
||||
|
||||
private String headImg;
|
||||
|
||||
private String pwd;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
@@ -214,4 +216,12 @@ public class TbmerchantAccount implements Serializable {
|
||||
public void setHeadImg(String headImg) {
|
||||
this.headImg = headImg == null ? null : headImg.trim();
|
||||
}
|
||||
|
||||
public String getPwd() {
|
||||
return pwd;
|
||||
}
|
||||
|
||||
public void setPwd(String pwd) {
|
||||
this.pwd = pwd;
|
||||
}
|
||||
}
|
||||
@@ -30,15 +30,13 @@ public class SignInterceptor implements HandlerInterceptor {
|
||||
|
||||
|
||||
@Autowired
|
||||
RedisUtils redisUtil;
|
||||
RedisUtil redisUtil;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||
throws Exception {
|
||||
|
||||
|
||||
|
||||
String requestURI = request.getRequestURI();
|
||||
|
||||
if (HttpMethod.OPTIONS.toString().equals(request.getMethod())) {
|
||||
@@ -59,7 +57,7 @@ public class SignInterceptor implements HandlerInterceptor {
|
||||
|
||||
String key=RedisCst.ONLINE_USER.concat(":").concat(clientType).concat(":").concat(loginName);
|
||||
|
||||
String cacheToken= redisUtil.get(key)+"";
|
||||
String cacheToken= redisUtil.getMessage(key);
|
||||
if(ObjectUtil.isEmpty(cacheToken)||!cacheToken.equals(token)){
|
||||
response.setContentType(CONTENT_TYPE);
|
||||
response.getWriter().print(JSONUtil.toJsonStr(new Result(CodeEnum.TOENNOEXIST)));
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.chaozhanggui.system.cashierservice.util.HttpClientUtil;
|
||||
import com.chaozhanggui.system.cashierservice.util.N;
|
||||
import com.chaozhanggui.system.cashierservice.util.RedisCst;
|
||||
import com.chaozhanggui.system.cashierservice.util.RedisUtil;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
@@ -19,10 +20,8 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@@ -70,6 +69,8 @@ public class ConsMsgConsumer {
|
||||
@RabbitHandler
|
||||
public void listener(String message) {
|
||||
|
||||
log.info("耗材即将售罄提醒:{}",message);
|
||||
|
||||
JSONObject object = JSONObject.parseObject(message);
|
||||
if (Objects.isNull(object) || !object.containsKey("skuId") || !object.containsKey("shopId") || Objects.isNull(object.getInteger("skuId")) || Objects.isNull(object.getInteger("shopId"))) {
|
||||
log.info("接收的信息为空");
|
||||
@@ -108,65 +109,67 @@ public class ConsMsgConsumer {
|
||||
tbProskuCons.parallelStream().forEach(it -> {
|
||||
TbConsInfo tbConsInfo = tbConsInfoMapper.selectByPrimaryKey(it.getConInfoId());
|
||||
if (Objects.isNull(tbConsInfo)) {
|
||||
log.info("耗材信息不存在");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Objects.nonNull(tbConsInfo)) {
|
||||
|
||||
if (N.gt(tbConsInfo.getConWarning(), tbConsInfo.getStockNumber())) {
|
||||
String key = redisUtil.getMessage(RedisCst.ORDER_MESSAGE.concat(tbConsInfo.getShopId().toString()).concat("#").concat(tbConsInfo.getId().toString()));
|
||||
|
||||
if (Objects.isNull(key)) {
|
||||
TbUserShopMsg tbUserShopMsg = tbUserShopMsgMapper.selectByPrimaryKey(tbConsInfo.getShopId());
|
||||
if (Objects.nonNull(tbUserShopMsg) && Objects.nonNull(tbUserShopMsg.getOpenId())) {
|
||||
JSONObject access_token = getAccessToken();
|
||||
String accessToken = String.valueOf(access_token.get("access_token"));
|
||||
|
||||
JSONObject object1 = new JSONObject();
|
||||
|
||||
object1.put("template_id", "IZ-l9p9yBgcvhRR0uN6cBQPkWJ5i05zyWMkfeCPaAmY");
|
||||
object1.put("touser", tbUserShopMsg.getOpenId());
|
||||
log.info("conwarning:{},stockNumber:{}",tbConsInfo.getConWarning(),tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()).abs());
|
||||
if (N.gt(tbConsInfo.getConWarning(), tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()).abs())) {
|
||||
|
||||
|
||||
JSONObject data = new JSONObject();
|
||||
List<TbUserShopMsg> tbUserShopMsgs = tbUserShopMsgMapper.selectAllByShopId(tbConsInfo.getShopId());
|
||||
if (Objects.nonNull(tbUserShopMsgs) && tbUserShopMsgs.size()>0) {
|
||||
tbUserShopMsgs.parallelStream().forEach(tbUserShopMsg->{
|
||||
String key=RedisCst.ORDER_MESSAGE.concat(tbConsInfo.getShopId().toString()).concat("#").concat(tbConsInfo.getId().toString()).concat("#").concat(tbUserShopMsg.getOpenId());
|
||||
String value = redisUtil.getMessage(key);
|
||||
log.info("redis_key:{}",value);
|
||||
if (Objects.isNull(value)) {
|
||||
JSONObject access_token = getAccessToken();
|
||||
String accessToken = String.valueOf(access_token.get("access_token"));
|
||||
|
||||
JSONObject thing1 = new JSONObject();
|
||||
thing1.put("value", shopInfo.getShopName());
|
||||
JSONObject object1 = new JSONObject();
|
||||
|
||||
JSONObject thing5 = new JSONObject();
|
||||
thing5.put("value", "耗材库存不足,请及时补充。");
|
||||
|
||||
JSONObject thing6 = new JSONObject();
|
||||
thing6.put("value", product.getName());
|
||||
object1.put("template_id", "IZ-l9p9yBgcvhRR0uN6cBQPkWJ5i05zyWMkfeCPaAmY");
|
||||
object1.put("touser", tbUserShopMsg.getOpenId());
|
||||
|
||||
|
||||
JSONObject thing7 = new JSONObject();
|
||||
thing7.put("value", tbConsInfo.getStockNumber().toPlainString());
|
||||
JSONObject data = new JSONObject();
|
||||
|
||||
data.put("thing1", thing1);
|
||||
data.put("thing6", thing6);
|
||||
data.put("number7", thing7);
|
||||
data.put("thing5", thing5);
|
||||
JSONObject thing1 = new JSONObject();
|
||||
thing1.put("value", shopInfo.getShopName());
|
||||
|
||||
object1.put("data", data);
|
||||
JSONObject thing5 = new JSONObject();
|
||||
thing5.put("value", "耗材库存不足,请及时补充。");
|
||||
|
||||
object1.put("miniprogram_state", miniprogramState);
|
||||
object1.put("lang", "zh_CN");
|
||||
JSONObject thing6 = new JSONObject();
|
||||
thing6.put("value", tbConsInfo.getConName());
|
||||
|
||||
String response = HttpRequest.post("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=".concat(accessToken)).body(object1.toString()).execute().body();
|
||||
log.info("返回结果:{}", response);
|
||||
JSONObject resObj = JSONObject.parseObject(response);
|
||||
if (ObjectUtil.isNotEmpty(resObj) && ObjectUtil.isNotNull(resObj) && "0".equals(String.valueOf(resObj.get("errcode")))) {
|
||||
redisUtil.saveMessage(key, object1.toString(),10*60*1000);
|
||||
|
||||
JSONObject thing7 = new JSONObject();
|
||||
thing7.put("value", tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()).setScale(2,BigDecimal.ROUND_DOWN).toPlainString());
|
||||
|
||||
data.put("thing1", thing1);
|
||||
data.put("thing6", thing6);
|
||||
data.put("number7", thing7);
|
||||
data.put("thing5", thing5);
|
||||
|
||||
object1.put("data", data);
|
||||
|
||||
object1.put("miniprogram_state", miniprogramState);
|
||||
object1.put("lang", "zh_CN");
|
||||
|
||||
String response = HttpRequest.post("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=".concat(accessToken)).body(object1.toString()).execute().body();
|
||||
log.info("openId:{},请求参数:{},返回结果:{}",tbUserShopMsg.getOpenId(),object1.toString(), response);
|
||||
JSONObject resObj = JSONObject.parseObject(response);
|
||||
if (ObjectUtil.isNotEmpty(resObj) && ObjectUtil.isNotNull(resObj) && "0".equals(String.valueOf(resObj.get("errcode")))) {
|
||||
log.info("写入redis:{}",key);
|
||||
redisUtil.saveMessage(key, object1.toString(), 10 * 60);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
@@ -192,44 +195,88 @@ public class ConsMsgConsumer {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
JSONObject getAccessToken1() {
|
||||
String requestUrl = "https://api.weixin.qq.com/cgi-bin/token";
|
||||
Map<String, String> requestUrlParam = new HashMap<>();
|
||||
|
||||
|
||||
requestUrlParam.put("appid", "wxcf0fe8cdba153fd6");
|
||||
//小程序secret
|
||||
requestUrlParam.put("secret", "c33e06467c6879a62af633d50ed6b720");
|
||||
//默认参数
|
||||
requestUrlParam.put("grant_type", "client_credential");
|
||||
JSONObject jsonObject = JSON.parseObject(HttpClientUtil.doGet(requestUrl, requestUrlParam));
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
@Data
|
||||
static class MsgInfo{
|
||||
private String openId;
|
||||
private String shopName;
|
||||
|
||||
private String productName;
|
||||
|
||||
private BigDecimal amount;
|
||||
|
||||
|
||||
public MsgInfo(String openId, String shopName, String productName, BigDecimal amount) {
|
||||
this.openId = openId;
|
||||
this.shopName = shopName;
|
||||
this.productName = productName;
|
||||
this.amount = amount;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
JSONObject access_token = new ConsMsgConsumer().getAccessToken();
|
||||
String accessToken = String.valueOf(access_token.get("access_token"));
|
||||
//
|
||||
// List<MsgInfo> list=new ArrayList<>();
|
||||
//
|
||||
// list.add(new MsgInfo("oeQYq5KEjN1-laurB3oRbqEllVzs","双屿Pisces","茄汁肉酱意面",new BigDecimal(24)));
|
||||
// list.add(new MsgInfo("oeQYq5KEjN1-laurB3oRbqEllVzs","森食界创意轻食(未央店)","番茄鸳鸯锅",new BigDecimal(36)));
|
||||
//
|
||||
// for (MsgInfo msgInfo : list) {
|
||||
// JSONObject access_token = new ConsMsgConsumer().getAccessToken1();
|
||||
// String accessToken = String.valueOf(access_token.get("access_token"));
|
||||
//
|
||||
// JSONObject object1 = new JSONObject();
|
||||
//
|
||||
// object1.put("template_id", "IZ-l9p9yBgcvhRR0uN6cBQPkWJ5i05zyWMkfeCPaAmY");
|
||||
// object1.put("touser", msgInfo.getOpenId());
|
||||
//
|
||||
//
|
||||
// JSONObject data = new JSONObject();
|
||||
//
|
||||
// JSONObject thing1 = new JSONObject();
|
||||
// thing1.put("value", msgInfo.getShopName());
|
||||
//
|
||||
// JSONObject thing5 = new JSONObject();
|
||||
// thing5.put("value", "耗材库存不足,请及时补充。");
|
||||
//
|
||||
// JSONObject thing6 = new JSONObject();
|
||||
// thing6.put("value", msgInfo.getProductName());
|
||||
//
|
||||
//
|
||||
// JSONObject thing7 = new JSONObject();
|
||||
// thing7.put("value", msgInfo.getAmount().toPlainString());
|
||||
//
|
||||
// data.put("thing1", thing1);
|
||||
// data.put("thing6", thing6);
|
||||
// data.put("number7", thing7);
|
||||
// data.put("thing5", thing5);
|
||||
//
|
||||
// object1.put("data", data);
|
||||
//
|
||||
// object1.put("miniprogram_state", "formal");
|
||||
// object1.put("lang", "zh_CN");
|
||||
//
|
||||
// String response = HttpRequest.post("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=".concat(accessToken)).body(object1.toString()).execute().body();
|
||||
// log.info("返回结果:{}", response);
|
||||
// JSONObject resObj = JSONObject.parseObject(response);
|
||||
// }
|
||||
|
||||
JSONObject object1 = new JSONObject();
|
||||
|
||||
object1.put("template_id", "IZ-l9p9yBgcvhRR0uN6cBQPkWJ5i05zyWMkfeCPaAmY");
|
||||
object1.put("touser", "oeQYq5CAuSpdeX9uZz52DJiSUO9M");
|
||||
|
||||
|
||||
JSONObject data = new JSONObject();
|
||||
|
||||
JSONObject thing1 = new JSONObject();
|
||||
thing1.put("value", "水");
|
||||
|
||||
JSONObject thing5 = new JSONObject();
|
||||
thing5.put("value", "耗材库存不足,请及时补充。");
|
||||
|
||||
JSONObject thing6 = new JSONObject();
|
||||
thing6.put("value", "咖啡");
|
||||
|
||||
|
||||
JSONObject thing7 = new JSONObject();
|
||||
thing7.put("value", "3.2");
|
||||
|
||||
data.put("thing1", thing1);
|
||||
data.put("thing6", thing6);
|
||||
data.put("number7", thing7);
|
||||
data.put("thing5", thing5);
|
||||
|
||||
object1.put("data", data);
|
||||
|
||||
object1.put("miniprogram_state", "trial");
|
||||
object1.put("lang", "zh_CN");
|
||||
|
||||
String response = HttpRequest.post("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=".concat(accessToken)).body(object1.toString()).execute().body();
|
||||
log.info("返回结果:{}", response);
|
||||
JSONObject resObj = JSONObject.parseObject(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ public class RabbitConfig {
|
||||
|
||||
@Bean
|
||||
public Binding bindingcons_Register() {
|
||||
return BindingBuilder.bind(queuePrint_Register()).to(printExchange_Register()).with(RabbitConstants.CONS_COLLECT_ROUTINGKEY_PUT);
|
||||
return BindingBuilder.bind(queuecons_Register()).to(consExchange_Register()).with(RabbitConstants.CONS_COLLECT_ROUTINGKEY_PUT);
|
||||
}
|
||||
|
||||
|
||||
@@ -120,12 +120,11 @@ public class RabbitConfig {
|
||||
|
||||
@Bean
|
||||
public Binding bindingcons_msg_Register() {
|
||||
return BindingBuilder.bind(queuePrint_Register()).to(printExchange_Register()).with(RabbitConstants.CONS_MSG_COLLECT_ROUTINGKEY_PUT);
|
||||
return BindingBuilder.bind(queuecons_msg_Register()).to(cons_msg_Exchange_Register()).with(RabbitConstants.CONS_MSG_COLLECT_ROUTINGKEY_PUT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -45,9 +45,6 @@ public class RabbitProducer implements RabbitTemplate.ConfirmCallback {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void con_msg(String content){
|
||||
CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
|
||||
rabbitTemplate.convertAndSend(RabbitConstants.CONS_MSG_COLLECT_PUT, RabbitConstants.CONS_MSG_COLLECT_ROUTINGKEY_PUT, content, correlationId);
|
||||
|
||||
@@ -2,20 +2,16 @@ package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
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.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
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.sql.Timestamp;
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
@@ -36,6 +32,9 @@ public class ConsService {
|
||||
@Autowired
|
||||
TbConsInfoFlowMapper tbConsInfoFlowMapper;
|
||||
|
||||
@Autowired
|
||||
TbOrderDetailMapper tbOrderDetailMapper;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void exect(String message) throws Exception {
|
||||
log.info("耗材信息更新开始:{}",message);
|
||||
@@ -43,109 +42,81 @@ public class ConsService {
|
||||
|
||||
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;
|
||||
}
|
||||
String orderId=jsonObject.getString("orderId");
|
||||
|
||||
|
||||
//减少耗材库存信息
|
||||
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(),tbProskuCon.getSurplusStock());
|
||||
consInfoPOS.add(consInfoPO);
|
||||
|
||||
TbConsInfoFlow flow=new TbConsInfoFlow();
|
||||
flow.setConsId(tbConsInfo.getId());
|
||||
flow.setShopId(tbConsInfo.getShopId());
|
||||
flow.setConName(tbConsInfo.getConName());
|
||||
flow.setAmount(tbProskuCon.getSurplusStock());
|
||||
flow.setBalance(tbConsInfo.getStockNumber().subtract(tbProskuCon.getSurplusStock()));
|
||||
flow.setBizCode("createCart");
|
||||
flow.setBizName("加入购物陈消耗");
|
||||
flow.setBizType("-");
|
||||
flow.setCreateTime(new Date());
|
||||
flow.setUpdateTime(new Date());
|
||||
consInfoFlows.add(flow);
|
||||
}
|
||||
}
|
||||
Thread.sleep(1000L);
|
||||
|
||||
|
||||
|
||||
//更新耗材信息
|
||||
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(),tbProskuCon.getSurplusStock().negate());
|
||||
consInfoPOS.add(consInfoPO);
|
||||
|
||||
TbConsInfoFlow flow=new TbConsInfoFlow();
|
||||
flow.setConsId(tbConsInfo.getId());
|
||||
flow.setShopId(tbConsInfo.getShopId());
|
||||
flow.setConName(tbConsInfo.getConName());
|
||||
flow.setAmount(tbProskuCon.getSurplusStock());
|
||||
flow.setBalance(tbConsInfo.getStockNumber().add(tbProskuCon.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;
|
||||
}
|
||||
|
||||
List<TbOrderDetail> orderDetails= tbOrderDetailMapper.selectAllByOrderId(Integer.valueOf(orderId));
|
||||
if(Objects.isNull(orderDetails)||orderDetails.size()<=0){
|
||||
log.info("订单信息不存在");
|
||||
return;
|
||||
}
|
||||
List<ConsInfoPO> consInfoPOS=new ArrayList<>();
|
||||
List<TbConsInfoFlow> consInfoFlows=new ArrayList<>();
|
||||
|
||||
for (TbOrderDetail orderDetail : orderDetails) {
|
||||
List<TbProskuCon> proskuCons= tbProskuConMapper.selectByShopIdAndSkuIdAndProductId(orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
|
||||
if(Objects.isNull(proskuCons)||proskuCons.size()<=0){
|
||||
log.info("不存在的耗材信息配置:orderId:{},skuId:{},shopId:{},productId:{}",orderDetail.getOrderId(),orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
|
||||
continue;
|
||||
}
|
||||
for (TbProskuCon proskuCon : proskuCons) {
|
||||
TbConsInfo tbConsInfo= tbConsInfoMapper.selectByPrimaryKey(proskuCon.getConInfoId());
|
||||
if(Objects.nonNull(tbConsInfo)&&"1".equals(tbConsInfo.getStatus())){
|
||||
BigDecimal amount=BigDecimal.ZERO;
|
||||
TbConsInfoFlow flow=new TbConsInfoFlow();
|
||||
flow.setConsId(tbConsInfo.getId());
|
||||
flow.setProSkuId(proskuCon.getProductSkuId());
|
||||
flow.setShopId(tbConsInfo.getShopId());
|
||||
flow.setConName(tbConsInfo.getConName());
|
||||
flow.setProSkuId(proskuCon.getProductSkuId());
|
||||
if("create".equals(type)){
|
||||
amount=proskuCon.getSurplusStock().multiply(new BigDecimal(orderDetail.getNum()));
|
||||
|
||||
flow.setAmount(amount);
|
||||
|
||||
flow.setBizCode("createCart");
|
||||
flow.setBizName("销售扣除");
|
||||
flow.setBizType("-");
|
||||
|
||||
tbConsInfo.setStockConsume(tbConsInfo.getStockConsume().add(amount));
|
||||
flow.setBalance(tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()));
|
||||
tbConsInfo.setUpdateTime(new Timestamp(System.currentTimeMillis()));
|
||||
|
||||
}else if("delete".equals(type)){
|
||||
amount=proskuCon.getSurplusStock().multiply(new BigDecimal(orderDetail.getNum())).negate();
|
||||
|
||||
flow.setAmount(amount.abs());
|
||||
flow.setBizCode("cancelCart");
|
||||
flow.setBizName("退单返还");
|
||||
flow.setBizType("+");
|
||||
|
||||
tbConsInfo.setStockConsume(tbConsInfo.getStockConsume().add(amount));
|
||||
|
||||
flow.setBalance(tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()));
|
||||
tbConsInfo.setUpdateTime(new Timestamp(System.currentTimeMillis()));
|
||||
}
|
||||
// ConsInfoPO consInfoPO=new ConsInfoPO(tbConsInfo.getId(),amount);
|
||||
// consInfoPOS.add(consInfoPO);
|
||||
|
||||
flow.setCreateTime(new Date());
|
||||
// flow.setUpdateTime(new Date());
|
||||
// consInfoFlows.add(flow);
|
||||
|
||||
tbConsInfoMapper.updateByPrimaryKey(tbConsInfo);
|
||||
tbConsInfoFlowMapper.insert(flow);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
//更新耗材信息
|
||||
// tbConsInfoMapper.batchStock(consInfoPOS);
|
||||
// //记录更新日志
|
||||
// tbConsInfoFlowMapper.insertBatch(consInfoFlows);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,7 @@ import com.chaozhanggui.system.cashierservice.model.LoginReq;
|
||||
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.MD5Util;
|
||||
import com.chaozhanggui.system.cashierservice.util.RedisCst;
|
||||
import com.chaozhanggui.system.cashierservice.util.RedisUtils;
|
||||
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
|
||||
import com.chaozhanggui.system.cashierservice.util.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -46,7 +43,7 @@ public class LoginService {
|
||||
TbPlussShopStaffMapper tbPlussShopStaffMapper;
|
||||
|
||||
@Autowired
|
||||
RedisUtils redisUtil;
|
||||
RedisUtil redisUtil;
|
||||
|
||||
@Autowired
|
||||
TbTokenMapper tbTokenMapper;
|
||||
@@ -60,6 +57,8 @@ public class LoginService {
|
||||
return Result.fail(CodeEnum.PARAM);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (ObjectUtil.isEmpty(loginReq.getSerialNumber())) {
|
||||
return Result.fail(CodeEnum.SERIALNUMBER);
|
||||
}
|
||||
@@ -79,6 +78,7 @@ public class LoginService {
|
||||
String key = RedisCst.ONLINE_USER.concat(":").concat(loginReq.getClientType()).concat(":").concat(loginReq.getLoginName());
|
||||
//
|
||||
// String data = redisUtil.getMessage(key);
|
||||
// log.info("key:{},data:{}",key,data);
|
||||
// if(ObjectUtil.isNotEmpty(data)){
|
||||
// return Result.fail(CodeEnum.USERHAVEDLOGIN);
|
||||
// }
|
||||
@@ -115,7 +115,7 @@ public class LoginService {
|
||||
|
||||
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(account.getShopId()));
|
||||
|
||||
redisUtil.set(key, token, 365 * 24 * 60 * 60);
|
||||
redisUtil.saveMessage(key, token, 365 * 24 * 60 * 60);
|
||||
|
||||
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
|
||||
@@ -133,7 +133,7 @@ public class LoginService {
|
||||
accountMap.put("shopName", shopInfo.getShopName());
|
||||
}
|
||||
accountMap.put("uuid", uuid);
|
||||
redisUtil.set("CART:UUID:" + account.getShopId().concat(account.getId().toString()), uuid);
|
||||
redisUtil.saveMessage("CART:UUID:" + account.getShopId().concat(account.getId().toString()), uuid);
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS, accountMap);
|
||||
}
|
||||
@@ -143,17 +143,17 @@ public class LoginService {
|
||||
|
||||
String key = RedisCst.ONLINE_USER.concat(":").concat(clientType).concat(":").concat(loginName);
|
||||
|
||||
String cacheToken = redisUtil.get(key)+"";
|
||||
String cacheToken = redisUtil.getMessage(key)+"";
|
||||
|
||||
TbToken tbToken = tbTokenMapper.selectByToken(token);
|
||||
|
||||
if (ObjectUtil.isEmpty(tbToken)) {
|
||||
redisUtil.del(key);
|
||||
redisUtil.deleteByKey(key);
|
||||
return Result.fail(USERNOLOGIN);
|
||||
}
|
||||
|
||||
if (!"1".equals(tbToken.getStatus()) || "2".equals(tbToken.getStatus()) || "3".equals(tbToken.getStatus())) {
|
||||
redisUtil.del(key);
|
||||
redisUtil.deleteByKey(key);
|
||||
return Result.fail(USERNOLOGIN);
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ public class LoginService {
|
||||
if (!cacheToken.equals(token)) {
|
||||
return Result.fail(TOKENTERROR);
|
||||
}
|
||||
redisUtil.del(key);
|
||||
redisUtil.deleteByKey(key);
|
||||
tbToken.setStatus(status);
|
||||
tbToken.setUpdateTime(new Date());
|
||||
tbTokenMapper.updateByPrimaryKey(tbToken);
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.math.RoundingMode;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
public class MemberService {
|
||||
@@ -73,6 +74,9 @@ public class MemberService {
|
||||
@Value("${thirdPay.callBack}")
|
||||
private String callBack;
|
||||
|
||||
@Autowired
|
||||
TbmerchantAccountMapper tbmerchantAccountMapper;
|
||||
|
||||
public Result queryMember(String shopId, String phone, int page, int pageSize) {
|
||||
|
||||
PageHelperUtil.startPage(page, pageSize);
|
||||
@@ -519,10 +523,28 @@ public class MemberService {
|
||||
|| !map.containsKey("shopId") || ObjectUtil.isEmpty(map.get("shopId"))
|
||||
|| !map.containsKey("memberId") || ObjectUtil.isEmpty(map.get("memberId"))
|
||||
|| !map.containsKey("amount") || ObjectUtil.isEmpty(map.get("amount"))
|
||||
||!map.containsKey("pwd")||ObjectUtil.isEmpty(map.get("pwd"))
|
||||
) {
|
||||
return Result.fail(CodeEnum.PARAM);
|
||||
}
|
||||
|
||||
String accountId= TokenUtil.parseParamFromToken(token).getString("accountId");
|
||||
|
||||
TbmerchantAccount account= tbmerchantAccountMapper.selectByPrimaryKey(Integer.valueOf(accountId));
|
||||
if(Objects.isNull(account)){
|
||||
return Result.fail(CodeEnum.ACCOUNTEIXST);
|
||||
}
|
||||
|
||||
|
||||
if(Objects.isNull(account.getPwd())||ObjectUtil.isEmpty(account.getPwd())){
|
||||
return Result.fail(CodeEnum.PWDNOSET);
|
||||
}
|
||||
|
||||
if(!account.getPwd().equals(MD5Util.encrypt(map.get("pwd").toString().concat(account.getAccount()).concat(account.getId().toString())))){
|
||||
return Result.fail(CodeEnum.PWDERROE);
|
||||
}
|
||||
|
||||
|
||||
String memberId = String.valueOf(map.get("memberId"));
|
||||
|
||||
String shopId = String.valueOf(map.get("shopId"));
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
@@ -22,9 +24,10 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static com.chaozhanggui.system.cashierservice.sign.CodeEnum.CARTEXIST;
|
||||
|
||||
@@ -64,9 +67,23 @@ public class OrderService {
|
||||
@Autowired
|
||||
RabbitProducer producer;
|
||||
|
||||
private final WechatUtil wechatUtil;
|
||||
|
||||
private final TbUserShopMsgMapper tbUserShopMsgMapper;
|
||||
|
||||
private final TbShopOpenIdMapper shopOpenIdMapper;
|
||||
|
||||
|
||||
private static ConcurrentHashMap<String, HashSet<Integer>> codeMap = new ConcurrentHashMap<>();
|
||||
private static ConcurrentHashMap<String, HashSet<String>> userMap = new ConcurrentHashMap<>();
|
||||
@Autowired
|
||||
private ProductService productService;
|
||||
|
||||
public OrderService(WechatUtil wechatUtil, TbUserShopMsgMapper tbUserShopMsgMapper, TbShopOpenIdMapper shopOpenIdMapper) {
|
||||
this.wechatUtil = wechatUtil;
|
||||
this.tbUserShopMsgMapper = tbUserShopMsgMapper;
|
||||
this.shopOpenIdMapper = shopOpenIdMapper;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result createCart(String masterId, String productId, String shopId, Integer skuId, Integer number,
|
||||
@@ -100,21 +117,31 @@ public class OrderService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
String exists = redisUtil.getMessage(RedisCst.ORDER_CART_EXISTS + cartId);
|
||||
|
||||
// 首次加入购物车,并且拥有起售数,设置为起售数
|
||||
if (exists == null && skuWithBLOBs.getSuit() != null && skuWithBLOBs.getSuit() != 0) {
|
||||
number = skuWithBLOBs.getSuit();
|
||||
// 低于起售,删除商品
|
||||
}else if (exists != null && skuWithBLOBs.getSuit() != null && skuWithBLOBs.getSuit() != 0 && number < skuWithBLOBs.getSuit()){
|
||||
redisUtil.deleteByKey(RedisCst.ORDER_CART_EXISTS + cartId);
|
||||
delCart(masterId, cartId);
|
||||
return Result.success(CodeEnum.SUCCESS, masterId);
|
||||
}
|
||||
|
||||
if("1".equals(product.getIsStock().toString())){
|
||||
if(product.getId().intValue()==Integer.valueOf(skuWithBLOBs.getProductId()).intValue()){
|
||||
if ("1".equals(product.getIsDistribute().toString())) {
|
||||
if(product.getStockNumber()-number<0){
|
||||
return Result.fail(CodeEnum.STOCKERROR);
|
||||
}
|
||||
} else if (product.getId().intValue()==Integer.valueOf(skuWithBLOBs.getProductId()).intValue()){
|
||||
if(skuWithBLOBs.getStockNumber()-number<0){
|
||||
return Result.fail(CodeEnum.STOCKERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject objectMsg=new JSONObject();
|
||||
objectMsg.put("skuId",skuWithBLOBs.getId());
|
||||
objectMsg.put("shopId",shopInfo.getId());
|
||||
|
||||
|
||||
producer.con_msg(objectMsg.toString());
|
||||
|
||||
if (StringUtils.isEmpty(masterId)) {
|
||||
boolean flag = redisUtil.exists("SHOP:CODE:" + clientType + ":" + shopId);
|
||||
if (flag) {
|
||||
@@ -148,6 +175,7 @@ public class OrderService {
|
||||
cart.setTotalNumber(number);
|
||||
cart.setUuid(uuid);
|
||||
cashierCartMapper.updateByPrimaryKeySelective(cart);
|
||||
|
||||
} else {
|
||||
List<TbCashierCart> list = cashierCartMapper.selectALlByMasterId(masterId, "create");
|
||||
TbCashierCart cashierCart = cashierCartMapper.selectByDetail(masterId, productId, shopId, skuId.toString(), DateUtils.getDay(), uuid);
|
||||
@@ -188,6 +216,7 @@ public class OrderService {
|
||||
cashierCart.setCategoryId(product.getCategoryId());
|
||||
list.add(cashierCart);
|
||||
cashierCartMapper.insert(cashierCart);
|
||||
cart=cashierCart;
|
||||
} else {
|
||||
if (type.equals("add")) {
|
||||
cashierCart.setNumber(cashierCart.getNumber() + number);
|
||||
@@ -206,24 +235,55 @@ public class OrderService {
|
||||
} else {
|
||||
cashierCartMapper.updateStatus(cashierCart.getId(), "close");
|
||||
}
|
||||
|
||||
cart=cashierCart;
|
||||
redisUtil.saveMessage(RedisCst.ORDER_CART_EXISTS + cart.getId(), "1", 60 * 60 * 24);
|
||||
}
|
||||
|
||||
redisUtil.saveMessage(RedisCst.ORDER_CART_EXISTS + cart.getId(), "1", 60 * 60 * 24);
|
||||
|
||||
skuWithBLOBs.setStockNumber(skuWithBLOBs.getStockNumber()-number);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验商品库存警戒线并通知商户
|
||||
*
|
||||
* @param productSku sku
|
||||
*/
|
||||
private void checkWarnLineAndSendMsg(TbProductSku productSku, TbProduct product, Integer shopId, Integer num) {
|
||||
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(shopId);
|
||||
if (productSku.getWarnLine() == null) {
|
||||
return;
|
||||
}
|
||||
if (productSku.getStockNumber() == null) {
|
||||
productSku.setStockNumber((double) 0);
|
||||
}
|
||||
|
||||
if (product.getStockNumber() == null) {
|
||||
product.setStockNumber(0);
|
||||
}
|
||||
if (
|
||||
(product.getIsDistribute() == 1 && product.getStockNumber() - num <= productSku.getWarnLine())
|
||||
|| (product.getIsDistribute() != 1) && productSku.getStockNumber() - num <= productSku.getWarnLine()
|
||||
) {
|
||||
List<TbShopOpenId> shopOpenIds = shopOpenIdMapper.selectByShopId(Integer.valueOf(product.getShopId()));
|
||||
shopOpenIds.forEach(item -> {
|
||||
wechatUtil.sendStockWarnMsg(shopInfo.getShopName(), product.getName(),
|
||||
product.getIsDistribute() == 1 ? String.valueOf(product.getStockNumber()-num) : String.valueOf(productSku.getStockNumber() - num),
|
||||
"商品库存不足,请及时补充。", item.getOpenId());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public Result queryCart(String masterId, String shopId) {
|
||||
if (StringUtils.isEmpty(shopId)) {
|
||||
return Result.fail(CodeEnum.SHOPINFONOEXIST);
|
||||
@@ -298,14 +358,21 @@ public class OrderService {
|
||||
if(ObjectUtil.isEmpty(product)){
|
||||
return Result.fail(CodeEnum.PRODUCTINFOERROR);
|
||||
}
|
||||
if("1".equals(product.getIsStock().toString())){
|
||||
TbProductSkuWithBLOBs skuWithBLOBs= tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getSkuId()));
|
||||
if(ObjectUtil.isEmpty(skuWithBLOBs)){
|
||||
return Result.fail(CodeEnum.PRODUCTSKUERROR);
|
||||
}
|
||||
skuWithBLOBs.setStockNumber(skuWithBLOBs.getStockNumber()+cashierCart.getTotalNumber());
|
||||
skuWithBLOBs.setUpdatedAt(System.currentTimeMillis());
|
||||
tbProductSkuMapper.updateByPrimaryKey(skuWithBLOBs);
|
||||
// if("1".equals(product.getIsStock().toString())){
|
||||
// TbProductSkuWithBLOBs skuWithBLOBs= tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getSkuId()));
|
||||
// if(ObjectUtil.isEmpty(skuWithBLOBs)){
|
||||
// return Result.fail(CodeEnum.PRODUCTSKUERROR);
|
||||
// }
|
||||
// skuWithBLOBs.setStockNumber(skuWithBLOBs.getStockNumber()+cashierCart.getTotalNumber());
|
||||
// skuWithBLOBs.setUpdatedAt(System.currentTimeMillis());
|
||||
// tbProductSkuMapper.updateByPrimaryKey(skuWithBLOBs);
|
||||
// }
|
||||
// 数量减少, 返还库存
|
||||
String message = redisUtil.getMessage(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId());
|
||||
redisUtil.deleteByKey(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId());
|
||||
|
||||
if (message != null) {
|
||||
productService.incrStock(cashierCart.getProductId(), cashierCart.getSkuId(), Integer.parseInt(message));
|
||||
}
|
||||
|
||||
List<String> skuIds=new ArrayList<>();
|
||||
@@ -313,14 +380,6 @@ public class OrderService {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -348,6 +407,14 @@ public class OrderService {
|
||||
return Result.fail(CARTEXIST);
|
||||
}
|
||||
for (TbCashierCart cashierCart : list) {
|
||||
|
||||
|
||||
JSONObject objectMsg=new JSONObject();
|
||||
objectMsg.put("skuId",Integer.valueOf(cashierCart.getSkuId()));
|
||||
objectMsg.put("shopId",Integer.valueOf(cashierCart.getShopId()));
|
||||
producer.con_msg(objectMsg.toString());
|
||||
|
||||
|
||||
TbProductSkuWithBLOBs tbProduct = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getSkuId()));
|
||||
totalAmount = totalAmount.add(cashierCart.getTotalAmount());
|
||||
packAMount = packAMount.add(cashierCart.getPackFee());
|
||||
@@ -442,8 +509,33 @@ public class OrderService {
|
||||
}
|
||||
boolean flag = true;
|
||||
for (TbCashierCart cashierCart : list) {
|
||||
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
|
||||
TbProductSkuWithBLOBs skuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getSkuId()));
|
||||
|
||||
log.info("下单,开始校验库存预警,购物车id:{}", cashierCart.getId());
|
||||
CompletableFuture.runAsync(() -> checkWarnLineAndSendMsg(skuWithBLOBs, product, Integer.valueOf(cashierCart.getShopId()), cashierCart.getNumber()));
|
||||
|
||||
// 已经添加的商品,修改数量
|
||||
if (StringUtils.isNotEmpty(cashierCart.getOrderId())) {
|
||||
flag = false;
|
||||
String message = redisUtil.getMessage(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId());
|
||||
if (message != null) {
|
||||
int lastNum = Integer.parseInt(message);
|
||||
// 数量减少, 返还库存
|
||||
if (lastNum > cashierCart.getNumber()) {
|
||||
productService.incrStock(cashierCart.getProductId(), cashierCart.getSkuId(), lastNum - cashierCart.getNumber());
|
||||
} else {
|
||||
productService.decrStock(cashierCart.getProductId(), cashierCart.getSkuId(), cashierCart.getNumber() - lastNum);
|
||||
}
|
||||
redisUtil.saveMessage(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId(), cashierCart.getNumber().toString(), 24 * 60*60);
|
||||
|
||||
}
|
||||
|
||||
// 首次添加的商品
|
||||
}else {
|
||||
redisUtil.saveMessage(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId(), cashierCart.getNumber().toString(), 24 * 60*60);
|
||||
// 修改库存
|
||||
productService.decrStock(cashierCart.getProductId(), cashierCart.getSkuId(), cashierCart.getNumber());
|
||||
}
|
||||
cashierCart.setOrderId(orderId + "");
|
||||
cashierCart.setUpdatedAt(System.currentTimeMillis());
|
||||
@@ -473,6 +565,15 @@ public class OrderService {
|
||||
redisUtil.saveMessage(RedisCst.OUT_NUMBER.concat(orderInfo.getShopId().toString()),object.toString());
|
||||
|
||||
|
||||
|
||||
|
||||
log.info("创建订单,发送更新耗材消息,订单id:{}", orderInfo.getId());
|
||||
//修改耗材数据
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put("orderId",orderInfo.getId());
|
||||
jsonObject.put("type","create");
|
||||
producer.cons(jsonObject.toString());
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS, orderInfo);
|
||||
}
|
||||
|
||||
@@ -722,20 +823,35 @@ public class OrderService {
|
||||
List<ProductSkuPo> productSkuPos=new ArrayList<>();
|
||||
List<String> skuIds=new ArrayList<>();
|
||||
for (TbCashierCart cashierCart : list) {
|
||||
// 数量减少, 返还库存
|
||||
String message = redisUtil.getMessage(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId());
|
||||
redisUtil.deleteByKey(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId());
|
||||
|
||||
if (message != null) {
|
||||
productService.incrStock(cashierCart.getProductId(), cashierCart.getSkuId(), Integer.parseInt(message));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(cashierCart.getOrderId())) {
|
||||
orderId = Integer.valueOf(cashierCart.getOrderId());
|
||||
skuIds.add(cashierCart.getSkuId());
|
||||
orderId = Integer.parseInt(cashierCart.getOrderId());
|
||||
|
||||
}
|
||||
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);
|
||||
skuIds.add(cashierCart.getSkuId());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (orderId > 0) {
|
||||
// 返还耗材
|
||||
JSONObject jsonObject1=new JSONObject();
|
||||
jsonObject1.put("orderId", orderId);
|
||||
jsonObject1.put("type","delete");
|
||||
log.info("清空购物车 发送返还耗材mq消息,订单id:{},消息内容:{}", orderId, jsonObject1);
|
||||
producer.cons(jsonObject1.toString());
|
||||
|
||||
TbOrderInfo orderInfo = tbOrderInfoMapper.selectByPrimaryKey(orderId);
|
||||
if (Objects.nonNull(orderInfo) && !orderInfo.getStatus().equals("pending")){
|
||||
tbOrderInfoMapper.updateStatusById(orderId, "cancelled");
|
||||
@@ -751,19 +867,20 @@ public class OrderService {
|
||||
|
||||
|
||||
|
||||
//修改耗材数据
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
public Result findOrder(Integer shopId, String status, Integer page, Integer size, String orderNo) {
|
||||
String day = DateUtils.getDay();
|
||||
public Result findOrder(Integer shopId, String status, Integer page, Integer size, String orderNo,
|
||||
Date startTime, Date endTime) {
|
||||
|
||||
String day = null;
|
||||
if (startTime == null && endTime == null) {
|
||||
startTime = DateUtil.beginOfDay(DateUtil.date());
|
||||
endTime = DateUtil.endOfDay(DateUtil.date());
|
||||
day = DateUtils.getDay();
|
||||
}
|
||||
|
||||
PageHelperUtil.startPage(page, size);
|
||||
String orderType = "";
|
||||
if (StringUtils.isNotEmpty(status)) {
|
||||
@@ -775,7 +892,8 @@ public class OrderService {
|
||||
}
|
||||
log.info("orderType:" + orderType);
|
||||
log.info("status:" + status);
|
||||
List<OrderPo> list = tbOrderInfoMapper.selectAllByShop(shopId, orderType, day, orderNo);
|
||||
List<OrderPo> list = tbOrderInfoMapper.selectAllByShop(shopId, orderType, day, orderNo,
|
||||
startTime == null ? null : startTime.getTime(), endTime == null ? null : endTime.getTime());
|
||||
|
||||
for (OrderPo orderInfo : list) {
|
||||
if (StringUtils.isEmpty(orderInfo.getImgUrl())) {
|
||||
@@ -788,7 +906,7 @@ public class OrderService {
|
||||
}
|
||||
orderInfo.setSkuInfos(skuInfoPos);
|
||||
orderInfo.setZdNo("POS");
|
||||
orderInfo.setNames(orderInfo.getProductName().split(","));
|
||||
orderInfo.setNames(orderInfo.getProductName() == null ? new String[]{""} : orderInfo.getProductName().split(","));
|
||||
}
|
||||
PageInfo pageInfo = new PageInfo(list);
|
||||
log.info("获取订单:{}", JSONUtil.toJSONString(pageInfo));
|
||||
|
||||
@@ -92,6 +92,12 @@ public class PayService {
|
||||
@Autowired
|
||||
private TbProductMapper productMapper;
|
||||
|
||||
@Autowired
|
||||
private TbShopUnitMapper shopUnitMapper;
|
||||
|
||||
@Autowired
|
||||
private TbProductStockDetailMapper productStockDetailMapper;
|
||||
|
||||
@Autowired
|
||||
private RedisUtils redisUtil;
|
||||
|
||||
@@ -107,6 +113,10 @@ public class PayService {
|
||||
private String callBack;
|
||||
|
||||
|
||||
@Autowired
|
||||
TbmerchantAccountMapper tbmerchantAccountMapper;
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
System.out.printf("%.2f%n", new BigDecimal(1).setScale(2, RoundingMode.DOWN));
|
||||
@@ -712,10 +722,27 @@ public class PayService {
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result returnOrder(List<TbOrderDetail> list, String token) {
|
||||
public Result returnOrder(List<TbOrderDetail> list, String token,String pwd) {
|
||||
if (ObjectUtil.isEmpty(list) || list.size() <= 0) {
|
||||
return Result.fail(CodeEnum.PARAM);
|
||||
}
|
||||
//
|
||||
// String accountId= TokenUtil.parseParamFromToken(token).getString("accountId");
|
||||
//
|
||||
// TbmerchantAccount account= tbmerchantAccountMapper.selectByPrimaryKey(Integer.valueOf(accountId));
|
||||
// if(Objects.isNull(account)){
|
||||
// return Result.fail(CodeEnum.ACCOUNTEIXST);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if(Objects.isNull(account.getPwd())||ObjectUtil.isEmpty(account.getPwd())){
|
||||
// return Result.fail(CodeEnum.PWDNOSET);
|
||||
// }
|
||||
//
|
||||
// if(!account.getPwd().equals(MD5Util.encrypt(pwd.concat(account.getAccount()).concat(account.getId().toString())))){
|
||||
// return Result.fail(CodeEnum.PWDERROE);
|
||||
// }
|
||||
|
||||
|
||||
Integer orderId = list.get(0).getOrderId();
|
||||
|
||||
@@ -856,10 +883,20 @@ public class PayService {
|
||||
|
||||
}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());
|
||||
|
||||
@@ -874,7 +911,7 @@ public class PayService {
|
||||
flow.setBizCode("accountReturnPay");
|
||||
flow.setBizName("会员储值卡退款");
|
||||
flow.setType("+");
|
||||
flow.setAmount(orderInfo.getOrderAmount());
|
||||
flow.setAmount(newOrderInfo.getOrderAmount());
|
||||
flow.setBalance(user.getAmount());
|
||||
flow.setCreateTime(new Date());
|
||||
tbShopUserFlowMapper.insert(flow);
|
||||
@@ -918,23 +955,59 @@ public class PayService {
|
||||
|
||||
producer.printMechine(String.valueOf(newOrderInfo.getId()));
|
||||
|
||||
|
||||
|
||||
//修改耗材数据
|
||||
JSONObject jsonObject1=new JSONObject();
|
||||
jsonObject1.put("orderId",orderInfo.getId());
|
||||
jsonObject1.put("type","delete");
|
||||
producer.cons(jsonObject1.toString());
|
||||
|
||||
// 更新商品库存
|
||||
for (TbOrderDetail detail : returnDetail) {
|
||||
detail = tbOrderDetailMapper.selectByPrimaryKey(detail.getId());
|
||||
|
||||
TbProductSku productSku = productSkuMapper.selectByPrimaryKey(detail.getProductSkuId());
|
||||
TbProductWithBLOBs product = productMapper.selectByPrimaryKey(detail.getProductId());
|
||||
|
||||
TbProductStockDetail tbProductStockDetail = new TbProductStockDetail();
|
||||
tbProductStockDetail.setCreatedAt(System.currentTimeMillis());
|
||||
tbProductStockDetail.setUpdatedAt(System.currentTimeMillis());
|
||||
tbProductStockDetail.setShopId(detail.getShopId().toString());
|
||||
tbProductStockDetail.setSourcePath("NORMAL");
|
||||
tbProductStockDetail.setType("退单");
|
||||
tbProductStockDetail.setSubType((byte) 1);
|
||||
tbProductStockDetail.setRemark("退单: " + detail.getOrderId());
|
||||
tbProductStockDetail.setOrderId(String.valueOf(detail.getOrderId()));
|
||||
|
||||
if (ObjectUtil.isNotEmpty(product)) {
|
||||
TbShopUnit shopUnit = shopUnitMapper.selectByPrimaryKey(Integer.valueOf(product.getUnitId()));
|
||||
|
||||
tbProductStockDetail.setProductName(product.getName());
|
||||
tbProductStockDetail.setIsStock(product.getIsStock());
|
||||
tbProductStockDetail.setStockSnap(product.getSelectSpec());
|
||||
tbProductStockDetail.setUnitName(shopUnit.getName());
|
||||
tbProductStockDetail.setProductId(product.getId().toString());
|
||||
|
||||
if (product.getIsDistribute() == 1) {
|
||||
redisUtil.seckill(RedisCst.PRODUCT + shopId.toString() + ":product" + product.getId().toString(), String.valueOf(detail.getReturnNum() + product.getStockNumber().intValue()));
|
||||
// redisUtil.seckill(RedisCst.PRODUCT + shopId.toString() + ":product" + product.getId().toString(), String.valueOf(detail.getReturnNum() + product.getStockNumber().intValue()));
|
||||
productMapper.updateStockById(product.getId(), detail.getReturnNum() * -1);
|
||||
|
||||
tbProductStockDetail.setLeftNumber(product.getStockNumber());
|
||||
tbProductStockDetail.setStockNumber(Double.valueOf(detail.getReturnNum()));
|
||||
} else {
|
||||
if (ObjectUtil.isNotEmpty(productSku)) {
|
||||
redisUtil.seckill(RedisCst.PRODUCT + shopId.toString() + ":" + productSku.getId().toString(), String.valueOf(detail.getReturnNum() + productSku.getStockNumber().intValue()));
|
||||
// redisUtil.seckill(RedisCst.PRODUCT + shopId.toString() + ":" + productSku.getId().toString(), String.valueOf(detail.getReturnNum() + productSku.getStockNumber().intValue()));
|
||||
productSkuMapper.updateByskuIdSub(productSku.getId(), detail.getReturnNum() * -1);
|
||||
|
||||
tbProductStockDetail.setSkuId(productSku.getId().toString());
|
||||
tbProductStockDetail.setLeftNumber(productSku.getStockNumber().intValue());
|
||||
tbProductStockDetail.setStockNumber(Double.valueOf(detail.getReturnNum()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
productStockDetailMapper.insert(tbProductStockDetail);
|
||||
}
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.ShopCategoryVo;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
||||
@@ -122,4 +123,34 @@ public class ProductService {
|
||||
PageInfo pageInfo=new PageInfo(tbProductWithBLOBs);
|
||||
return Result.success(CodeEnum.SUCCESS,pageInfo);
|
||||
}
|
||||
|
||||
public void incrStock(String productId, String skuId, int addNum) {
|
||||
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(productId));
|
||||
if (product.getIsDistribute() == 1) {
|
||||
tbProductMapper.incrStock(productId, addNum);
|
||||
}else {
|
||||
tbProductSkuMapper.incrStock(skuId, addNum);
|
||||
}
|
||||
}
|
||||
|
||||
public void decrStock(String productId, String skuId, int decrNum) {
|
||||
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(productId));
|
||||
if (product.getIsDistribute() == 1) {
|
||||
if (product.getIsStock() == 1) {
|
||||
if (tbProductMapper.decrStock(productId, decrNum) < 1) {
|
||||
throw new MsgException("库存不足,下单失败");
|
||||
}
|
||||
}else {
|
||||
tbProductMapper.decrStockUnCheck(productId, decrNum);
|
||||
}
|
||||
}else {
|
||||
if (product.getIsStock() == 1) {
|
||||
if (tbProductSkuMapper.decrStock(String.valueOf(skuId), decrNum) < 1) {
|
||||
throw new MsgException("库存不足,下单失败");
|
||||
}
|
||||
}else {
|
||||
tbProductSkuMapper.decrStockUnCheck(String.valueOf(skuId), decrNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,8 +98,11 @@ public enum CodeEnum {
|
||||
|
||||
CONSERROR("100036",false,"商品已售罄","fail"),
|
||||
|
||||
PWDNOSET("100037",false,"操作密码未设置","fail"),
|
||||
|
||||
|
||||
PWDERROE("100038",false,"操作密码错误","fail"),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -18,4 +18,6 @@ public class RedisCst {
|
||||
public static final String OUT_NUMBER="ORDER:NUMBER:";
|
||||
|
||||
public static final String ORDER_MESSAGE="ORDER:MESSAGE:";
|
||||
public static final String ORDER_PRODUCT_NUM = "ORDER_NUM:";
|
||||
public static final String ORDER_CART_EXISTS = "ORDER_CART_EXISTS:";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.chaozhanggui.system.cashierservice.util;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class WechatUtil {
|
||||
@Value("${wx.msg.appId}")
|
||||
private String appId;
|
||||
|
||||
@Value("${wx.msg.secrete}")
|
||||
private String secrete;
|
||||
|
||||
@Value("${wx.msg.warnMsgTmpId}")
|
||||
private String msgTmpId;
|
||||
|
||||
static LinkedHashMap<String,String> linkedHashMap=new LinkedHashMap<>();
|
||||
|
||||
static {
|
||||
|
||||
linkedHashMap.put("40001","获取 access_token 时 AppSecret 错误,或者 access_token 无效。请开发者认真比对 AppSecret 的正确性,或查看是否正在为恰当的公众号调用接口");
|
||||
linkedHashMap.put("40003","不合法的 OpenID ,请开发者确认 OpenID (该用户)是否已关注公众号,或是否是其他公众号的 OpenID");
|
||||
linkedHashMap.put("40014","不合法的 access_token ,请开发者认真比对 access_token 的有效性(如是否过期),或查看是否正在为恰当的公众号调用接口");
|
||||
linkedHashMap.put("40037","不合法的 template_id");
|
||||
linkedHashMap.put("43101","用户未订阅消息");
|
||||
linkedHashMap.put("43107","订阅消息能力封禁");
|
||||
linkedHashMap.put("43108","并发下发消息给同一个粉丝");
|
||||
linkedHashMap.put("45168","命中敏感词");
|
||||
linkedHashMap.put("47003","参数错误");
|
||||
|
||||
}
|
||||
|
||||
public JSONObject getAccessToken(){
|
||||
String requestUrl = "https://api.weixin.qq.com/cgi-bin/token";
|
||||
Map<String, String> requestUrlParam = new HashMap<>();
|
||||
//小程序appId
|
||||
requestUrlParam.put("appid", appId);
|
||||
//小程序secret
|
||||
requestUrlParam.put("secret", secrete);
|
||||
//默认参数
|
||||
requestUrlParam.put("grant_type", "client_credential");
|
||||
JSONObject jsonObject = JSON.parseObject(HttpClientUtil.doGet(requestUrl,requestUrlParam));
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String id ="kSxJL9TR4s_UmOmNLE";
|
||||
// sendStockWarnMsg("123", "1231", "1231", "23321", id);
|
||||
}
|
||||
|
||||
public JSONObject sendStockWarnMsg(String shopName, String productName, String stock, String note, String toUserOpenId) {
|
||||
Map<String, Object> data = new HashMap<String, Object>() {{
|
||||
put("thing1", new HashMap<String, Object>(){{
|
||||
put("value", shopName);
|
||||
}});
|
||||
put("thing6", new HashMap<String, Object>(){{
|
||||
put("value", productName);
|
||||
}});
|
||||
put("number7", new HashMap<String, Object>(){{
|
||||
put("value", stock);
|
||||
}});
|
||||
put("thing5", new HashMap<String, Object>(){{
|
||||
put("value", note);
|
||||
}});
|
||||
}};
|
||||
log.info("开始发送库存预警消息, 接收用户openId: {}, 消息数据: {}", toUserOpenId, data);
|
||||
return sendTempMsg(msgTmpId, toUserOpenId, data);
|
||||
}
|
||||
|
||||
|
||||
public JSONObject sendTempMsg(String tempId, String toUserOpenId, Map<String, Object> data) {
|
||||
log.info("开始发送微信模板消息, 接收用户openId: {}, 消息数据: {}", toUserOpenId, data);
|
||||
JSONObject object= getAccessToken();
|
||||
String accessToken=object.get("access_token")+"";
|
||||
|
||||
JSONObject object1=new JSONObject();
|
||||
|
||||
object1.put("template_id", tempId);
|
||||
object1.put("touser", toUserOpenId);
|
||||
object1.put("data",data);
|
||||
|
||||
object1.put("miniprogram_state","trial");
|
||||
object1.put("lang","zh_CN");
|
||||
|
||||
String response= HttpRequest.post("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=".concat(accessToken)).body(object1.toString()).execute().body();
|
||||
log.info("微信模板消息发送成功,相应内容:{}",response);
|
||||
JSONObject resObj=JSONObject.parseObject(response);
|
||||
if(ObjectUtil.isNotEmpty(resObj)&&ObjectUtil.isNotNull(resObj)&&"0".equals(resObj.get("errcode")+"")){
|
||||
return resObj;
|
||||
}
|
||||
|
||||
throw new RuntimeException(linkedHashMap.getOrDefault(resObj.get("errcode") + "", "未知错误"));
|
||||
}
|
||||
}
|
||||
@@ -20,11 +20,11 @@ logging:
|
||||
file:
|
||||
# 切记,该文件表示正在产出日志的日志文件。并不会打包,当文件大于max-file-size,会根据file-name-pattern格式打包
|
||||
# 名称为log/cashier-client.log文件夹会在项目根目录下,打包后会在启动包同目录下;名称为/log/cashier-client.log的文件夹会在项目所在磁盘的跟目录下
|
||||
name: log/cashier-client.log
|
||||
name: cashier-client.log
|
||||
logback:
|
||||
rollingpolicy:
|
||||
# 单文件的大小,默认10M, 超过之后打包成一个日志文件
|
||||
max-file-size: 1MB
|
||||
max-file-size: 10MB
|
||||
# 日志保存的天数
|
||||
max-history: 30
|
||||
# 打包文件格式,默认: ${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz,书写格式为:文件路径/文件名.%i.文件后缀,其中%i不可省去,否则无日志显示
|
||||
@@ -32,6 +32,7 @@ logging:
|
||||
# 如果是压缩包,里面会多一个名log/ota.2021-11-05.0的日志文件
|
||||
# 如下面的例子,打包之后为: log/2021-11/cashier-client.2020-11-5.0.log,这是一个日志文件
|
||||
file-name-pattern: log/%d{yyyy-MM}/cashier-client.%d{yyyy-MM-dd}.%i.log
|
||||
# file-name-pattern: log/%d{yyyy-MM}/cashier-client.%d{yyyy-MM-dd}.%i.log.gz
|
||||
|
||||
|
||||
gateway:
|
||||
@@ -48,6 +49,7 @@ wx:
|
||||
msg:
|
||||
appId: wxcf0fe8cdba153fd6
|
||||
secrete: c33e06467c6879a62af633d50ed6b720
|
||||
warnMsgTmpId: IZ-l9p9yBgcvhRR0uN6cBQPkWJ5i05zyWMkfeCPaAmY
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -52,14 +52,8 @@
|
||||
|
||||
<!-- 要生成的表tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
|
||||
<!-- <table tableName="%" schema="fycashier" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" ></table>-->
|
||||
<table tableName="tb_cons_info" domainObjectName="TbConsInfo"
|
||||
enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
|
||||
enableSelectByExample="false" selectByExampleQueryId="false" >
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<table tableName="tb_prosku_con" domainObjectName="TbProskuCon"
|
||||
<table tableName="tb_user_shop_msg" domainObjectName="TbUserShopMsg"
|
||||
enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
|
||||
enableSelectByExample="false" selectByExampleQueryId="false" >
|
||||
</table>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<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="pro_sku_id" jdbcType="INTEGER" property="proSkuId" />
|
||||
<result column="con_name" jdbcType="VARCHAR" property="conName" />
|
||||
<result column="amount" jdbcType="DECIMAL" property="amount" />
|
||||
<result column="balance" jdbcType="DECIMAL" property="balance" />
|
||||
@@ -29,11 +30,11 @@
|
||||
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,
|
||||
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)
|
||||
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{consId,jdbcType=INTEGER},
|
||||
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})
|
||||
@@ -163,15 +164,17 @@
|
||||
</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},
|
||||
create_time)
|
||||
values
|
||||
<foreach collection ="list" item="item" separator =",">
|
||||
( #{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})
|
||||
now())
|
||||
</foreach>
|
||||
|
||||
</insert>
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
<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="price" jdbcType="DECIMAL" property="price" />
|
||||
<result column="stock_consume" jdbcType="DECIMAL" property="stockConsume" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="con_unit" jdbcType="VARCHAR" property="conUnit" />
|
||||
<result column="laster_in_stock" jdbcType="DECIMAL" property="lasterInStock" />
|
||||
<result column="con_warning" jdbcType="DECIMAL" property="conWarning" />
|
||||
@@ -16,7 +19,7 @@
|
||||
<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,
|
||||
id, shop_id, con_type_id, con_type_name, con_code, con_name, stock_number,price,stock_consume,status, con_unit,
|
||||
laster_in_stock, con_warning, create_time, update_time
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
@@ -171,7 +174,8 @@
|
||||
laster_in_stock = #{lasterInStock,jdbcType=DECIMAL},
|
||||
con_warning = #{conWarning,jdbcType=DECIMAL},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
stock_consume=#{stockConsume,jdbcType=DECIMAL}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
@@ -187,7 +191,7 @@
|
||||
<update id="batchStock">
|
||||
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
|
||||
update tb_cons_info
|
||||
set stock_number= stock_number- #{item.amount},
|
||||
set stock_consume= stock_consume + #{item.amount},
|
||||
update_time = now()
|
||||
where id = #{item.id}
|
||||
</foreach>
|
||||
|
||||
@@ -51,11 +51,11 @@
|
||||
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, order_no, settlement_amount, pack_fee, origin_amount, product_amount, amount,
|
||||
refund_amount, pay_type, pay_amount, order_amount, freight_amount, discount_ratio,
|
||||
discount_amount, table_id, small_change, send_type, order_type, product_type, status,
|
||||
billing_id, merchant_id, shop_id, is_vip, member_id, user_id, product_score, deduct_score,
|
||||
user_coupon_id, user_coupon_amount, refund_able, paid_time, is_effect, is_group,
|
||||
id, order_no, settlement_amount, pack_fee, origin_amount, product_amount, amount,
|
||||
refund_amount, pay_type, pay_amount, order_amount, freight_amount, discount_ratio,
|
||||
discount_amount, table_id, small_change, send_type, order_type, product_type, status,
|
||||
billing_id, merchant_id, shop_id, is_vip, member_id, user_id, product_score, deduct_score,
|
||||
user_coupon_id, user_coupon_amount, refund_able, paid_time, is_effect, is_group,
|
||||
updated_at, `system_time`, created_at, is_accepted, pay_order_no,trade_day,`source`,remark,master_id,`table_name`,out_number
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
@@ -83,6 +83,13 @@
|
||||
|
||||
WHERE
|
||||
toi.shop_id = #{shopId}
|
||||
<if test="startTime != null">
|
||||
and created_at >= #{startTime}
|
||||
</if>
|
||||
|
||||
<if test="endTime != null">
|
||||
and created_at <= #{endTime}
|
||||
</if>
|
||||
<choose>
|
||||
<when test="orderType == 'return'">
|
||||
and toi.order_type = 'return' and toi.status in ('refund','closed')
|
||||
@@ -110,32 +117,32 @@
|
||||
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbOrderInfo"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
insert into tb_order_info (id, order_no, settlement_amount,
|
||||
pack_fee, origin_amount, product_amount,
|
||||
amount, refund_amount, pay_type,
|
||||
pay_amount, order_amount, freight_amount,
|
||||
discount_ratio, discount_amount, table_id,
|
||||
small_change, send_type, order_type,
|
||||
product_type, status, billing_id,
|
||||
merchant_id, shop_id, is_vip,
|
||||
member_id, user_id, product_score,
|
||||
deduct_score, user_coupon_id, user_coupon_amount,
|
||||
refund_able, paid_time, is_effect,
|
||||
is_group, updated_at, system_time,
|
||||
insert into tb_order_info (id, order_no, settlement_amount,
|
||||
pack_fee, origin_amount, product_amount,
|
||||
amount, refund_amount, pay_type,
|
||||
pay_amount, order_amount, freight_amount,
|
||||
discount_ratio, discount_amount, table_id,
|
||||
small_change, send_type, order_type,
|
||||
product_type, status, billing_id,
|
||||
merchant_id, shop_id, is_vip,
|
||||
member_id, user_id, product_score,
|
||||
deduct_score, user_coupon_id, user_coupon_amount,
|
||||
refund_able, paid_time, is_effect,
|
||||
is_group, updated_at, system_time,
|
||||
created_at, is_accepted, pay_order_no,trade_day,source,remark,master_id,table_name,out_number
|
||||
)
|
||||
values (#{id,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{settlementAmount,jdbcType=DECIMAL},
|
||||
#{packFee,jdbcType=DECIMAL}, #{originAmount,jdbcType=DECIMAL}, #{productAmount,jdbcType=DECIMAL},
|
||||
#{amount,jdbcType=DECIMAL}, #{refundAmount,jdbcType=DECIMAL}, #{payType,jdbcType=VARCHAR},
|
||||
#{payAmount,jdbcType=DECIMAL}, #{orderAmount,jdbcType=DECIMAL}, #{freightAmount,jdbcType=DECIMAL},
|
||||
#{discountRatio,jdbcType=DECIMAL}, #{discountAmount,jdbcType=DECIMAL}, #{tableId,jdbcType=VARCHAR},
|
||||
#{smallChange,jdbcType=DECIMAL}, #{sendType,jdbcType=VARCHAR}, #{orderType,jdbcType=VARCHAR},
|
||||
#{productType,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{billingId,jdbcType=VARCHAR},
|
||||
#{merchantId,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR}, #{isVip,jdbcType=TINYINT},
|
||||
#{memberId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{productScore,jdbcType=INTEGER},
|
||||
#{deductScore,jdbcType=INTEGER}, #{userCouponId,jdbcType=VARCHAR}, #{userCouponAmount,jdbcType=DECIMAL},
|
||||
#{refundAble,jdbcType=TINYINT}, #{paidTime,jdbcType=BIGINT}, #{isEffect,jdbcType=TINYINT},
|
||||
#{isGroup,jdbcType=TINYINT}, #{updatedAt,jdbcType=BIGINT}, #{systemTime,jdbcType=BIGINT},
|
||||
values (#{id,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{settlementAmount,jdbcType=DECIMAL},
|
||||
#{packFee,jdbcType=DECIMAL}, #{originAmount,jdbcType=DECIMAL}, #{productAmount,jdbcType=DECIMAL},
|
||||
#{amount,jdbcType=DECIMAL}, #{refundAmount,jdbcType=DECIMAL}, #{payType,jdbcType=VARCHAR},
|
||||
#{payAmount,jdbcType=DECIMAL}, #{orderAmount,jdbcType=DECIMAL}, #{freightAmount,jdbcType=DECIMAL},
|
||||
#{discountRatio,jdbcType=DECIMAL}, #{discountAmount,jdbcType=DECIMAL}, #{tableId,jdbcType=VARCHAR},
|
||||
#{smallChange,jdbcType=DECIMAL}, #{sendType,jdbcType=VARCHAR}, #{orderType,jdbcType=VARCHAR},
|
||||
#{productType,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{billingId,jdbcType=VARCHAR},
|
||||
#{merchantId,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR}, #{isVip,jdbcType=TINYINT},
|
||||
#{memberId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{productScore,jdbcType=INTEGER},
|
||||
#{deductScore,jdbcType=INTEGER}, #{userCouponId,jdbcType=VARCHAR}, #{userCouponAmount,jdbcType=DECIMAL},
|
||||
#{refundAble,jdbcType=TINYINT}, #{paidTime,jdbcType=BIGINT}, #{isEffect,jdbcType=TINYINT},
|
||||
#{isGroup,jdbcType=TINYINT}, #{updatedAt,jdbcType=BIGINT}, #{systemTime,jdbcType=BIGINT},
|
||||
#{createdAt,jdbcType=BIGINT}, #{isAccepted,jdbcType=TINYINT}, #{payOrderNo,jdbcType=VARCHAR},
|
||||
#{tradeDay,jdbcType=VARCHAR}, #{source,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, #{masterId,jdbcType=VARCHAR},#{tableName,jdbcType=VARCHAR},
|
||||
#{outNumber,jdbcType=VARCHAR}
|
||||
@@ -592,4 +599,4 @@ 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>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@@ -932,7 +932,7 @@
|
||||
|
||||
<update id="updateStockById">
|
||||
update tb_product
|
||||
set stock_number = stock_number - #{number,jdbcType=INTEGER}
|
||||
set stock_number = stock_number - #{num,jdbcType=INTEGER}
|
||||
where id = #{productId}
|
||||
</update>
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<result column="stock_number" jdbcType="DOUBLE" property="stockNumber" />
|
||||
<result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
|
||||
<result column="warn_line" jdbcType="INTEGER" property="warnLine" />
|
||||
<result column="suit" jdbcType="INTEGER" property="suit" />
|
||||
<result column="weight" jdbcType="DOUBLE" property="weight" />
|
||||
<result column="volume" jdbcType="REAL" property="volume" />
|
||||
<result column="real_sales_number" jdbcType="DOUBLE" property="realSalesNumber" />
|
||||
@@ -29,15 +30,15 @@
|
||||
<result column="spec_snap" jdbcType="LONGVARCHAR" property="specSnap" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, shop_id, bar_code, product_id, origin_price, cost_price, member_price, meal_price,
|
||||
sale_price, guide_price, strategy_price, stock_number, cover_img, warn_line, weight,
|
||||
volume, real_sales_number, first_shared, second_shared, created_at, updated_at
|
||||
id, shop_id, bar_code, product_id, origin_price, cost_price, member_price, meal_price,
|
||||
sale_price, guide_price, strategy_price, stock_number, cover_img, warn_line, weight,
|
||||
volume, real_sales_number, first_shared, second_shared, created_at, updated_at,suit
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
spec_info, spec_snap
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
@@ -49,21 +50,21 @@
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductSkuWithBLOBs">
|
||||
insert into tb_product_sku (id, shop_id, bar_code,
|
||||
product_id, origin_price, cost_price,
|
||||
member_price, meal_price, sale_price,
|
||||
guide_price, strategy_price, stock_number,
|
||||
cover_img, warn_line, weight,
|
||||
volume, real_sales_number, first_shared,
|
||||
second_shared, created_at, updated_at,
|
||||
insert into tb_product_sku (id, shop_id, bar_code,
|
||||
product_id, origin_price, cost_price,
|
||||
member_price, meal_price, sale_price,
|
||||
guide_price, strategy_price, stock_number,
|
||||
cover_img, warn_line, weight,
|
||||
volume, real_sales_number, first_shared,
|
||||
second_shared, created_at, updated_at,
|
||||
spec_info, spec_snap)
|
||||
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=VARCHAR}, #{barCode,jdbcType=VARCHAR},
|
||||
#{productId,jdbcType=VARCHAR}, #{originPrice,jdbcType=DECIMAL}, #{costPrice,jdbcType=DECIMAL},
|
||||
#{memberPrice,jdbcType=DECIMAL}, #{mealPrice,jdbcType=DECIMAL}, #{salePrice,jdbcType=DECIMAL},
|
||||
#{guidePrice,jdbcType=DECIMAL}, #{strategyPrice,jdbcType=DECIMAL}, #{stockNumber,jdbcType=DOUBLE},
|
||||
#{coverImg,jdbcType=VARCHAR}, #{warnLine,jdbcType=INTEGER}, #{weight,jdbcType=DOUBLE},
|
||||
#{volume,jdbcType=REAL}, #{realSalesNumber,jdbcType=DOUBLE}, #{firstShared,jdbcType=DECIMAL},
|
||||
#{secondShared,jdbcType=DECIMAL}, #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT},
|
||||
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=VARCHAR}, #{barCode,jdbcType=VARCHAR},
|
||||
#{productId,jdbcType=VARCHAR}, #{originPrice,jdbcType=DECIMAL}, #{costPrice,jdbcType=DECIMAL},
|
||||
#{memberPrice,jdbcType=DECIMAL}, #{mealPrice,jdbcType=DECIMAL}, #{salePrice,jdbcType=DECIMAL},
|
||||
#{guidePrice,jdbcType=DECIMAL}, #{strategyPrice,jdbcType=DECIMAL}, #{stockNumber,jdbcType=DOUBLE},
|
||||
#{coverImg,jdbcType=VARCHAR}, #{warnLine,jdbcType=INTEGER}, #{weight,jdbcType=DOUBLE},
|
||||
#{volume,jdbcType=REAL}, #{realSalesNumber,jdbcType=DOUBLE}, #{firstShared,jdbcType=DECIMAL},
|
||||
#{secondShared,jdbcType=DECIMAL}, #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT},
|
||||
#{specInfo,jdbcType=LONGVARCHAR}, #{specSnap,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductSkuWithBLOBs">
|
||||
@@ -344,7 +345,7 @@
|
||||
</update>
|
||||
|
||||
<select id="selectByShopIdAndProductIdAndSpec" resultMap="ResultMapWithBLOBs">
|
||||
select * from tb_product_sku where shop_id=#{shopId} and product_id=#{productId}
|
||||
select * from tb_product_sku where shop_id=#{shopId} and product_id=#{productId} and is_del=0
|
||||
|
||||
<if test="spec != null and spec !=''">
|
||||
and spec_snap = #{spec}
|
||||
@@ -364,4 +365,4 @@
|
||||
</foreach>
|
||||
|
||||
</update>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<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_id" jdbcType="INTEGER" property="productId" />
|
||||
<result column="product_sku_id" jdbcType="INTEGER" property="productSkuId" />
|
||||
<result column="con_info_id" jdbcType="INTEGER" property="conInfoId" />
|
||||
<result column="surplus_stock" jdbcType="DECIMAL" property="surplusStock" />
|
||||
@@ -11,7 +12,7 @@
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, shop_id, product_sku_id, con_info_id, surplus_stock, status, create_time
|
||||
id, shop_id,product_id ,product_sku_id, con_info_id, surplus_stock, status, create_time
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
@@ -119,7 +120,7 @@
|
||||
|
||||
|
||||
<select id="selectBySkuIdAndShopId" resultMap="BaseResultMap">
|
||||
select * from tb_prosku_con where product_sku_id=#{shopId} and shop_id=#{shopId} and status=1
|
||||
select * from tb_prosku_con where product_sku_id=#{skuId} and shop_id=#{shopId} and status=1
|
||||
</select>
|
||||
|
||||
<select id="selectIdBySkuIdAndShopId" resultType="java.lang.Integer">
|
||||
@@ -133,4 +134,9 @@
|
||||
AND p.`status` = 1
|
||||
group by p.con_info_id
|
||||
</select>
|
||||
|
||||
<select id="selectByShopIdAndSkuIdAndProductId" resultMap="BaseResultMap">
|
||||
|
||||
select * from tb_prosku_con where product_sku_id=#{skuId} and shop_id=#{shopId} and product_id=#{productId} and status=1
|
||||
</select>
|
||||
</mapper>
|
||||
91
src/main/resources/mapper/TbShopOpenIdMapper.xml
Normal file
91
src/main/resources/mapper/TbShopOpenIdMapper.xml
Normal file
@@ -0,0 +1,91 @@
|
||||
<?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.TbShopOpenIdMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbShopOpenId">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
|
||||
<result property="openId" column="open_id" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="status" jdbcType="TINYINT"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,shop_id,open_id,
|
||||
status,create_time,update_time
|
||||
</sql>
|
||||
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_shop_open_id
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from tb_shop_open_id
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopOpenId" useGeneratedKeys="true">
|
||||
insert into tb_shop_open_id
|
||||
( id,shop_id,open_id
|
||||
,status,create_time,update_time
|
||||
)
|
||||
values (#{id,jdbcType=INTEGER},#{shopId,jdbcType=INTEGER},#{openId,jdbcType=VARCHAR}
|
||||
,#{status,jdbcType=TINYINT},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopOpenId" useGeneratedKeys="true">
|
||||
insert into tb_shop_open_id
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="shopId != null">shop_id,</if>
|
||||
<if test="openId != null">open_id,</if>
|
||||
<if test="status != null">status,</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="openId != null">#{openId,jdbcType=VARCHAR},</if>
|
||||
<if test="status != null">#{status,jdbcType=TINYINT},</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.TbShopOpenId">
|
||||
update tb_shop_open_id
|
||||
<set>
|
||||
<if test="shopId != null">
|
||||
shop_id = #{shopId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="openId != null">
|
||||
open_id = #{openId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status,jdbcType=TINYINT},
|
||||
</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.TbShopOpenId">
|
||||
update tb_shop_open_id
|
||||
set
|
||||
shop_id = #{shopId,jdbcType=INTEGER},
|
||||
open_id = #{openId,jdbcType=VARCHAR},
|
||||
status = #{status,jdbcType=TINYINT},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -2,7 +2,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.TbUserShopMsgMapper">
|
||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg">
|
||||
<id column="shop_id" jdbcType="INTEGER" property="shopId" />
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
|
||||
<result column="open_id" jdbcType="VARCHAR" property="openId" />
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
@@ -10,29 +11,32 @@
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
shop_id, open_id, remark, status, create_time, update_time
|
||||
id, shop_id, open_id, remark, status, create_time, update_time
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_user_shop_msg
|
||||
where shop_id = #{shopId,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
delete from tb_user_shop_msg
|
||||
where shop_id = #{shopId,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg">
|
||||
insert into tb_user_shop_msg (shop_id, open_id, remark,
|
||||
status, create_time, update_time
|
||||
)
|
||||
values (#{shopId,jdbcType=INTEGER}, #{openId,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
|
||||
#{status,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
|
||||
)
|
||||
insert into tb_user_shop_msg (id, shop_id, open_id,
|
||||
remark, status, create_time,
|
||||
update_time)
|
||||
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{openId,jdbcType=VARCHAR},
|
||||
#{remark,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{updateTime,jdbcType=TIMESTAMP})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg">
|
||||
insert into tb_user_shop_msg
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
shop_id,
|
||||
</if>
|
||||
@@ -53,6 +57,9 @@
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
#{shopId,jdbcType=INTEGER},
|
||||
</if>
|
||||
@@ -76,6 +83,9 @@
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg">
|
||||
update tb_user_shop_msg
|
||||
<set>
|
||||
<if test="shopId != null">
|
||||
shop_id = #{shopId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="openId != null">
|
||||
open_id = #{openId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -92,15 +102,20 @@
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where shop_id = #{shopId,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg">
|
||||
update tb_user_shop_msg
|
||||
set open_id = #{openId,jdbcType=VARCHAR},
|
||||
set shop_id = #{shopId,jdbcType=INTEGER},
|
||||
open_id = #{openId,jdbcType=VARCHAR},
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
status = #{status,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
||||
where shop_id = #{shopId,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
<select id="selectAllByShopId" resultMap="BaseResultMap">
|
||||
select * from tb_user_shop_msg where shop_id=#{shopId}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -22,6 +22,8 @@
|
||||
<result column="msg_able" jdbcType="TINYINT" property="msgAble" />
|
||||
<result column="created_at" jdbcType="BIGINT" property="createdAt" />
|
||||
<result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
|
||||
|
||||
<result column="pwd" jdbcType="VARCHAR" property="pwd" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chaozhanggui.system.cashierservice.entity.TbmerchantAccount">
|
||||
<result column="head_img" jdbcType="LONGVARCHAR" property="headImg" />
|
||||
@@ -29,7 +31,7 @@
|
||||
<sql id="Base_Column_List">
|
||||
id, account, password, merchant_id, shop_id, shop_snap, is_admin, is_mercantile,
|
||||
name, sex, email, telephone, status, sort, role_id, last_login_at, mp_open_id, msg_able,
|
||||
created_at, updated_at
|
||||
created_at, updated_at,pwd
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
head_img
|
||||
|
||||
Reference in New Issue
Block a user