16 Commits
1.0.1 ... 1.0.2

Author SHA1 Message Date
韩鹏辉
fad761b63c 修改耗材库存 2024-06-28 09:39:29 +08:00
韩鹏辉
75ec8fc9e5 修改耗材库存 2024-06-28 09:39:14 +08:00
e91636a188 分页配置统一 2024-06-27 14:21:46 +08:00
韩鹏辉
d8305159bd 根据token 获取店铺信息 2024-06-26 16:49:41 +08:00
b96c4dcef2 冲突 2024-06-26 14:32:49 +08:00
aa51ff123b Merge remote-tracking branch 'origin/dev' into dev
# Conflicts:
#	src/main/resources/mapper/TbOrderInfoMapper.xml
2024-06-26 14:30:08 +08:00
7b90da01d6 Merge branch 'master' into dev 2024-06-26 14:29:01 +08:00
韩鹏辉
abc5ea04e4 Merge branch '1.0.1' into dev 2024-06-26 14:28:36 +08:00
韩鹏辉
22c0032f78 Merge remote-tracking branch 'origin/master' 2024-06-26 11:12:40 +08:00
韩鹏辉
3668252207 修改打印 2024-06-26 11:12:28 +08:00
92fb9c48a0 解决页数超限 仍返回数据问题 2024-06-26 11:09:05 +08:00
GYJ
bd0054ffa8 Merge branch 'refs/heads/stock-share' into dev 2024-06-26 09:18:57 +08:00
GYJ
2310a0164b 回滚库存 2024-06-25 15:31:50 +08:00
韩鹏辉
82935827f5 修改打印 2024-06-25 15:08:46 +08:00
GYJ
b66a89b143 退款回滚库存 2024-06-24 18:00:25 +08:00
GYJ
fa2668ed1c 添加字段 2024-06-24 15:05:26 +08:00
42 changed files with 1130 additions and 152 deletions

View File

@@ -178,6 +178,13 @@
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-mp-jdk6</artifactId>
<version>2.2.0</version>
</dependency>
</dependencies>
<!-- <profiles>-->
<!-- <profile>-->

View File

@@ -1,6 +1,7 @@
package com.chaozhanggui.system.cashierservice;
import com.chaozhanggui.system.cashierservice.task.ConsInfoTask;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,6 +45,7 @@ public class Shell {
@Bean
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
return (args) -> {
// ctx.getBean(ConsInfoTask.class).init();
logger.info("=========================启动完成==========================");
};
}

View File

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

View File

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

View File

@@ -2,12 +2,14 @@ package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.TbConsInfo;
import com.chaozhanggui.system.cashierservice.entity.po.ConsInfoPO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
@Mapper
public interface TbConsInfoMapper {
int deleteByPrimaryKey(Integer id);
@@ -22,4 +24,7 @@ public interface TbConsInfoMapper {
int updateByPrimaryKey(TbConsInfo record);
void batchStock(@Param("list")List<ConsInfoPO> list);
int countAll();
List<TbConsInfo> selectAllInfo();
}

View File

@@ -2,6 +2,7 @@ package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.TbProduct;
import com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs;
import com.chaozhanggui.system.cashierservice.entity.po.ProConsSkuInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.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);
void updateStockById(@Param("productId")Integer productId, @Param("num")Integer num);
List<ProConsSkuInfo> selectBySkuId(Integer skuId);
}

View File

@@ -22,5 +22,13 @@ public interface TbProskuConMapper {
int updateByPrimaryKey(TbProskuCon record);
List<TbProskuCon> selectBySkuIdAndShopId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
List<Integer> selectIdBySkuIdAndShopId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
}

View File

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

View File

@@ -21,10 +21,10 @@ public class TbConsInfo implements Serializable {
private String conUnit;
private BigDecimal surplusStock;
private BigDecimal lasterInStock;
private BigDecimal conWarning;
private Date createTime;
private Date updateTime;
@@ -95,14 +95,6 @@ public class TbConsInfo implements Serializable {
this.conUnit = conUnit == null ? null : conUnit.trim();
}
public BigDecimal getSurplusStock() {
return surplusStock;
}
public void setSurplusStock(BigDecimal surplusStock) {
this.surplusStock = surplusStock;
}
public BigDecimal getLasterInStock() {
return lasterInStock;
}
@@ -111,6 +103,14 @@ public class TbConsInfo implements Serializable {
this.lasterInStock = lasterInStock;
}
public BigDecimal getConWarning() {
return conWarning;
}
public void setConWarning(BigDecimal conWarning) {
this.conWarning = conWarning;
}
public Date getCreateTime() {
return createTime;
}

View File

@@ -126,6 +126,8 @@ public class TbProduct implements Serializable {
private String specTableHeaders;
private Integer stockNumber;
@Transient
private int orderCount;
@@ -642,4 +644,12 @@ public class TbProduct implements Serializable {
public void setOrderCount(int orderCount) {
this.orderCount = orderCount;
}
public Integer getStockNumber() {
return stockNumber;
}
public void setStockNumber(Integer stockNumber) {
this.stockNumber = stockNumber;
}
}

View File

@@ -49,5 +49,7 @@ public class TbProductSku implements Serializable {
private Long updatedAt;
private Integer isPauseSale = 0;
private static final long serialVersionUID = 1L;
}

View File

@@ -1,6 +1,7 @@
package com.chaozhanggui.system.cashierservice.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
public class TbProskuCon implements Serializable {
@@ -12,6 +13,8 @@ public class TbProskuCon implements Serializable {
private Integer conInfoId;
private BigDecimal surplusStock;
private String status;
private Date createTime;
@@ -50,6 +53,14 @@ public class TbProskuCon implements Serializable {
this.conInfoId = conInfoId;
}
public BigDecimal getSurplusStock() {
return surplusStock;
}
public void setSurplusStock(BigDecimal surplusStock) {
this.surplusStock = surplusStock;
}
public String getStatus() {
return status;
}

View File

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

View File

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

View File

@@ -23,6 +23,7 @@ public class WebAppConfigurer implements WebMvcConfigurer {
.excludePathPatterns("/data/handoverData")
.excludePathPatterns("/order/scanSendMessage")
.excludePathPatterns("/order/getsendMessage")
.excludePathPatterns("/qrcode/getscanCode")
.excludePathPatterns("/order/sendMessage");
}
}

View File

@@ -1,15 +1,6 @@
package com.chaozhanggui.system.cashierservice.rabbit;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.dao.TbCashierCartMapper;
import com.chaozhanggui.system.cashierservice.dao.TbConsInfoMapper;
import com.chaozhanggui.system.cashierservice.dao.TbProskuConMapper;
import com.chaozhanggui.system.cashierservice.entity.TbCashierCart;
import com.chaozhanggui.system.cashierservice.entity.TbConsInfo;
import com.chaozhanggui.system.cashierservice.entity.TbProskuCon;
import com.chaozhanggui.system.cashierservice.entity.po.ConsInfoPO;
import com.chaozhanggui.system.cashierservice.service.ConsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
@@ -18,13 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@Slf4j
@Component
@RabbitListener(queues = {RabbitConstants.CONS_COLLECT_QUEUE_PUT})

View File

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

View File

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

View File

@@ -31,4 +31,18 @@ public interface RabbitConstants {
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";
}

View File

@@ -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
public void confirm(CorrelationData correlationData, boolean ack, String cause) {
logger.info(" 回调id:" + correlationData);

View File

@@ -1,7 +1,6 @@
package com.chaozhanggui.system.cashierservice.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.dao.TbCashierCartMapper;
import com.chaozhanggui.system.cashierservice.dao.TbConsInfoFlowMapper;
@@ -17,7 +16,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
@Slf4j
@@ -70,15 +68,15 @@ public class ConsService {
for (TbProskuCon tbProskuCon : tbProskuCons) {
TbConsInfo tbConsInfo= tbConsInfoMapper.selectByPrimaryKey(tbProskuCon.getConInfoId());
if(Objects.nonNull(tbConsInfo)){
ConsInfoPO consInfoPO=new ConsInfoPO(tbConsInfo.getId(),tbConsInfo.getSurplusStock());
ConsInfoPO consInfoPO=new ConsInfoPO(tbConsInfo.getId(),tbProskuCon.getSurplusStock());
consInfoPOS.add(consInfoPO);
TbConsInfoFlow flow=new TbConsInfoFlow();
flow.setConsId(tbConsInfo.getId());
flow.setShopId(tbConsInfo.getShopId());
flow.setConName(tbConsInfo.getConName());
flow.setAmount(tbConsInfo.getSurplusStock());
flow.setBalance(tbConsInfo.getStockNumber().subtract(tbConsInfo.getSurplusStock()));
flow.setAmount(tbProskuCon.getSurplusStock());
flow.setBalance(tbConsInfo.getStockNumber().subtract(tbProskuCon.getSurplusStock()));
flow.setBizCode("createCart");
flow.setBizName("加入购物陈消耗");
flow.setBizType("-");
@@ -121,15 +119,15 @@ public class ConsService {
for (TbProskuCon tbProskuCon : tbProskuCons) {
TbConsInfo tbConsInfo= tbConsInfoMapper.selectByPrimaryKey(tbProskuCon.getConInfoId());
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);
TbConsInfoFlow flow=new TbConsInfoFlow();
flow.setConsId(tbConsInfo.getId());
flow.setShopId(tbConsInfo.getShopId());
flow.setConName(tbConsInfo.getConName());
flow.setAmount(tbConsInfo.getSurplusStock());
flow.setBalance(tbConsInfo.getStockNumber().add(tbConsInfo.getSurplusStock()));
flow.setAmount(tbProskuCon.getSurplusStock());
flow.setBalance(tbConsInfo.getStockNumber().add(tbProskuCon.getSurplusStock()));
flow.setBizCode("cancelCart");
flow.setBizName("取消购物车返回");
flow.setBizType("+");

View File

@@ -45,6 +45,8 @@ public class DutyService {
@Autowired
private TbProductSkuMapper productSkuMapper;
@Autowired
private TbProductMapper productMapper;
@Autowired
private CloudPrinterService cloudPrinterService;
@Autowired
private RedisUtils redisUtil;
@@ -372,8 +374,17 @@ public class DutyService {
}
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);
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()) {
productSkuMapper.updateStockNum(skuId,num);
} else {
@@ -381,3 +392,7 @@ public class DutyService {
}
}
}
}
}
}

View File

@@ -176,4 +176,15 @@ public class LoginService {
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);
}
}

View File

@@ -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.PublicResp;
import com.chaozhanggui.system.cashierservice.thirdpay.service.ThirdPayService;
import com.chaozhanggui.system.cashierservice.util.BeanUtil;
import com.chaozhanggui.system.cashierservice.util.DateUtils;
import com.chaozhanggui.system.cashierservice.util.MD5Util;
import com.chaozhanggui.system.cashierservice.util.SnowFlakeUtil;
import com.chaozhanggui.system.cashierservice.util.*;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@@ -78,7 +75,7 @@ public class MemberService {
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);
PageInfo pageInfo = new PageInfo(tbShopUsers);
return Result.success(CodeEnum.SUCCESS, pageInfo);
@@ -622,7 +619,7 @@ public class MemberService {
if (ObjectUtil.isEmpty(memberId)) {
return Result.fail(CodeEnum.PARAM);
}
PageHelper.startPage(page, pageSize);
PageHelperUtil.startPage(page, pageSize);
List<Map<String, Object>> list = tbShopUserFlowMapper.selectByMemberAccountFlow(memberId);
PageInfo pageInfo = new PageInfo(list);
return Result.success(CodeEnum.SUCCESS, pageInfo);

View File

@@ -12,7 +12,6 @@ import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.util.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -25,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import static com.chaozhanggui.system.cashierservice.sign.CodeEnum.CARTEXIST;
@@ -63,6 +63,8 @@ public class OrderService {
@Autowired
RabbitProducer producer;
private static ConcurrentHashMap<String, HashSet<Integer>> codeMap = 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)) {
boolean flag = redisUtil.exists("SHOP:CODE:" + clientType + ":" + shopId);
if (flag) {
@@ -401,7 +410,30 @@ public class OrderService {
if (Objects.nonNull(tbToken)){
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);
redisUtil.saveMessage(RedisCst.OUT_NUMBER.concat(orderInfo.getShopId()),object.toString());
orderId = orderInfo.getId();
}
for (TbOrderDetail orderDetail : orderDetails) {
@@ -732,7 +764,7 @@ public class OrderService {
public Result findOrder(Integer shopId, String status, Integer page, Integer size, String orderNo) {
String day = DateUtils.getDay();
PageHelper.startPage(page, size);
PageHelperUtil.startPage(page, size);
String orderType = "";
if (StringUtils.isNotEmpty(status)) {
if (status.equals("refund")) {
@@ -749,15 +781,14 @@ public class OrderService {
if (StringUtils.isEmpty(orderInfo.getImgUrl())) {
orderInfo.setImgUrl("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20240223/a04e0d3beef74d099ebd0fd1f7c41873.jpg");
}
orderInfo.setZdNo("POS");
orderInfo.setNames(orderInfo.getProductName().split(","));
List<SkuInfoPo> skuInfoPos=tbOrderInfoMapper.selectSkuByOrderId(orderInfo.getId().toString());
if(Objects.isNull(skuInfoPos)||skuInfoPos.size()<0){
skuInfoPos=new ArrayList<>();
}
orderInfo.setSkuInfos(skuInfoPos);
orderInfo.setZdNo("POS");
orderInfo.setNames(orderInfo.getProductName().split(","));
}
PageInfo pageInfo = new PageInfo(list);
log.info("获取订单:{}", JSONUtil.toJSONString(pageInfo));
@@ -927,6 +958,9 @@ public class OrderService {
private String secrete;
@Value("${subscribe.message.miniprogramState}")
private String miniprogramState;
public Result sendMassage(String orderId){
if(ObjectUtil.isEmpty(orderId)){
return Result.fail(CodeEnum.ERRMASTER);
@@ -987,7 +1021,7 @@ public class OrderService {
object1.put("data",data);
object1.put("miniprogram_state","trial");
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();
@@ -1075,7 +1109,7 @@ public class OrderService {
object1.put("data",data);
object1.put("miniprogram_state","trial");
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();
@@ -1108,7 +1142,7 @@ public class OrderService {
public Result getOutNumber(String shopId,Integer page,Integer pageSize){
PageHelper.startPage(page, pageSize);
PageHelperUtil.startPage(page, pageSize);
List<TbOrderOutNumber> list= tbOrderOutNumberMapper.selectAll(shopId);
PageInfo pageInfo=new PageInfo(list);
return Result.success(CodeEnum.SUCCESS,pageInfo);

View File

@@ -89,6 +89,9 @@ public class PayService {
@Autowired
private TbProductSkuMapper productSkuMapper;
@Autowired
private TbProductMapper productMapper;
@Autowired
private RedisUtils redisUtil;
@@ -920,11 +923,19 @@ public class PayService {
detail = tbOrderDetailMapper.selectByPrimaryKey(detail.getId());
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)) {
redisUtil.seckill(RedisCst.PRODUCT + shopId.toString() + ":" + productSku.getId().toString(), String.valueOf(detail.getReturnNum() + productSku.getStockNumber().intValue()));
productSkuMapper.updateByskuIdSub(productSku.getId(), detail.getReturnNum() * -1);
}
}
}
}
return Result.success(CodeEnum.SUCCESS);
}
@@ -1088,7 +1099,7 @@ public class PayService {
String shopId = info.getString("shopId");
String staffId = info.getString("staffId");
PageHelper.startPage(pageNo, pageSize);
PageHelperUtil.startPage(pageNo, pageSize);
List<TbQuickPay> list = tbQuickPayMapper.selectByShopIdAndStaffId(Integer.valueOf(shopId), Integer.valueOf(staffId));

View File

@@ -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.Result;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
@Slf4j
@@ -39,14 +38,14 @@ public class ProductService {
public Result queryCategory(String shopId,Integer page,Integer pageSize){
PageHelper.startPage(page, pageSize);
PageHelperUtil.startPage(page, pageSize);
List<TbShopCategory> list=tbShopCategoryMapper.selectByAll(shopId);
PageInfo pageInfo=new PageInfo(list);
return Result.success(CodeEnum.SUCCESS,pageInfo);
}
public Result queryAllCategory(String shopId,Integer page,Integer pageSize){
PageHelper.startPage(page, pageSize);
PageHelperUtil.startPage(page, pageSize);
List<ShopCategoryVo> list=tbShopCategoryMapper.queryAllCategory(shopId);
PageInfo pageInfo=new PageInfo(list);
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) {
List<TbProductWithBLOBs> tbProductWithBLOBs=null;
PageHelperUtil.startPage(page,pageSize);
if(ObjectUtil.isEmpty(categoryId)){
PageHelper.startPage(page, pageSize);
tbProductWithBLOBs=tbProductMapper.selectByShopId(shopId,commdityName);
}else {
PageHelper.startPage(page, pageSize);
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndShopType(shopId,categoryId,commdityName);
}

View File

@@ -7,6 +7,7 @@ import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.util.DateUtils;
import com.chaozhanggui.system.cashierservice.util.PageHelperUtil;
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@@ -44,7 +45,7 @@ public class ShopInfoService {
return Result.fail(CodeEnum.PARAM);
}
PageHelper.startPage(page, pageSize);
PageHelperUtil.startPage(page, pageSize);
List<TbShopTable> shopTables=tbShopTableMapper.selectByShopIdAndStatus(shopId,areaId,status);
PageInfo pageInfo=new PageInfo(shopTables);
return Result.success(CodeEnum.SUCCESS,pageInfo);
@@ -64,7 +65,7 @@ public class ShopInfoService {
// ShopUserDuty shopUserDuty = shopUserDutyMapper.selectByShopIdAndTrade(shopId,day);
// List<String> list = shopUserDutyMapper.selectByShopIdAndTradeAll(shopId,day,tbToken.getId());
if (Objects.nonNull(shopUserDuty)){
// PageHelper.startPage(page, pageSize);
// PageHelperUtil.startPage(page, pageSize);
List<ShopUserDutyDetail> shopTables=shopUserDutyDetailMapper.selectAllByDuctId(shopUserDuty.getId());
// PageInfo pageInfo=new PageInfo(shopTables);
shopUserDuty.setDetailList(shopTables);
@@ -82,7 +83,7 @@ public class ShopInfoService {
public Result queryDutyFlow(String token, String shopId, int page, int pageSize) {
// JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
// String userId = jsonObject.getString("accountId");
PageHelper.startPage(page, pageSize);
PageHelperUtil.startPage(page, pageSize);
PageHelper.orderBy("login_out_time desc");
List<ShopUserDuty> list = shopUserDutyMapper.selectByShopId(shopId);
PageInfo pageInfo=new PageInfo(list);

View File

@@ -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.Result;
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 lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -109,7 +109,7 @@ public class TbGroupOrderInfoService {
}
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)));
}

View File

@@ -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.Result;
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 lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
@@ -60,7 +60,7 @@ public class TbPrintPCMachineService {
* @return 查询结果
*/
public Result queryByPage(TbPrintPCMachine tbPrintMachine) {
PageHelper.startPage(tbPrintMachine.getPage(), tbPrintMachine.getPageSize());
PageHelperUtil.startPage(tbPrintMachine.getPage(), tbPrintMachine.getPageSize());
tbPrintMachine.setContentType("local");
List<TbPrintPCMachine> tbPrintMachines = this.tbPrintMachineMapper.queryAll(tbPrintMachine);

View File

@@ -96,6 +96,9 @@ public enum CodeEnum {
ISNOTAPPORDER("100035",false,"不是小程序订单","fail"),
CONSERROR("100036",false,"商品已售罄","fail"),

View File

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

View File

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

View File

@@ -16,4 +16,6 @@ public class RedisCst {
public static final Object PRODUCT = "PRODUCT:";
public static final String OUT_NUMBER="ORDER:NUMBER:";
public static final String ORDER_MESSAGE="ORDER:MESSAGE:";
}

View File

@@ -52,6 +52,9 @@ mybatis:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mapper-locations: classpath:mapper/*.xml
subscribe:
message:
miniprogramState: trial

View File

@@ -54,6 +54,9 @@ mybatis:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mapper-locations: classpath:mapper/*.xml
subscribe:
message:
miniprogramState: formal

View File

@@ -45,6 +45,10 @@ thirdPay:
wx:
appId: wxd88fffa983758a30
secrete: a34a61adc0602118b49400baa8812454
msg:
appId: wxcf0fe8cdba153fd6
secrete: c33e06467c6879a62af633d50ed6b720

View File

@@ -52,6 +52,13 @@
<!-- 要生成的表tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
<!-- <table tableName="%" schema="fycashier" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" ></table>-->
<table tableName="tb_cons_info" domainObjectName="TbConsInfo"
enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false" >
</table>
<table tableName="tb_prosku_con" domainObjectName="TbProskuCon"
enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false" >

View File

@@ -10,14 +10,14 @@
<result column="con_name" jdbcType="VARCHAR" property="conName" />
<result column="stock_number" jdbcType="DECIMAL" property="stockNumber" />
<result column="con_unit" jdbcType="VARCHAR" property="conUnit" />
<result column="surplus_stock" jdbcType="DECIMAL" property="surplusStock" />
<result column="laster_in_stock" jdbcType="DECIMAL" property="lasterInStock" />
<result column="con_warning" jdbcType="DECIMAL" property="conWarning" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
id, shop_id, con_type_id, con_type_name, con_code, con_name, stock_number, con_unit,
surplus_stock, laster_in_stock, create_time, update_time
laster_in_stock, con_warning, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
@@ -32,13 +32,13 @@
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
insert into tb_cons_info (id, shop_id, con_type_id,
con_type_name, con_code, con_name,
stock_number, con_unit, surplus_stock,
laster_in_stock, create_time, update_time
stock_number, con_unit, laster_in_stock,
con_warning, create_time, update_time
)
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{conTypeId,jdbcType=INTEGER},
#{conTypeName,jdbcType=VARCHAR}, #{conCode,jdbcType=VARCHAR}, #{conName,jdbcType=VARCHAR},
#{stockNumber,jdbcType=DECIMAL}, #{conUnit,jdbcType=VARCHAR}, #{surplusStock,jdbcType=DECIMAL},
#{lasterInStock,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
#{stockNumber,jdbcType=DECIMAL}, #{conUnit,jdbcType=VARCHAR}, #{lasterInStock,jdbcType=DECIMAL},
#{conWarning,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
@@ -68,12 +68,12 @@
<if test="conUnit != null">
con_unit,
</if>
<if test="surplusStock != null">
surplus_stock,
</if>
<if test="lasterInStock != null">
laster_in_stock,
</if>
<if test="conWarning != null">
con_warning,
</if>
<if test="createTime != null">
create_time,
</if>
@@ -106,12 +106,12 @@
<if test="conUnit != null">
#{conUnit,jdbcType=VARCHAR},
</if>
<if test="surplusStock != null">
#{surplusStock,jdbcType=DECIMAL},
</if>
<if test="lasterInStock != null">
#{lasterInStock,jdbcType=DECIMAL},
</if>
<if test="conWarning != null">
#{conWarning,jdbcType=DECIMAL},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
@@ -144,12 +144,12 @@
<if test="conUnit != null">
con_unit = #{conUnit,jdbcType=VARCHAR},
</if>
<if test="surplusStock != null">
surplus_stock = #{surplusStock,jdbcType=DECIMAL},
</if>
<if test="lasterInStock != null">
laster_in_stock = #{lasterInStock,jdbcType=DECIMAL},
</if>
<if test="conWarning != null">
con_warning = #{conWarning,jdbcType=DECIMAL},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
@@ -168,13 +168,21 @@
con_name = #{conName,jdbcType=VARCHAR},
stock_number = #{stockNumber,jdbcType=DECIMAL},
con_unit = #{conUnit,jdbcType=VARCHAR},
surplus_stock = #{surplusStock,jdbcType=DECIMAL},
laster_in_stock = #{lasterInStock,jdbcType=DECIMAL},
con_warning = #{conWarning,jdbcType=DECIMAL},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</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">
<foreach collection="list" item="item" index="index" open="" close="" separator=";">

View File

@@ -62,6 +62,7 @@
<result column="enable_label" jdbcType="TINYINT" property="enableLabel" />
<result column="tax_config_id" jdbcType="VARCHAR" property="taxConfigId" />
<result column="spec_table_headers" jdbcType="VARCHAR" property="specTableHeaders" />
<result column="stock_number" jdbcType="INTEGER" property="stockNumber" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs">
<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,
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,
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 id="Blob_Column_List">
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,
enable_label, tax_config_id, spec_table_headers,
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},
#{sourcePath,jdbcType=VARCHAR}, #{brandId,jdbcType=INTEGER}, #{merchantId,jdbcType=VARCHAR},
@@ -142,7 +143,8 @@
#{showOnMallStatus,jdbcType=TINYINT}, #{showOnMallTime,jdbcType=BIGINT}, #{showOnMallErrorMsg,jdbcType=VARCHAR},
#{enableLabel,jdbcType=TINYINT}, #{taxConfigId,jdbcType=VARCHAR}, #{specTableHeaders,jdbcType=VARCHAR},
#{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 id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs">
@@ -346,6 +348,9 @@
<if test="selectSpec != null">
select_spec,
</if>
<if test="stockNumber != null">
stock_number,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@@ -546,6 +551,9 @@
<if test="selectSpec != null">
#{selectSpec,jdbcType=LONGVARCHAR},
</if>
<if test="stockNumber != null">
#{stockNumber,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs">
@@ -746,6 +754,9 @@
<if test="selectSpec != null">
select_spec = #{selectSpec,jdbcType=LONGVARCHAR},
</if>
<if test="stockNumber != null">
stock_number = #{stockNumber,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
@@ -815,7 +826,8 @@
notice = #{notice,jdbcType=LONGVARCHAR},
group_snap = #{groupSnap,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}
</update>
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProduct">
@@ -878,7 +890,8 @@
show_on_mall_error_msg = #{showOnMallErrorMsg,jdbcType=VARCHAR},
enable_label = #{enableLabel,jdbcType=TINYINT},
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}
</update>
@@ -916,4 +929,35 @@
and trade_day = #{day}
group by shop_id,product_id
</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>

View File

@@ -6,11 +6,12 @@
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
<result column="product_sku_id" jdbcType="INTEGER" property="productSkuId" />
<result column="con_info_id" jdbcType="INTEGER" property="conInfoId" />
<result column="surplus_stock" jdbcType="DECIMAL" property="surplusStock" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<sql id="Base_Column_List">
id, shop_id, product_sku_id, con_info_id, status, create_time
id, shop_id, product_sku_id, con_info_id, surplus_stock, status, create_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
@@ -24,11 +25,11 @@
</delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
insert into tb_prosku_con (id, shop_id, product_sku_id,
con_info_id, status, create_time
)
con_info_id, surplus_stock, status,
create_time)
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 id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
insert into tb_prosku_con
@@ -45,6 +46,9 @@
<if test="conInfoId != null">
con_info_id,
</if>
<if test="surplusStock != null">
surplus_stock,
</if>
<if test="status != null">
status,
</if>
@@ -65,6 +69,9 @@
<if test="conInfoId != null">
#{conInfoId,jdbcType=INTEGER},
</if>
<if test="surplusStock != null">
#{surplusStock,jdbcType=DECIMAL},
</if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
@@ -85,6 +92,9 @@
<if test="conInfoId != null">
con_info_id = #{conInfoId,jdbcType=INTEGER},
</if>
<if test="surplusStock != null">
surplus_stock = #{surplusStock,jdbcType=DECIMAL},
</if>
<if test="status != null">
status = #{status,jdbcType=VARCHAR},
</if>
@@ -99,12 +109,28 @@
set shop_id = #{shopId,jdbcType=INTEGER},
product_sku_id = #{productSkuId,jdbcType=INTEGER},
con_info_id = #{conInfoId,jdbcType=INTEGER},
surplus_stock = #{surplusStock,jdbcType=DECIMAL},
status = #{status,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectBySkuIdAndShopId" resultMap="BaseResultMap">
select * from tb_prosku_con where product_sku_id=#{shopId} and shop_id=#{shopId} and status=1
</select>
<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>

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