Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fad761b63c | ||
|
|
75ec8fc9e5 | ||
| e91636a188 | |||
|
|
d8305159bd | ||
| b96c4dcef2 | |||
| aa51ff123b | |||
| 7b90da01d6 | |||
|
|
abc5ea04e4 | ||
|
|
22c0032f78 | ||
|
|
3668252207 | ||
| 92fb9c48a0 | |||
|
|
bd0054ffa8 | ||
|
|
2310a0164b | ||
|
|
82935827f5 | ||
|
|
b66a89b143 | ||
|
|
fa2668ed1c |
7
pom.xml
7
pom.xml
@@ -178,6 +178,13 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.binarywang</groupId>
|
||||||
|
<artifactId>weixin-java-mp-jdk6</artifactId>
|
||||||
|
<version>2.2.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<!-- <profiles>-->
|
<!-- <profiles>-->
|
||||||
<!-- <profile>-->
|
<!-- <profile>-->
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.chaozhanggui.system.cashierservice;
|
package com.chaozhanggui.system.cashierservice;
|
||||||
|
|
||||||
|
|
||||||
|
import com.chaozhanggui.system.cashierservice.task.ConsInfoTask;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -44,6 +45,7 @@ public class Shell {
|
|||||||
@Bean
|
@Bean
|
||||||
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
|
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
|
||||||
return (args) -> {
|
return (args) -> {
|
||||||
|
// ctx.getBean(ConsInfoTask.class).init();
|
||||||
logger.info("=========================启动完成==========================");
|
logger.info("=========================启动完成==========================");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,4 +43,11 @@ public class LoginContoller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "getShopInfo")
|
||||||
|
public Result getShopInfo(@RequestHeader("token") String token,
|
||||||
|
@RequestHeader("loginName") String loginName,
|
||||||
|
@RequestHeader("clientType") String clientType){
|
||||||
|
return loginService.getShopInfo(token);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,125 @@
|
|||||||
|
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;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
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.*;
|
||||||
|
|
||||||
|
@CrossOrigin(origins = "*")
|
||||||
|
@RestController
|
||||||
|
@Slf4j
|
||||||
|
@RequestMapping("qrcode")
|
||||||
|
public class QrCodeController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
TbUserShopMsgMapper tbUserShopMsgMapper;
|
||||||
|
|
||||||
|
|
||||||
|
// public Result scanCode(){
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping("/getscanCode")
|
||||||
|
public void getscanCode(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
|
|
||||||
|
log.info("****************来自微信服务器的请求:{}", request.getMethod().toUpperCase());
|
||||||
|
//微信服务器POST请求时,用的是UTF-8编码,在接收时也要用同样的编码,否则中文乱码
|
||||||
|
request.setCharacterEncoding("UTF-8");
|
||||||
|
//响应消息时,也要设置同样的编码
|
||||||
|
response.setCharacterEncoding("UTF-8");
|
||||||
|
//判断请求方式是否是post
|
||||||
|
boolean isPost = Objects.equals("POST", request.getMethod().toUpperCase());
|
||||||
|
if(isPost){
|
||||||
|
|
||||||
|
Map map= request.getParameterMap();
|
||||||
|
|
||||||
|
log.info("map:{}",JSONUtil.toJSONString(map));
|
||||||
|
|
||||||
|
}else {
|
||||||
|
String signature=request.getParameter("signature");
|
||||||
|
String timestamp=request.getParameter("timestamp");
|
||||||
|
String nonce=request.getParameter("nonce");
|
||||||
|
String echostr=request.getParameter("echostr");
|
||||||
|
|
||||||
|
if (StringUtils.isEmpty(signature) || StringUtils.isEmpty(timestamp) || StringUtils.isEmpty(nonce) || StringUtils.isEmpty(echostr)) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
String token="chaozhanggui123";
|
||||||
|
|
||||||
|
List<String> list= Arrays.asList(token,timestamp,nonce);
|
||||||
|
Collections.sort(list);
|
||||||
|
StringBuffer sb=new StringBuffer();
|
||||||
|
for(String s: list){
|
||||||
|
sb.append(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
MessageDigest instance = MessageDigest.getInstance("sha1");
|
||||||
|
//使用sha1进行加密,获得byte数组
|
||||||
|
byte[] digest = instance.digest(sb.toString().getBytes());
|
||||||
|
StringBuilder sum = new StringBuilder();
|
||||||
|
for (byte b : digest) {
|
||||||
|
sum.append(Integer.toHexString((b >> 4) & 15));
|
||||||
|
sum.append(Integer.toHexString(b & 15));
|
||||||
|
}
|
||||||
|
// 3)开发者获得加密后的字符串可与 signature 对比,标识该请求来源于微信
|
||||||
|
if (!StringUtils.isEmpty(signature) && signature.equals(sum.toString())) {
|
||||||
|
response.getWriter().write(echostr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
response.getWriter().write("");
|
||||||
|
return;
|
||||||
|
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
response.getWriter().write("");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void main(String[] args){
|
||||||
|
WxMpInMemoryConfigStorage configStorage=new WxMpInMemoryConfigStorage();
|
||||||
|
|
||||||
|
configStorage.setAppId("wxdd2b72cc2c40c979");
|
||||||
|
configStorage.setSecret("4d909d8dbe3e6e7ac31055fa03dcee4b");
|
||||||
|
// configStorage.setAccessToken("");
|
||||||
|
// configStorage.setAesKey("");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
WxMpService wxMpService=new WxMpServiceImpl();
|
||||||
|
|
||||||
|
wxMpService.setWxMpConfigStorage(configStorage);
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
WxMpQrCodeTicket ticket= wxMpService.getQrcodeService().qrCodeCreateLastTicket("哈哈哈哈哈哈哈哈哈哈哈哈");
|
||||||
|
System.out.println(JSONUtil.toJSONString(ticket));
|
||||||
|
} catch (WxErrorException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,12 +2,14 @@ package com.chaozhanggui.system.cashierservice.dao;
|
|||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbConsInfo;
|
import com.chaozhanggui.system.cashierservice.entity.TbConsInfo;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.po.ConsInfoPO;
|
import com.chaozhanggui.system.cashierservice.entity.po.ConsInfoPO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
@Mapper
|
||||||
public interface TbConsInfoMapper {
|
public interface TbConsInfoMapper {
|
||||||
int deleteByPrimaryKey(Integer id);
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
@@ -22,4 +24,7 @@ public interface TbConsInfoMapper {
|
|||||||
int updateByPrimaryKey(TbConsInfo record);
|
int updateByPrimaryKey(TbConsInfo record);
|
||||||
|
|
||||||
void batchStock(@Param("list")List<ConsInfoPO> list);
|
void batchStock(@Param("list")List<ConsInfoPO> list);
|
||||||
|
int countAll();
|
||||||
|
|
||||||
|
List<TbConsInfo> selectAllInfo();
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.chaozhanggui.system.cashierservice.dao;
|
|||||||
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbProduct;
|
import com.chaozhanggui.system.cashierservice.entity.TbProduct;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs;
|
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.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -36,4 +37,8 @@ public interface TbProductMapper {
|
|||||||
|
|
||||||
Integer countOrderByshopIdAndProductId(@Param("shopId") String shopId, @Param("productId") String productId, @Param("masterId") String masterId,@Param("day") String day);
|
Integer countOrderByshopIdAndProductId(@Param("shopId") String shopId, @Param("productId") String productId, @Param("masterId") String masterId,@Param("day") String day);
|
||||||
|
|
||||||
|
void updateStockById(@Param("productId")Integer productId, @Param("num")Integer num);
|
||||||
|
|
||||||
|
|
||||||
|
List<ProConsSkuInfo> selectBySkuId(Integer skuId);
|
||||||
}
|
}
|
||||||
@@ -22,5 +22,13 @@ public interface TbProskuConMapper {
|
|||||||
|
|
||||||
int updateByPrimaryKey(TbProskuCon record);
|
int updateByPrimaryKey(TbProskuCon record);
|
||||||
|
|
||||||
|
|
||||||
List<TbProskuCon> selectBySkuIdAndShopId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
|
List<TbProskuCon> selectBySkuIdAndShopId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
|
||||||
|
|
||||||
|
|
||||||
|
List<Integer> selectIdBySkuIdAndShopId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.chaozhanggui.system.cashierservice.dao;
|
||||||
|
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Mapper
|
||||||
|
public interface TbUserShopMsgMapper {
|
||||||
|
int deleteByPrimaryKey(Integer shopId);
|
||||||
|
|
||||||
|
int insert(TbUserShopMsg record);
|
||||||
|
|
||||||
|
int insertSelective(TbUserShopMsg record);
|
||||||
|
|
||||||
|
TbUserShopMsg selectByPrimaryKey(Integer shopId);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(TbUserShopMsg record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(TbUserShopMsg record);
|
||||||
|
}
|
||||||
@@ -21,10 +21,10 @@ public class TbConsInfo implements Serializable {
|
|||||||
|
|
||||||
private String conUnit;
|
private String conUnit;
|
||||||
|
|
||||||
private BigDecimal surplusStock;
|
|
||||||
|
|
||||||
private BigDecimal lasterInStock;
|
private BigDecimal lasterInStock;
|
||||||
|
|
||||||
|
private BigDecimal conWarning;
|
||||||
|
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
@@ -95,14 +95,6 @@ public class TbConsInfo implements Serializable {
|
|||||||
this.conUnit = conUnit == null ? null : conUnit.trim();
|
this.conUnit = conUnit == null ? null : conUnit.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getSurplusStock() {
|
|
||||||
return surplusStock;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSurplusStock(BigDecimal surplusStock) {
|
|
||||||
this.surplusStock = surplusStock;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getLasterInStock() {
|
public BigDecimal getLasterInStock() {
|
||||||
return lasterInStock;
|
return lasterInStock;
|
||||||
}
|
}
|
||||||
@@ -111,6 +103,14 @@ public class TbConsInfo implements Serializable {
|
|||||||
this.lasterInStock = lasterInStock;
|
this.lasterInStock = lasterInStock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BigDecimal getConWarning() {
|
||||||
|
return conWarning;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConWarning(BigDecimal conWarning) {
|
||||||
|
this.conWarning = conWarning;
|
||||||
|
}
|
||||||
|
|
||||||
public Date getCreateTime() {
|
public Date getCreateTime() {
|
||||||
return createTime;
|
return createTime;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,6 +126,8 @@ public class TbProduct implements Serializable {
|
|||||||
|
|
||||||
private String specTableHeaders;
|
private String specTableHeaders;
|
||||||
|
|
||||||
|
private Integer stockNumber;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private int orderCount;
|
private int orderCount;
|
||||||
|
|
||||||
@@ -642,4 +644,12 @@ public class TbProduct implements Serializable {
|
|||||||
public void setOrderCount(int orderCount) {
|
public void setOrderCount(int orderCount) {
|
||||||
this.orderCount = orderCount;
|
this.orderCount = orderCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getStockNumber() {
|
||||||
|
return stockNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStockNumber(Integer stockNumber) {
|
||||||
|
this.stockNumber = stockNumber;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -49,5 +49,7 @@ public class TbProductSku implements Serializable {
|
|||||||
|
|
||||||
private Long updatedAt;
|
private Long updatedAt;
|
||||||
|
|
||||||
|
private Integer isPauseSale = 0;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.entity;
|
package com.chaozhanggui.system.cashierservice.entity;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
public class TbProskuCon implements Serializable {
|
public class TbProskuCon implements Serializable {
|
||||||
@@ -12,6 +13,8 @@ public class TbProskuCon implements Serializable {
|
|||||||
|
|
||||||
private Integer conInfoId;
|
private Integer conInfoId;
|
||||||
|
|
||||||
|
private BigDecimal surplusStock;
|
||||||
|
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
@@ -50,6 +53,14 @@ public class TbProskuCon implements Serializable {
|
|||||||
this.conInfoId = conInfoId;
|
this.conInfoId = conInfoId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BigDecimal getSurplusStock() {
|
||||||
|
return surplusStock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSurplusStock(BigDecimal surplusStock) {
|
||||||
|
this.surplusStock = surplusStock;
|
||||||
|
}
|
||||||
|
|
||||||
public String getStatus() {
|
public String getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package com.chaozhanggui.system.cashierservice.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class TbUserShopMsg implements Serializable {
|
||||||
|
private Integer shopId;
|
||||||
|
|
||||||
|
private String openId;
|
||||||
|
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public Integer getShopId() {
|
||||||
|
return shopId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShopId(Integer shopId) {
|
||||||
|
this.shopId = shopId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOpenId() {
|
||||||
|
return openId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpenId(String openId) {
|
||||||
|
this.openId = openId == null ? null : openId.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRemark() {
|
||||||
|
return remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemark(String remark) {
|
||||||
|
this.remark = remark == null ? null : remark.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status == null ? null : status.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getUpdateTime() {
|
||||||
|
return updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateTime(Date updateTime) {
|
||||||
|
this.updateTime = updateTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.chaozhanggui.system.cashierservice.entity.po;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ProConsSkuInfo implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
private String shopId;
|
||||||
|
|
||||||
|
private String productSkuId;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
private String conId;
|
||||||
|
|
||||||
|
private String conCode;
|
||||||
|
|
||||||
|
private String conName;
|
||||||
|
|
||||||
|
private BigDecimal surplusStock;
|
||||||
|
|
||||||
|
private BigDecimal stockNumber;
|
||||||
|
|
||||||
|
private BigDecimal conWarning;
|
||||||
|
|
||||||
|
private String productId;
|
||||||
|
|
||||||
|
private String productName;
|
||||||
|
|
||||||
|
private String specSnap;
|
||||||
|
}
|
||||||
@@ -23,6 +23,7 @@ public class WebAppConfigurer implements WebMvcConfigurer {
|
|||||||
.excludePathPatterns("/data/handoverData")
|
.excludePathPatterns("/data/handoverData")
|
||||||
.excludePathPatterns("/order/scanSendMessage")
|
.excludePathPatterns("/order/scanSendMessage")
|
||||||
.excludePathPatterns("/order/getsendMessage")
|
.excludePathPatterns("/order/getsendMessage")
|
||||||
|
.excludePathPatterns("/qrcode/getscanCode")
|
||||||
.excludePathPatterns("/order/sendMessage");
|
.excludePathPatterns("/order/sendMessage");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,6 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.rabbit;
|
package com.chaozhanggui.system.cashierservice.rabbit;
|
||||||
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.chaozhanggui.system.cashierservice.dao.TbCashierCartMapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.dao.TbConsInfoMapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.dao.TbProskuConMapper;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbCashierCart;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbConsInfo;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.TbProskuCon;
|
|
||||||
import com.chaozhanggui.system.cashierservice.entity.po.ConsInfoPO;
|
|
||||||
import com.chaozhanggui.system.cashierservice.service.ConsService;
|
import com.chaozhanggui.system.cashierservice.service.ConsService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||||
@@ -18,13 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.sql.Time;
|
|
||||||
import java.sql.Timestamp;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@RabbitListener(queues = {RabbitConstants.CONS_COLLECT_QUEUE_PUT})
|
@RabbitListener(queues = {RabbitConstants.CONS_COLLECT_QUEUE_PUT})
|
||||||
|
|||||||
@@ -0,0 +1,236 @@
|
|||||||
|
package com.chaozhanggui.system.cashierservice.rabbit;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||||
|
import com.chaozhanggui.system.cashierservice.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.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.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;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@RabbitListener(queues = {RabbitConstants.CONS_MSG_COLLECT_QUEUE_PUT})
|
||||||
|
@Service
|
||||||
|
public class ConsMsgConsumer {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
TbConsInfoMapper tbConsInfoMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
TbUserShopMsgMapper tbUserShopMsgMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
TbShopInfoMapper tbShopInfoMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
TbProductSkuMapper tbProductSkuMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
TbProskuConMapper tbProskuConMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
TbProductMapper tbProductMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
RedisUtil redisUtil;
|
||||||
|
|
||||||
|
|
||||||
|
@Value("${wx.msg.appId}")
|
||||||
|
private String appId;
|
||||||
|
|
||||||
|
|
||||||
|
@Value("${wx.msg.secrete}")
|
||||||
|
private String secrete;
|
||||||
|
|
||||||
|
@Value("${subscribe.message.miniprogramState}")
|
||||||
|
private String miniprogramState;
|
||||||
|
|
||||||
|
|
||||||
|
@RabbitHandler
|
||||||
|
public void listener(String 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("接收的信息为空");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer skuId = object.getInteger("skuId");
|
||||||
|
Integer shopId = object.getInteger("shopId");
|
||||||
|
|
||||||
|
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(shopId);
|
||||||
|
if (Objects.isNull(shopInfo)) {
|
||||||
|
log.info("店铺信息不存在");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List<TbProskuCon> tbProskuCons = tbProskuConMapper.selectBySkuIdAndShopId(skuId, shopId);
|
||||||
|
if (Objects.isNull(tbProskuCons) || tbProskuCons.size() <= 0) {
|
||||||
|
log.info("耗材信息未配置");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TbProductSkuWithBLOBs skuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(skuId);
|
||||||
|
if (Objects.isNull(skuWithBLOBs)) {
|
||||||
|
log.info("规格信息不存在");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(skuWithBLOBs.getProductId()));
|
||||||
|
if (Objects.isNull(product)) {
|
||||||
|
log.info("商品信息不存在");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbProskuCons.parallelStream().forEach(it -> {
|
||||||
|
TbConsInfo tbConsInfo = tbConsInfoMapper.selectByPrimaryKey(it.getConInfoId());
|
||||||
|
if (Objects.isNull(tbConsInfo)) {
|
||||||
|
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());
|
||||||
|
|
||||||
|
|
||||||
|
JSONObject data = new JSONObject();
|
||||||
|
|
||||||
|
JSONObject thing1 = new JSONObject();
|
||||||
|
thing1.put("value", shopInfo.getShopName());
|
||||||
|
|
||||||
|
JSONObject thing5 = new JSONObject();
|
||||||
|
thing5.put("value", "耗材库存不足,请及时补充。");
|
||||||
|
|
||||||
|
JSONObject thing6 = new JSONObject();
|
||||||
|
thing6.put("value", product.getName());
|
||||||
|
|
||||||
|
|
||||||
|
JSONObject thing7 = new JSONObject();
|
||||||
|
thing7.put("value", tbConsInfo.getStockNumber().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("返回结果:{}", 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 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("appid", "wxcf0fe8cdba153fd6");
|
||||||
|
// //小程序secret
|
||||||
|
// requestUrlParam.put("secret", "c33e06467c6879a62af633d50ed6b720");
|
||||||
|
//默认参数
|
||||||
|
requestUrlParam.put("grant_type", "client_credential");
|
||||||
|
JSONObject jsonObject = JSON.parseObject(HttpClientUtil.doGet(requestUrl, requestUrlParam));
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args){
|
||||||
|
JSONObject access_token = new ConsMsgConsumer().getAccessToken();
|
||||||
|
String accessToken = String.valueOf(access_token.get("access_token"));
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -108,6 +108,22 @@ public class RabbitConfig {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public DirectExchange cons_msg_Exchange_Register() {
|
||||||
|
return new DirectExchange(RabbitConstants.CONS_MSG_COLLECT_PUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Queue queuecons_msg_Register() {
|
||||||
|
return new Queue(RabbitConstants.CONS_MSG_COLLECT_QUEUE_PUT, true); //队列持久
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Binding bindingcons_msg_Register() {
|
||||||
|
return BindingBuilder.bind(queuePrint_Register()).to(printExchange_Register()).with(RabbitConstants.CONS_MSG_COLLECT_ROUTINGKEY_PUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,4 +31,18 @@ public interface RabbitConstants {
|
|||||||
public static final String CONS_COLLECT_ROUTINGKEY_PUT = "cons_collect_routingkey_put";
|
public static final String CONS_COLLECT_ROUTINGKEY_PUT = "cons_collect_routingkey_put";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static final String CONS_MSG_COLLECT_PUT="cons_msg_collect_put";
|
||||||
|
|
||||||
|
public static final String CONS_MSG_COLLECT_QUEUE_PUT = "cons_msg_collect_queue_put";
|
||||||
|
|
||||||
|
|
||||||
|
public static final String CONS_MSG_COLLECT_ROUTINGKEY_PUT = "cons_msg_collect_routingkey_put";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,16 @@ 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void confirm(CorrelationData correlationData, boolean ack, String cause) {
|
public void confirm(CorrelationData correlationData, boolean ack, String cause) {
|
||||||
logger.info(" 回调id:" + correlationData);
|
logger.info(" 回调id:" + correlationData);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.service;
|
package com.chaozhanggui.system.cashierservice.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.chaozhanggui.system.cashierservice.dao.TbCashierCartMapper;
|
import com.chaozhanggui.system.cashierservice.dao.TbCashierCartMapper;
|
||||||
import com.chaozhanggui.system.cashierservice.dao.TbConsInfoFlowMapper;
|
import com.chaozhanggui.system.cashierservice.dao.TbConsInfoFlowMapper;
|
||||||
@@ -17,7 +16,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -70,15 +68,15 @@ public class ConsService {
|
|||||||
for (TbProskuCon tbProskuCon : tbProskuCons) {
|
for (TbProskuCon tbProskuCon : tbProskuCons) {
|
||||||
TbConsInfo tbConsInfo= tbConsInfoMapper.selectByPrimaryKey(tbProskuCon.getConInfoId());
|
TbConsInfo tbConsInfo= tbConsInfoMapper.selectByPrimaryKey(tbProskuCon.getConInfoId());
|
||||||
if(Objects.nonNull(tbConsInfo)){
|
if(Objects.nonNull(tbConsInfo)){
|
||||||
ConsInfoPO consInfoPO=new ConsInfoPO(tbConsInfo.getId(),tbConsInfo.getSurplusStock());
|
ConsInfoPO consInfoPO=new ConsInfoPO(tbConsInfo.getId(),tbProskuCon.getSurplusStock());
|
||||||
consInfoPOS.add(consInfoPO);
|
consInfoPOS.add(consInfoPO);
|
||||||
|
|
||||||
TbConsInfoFlow flow=new TbConsInfoFlow();
|
TbConsInfoFlow flow=new TbConsInfoFlow();
|
||||||
flow.setConsId(tbConsInfo.getId());
|
flow.setConsId(tbConsInfo.getId());
|
||||||
flow.setShopId(tbConsInfo.getShopId());
|
flow.setShopId(tbConsInfo.getShopId());
|
||||||
flow.setConName(tbConsInfo.getConName());
|
flow.setConName(tbConsInfo.getConName());
|
||||||
flow.setAmount(tbConsInfo.getSurplusStock());
|
flow.setAmount(tbProskuCon.getSurplusStock());
|
||||||
flow.setBalance(tbConsInfo.getStockNumber().subtract(tbConsInfo.getSurplusStock()));
|
flow.setBalance(tbConsInfo.getStockNumber().subtract(tbProskuCon.getSurplusStock()));
|
||||||
flow.setBizCode("createCart");
|
flow.setBizCode("createCart");
|
||||||
flow.setBizName("加入购物陈消耗");
|
flow.setBizName("加入购物陈消耗");
|
||||||
flow.setBizType("-");
|
flow.setBizType("-");
|
||||||
@@ -121,15 +119,15 @@ public class ConsService {
|
|||||||
for (TbProskuCon tbProskuCon : tbProskuCons) {
|
for (TbProskuCon tbProskuCon : tbProskuCons) {
|
||||||
TbConsInfo tbConsInfo= tbConsInfoMapper.selectByPrimaryKey(tbProskuCon.getConInfoId());
|
TbConsInfo tbConsInfo= tbConsInfoMapper.selectByPrimaryKey(tbProskuCon.getConInfoId());
|
||||||
if(Objects.nonNull(tbConsInfo)){
|
if(Objects.nonNull(tbConsInfo)){
|
||||||
ConsInfoPO consInfoPO=new ConsInfoPO(tbConsInfo.getId(),tbConsInfo.getSurplusStock().negate());
|
ConsInfoPO consInfoPO=new ConsInfoPO(tbConsInfo.getId(),tbProskuCon.getSurplusStock().negate());
|
||||||
consInfoPOS.add(consInfoPO);
|
consInfoPOS.add(consInfoPO);
|
||||||
|
|
||||||
TbConsInfoFlow flow=new TbConsInfoFlow();
|
TbConsInfoFlow flow=new TbConsInfoFlow();
|
||||||
flow.setConsId(tbConsInfo.getId());
|
flow.setConsId(tbConsInfo.getId());
|
||||||
flow.setShopId(tbConsInfo.getShopId());
|
flow.setShopId(tbConsInfo.getShopId());
|
||||||
flow.setConName(tbConsInfo.getConName());
|
flow.setConName(tbConsInfo.getConName());
|
||||||
flow.setAmount(tbConsInfo.getSurplusStock());
|
flow.setAmount(tbProskuCon.getSurplusStock());
|
||||||
flow.setBalance(tbConsInfo.getStockNumber().add(tbConsInfo.getSurplusStock()));
|
flow.setBalance(tbConsInfo.getStockNumber().add(tbProskuCon.getSurplusStock()));
|
||||||
flow.setBizCode("cancelCart");
|
flow.setBizCode("cancelCart");
|
||||||
flow.setBizName("取消购物车返回");
|
flow.setBizName("取消购物车返回");
|
||||||
flow.setBizType("+");
|
flow.setBizType("+");
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ public class DutyService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TbProductSkuMapper productSkuMapper;
|
private TbProductSkuMapper productSkuMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private TbProductMapper productMapper;
|
||||||
|
@Autowired
|
||||||
private CloudPrinterService cloudPrinterService;
|
private CloudPrinterService cloudPrinterService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisUtils redisUtil;
|
private RedisUtils redisUtil;
|
||||||
@@ -372,8 +374,17 @@ public class DutyService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void subInventory(Integer shopId, Integer skuId, Integer num) {
|
private void subInventory(Integer shopId, Integer skuId, Integer num) {
|
||||||
String result = redisUtil.seckill(RedisCst.PRODUCT + shopId.toString() + ":" + skuId.toString(), num.toString());
|
|
||||||
TbProductSku tbProductSku = productSkuMapper.selectByPrimaryKey(skuId);
|
TbProductSku tbProductSku = productSkuMapper.selectByPrimaryKey(skuId);
|
||||||
|
TbProductWithBLOBs product = productMapper.selectByPrimaryKey(Integer.valueOf(tbProductSku.getProductId()));
|
||||||
|
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(product)) {
|
||||||
|
if (product.getIsDistribute() == 1) {
|
||||||
|
redisUtil.seckill(RedisCst.PRODUCT + shopId.toString() + ":product" + product.getId().toString(), num.toString());
|
||||||
|
productMapper.updateStockById(skuId, num);
|
||||||
|
} else {
|
||||||
|
redisUtil.seckill(RedisCst.PRODUCT + shopId.toString() + ":" + skuId.toString(), num.toString());
|
||||||
|
if (ObjectUtil.isNotEmpty(tbProductSku)) {
|
||||||
if (num > tbProductSku.getStockNumber()) {
|
if (num > tbProductSku.getStockNumber()) {
|
||||||
productSkuMapper.updateStockNum(skuId,num);
|
productSkuMapper.updateStockNum(skuId,num);
|
||||||
} else {
|
} else {
|
||||||
@@ -381,3 +392,7 @@ public class DutyService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -176,4 +176,15 @@ public class LoginService {
|
|||||||
return Result.success(SUCCESS);
|
return Result.success(SUCCESS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Result getShopInfo(String token){
|
||||||
|
JSONObject jsonObject= TokenUtil.parseParamFromToken(token);
|
||||||
|
if(Objects.isNull(jsonObject)){
|
||||||
|
return Result.fail(CodeEnum.TOKENTERROR);
|
||||||
|
}
|
||||||
|
TbShopInfo shopInfo= tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(jsonObject.getString("shopId")));
|
||||||
|
|
||||||
|
return Result.success(SUCCESS,shopInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,7 @@ import com.chaozhanggui.system.cashierservice.thirdpay.resp.MainScanResp;
|
|||||||
import com.chaozhanggui.system.cashierservice.thirdpay.resp.OrderStatusQueryResp;
|
import com.chaozhanggui.system.cashierservice.thirdpay.resp.OrderStatusQueryResp;
|
||||||
import com.chaozhanggui.system.cashierservice.thirdpay.resp.PublicResp;
|
import com.chaozhanggui.system.cashierservice.thirdpay.resp.PublicResp;
|
||||||
import com.chaozhanggui.system.cashierservice.thirdpay.service.ThirdPayService;
|
import com.chaozhanggui.system.cashierservice.thirdpay.service.ThirdPayService;
|
||||||
import com.chaozhanggui.system.cashierservice.util.BeanUtil;
|
import com.chaozhanggui.system.cashierservice.util.*;
|
||||||
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
|
||||||
import com.chaozhanggui.system.cashierservice.util.MD5Util;
|
|
||||||
import com.chaozhanggui.system.cashierservice.util.SnowFlakeUtil;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
@@ -78,7 +75,7 @@ public class MemberService {
|
|||||||
|
|
||||||
public Result queryMember(String shopId, String phone, int page, int pageSize) {
|
public Result queryMember(String shopId, String phone, int page, int pageSize) {
|
||||||
|
|
||||||
PageHelper.startPage(page, pageSize);
|
PageHelperUtil.startPage(page, pageSize);
|
||||||
List<TbShopUser> tbShopUsers = tbShopUserMapper.selectByShopId(shopId, phone);
|
List<TbShopUser> tbShopUsers = tbShopUserMapper.selectByShopId(shopId, phone);
|
||||||
PageInfo pageInfo = new PageInfo(tbShopUsers);
|
PageInfo pageInfo = new PageInfo(tbShopUsers);
|
||||||
return Result.success(CodeEnum.SUCCESS, pageInfo);
|
return Result.success(CodeEnum.SUCCESS, pageInfo);
|
||||||
@@ -622,7 +619,7 @@ public class MemberService {
|
|||||||
if (ObjectUtil.isEmpty(memberId)) {
|
if (ObjectUtil.isEmpty(memberId)) {
|
||||||
return Result.fail(CodeEnum.PARAM);
|
return Result.fail(CodeEnum.PARAM);
|
||||||
}
|
}
|
||||||
PageHelper.startPage(page, pageSize);
|
PageHelperUtil.startPage(page, pageSize);
|
||||||
List<Map<String, Object>> list = tbShopUserFlowMapper.selectByMemberAccountFlow(memberId);
|
List<Map<String, Object>> list = tbShopUserFlowMapper.selectByMemberAccountFlow(memberId);
|
||||||
PageInfo pageInfo = new PageInfo(list);
|
PageInfo pageInfo = new PageInfo(list);
|
||||||
return Result.success(CodeEnum.SUCCESS, pageInfo);
|
return Result.success(CodeEnum.SUCCESS, pageInfo);
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
|
|||||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
import com.chaozhanggui.system.cashierservice.util.*;
|
import com.chaozhanggui.system.cashierservice.util.*;
|
||||||
import com.github.pagehelper.PageHelper;
|
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -25,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import static com.chaozhanggui.system.cashierservice.sign.CodeEnum.CARTEXIST;
|
import static com.chaozhanggui.system.cashierservice.sign.CodeEnum.CARTEXIST;
|
||||||
|
|
||||||
@@ -63,6 +63,8 @@ public class OrderService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
RabbitProducer producer;
|
RabbitProducer producer;
|
||||||
|
|
||||||
|
|
||||||
private static ConcurrentHashMap<String, HashSet<Integer>> codeMap = new ConcurrentHashMap<>();
|
private static ConcurrentHashMap<String, HashSet<Integer>> codeMap = new ConcurrentHashMap<>();
|
||||||
private static ConcurrentHashMap<String, HashSet<String>> userMap = new ConcurrentHashMap<>();
|
private static ConcurrentHashMap<String, HashSet<String>> userMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
@@ -106,6 +108,13 @@ public class OrderService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JSONObject objectMsg=new JSONObject();
|
||||||
|
objectMsg.put("skuId",skuWithBLOBs.getId());
|
||||||
|
objectMsg.put("shopId",shopInfo.getId());
|
||||||
|
|
||||||
|
|
||||||
|
producer.con_msg(objectMsg.toString());
|
||||||
|
|
||||||
if (StringUtils.isEmpty(masterId)) {
|
if (StringUtils.isEmpty(masterId)) {
|
||||||
boolean flag = redisUtil.exists("SHOP:CODE:" + clientType + ":" + shopId);
|
boolean flag = redisUtil.exists("SHOP:CODE:" + clientType + ":" + shopId);
|
||||||
if (flag) {
|
if (flag) {
|
||||||
@@ -401,7 +410,30 @@ public class OrderService {
|
|||||||
if (Objects.nonNull(tbToken)){
|
if (Objects.nonNull(tbToken)){
|
||||||
orderInfo.setTokenId(tbToken.getId());
|
orderInfo.setTokenId(tbToken.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
JSONObject object=new JSONObject();
|
||||||
|
String outNumber= redisUtil.getMessage(RedisCst.OUT_NUMBER.concat(orderInfo.getShopId()));
|
||||||
|
Integer number=1;
|
||||||
|
if(Objects.isNull(outNumber)){
|
||||||
|
object.put("outNumber",number);
|
||||||
|
object.put("times",DateUtils.getDay());
|
||||||
|
}else {
|
||||||
|
object=JSONObject.parseObject(outNumber);
|
||||||
|
if(object.getString("times").equals(DateUtils.getDay())){
|
||||||
|
number=object.getInteger("outNumber")+1;
|
||||||
|
object.put("outNumber",number);
|
||||||
|
}else {
|
||||||
|
object.put("outNumber",number);
|
||||||
|
object.put("times",DateUtils.getDay());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
orderInfo.setOutNumber(number+"");
|
||||||
|
|
||||||
tbOrderInfoMapper.insert(orderInfo);
|
tbOrderInfoMapper.insert(orderInfo);
|
||||||
|
redisUtil.saveMessage(RedisCst.OUT_NUMBER.concat(orderInfo.getShopId()),object.toString());
|
||||||
orderId = orderInfo.getId();
|
orderId = orderInfo.getId();
|
||||||
}
|
}
|
||||||
for (TbOrderDetail orderDetail : orderDetails) {
|
for (TbOrderDetail orderDetail : orderDetails) {
|
||||||
@@ -732,7 +764,7 @@ public class OrderService {
|
|||||||
|
|
||||||
public Result findOrder(Integer shopId, String status, Integer page, Integer size, String orderNo) {
|
public Result findOrder(Integer shopId, String status, Integer page, Integer size, String orderNo) {
|
||||||
String day = DateUtils.getDay();
|
String day = DateUtils.getDay();
|
||||||
PageHelper.startPage(page, size);
|
PageHelperUtil.startPage(page, size);
|
||||||
String orderType = "";
|
String orderType = "";
|
||||||
if (StringUtils.isNotEmpty(status)) {
|
if (StringUtils.isNotEmpty(status)) {
|
||||||
if (status.equals("refund")) {
|
if (status.equals("refund")) {
|
||||||
@@ -749,15 +781,14 @@ public class OrderService {
|
|||||||
if (StringUtils.isEmpty(orderInfo.getImgUrl())) {
|
if (StringUtils.isEmpty(orderInfo.getImgUrl())) {
|
||||||
orderInfo.setImgUrl("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240223/a04e0d3beef74d099ebd0fd1f7c41873.jpg");
|
orderInfo.setImgUrl("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240223/a04e0d3beef74d099ebd0fd1f7c41873.jpg");
|
||||||
}
|
}
|
||||||
orderInfo.setZdNo("POS");
|
|
||||||
orderInfo.setNames(orderInfo.getProductName().split(","));
|
|
||||||
|
|
||||||
List<SkuInfoPo> skuInfoPos=tbOrderInfoMapper.selectSkuByOrderId(orderInfo.getId().toString());
|
List<SkuInfoPo> skuInfoPos=tbOrderInfoMapper.selectSkuByOrderId(orderInfo.getId().toString());
|
||||||
if(Objects.isNull(skuInfoPos)||skuInfoPos.size()<0){
|
if(Objects.isNull(skuInfoPos)||skuInfoPos.size()<0){
|
||||||
skuInfoPos=new ArrayList<>();
|
skuInfoPos=new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
orderInfo.setSkuInfos(skuInfoPos);
|
orderInfo.setSkuInfos(skuInfoPos);
|
||||||
|
orderInfo.setZdNo("POS");
|
||||||
|
orderInfo.setNames(orderInfo.getProductName().split(","));
|
||||||
}
|
}
|
||||||
PageInfo pageInfo = new PageInfo(list);
|
PageInfo pageInfo = new PageInfo(list);
|
||||||
log.info("获取订单:{}", JSONUtil.toJSONString(pageInfo));
|
log.info("获取订单:{}", JSONUtil.toJSONString(pageInfo));
|
||||||
@@ -927,6 +958,9 @@ public class OrderService {
|
|||||||
private String secrete;
|
private String secrete;
|
||||||
|
|
||||||
|
|
||||||
|
@Value("${subscribe.message.miniprogramState}")
|
||||||
|
private String miniprogramState;
|
||||||
|
|
||||||
public Result sendMassage(String orderId){
|
public Result sendMassage(String orderId){
|
||||||
if(ObjectUtil.isEmpty(orderId)){
|
if(ObjectUtil.isEmpty(orderId)){
|
||||||
return Result.fail(CodeEnum.ERRMASTER);
|
return Result.fail(CodeEnum.ERRMASTER);
|
||||||
@@ -987,7 +1021,7 @@ public class OrderService {
|
|||||||
|
|
||||||
object1.put("data",data);
|
object1.put("data",data);
|
||||||
|
|
||||||
object1.put("miniprogram_state","trial");
|
object1.put("miniprogram_state",miniprogramState);
|
||||||
object1.put("lang","zh_CN");
|
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();
|
String response= HttpRequest.post("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=".concat(accessToken)).body(object1.toString()).execute().body();
|
||||||
@@ -1075,7 +1109,7 @@ public class OrderService {
|
|||||||
|
|
||||||
object1.put("data",data);
|
object1.put("data",data);
|
||||||
|
|
||||||
object1.put("miniprogram_state","trial");
|
object1.put("miniprogram_state",miniprogramState);
|
||||||
object1.put("lang","zh_CN");
|
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();
|
String response= HttpRequest.post("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=".concat(accessToken)).body(object1.toString()).execute().body();
|
||||||
@@ -1108,7 +1142,7 @@ public class OrderService {
|
|||||||
|
|
||||||
|
|
||||||
public Result getOutNumber(String shopId,Integer page,Integer pageSize){
|
public Result getOutNumber(String shopId,Integer page,Integer pageSize){
|
||||||
PageHelper.startPage(page, pageSize);
|
PageHelperUtil.startPage(page, pageSize);
|
||||||
List<TbOrderOutNumber> list= tbOrderOutNumberMapper.selectAll(shopId);
|
List<TbOrderOutNumber> list= tbOrderOutNumberMapper.selectAll(shopId);
|
||||||
PageInfo pageInfo=new PageInfo(list);
|
PageInfo pageInfo=new PageInfo(list);
|
||||||
return Result.success(CodeEnum.SUCCESS,pageInfo);
|
return Result.success(CodeEnum.SUCCESS,pageInfo);
|
||||||
|
|||||||
@@ -89,6 +89,9 @@ public class PayService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TbProductSkuMapper productSkuMapper;
|
private TbProductSkuMapper productSkuMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TbProductMapper productMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisUtils redisUtil;
|
private RedisUtils redisUtil;
|
||||||
|
|
||||||
@@ -920,11 +923,19 @@ public class PayService {
|
|||||||
detail = tbOrderDetailMapper.selectByPrimaryKey(detail.getId());
|
detail = tbOrderDetailMapper.selectByPrimaryKey(detail.getId());
|
||||||
|
|
||||||
TbProductSku productSku = productSkuMapper.selectByPrimaryKey(detail.getProductSkuId());
|
TbProductSku productSku = productSkuMapper.selectByPrimaryKey(detail.getProductSkuId());
|
||||||
|
TbProductWithBLOBs product = productMapper.selectByPrimaryKey(detail.getProductId());
|
||||||
|
if (ObjectUtil.isNotEmpty(product)) {
|
||||||
|
if (product.getIsDistribute() == 1) {
|
||||||
|
redisUtil.seckill(RedisCst.PRODUCT + shopId.toString() + ":product" + product.getId().toString(), String.valueOf(detail.getReturnNum() + product.getStockNumber().intValue()));
|
||||||
|
productMapper.updateStockById(product.getId(), detail.getReturnNum() * -1);
|
||||||
|
} else {
|
||||||
if (ObjectUtil.isNotEmpty(productSku)) {
|
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);
|
productSkuMapper.updateByskuIdSub(productSku.getId(), detail.getReturnNum() * -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Result.success(CodeEnum.SUCCESS);
|
return Result.success(CodeEnum.SUCCESS);
|
||||||
}
|
}
|
||||||
@@ -1088,7 +1099,7 @@ public class PayService {
|
|||||||
|
|
||||||
String shopId = info.getString("shopId");
|
String shopId = info.getString("shopId");
|
||||||
String staffId = info.getString("staffId");
|
String staffId = info.getString("staffId");
|
||||||
PageHelper.startPage(pageNo, pageSize);
|
PageHelperUtil.startPage(pageNo, pageSize);
|
||||||
|
|
||||||
|
|
||||||
List<TbQuickPay> list = tbQuickPayMapper.selectByShopIdAndStaffId(Integer.valueOf(shopId), Integer.valueOf(staffId));
|
List<TbQuickPay> list = tbQuickPayMapper.selectByShopIdAndStaffId(Integer.valueOf(shopId), Integer.valueOf(staffId));
|
||||||
|
|||||||
@@ -7,14 +7,13 @@ import com.chaozhanggui.system.cashierservice.entity.vo.ShopCategoryVo;
|
|||||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.chaozhanggui.system.cashierservice.util.PageHelperUtil;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -39,14 +38,14 @@ public class ProductService {
|
|||||||
|
|
||||||
|
|
||||||
public Result queryCategory(String shopId,Integer page,Integer pageSize){
|
public Result queryCategory(String shopId,Integer page,Integer pageSize){
|
||||||
PageHelper.startPage(page, pageSize);
|
PageHelperUtil.startPage(page, pageSize);
|
||||||
List<TbShopCategory> list=tbShopCategoryMapper.selectByAll(shopId);
|
List<TbShopCategory> list=tbShopCategoryMapper.selectByAll(shopId);
|
||||||
PageInfo pageInfo=new PageInfo(list);
|
PageInfo pageInfo=new PageInfo(list);
|
||||||
return Result.success(CodeEnum.SUCCESS,pageInfo);
|
return Result.success(CodeEnum.SUCCESS,pageInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result queryAllCategory(String shopId,Integer page,Integer pageSize){
|
public Result queryAllCategory(String shopId,Integer page,Integer pageSize){
|
||||||
PageHelper.startPage(page, pageSize);
|
PageHelperUtil.startPage(page, pageSize);
|
||||||
List<ShopCategoryVo> list=tbShopCategoryMapper.queryAllCategory(shopId);
|
List<ShopCategoryVo> list=tbShopCategoryMapper.queryAllCategory(shopId);
|
||||||
PageInfo pageInfo=new PageInfo(list);
|
PageInfo pageInfo=new PageInfo(list);
|
||||||
return Result.success(CodeEnum.SUCCESS,pageInfo);
|
return Result.success(CodeEnum.SUCCESS,pageInfo);
|
||||||
@@ -95,11 +94,10 @@ public class ProductService {
|
|||||||
|
|
||||||
public Result queryNewCommodityInfo(String shopId, String categoryId, String commdityName, int page, int pageSize, String masterId) {
|
public Result queryNewCommodityInfo(String shopId, String categoryId, String commdityName, int page, int pageSize, String masterId) {
|
||||||
List<TbProductWithBLOBs> tbProductWithBLOBs=null;
|
List<TbProductWithBLOBs> tbProductWithBLOBs=null;
|
||||||
|
PageHelperUtil.startPage(page,pageSize);
|
||||||
if(ObjectUtil.isEmpty(categoryId)){
|
if(ObjectUtil.isEmpty(categoryId)){
|
||||||
PageHelper.startPage(page, pageSize);
|
|
||||||
tbProductWithBLOBs=tbProductMapper.selectByShopId(shopId,commdityName);
|
tbProductWithBLOBs=tbProductMapper.selectByShopId(shopId,commdityName);
|
||||||
}else {
|
}else {
|
||||||
PageHelper.startPage(page, pageSize);
|
|
||||||
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndShopType(shopId,categoryId,commdityName);
|
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndShopType(shopId,categoryId,commdityName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.chaozhanggui.system.cashierservice.entity.*;
|
|||||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
||||||
|
import com.chaozhanggui.system.cashierservice.util.PageHelperUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
|
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
@@ -44,7 +45,7 @@ public class ShopInfoService {
|
|||||||
return Result.fail(CodeEnum.PARAM);
|
return Result.fail(CodeEnum.PARAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
PageHelper.startPage(page, pageSize);
|
PageHelperUtil.startPage(page, pageSize);
|
||||||
List<TbShopTable> shopTables=tbShopTableMapper.selectByShopIdAndStatus(shopId,areaId,status);
|
List<TbShopTable> shopTables=tbShopTableMapper.selectByShopIdAndStatus(shopId,areaId,status);
|
||||||
PageInfo pageInfo=new PageInfo(shopTables);
|
PageInfo pageInfo=new PageInfo(shopTables);
|
||||||
return Result.success(CodeEnum.SUCCESS,pageInfo);
|
return Result.success(CodeEnum.SUCCESS,pageInfo);
|
||||||
@@ -64,7 +65,7 @@ public class ShopInfoService {
|
|||||||
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndTrade(shopId,day);
|
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndTrade(shopId,day);
|
||||||
// List<String> list = shopUserDutyMapper.selectByShopIdAndTradeAll(shopId,day,tbToken.getId());
|
// List<String> list = shopUserDutyMapper.selectByShopIdAndTradeAll(shopId,day,tbToken.getId());
|
||||||
if (Objects.nonNull(shopUserDuty)){
|
if (Objects.nonNull(shopUserDuty)){
|
||||||
// PageHelper.startPage(page, pageSize);
|
// PageHelperUtil.startPage(page, pageSize);
|
||||||
List<ShopUserDutyDetail> shopTables=shopUserDutyDetailMapper.selectAllByDuctId(shopUserDuty.getId());
|
List<ShopUserDutyDetail> shopTables=shopUserDutyDetailMapper.selectAllByDuctId(shopUserDuty.getId());
|
||||||
// PageInfo pageInfo=new PageInfo(shopTables);
|
// PageInfo pageInfo=new PageInfo(shopTables);
|
||||||
shopUserDuty.setDetailList(shopTables);
|
shopUserDuty.setDetailList(shopTables);
|
||||||
@@ -82,7 +83,7 @@ public class ShopInfoService {
|
|||||||
public Result queryDutyFlow(String token, String shopId, int page, int pageSize) {
|
public Result queryDutyFlow(String token, String shopId, int page, int pageSize) {
|
||||||
// JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
|
// JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
|
||||||
// String userId = jsonObject.getString("accountId");
|
// String userId = jsonObject.getString("accountId");
|
||||||
PageHelper.startPage(page, pageSize);
|
PageHelperUtil.startPage(page, pageSize);
|
||||||
PageHelper.orderBy("login_out_time desc");
|
PageHelper.orderBy("login_out_time desc");
|
||||||
List<ShopUserDuty> list = shopUserDutyMapper.selectByShopId(shopId);
|
List<ShopUserDuty> list = shopUserDutyMapper.selectByShopId(shopId);
|
||||||
PageInfo pageInfo=new PageInfo(list);
|
PageInfo pageInfo=new PageInfo(list);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import com.chaozhanggui.system.cashierservice.entity.vo.ProductVo;
|
|||||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.chaozhanggui.system.cashierservice.util.PageHelperUtil;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -109,7 +109,7 @@ public class TbGroupOrderInfoService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Result queryByPage(GroupOrderDto param) {
|
public Result queryByPage(GroupOrderDto param) {
|
||||||
PageHelper.startPage(param.getPage(), param.getSize());
|
PageHelperUtil.startPage(param.getPage(), param.getSize());
|
||||||
return Result.success(CodeEnum.SUCCESS, new PageInfo(tbGroupOrderInfoMapper.queryList(param)));
|
return Result.success(CodeEnum.SUCCESS, new PageInfo(tbGroupOrderInfoMapper.queryList(param)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import com.chaozhanggui.system.cashierservice.entity.dto.PrintMachineDto;
|
|||||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||||
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.chaozhanggui.system.cashierservice.util.PageHelperUtil;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
@@ -60,7 +60,7 @@ public class TbPrintPCMachineService {
|
|||||||
* @return 查询结果
|
* @return 查询结果
|
||||||
*/
|
*/
|
||||||
public Result queryByPage(TbPrintPCMachine tbPrintMachine) {
|
public Result queryByPage(TbPrintPCMachine tbPrintMachine) {
|
||||||
PageHelper.startPage(tbPrintMachine.getPage(), tbPrintMachine.getPageSize());
|
PageHelperUtil.startPage(tbPrintMachine.getPage(), tbPrintMachine.getPageSize());
|
||||||
tbPrintMachine.setContentType("local");
|
tbPrintMachine.setContentType("local");
|
||||||
List<TbPrintPCMachine> tbPrintMachines = this.tbPrintMachineMapper.queryAll(tbPrintMachine);
|
List<TbPrintPCMachine> tbPrintMachines = this.tbPrintMachineMapper.queryAll(tbPrintMachine);
|
||||||
|
|
||||||
|
|||||||
@@ -96,6 +96,9 @@ public enum CodeEnum {
|
|||||||
ISNOTAPPORDER("100035",false,"不是小程序订单","fail"),
|
ISNOTAPPORDER("100035",false,"不是小程序订单","fail"),
|
||||||
|
|
||||||
|
|
||||||
|
CONSERROR("100036",false,"商品已售罄","fail"),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,127 @@
|
|||||||
|
package com.chaozhanggui.system.cashierservice.task;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.chaozhanggui.system.cashierservice.dao.TbConsInfoMapper;
|
||||||
|
import com.chaozhanggui.system.cashierservice.dao.TbUserShopMsgMapper;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.TbConsInfo;
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg;
|
||||||
|
import com.chaozhanggui.system.cashierservice.util.HttpClientUtil;
|
||||||
|
import com.chaozhanggui.system.cashierservice.util.N;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class ConsInfoTask {
|
||||||
|
|
||||||
|
private ScheduledExecutorService executorService=Executors.newScheduledThreadPool(100);
|
||||||
|
|
||||||
|
|
||||||
|
@Value("${wx.appId}")
|
||||||
|
private String appId;
|
||||||
|
|
||||||
|
|
||||||
|
@Value("${wx.secrete}")
|
||||||
|
private String secrete;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
TbConsInfoMapper tbConsInfoMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
TbUserShopMsgMapper tbUserShopMsgMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void init(){
|
||||||
|
executorService.scheduleWithFixedDelay(timerTask(),0,10,TimeUnit.MINUTES);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public TimerTask timerTask () {
|
||||||
|
return new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
List<TbConsInfo> tbShopInfos= tbConsInfoMapper.selectAllInfo();
|
||||||
|
if(Objects.nonNull(tbShopInfos)&&tbShopInfos.size()>0){
|
||||||
|
tbShopInfos.parallelStream().forEach(it->{
|
||||||
|
|
||||||
|
if(N.gt(it.getConWarning(),it.getStockNumber())){
|
||||||
|
TbUserShopMsg tbUserShopMsg=tbUserShopMsgMapper.selectByPrimaryKey(it.getShopId());
|
||||||
|
if(Objects.nonNull(tbUserShopMsg)&&Objects.nonNull(tbUserShopMsg.getOpenId())){
|
||||||
|
JSONObject object= getAccessToken();
|
||||||
|
String accessToken=object.get("access_token")+"";
|
||||||
|
|
||||||
|
JSONObject object1=new JSONObject();
|
||||||
|
|
||||||
|
object1.put("template_id","BKTcsYHW1xnUaE-CFmF7pOglJH0aLEyW9e4r5nWKUIU");
|
||||||
|
object1.put("touser",tbUserShopMsg.getOpenId());
|
||||||
|
|
||||||
|
|
||||||
|
JSONObject data=new JSONObject();
|
||||||
|
|
||||||
|
JSONObject tabname=new JSONObject();
|
||||||
|
tabname.put("value",it.getConName());
|
||||||
|
|
||||||
|
|
||||||
|
JSONObject thing21=new JSONObject();
|
||||||
|
thing21.put("value",it.getStockNumber().toPlainString());
|
||||||
|
|
||||||
|
JSONObject thing8=new JSONObject();
|
||||||
|
thing8.put("value","耗材库存不足,请及时补充。");
|
||||||
|
|
||||||
|
data.put("thing1.",tabname);
|
||||||
|
data.put("thing2",thing21);
|
||||||
|
data.put("thing3",thing8);
|
||||||
|
|
||||||
|
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")+"")){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.chaozhanggui.system.cashierservice.util;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
|
||||||
|
public class PageHelperUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解决页数超限 仍返回数据问题
|
||||||
|
*/
|
||||||
|
public static void startPage(int page, int pageSize) {
|
||||||
|
PageHelper.startPage(page, pageSize, true, false, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,4 +16,6 @@ public class RedisCst {
|
|||||||
public static final Object PRODUCT = "PRODUCT:";
|
public static final Object PRODUCT = "PRODUCT:";
|
||||||
|
|
||||||
public static final String OUT_NUMBER="ORDER:NUMBER:";
|
public static final String OUT_NUMBER="ORDER:NUMBER:";
|
||||||
|
|
||||||
|
public static final String ORDER_MESSAGE="ORDER:MESSAGE:";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ mybatis:
|
|||||||
map-underscore-to-camel-case: true
|
map-underscore-to-camel-case: true
|
||||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
mapper-locations: classpath:mapper/*.xml
|
mapper-locations: classpath:mapper/*.xml
|
||||||
|
subscribe:
|
||||||
|
message:
|
||||||
|
miniprogramState: trial
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ mybatis:
|
|||||||
map-underscore-to-camel-case: true
|
map-underscore-to-camel-case: true
|
||||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
mapper-locations: classpath:mapper/*.xml
|
mapper-locations: classpath:mapper/*.xml
|
||||||
|
subscribe:
|
||||||
|
message:
|
||||||
|
miniprogramState: formal
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,10 @@ thirdPay:
|
|||||||
wx:
|
wx:
|
||||||
appId: wxd88fffa983758a30
|
appId: wxd88fffa983758a30
|
||||||
secrete: a34a61adc0602118b49400baa8812454
|
secrete: a34a61adc0602118b49400baa8812454
|
||||||
|
msg:
|
||||||
|
appId: wxcf0fe8cdba153fd6
|
||||||
|
secrete: c33e06467c6879a62af633d50ed6b720
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,13 @@
|
|||||||
|
|
||||||
<!-- 要生成的表tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
|
<!-- 要生成的表tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
|
||||||
<!-- <table tableName="%" schema="fycashier" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" ></table>-->
|
<!-- <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_prosku_con" domainObjectName="TbProskuCon"
|
||||||
enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
|
enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
|
||||||
enableSelectByExample="false" selectByExampleQueryId="false" >
|
enableSelectByExample="false" selectByExampleQueryId="false" >
|
||||||
|
|||||||
@@ -10,14 +10,14 @@
|
|||||||
<result column="con_name" jdbcType="VARCHAR" property="conName" />
|
<result column="con_name" jdbcType="VARCHAR" property="conName" />
|
||||||
<result column="stock_number" jdbcType="DECIMAL" property="stockNumber" />
|
<result column="stock_number" jdbcType="DECIMAL" property="stockNumber" />
|
||||||
<result column="con_unit" jdbcType="VARCHAR" property="conUnit" />
|
<result column="con_unit" jdbcType="VARCHAR" property="conUnit" />
|
||||||
<result column="surplus_stock" jdbcType="DECIMAL" property="surplusStock" />
|
|
||||||
<result column="laster_in_stock" jdbcType="DECIMAL" property="lasterInStock" />
|
<result column="laster_in_stock" jdbcType="DECIMAL" property="lasterInStock" />
|
||||||
|
<result column="con_warning" jdbcType="DECIMAL" property="conWarning" />
|
||||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Base_Column_List">
|
<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, con_unit,
|
||||||
surplus_stock, laster_in_stock, create_time, update_time
|
laster_in_stock, con_warning, create_time, update_time
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
@@ -32,13 +32,13 @@
|
|||||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
|
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
|
||||||
insert into tb_cons_info (id, shop_id, con_type_id,
|
insert into tb_cons_info (id, shop_id, con_type_id,
|
||||||
con_type_name, con_code, con_name,
|
con_type_name, con_code, con_name,
|
||||||
stock_number, con_unit, surplus_stock,
|
stock_number, con_unit, laster_in_stock,
|
||||||
laster_in_stock, create_time, update_time
|
con_warning, create_time, update_time
|
||||||
)
|
)
|
||||||
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{conTypeId,jdbcType=INTEGER},
|
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{conTypeId,jdbcType=INTEGER},
|
||||||
#{conTypeName,jdbcType=VARCHAR}, #{conCode,jdbcType=VARCHAR}, #{conName,jdbcType=VARCHAR},
|
#{conTypeName,jdbcType=VARCHAR}, #{conCode,jdbcType=VARCHAR}, #{conName,jdbcType=VARCHAR},
|
||||||
#{stockNumber,jdbcType=DECIMAL}, #{conUnit,jdbcType=VARCHAR}, #{surplusStock,jdbcType=DECIMAL},
|
#{stockNumber,jdbcType=DECIMAL}, #{conUnit,jdbcType=VARCHAR}, #{lasterInStock,jdbcType=DECIMAL},
|
||||||
#{lasterInStock,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
|
#{conWarning,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
|
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
|
||||||
@@ -68,12 +68,12 @@
|
|||||||
<if test="conUnit != null">
|
<if test="conUnit != null">
|
||||||
con_unit,
|
con_unit,
|
||||||
</if>
|
</if>
|
||||||
<if test="surplusStock != null">
|
|
||||||
surplus_stock,
|
|
||||||
</if>
|
|
||||||
<if test="lasterInStock != null">
|
<if test="lasterInStock != null">
|
||||||
laster_in_stock,
|
laster_in_stock,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="conWarning != null">
|
||||||
|
con_warning,
|
||||||
|
</if>
|
||||||
<if test="createTime != null">
|
<if test="createTime != null">
|
||||||
create_time,
|
create_time,
|
||||||
</if>
|
</if>
|
||||||
@@ -106,12 +106,12 @@
|
|||||||
<if test="conUnit != null">
|
<if test="conUnit != null">
|
||||||
#{conUnit,jdbcType=VARCHAR},
|
#{conUnit,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="surplusStock != null">
|
|
||||||
#{surplusStock,jdbcType=DECIMAL},
|
|
||||||
</if>
|
|
||||||
<if test="lasterInStock != null">
|
<if test="lasterInStock != null">
|
||||||
#{lasterInStock,jdbcType=DECIMAL},
|
#{lasterInStock,jdbcType=DECIMAL},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="conWarning != null">
|
||||||
|
#{conWarning,jdbcType=DECIMAL},
|
||||||
|
</if>
|
||||||
<if test="createTime != null">
|
<if test="createTime != null">
|
||||||
#{createTime,jdbcType=TIMESTAMP},
|
#{createTime,jdbcType=TIMESTAMP},
|
||||||
</if>
|
</if>
|
||||||
@@ -144,12 +144,12 @@
|
|||||||
<if test="conUnit != null">
|
<if test="conUnit != null">
|
||||||
con_unit = #{conUnit,jdbcType=VARCHAR},
|
con_unit = #{conUnit,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="surplusStock != null">
|
|
||||||
surplus_stock = #{surplusStock,jdbcType=DECIMAL},
|
|
||||||
</if>
|
|
||||||
<if test="lasterInStock != null">
|
<if test="lasterInStock != null">
|
||||||
laster_in_stock = #{lasterInStock,jdbcType=DECIMAL},
|
laster_in_stock = #{lasterInStock,jdbcType=DECIMAL},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="conWarning != null">
|
||||||
|
con_warning = #{conWarning,jdbcType=DECIMAL},
|
||||||
|
</if>
|
||||||
<if test="createTime != null">
|
<if test="createTime != null">
|
||||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||||
</if>
|
</if>
|
||||||
@@ -168,13 +168,21 @@
|
|||||||
con_name = #{conName,jdbcType=VARCHAR},
|
con_name = #{conName,jdbcType=VARCHAR},
|
||||||
stock_number = #{stockNumber,jdbcType=DECIMAL},
|
stock_number = #{stockNumber,jdbcType=DECIMAL},
|
||||||
con_unit = #{conUnit,jdbcType=VARCHAR},
|
con_unit = #{conUnit,jdbcType=VARCHAR},
|
||||||
surplus_stock = #{surplusStock,jdbcType=DECIMAL},
|
|
||||||
laster_in_stock = #{lasterInStock,jdbcType=DECIMAL},
|
laster_in_stock = #{lasterInStock,jdbcType=DECIMAL},
|
||||||
|
con_warning = #{conWarning,jdbcType=DECIMAL},
|
||||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||||
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<select id="countAll" resultType="int">
|
||||||
|
select count(id) from tb_cons_info
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAllInfo" resultType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
|
||||||
|
select * from tb_cons_info order by id desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<update id="batchStock">
|
<update id="batchStock">
|
||||||
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
|
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
|
||||||
|
|||||||
@@ -62,6 +62,7 @@
|
|||||||
<result column="enable_label" jdbcType="TINYINT" property="enableLabel" />
|
<result column="enable_label" jdbcType="TINYINT" property="enableLabel" />
|
||||||
<result column="tax_config_id" jdbcType="VARCHAR" property="taxConfigId" />
|
<result column="tax_config_id" jdbcType="VARCHAR" property="taxConfigId" />
|
||||||
<result column="spec_table_headers" jdbcType="VARCHAR" property="specTableHeaders" />
|
<result column="spec_table_headers" jdbcType="VARCHAR" property="specTableHeaders" />
|
||||||
|
<result column="stock_number" jdbcType="INTEGER" property="stockNumber" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs">
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs">
|
||||||
<result column="images" jdbcType="LONGVARCHAR" property="images" />
|
<result column="images" jdbcType="LONGVARCHAR" property="images" />
|
||||||
@@ -80,7 +81,7 @@
|
|||||||
created_at, updated_at, base_sales_number, real_sales_number, sales_number, thumb_count,
|
created_at, updated_at, base_sales_number, real_sales_number, sales_number, thumb_count,
|
||||||
store_count, furnish_meal, furnish_express, furnish_draw, furnish_vir, is_combo,
|
store_count, furnish_meal, furnish_express, furnish_draw, furnish_vir, is_combo,
|
||||||
is_show_cash, is_show_mall, is_need_examine, show_on_mall_status, show_on_mall_time,
|
is_show_cash, is_show_mall, is_need_examine, show_on_mall_status, show_on_mall_time,
|
||||||
show_on_mall_error_msg, enable_label, tax_config_id, spec_table_headers
|
show_on_mall_error_msg, enable_label, tax_config_id, spec_table_headers, stock_number
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Blob_Column_List">
|
<sql id="Blob_Column_List">
|
||||||
images, video, notice, group_snap, spec_info, select_spec
|
images, video, notice, group_snap, spec_info, select_spec
|
||||||
@@ -119,7 +120,7 @@
|
|||||||
show_on_mall_status, show_on_mall_time, show_on_mall_error_msg,
|
show_on_mall_status, show_on_mall_time, show_on_mall_error_msg,
|
||||||
enable_label, tax_config_id, spec_table_headers,
|
enable_label, tax_config_id, spec_table_headers,
|
||||||
images, video, notice,
|
images, video, notice,
|
||||||
group_snap, spec_info, select_spec
|
group_snap, spec_info, select_spec, stock_number
|
||||||
)
|
)
|
||||||
values (#{id,jdbcType=INTEGER}, #{categoryId,jdbcType=VARCHAR}, #{specId,jdbcType=INTEGER},
|
values (#{id,jdbcType=INTEGER}, #{categoryId,jdbcType=VARCHAR}, #{specId,jdbcType=INTEGER},
|
||||||
#{sourcePath,jdbcType=VARCHAR}, #{brandId,jdbcType=INTEGER}, #{merchantId,jdbcType=VARCHAR},
|
#{sourcePath,jdbcType=VARCHAR}, #{brandId,jdbcType=INTEGER}, #{merchantId,jdbcType=VARCHAR},
|
||||||
@@ -142,7 +143,8 @@
|
|||||||
#{showOnMallStatus,jdbcType=TINYINT}, #{showOnMallTime,jdbcType=BIGINT}, #{showOnMallErrorMsg,jdbcType=VARCHAR},
|
#{showOnMallStatus,jdbcType=TINYINT}, #{showOnMallTime,jdbcType=BIGINT}, #{showOnMallErrorMsg,jdbcType=VARCHAR},
|
||||||
#{enableLabel,jdbcType=TINYINT}, #{taxConfigId,jdbcType=VARCHAR}, #{specTableHeaders,jdbcType=VARCHAR},
|
#{enableLabel,jdbcType=TINYINT}, #{taxConfigId,jdbcType=VARCHAR}, #{specTableHeaders,jdbcType=VARCHAR},
|
||||||
#{images,jdbcType=LONGVARCHAR}, #{video,jdbcType=LONGVARCHAR}, #{notice,jdbcType=LONGVARCHAR},
|
#{images,jdbcType=LONGVARCHAR}, #{video,jdbcType=LONGVARCHAR}, #{notice,jdbcType=LONGVARCHAR},
|
||||||
#{groupSnap,jdbcType=LONGVARCHAR}, #{specInfo,jdbcType=LONGVARCHAR}, #{selectSpec,jdbcType=LONGVARCHAR}
|
#{groupSnap,jdbcType=LONGVARCHAR}, #{specInfo,jdbcType=LONGVARCHAR}, #{selectSpec,jdbcType=LONGVARCHAR},
|
||||||
|
#{stockNumber,jdbcType=INTEGER}
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs">
|
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs">
|
||||||
@@ -346,6 +348,9 @@
|
|||||||
<if test="selectSpec != null">
|
<if test="selectSpec != null">
|
||||||
select_spec,
|
select_spec,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="stockNumber != null">
|
||||||
|
stock_number,
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">
|
<if test="id != null">
|
||||||
@@ -546,6 +551,9 @@
|
|||||||
<if test="selectSpec != null">
|
<if test="selectSpec != null">
|
||||||
#{selectSpec,jdbcType=LONGVARCHAR},
|
#{selectSpec,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="stockNumber != null">
|
||||||
|
#{stockNumber,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs">
|
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs">
|
||||||
@@ -746,6 +754,9 @@
|
|||||||
<if test="selectSpec != null">
|
<if test="selectSpec != null">
|
||||||
select_spec = #{selectSpec,jdbcType=LONGVARCHAR},
|
select_spec = #{selectSpec,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="stockNumber != null">
|
||||||
|
stock_number = #{stockNumber,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
</set>
|
</set>
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</update>
|
</update>
|
||||||
@@ -815,7 +826,8 @@
|
|||||||
notice = #{notice,jdbcType=LONGVARCHAR},
|
notice = #{notice,jdbcType=LONGVARCHAR},
|
||||||
group_snap = #{groupSnap,jdbcType=LONGVARCHAR},
|
group_snap = #{groupSnap,jdbcType=LONGVARCHAR},
|
||||||
spec_info = #{specInfo,jdbcType=LONGVARCHAR},
|
spec_info = #{specInfo,jdbcType=LONGVARCHAR},
|
||||||
select_spec = #{selectSpec,jdbcType=LONGVARCHAR}
|
select_spec = #{selectSpec,jdbcType=LONGVARCHAR},
|
||||||
|
stock_number = #{stockNumber,jdbcType=INTEGER}
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</update>
|
</update>
|
||||||
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProduct">
|
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProduct">
|
||||||
@@ -878,7 +890,8 @@
|
|||||||
show_on_mall_error_msg = #{showOnMallErrorMsg,jdbcType=VARCHAR},
|
show_on_mall_error_msg = #{showOnMallErrorMsg,jdbcType=VARCHAR},
|
||||||
enable_label = #{enableLabel,jdbcType=TINYINT},
|
enable_label = #{enableLabel,jdbcType=TINYINT},
|
||||||
tax_config_id = #{taxConfigId,jdbcType=VARCHAR},
|
tax_config_id = #{taxConfigId,jdbcType=VARCHAR},
|
||||||
spec_table_headers = #{specTableHeaders,jdbcType=VARCHAR}
|
spec_table_headers = #{specTableHeaders,jdbcType=VARCHAR},
|
||||||
|
stock_number = #{stockNumber,jdbcType=INTEGER}
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
@@ -916,4 +929,35 @@
|
|||||||
and trade_day = #{day}
|
and trade_day = #{day}
|
||||||
group by shop_id,product_id
|
group by shop_id,product_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<update id="updateStockById">
|
||||||
|
update tb_product
|
||||||
|
set stock_number = stock_number - #{number,jdbcType=INTEGER}
|
||||||
|
where id = #{productId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="selectBySkuId" resultType="com.chaozhanggui.system.cashierservice.entity.po.ProConsSkuInfo">
|
||||||
|
SELECT
|
||||||
|
c.shop_id,
|
||||||
|
c.product_sku_id,
|
||||||
|
c.`status`,
|
||||||
|
i.id as con_id,
|
||||||
|
i.con_code,
|
||||||
|
i.con_name,
|
||||||
|
i.surplus_stock,
|
||||||
|
i.stock_number,
|
||||||
|
p.id as product_id,
|
||||||
|
p.`name` as product_name,
|
||||||
|
i.con_warning,
|
||||||
|
s.spec_snap
|
||||||
|
FROM
|
||||||
|
tb_prosku_con c
|
||||||
|
LEFT JOIN tb_cons_info i ON c.con_info_id = i.id
|
||||||
|
left join tb_product_sku s on c.product_sku_id=s.id
|
||||||
|
left join tb_product p on s.product_id=p.id
|
||||||
|
where c.`status`=1
|
||||||
|
and c.product_sku_id=#{skuId}
|
||||||
|
group by i.id
|
||||||
|
order by i.id
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -6,11 +6,12 @@
|
|||||||
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
|
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
|
||||||
<result column="product_sku_id" jdbcType="INTEGER" property="productSkuId" />
|
<result column="product_sku_id" jdbcType="INTEGER" property="productSkuId" />
|
||||||
<result column="con_info_id" jdbcType="INTEGER" property="conInfoId" />
|
<result column="con_info_id" jdbcType="INTEGER" property="conInfoId" />
|
||||||
|
<result column="surplus_stock" jdbcType="DECIMAL" property="surplusStock" />
|
||||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, shop_id, product_sku_id, con_info_id, status, create_time
|
id, shop_id, product_sku_id, con_info_id, surplus_stock, status, create_time
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
@@ -24,11 +25,11 @@
|
|||||||
</delete>
|
</delete>
|
||||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
|
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
|
||||||
insert into tb_prosku_con (id, shop_id, product_sku_id,
|
insert into tb_prosku_con (id, shop_id, product_sku_id,
|
||||||
con_info_id, status, create_time
|
con_info_id, surplus_stock, status,
|
||||||
)
|
create_time)
|
||||||
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{productSkuId,jdbcType=INTEGER},
|
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{productSkuId,jdbcType=INTEGER},
|
||||||
#{conInfoId,jdbcType=INTEGER}, #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}
|
#{conInfoId,jdbcType=INTEGER}, #{surplusStock,jdbcType=DECIMAL}, #{status,jdbcType=VARCHAR},
|
||||||
)
|
#{createTime,jdbcType=TIMESTAMP})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
|
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
|
||||||
insert into tb_prosku_con
|
insert into tb_prosku_con
|
||||||
@@ -45,6 +46,9 @@
|
|||||||
<if test="conInfoId != null">
|
<if test="conInfoId != null">
|
||||||
con_info_id,
|
con_info_id,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="surplusStock != null">
|
||||||
|
surplus_stock,
|
||||||
|
</if>
|
||||||
<if test="status != null">
|
<if test="status != null">
|
||||||
status,
|
status,
|
||||||
</if>
|
</if>
|
||||||
@@ -65,6 +69,9 @@
|
|||||||
<if test="conInfoId != null">
|
<if test="conInfoId != null">
|
||||||
#{conInfoId,jdbcType=INTEGER},
|
#{conInfoId,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="surplusStock != null">
|
||||||
|
#{surplusStock,jdbcType=DECIMAL},
|
||||||
|
</if>
|
||||||
<if test="status != null">
|
<if test="status != null">
|
||||||
#{status,jdbcType=VARCHAR},
|
#{status,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
@@ -85,6 +92,9 @@
|
|||||||
<if test="conInfoId != null">
|
<if test="conInfoId != null">
|
||||||
con_info_id = #{conInfoId,jdbcType=INTEGER},
|
con_info_id = #{conInfoId,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="surplusStock != null">
|
||||||
|
surplus_stock = #{surplusStock,jdbcType=DECIMAL},
|
||||||
|
</if>
|
||||||
<if test="status != null">
|
<if test="status != null">
|
||||||
status = #{status,jdbcType=VARCHAR},
|
status = #{status,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
@@ -99,12 +109,28 @@
|
|||||||
set shop_id = #{shopId,jdbcType=INTEGER},
|
set shop_id = #{shopId,jdbcType=INTEGER},
|
||||||
product_sku_id = #{productSkuId,jdbcType=INTEGER},
|
product_sku_id = #{productSkuId,jdbcType=INTEGER},
|
||||||
con_info_id = #{conInfoId,jdbcType=INTEGER},
|
con_info_id = #{conInfoId,jdbcType=INTEGER},
|
||||||
|
surplus_stock = #{surplusStock,jdbcType=DECIMAL},
|
||||||
status = #{status,jdbcType=VARCHAR},
|
status = #{status,jdbcType=VARCHAR},
|
||||||
create_time = #{createTime,jdbcType=TIMESTAMP}
|
create_time = #{createTime,jdbcType=TIMESTAMP}
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<select id="selectBySkuIdAndShopId" resultMap="BaseResultMap">
|
<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=#{shopId} and shop_id=#{shopId} and status=1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectIdBySkuIdAndShopId" resultType="java.lang.Integer">
|
||||||
|
SELECT
|
||||||
|
p.con_info_id
|
||||||
|
FROM
|
||||||
|
tb_prosku_con p
|
||||||
|
WHERE
|
||||||
|
p.shop_id = #{shopId}
|
||||||
|
AND p.product_sku_id = #{skuId}
|
||||||
|
AND p.`status` = 1
|
||||||
|
group by p.con_info_id
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
106
src/main/resources/mapper/TbUserShopMsgMapper.xml
Normal file
106
src/main/resources/mapper/TbUserShopMsgMapper.xml
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
<?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.TbUserShopMsgMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg">
|
||||||
|
<id 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" />
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
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}
|
||||||
|
</select>
|
||||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||||
|
delete from tb_user_shop_msg
|
||||||
|
where shop_id = #{shopId,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>
|
||||||
|
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg">
|
||||||
|
insert into tb_user_shop_msg
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="shopId != null">
|
||||||
|
shop_id,
|
||||||
|
</if>
|
||||||
|
<if test="openId != null">
|
||||||
|
open_id,
|
||||||
|
</if>
|
||||||
|
<if test="remark != null">
|
||||||
|
remark,
|
||||||
|
</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="shopId != null">
|
||||||
|
#{shopId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="openId != null">
|
||||||
|
#{openId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="remark != null">
|
||||||
|
#{remark,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="status != null">
|
||||||
|
#{status,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
#{createTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
#{updateTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg">
|
||||||
|
update tb_user_shop_msg
|
||||||
|
<set>
|
||||||
|
<if test="openId != null">
|
||||||
|
open_id = #{openId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="remark != null">
|
||||||
|
remark = #{remark,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="status != null">
|
||||||
|
status = #{status,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where shop_id = #{shopId,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbUserShopMsg">
|
||||||
|
update tb_user_shop_msg
|
||||||
|
set 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}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user