Compare commits
22 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
46133d7d16 | |
|
|
61157d730c | |
|
|
cee4643925 | |
|
|
38b03b556c | |
|
|
df75a74822 | |
|
|
dad47eb0c8 | |
|
|
b0243a9ddd | |
|
|
5a0112132d | |
|
|
4a0a548565 | |
|
|
6c6a447a5e | |
|
|
146cb0f00b | |
|
|
dc6df17a3f | |
|
|
780707e55c | |
|
|
b5bc0f2e0a | |
|
|
e640226629 | |
|
|
148440cb31 | |
|
|
d93bfd24a1 | |
|
|
f7b845201c | |
|
|
a8b9223454 | |
|
|
22eadf7193 | |
|
|
923ee6f1cb | |
|
|
86df7addd6 |
|
|
@ -1,7 +1,6 @@
|
|||
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;
|
||||
|
|
@ -45,7 +44,6 @@ public class Shell {
|
|||
@Bean
|
||||
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
|
||||
return (args) -> {
|
||||
// ctx.getBean(ConsInfoTask.class).init();
|
||||
logger.info("=========================启动完成==========================");
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
package com.chaozhanggui.system.cashierservice.annotation;
|
||||
|
||||
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.bean.*;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 日志注解
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface MyLog {
|
||||
String value() default "未命名日志";
|
||||
LogTag tag();
|
||||
OperationLogType operationLogType() default OperationLogType.NULL;
|
||||
boolean write() default false;
|
||||
GetKeyWith getKeyWith() default GetKeyWith.WITH_NULL;
|
||||
String keyName() default "";
|
||||
OperationLogState operationLogstate() default OperationLogState.UN_HTTP_STATE;
|
||||
ActionType actionType() default ActionType.SELECT;
|
||||
LogType type() default LogType.INFO;
|
||||
boolean showBody() default false;
|
||||
}
|
||||
|
|
@ -0,0 +1,201 @@
|
|||
package com.chaozhanggui.system.cashierservice.aop;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.text.StrFormatter;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.annotation.MyLog;
|
||||
import com.chaozhanggui.system.cashierservice.bean.GetKeyWith;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Before;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@Aspect
|
||||
@Order
|
||||
@Component
|
||||
@Log4j2
|
||||
public class LogAop {
|
||||
|
||||
|
||||
@Pointcut("@annotation(com.chaozhanggui.system.cashierservice.annotation.MyLog)")
|
||||
private void getLogPointCut() {
|
||||
}
|
||||
|
||||
private String getRequestBodyInfo(HttpServletRequest request) {
|
||||
try {
|
||||
//利用InputStreamReader将字节流转换为字符流
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(request.getInputStream()));
|
||||
String string;
|
||||
StringBuilder stringBuffer=new StringBuilder();
|
||||
//读取字符流的字符拼接在stringBuffer,StringBuffer在进行字符串处理时,不生成新的对象,在内存使用上要优于String类
|
||||
while((string=bufferedReader.readLine())!=null){
|
||||
stringBuffer.append(string);
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}catch (Exception e) {
|
||||
log.error(e);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
@Async
|
||||
public void writeLog(String remoteAddr, String url, MyLog logAnnotation, Map<String, String[]> parameterMap, String bodyInfo, Object resp, long duration) {
|
||||
if (!logAnnotation.write()) return;
|
||||
// 系统操作日志, 异步事件
|
||||
String keyVal = null;
|
||||
JSONObject jsonObject = JSON.parseObject(bodyInfo);
|
||||
if (logAnnotation.keyName() != null && jsonObject != null) {
|
||||
if (GetKeyWith.WITH_POST.equals(logAnnotation.getKeyWith())) {
|
||||
keyVal = jsonObject.getString(logAnnotation.keyName());
|
||||
}else if (GetKeyWith.WITH_GET.equals(logAnnotation.getKeyWith())) {
|
||||
for (Map.Entry<String, String[]> entry : parameterMap.entrySet()) {
|
||||
if (entry.getKey().equals(logAnnotation.keyName())) {
|
||||
keyVal = entry.getValue()[0];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// SystemOperationLog operationLog = new SystemOperationLog();
|
||||
// operationLog.setMsg(logAnnotation.tag().getValue() + " " + logAnnotation.value())
|
||||
// .setKeyValue(keyVal)
|
||||
// .setKeyName(logAnnotation.keyName())
|
||||
// .setState(logAnnotation.operationLogstate())
|
||||
// .setType(logAnnotation.operationLogType())
|
||||
// .setRespData(resp)
|
||||
// .setDuration(duration)
|
||||
// .setIp(remoteAddr)
|
||||
// .setUrl(url)
|
||||
// .setReqData(jsonObject);
|
||||
// Utils.publishEvent(operationLog, OperationLogEvent.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置环绕通知,使用在方法logPointcut()上注册的切入点
|
||||
*
|
||||
* @param joinPoint join point for advice
|
||||
*/
|
||||
@Around("getLogPointCut()")
|
||||
public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
String logInfo = "\033[34m请求地址: {}, 请求ip: {}, 请求方式: {}, GET参数: {}, POST参数: {}\033[0m";
|
||||
String logStr = "";
|
||||
String bodyInfo = "";
|
||||
|
||||
Map<String, String[]> parameterMap = new HashMap<>();
|
||||
HttpServletRequest request = null;
|
||||
String remoteAddr = "";
|
||||
if (attributes != null) {
|
||||
request = attributes.getRequest();
|
||||
if (request.getHeader("X-Forwarded-For") != null) {
|
||||
remoteAddr = request.getHeader("X-Forwarded-For").split(",")[0];
|
||||
} else {
|
||||
remoteAddr = request.getRemoteAddr();
|
||||
}
|
||||
parameterMap = request.getParameterMap();
|
||||
bodyInfo = getRequestBodyInfo(request);
|
||||
logStr = StrFormatter.format(logInfo,
|
||||
request.getRequestURI(), remoteAddr, request.getMethod(), request.getQueryString(), bodyInfo);
|
||||
log.info(logStr);
|
||||
}
|
||||
|
||||
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
|
||||
Method method = methodSignature.getMethod();
|
||||
MyLog logAnnotation = method.getAnnotation(MyLog.class);
|
||||
|
||||
|
||||
// 开始时间
|
||||
long startTime = DateUtil.current(false);
|
||||
Object result = null;
|
||||
Exception error = null;
|
||||
try {
|
||||
result = joinPoint.proceed();
|
||||
return result;
|
||||
}catch (Exception e) {
|
||||
error = e;
|
||||
throw e;
|
||||
}
|
||||
finally {
|
||||
long endTime = DateUtil.current(false);
|
||||
|
||||
writeLog(remoteAddr, request != null ? request.getRequestURI() : "", logAnnotation, parameterMap, bodyInfo, result == null ? Objects.requireNonNull(error).getCause() + error.getMessage(): result, endTime - startTime);
|
||||
|
||||
// 异步记录日志
|
||||
if (logAnnotation.showBody()) {
|
||||
logInfo = "\033[32;4m包名: {}, 方法名: {}, 描述: {}, 操作类型: {}, 执行结果: {}, 执行时间: {}ms\033[0m";
|
||||
}else {
|
||||
logInfo = "\033[32;4m包名: {}, 方法名: {}, 描述: {}, 操作类型: {}, 执行时间: {}ms\033[0m";
|
||||
}
|
||||
switch (logAnnotation.type()) {
|
||||
case INFO:
|
||||
if (logAnnotation.showBody()) {
|
||||
log.info(logInfo,
|
||||
joinPoint.getTarget().getClass().getPackage().getName(),
|
||||
method.getName(), logAnnotation.value(), logAnnotation.actionType().getType(), result, endTime - startTime);
|
||||
}else {
|
||||
log.info(logInfo,
|
||||
joinPoint.getTarget().getClass().getPackage().getName(),
|
||||
method.getName(), logAnnotation.tag() + logAnnotation.value(), logAnnotation.actionType().getType(), endTime - startTime);
|
||||
}
|
||||
|
||||
break;
|
||||
case ERROR:
|
||||
if (logAnnotation.showBody()) {
|
||||
log.error(logInfo,
|
||||
joinPoint.getTarget().getClass().getPackage().getName(),
|
||||
method.getName(), logAnnotation.value(), logAnnotation.actionType().getType(), result, endTime - startTime);
|
||||
}else {
|
||||
log.error(logInfo,
|
||||
joinPoint.getTarget().getClass().getPackage().getName(),
|
||||
method.getName(), logAnnotation.tag() + logAnnotation.value(), logAnnotation.actionType().getType(), endTime - startTime);
|
||||
}
|
||||
break;
|
||||
case WARN:
|
||||
if (logAnnotation.showBody()) {
|
||||
log.warn(logInfo,
|
||||
joinPoint.getTarget().getClass().getPackage().getName(),
|
||||
method.getName(), logAnnotation.value(), logAnnotation.actionType().getType(), result, endTime - startTime);
|
||||
}else {
|
||||
log.warn(logInfo,
|
||||
joinPoint.getTarget().getClass().getPackage().getName(),
|
||||
method.getName(), logAnnotation.tag() + logAnnotation.value(), logAnnotation.actionType().getType(), endTime - startTime);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (logAnnotation.showBody()) {
|
||||
log.debug(logInfo,
|
||||
joinPoint.getTarget().getClass().getPackage().getName(),
|
||||
method.getName(), logAnnotation.value(), logAnnotation.actionType().getType(), result, endTime - startTime);
|
||||
}else {
|
||||
log.debug(logInfo,
|
||||
joinPoint.getTarget().getClass().getPackage().getName(),
|
||||
method.getName(), logAnnotation.tag() + logAnnotation.value(), logAnnotation.actionType().getType(), endTime - startTime);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.chaozhanggui.system.cashierservice.bean;
|
||||
|
||||
|
||||
/**
|
||||
* 日志操作活动枚举
|
||||
*/
|
||||
public enum ActionType {
|
||||
SELECT("查询操作"),
|
||||
UPDATE("修改操作"),
|
||||
DELETE("删除操作"),
|
||||
ADD("新增操作");
|
||||
private String type;
|
||||
|
||||
ActionType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.chaozhanggui.system.cashierservice.bean;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author: ZhangSong
|
||||
* @create: 2024-05-15 17:01
|
||||
*/
|
||||
@Getter
|
||||
public enum GetKeyWith {
|
||||
WITH_GET(0),
|
||||
WITH_POST(1),
|
||||
WITH_NULL(-1);
|
||||
|
||||
private final Integer value;
|
||||
|
||||
GetKeyWith(Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.chaozhanggui.system.cashierservice.bean;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 日志标签
|
||||
* @author: ZhangSong
|
||||
* @create: 2024-05-15 16:32
|
||||
*/
|
||||
@Getter
|
||||
public enum LogTag {
|
||||
JPUSH("极光"), CLIENT("安卓"),
|
||||
LOGIN("登录"), SYSTEM("系统"), CART("订单购物车");
|
||||
private final String value;
|
||||
|
||||
LogTag(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.chaozhanggui.system.cashierservice.bean;
|
||||
|
||||
public enum LogType {
|
||||
INFO("INFO"),
|
||||
ERROR("ERROR"),
|
||||
WARN("WARN"),
|
||||
DEBUG("DEBUG");
|
||||
private String value;
|
||||
|
||||
LogType(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.chaozhanggui.system.cashierservice.bean;
|
||||
|
||||
/**
|
||||
* 操作日志所有状态
|
||||
* @author: ZhangSong
|
||||
* @create: 2024-04-28 11:06
|
||||
*/
|
||||
public enum OperationLogState {
|
||||
UN_HTTP_STATE(-1),
|
||||
HTTP_FAIL_STATE(0),
|
||||
HTTP_SUCCESS_STATE(1),
|
||||
SQL_EXE_FAIL_STATE(2),
|
||||
SQL_EXE_SUCCESS_STATE(3);
|
||||
|
||||
private Integer state;
|
||||
|
||||
OperationLogState(Integer state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public Integer getState() {
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.chaozhanggui.system.cashierservice.bean;
|
||||
|
||||
/**
|
||||
* 操作日志所有操作类型
|
||||
* @author: ZhangSong
|
||||
* @create: 2024-04-28 11:04
|
||||
*/
|
||||
public enum OperationLogType {
|
||||
UM_API_QUERY_CITY_CALL(1000),
|
||||
UM_API_UPDATE_ORDER_PHONE(1010),
|
||||
UM_API_QUERY_DRIVER_LOCATION(1020),
|
||||
UM_API_CANCEL_ORDER(1030),
|
||||
UM_API_CANCEL_ORDER_SUCCESS(1040),
|
||||
UM_API_PAY_ORDER_CALL(1050),
|
||||
UM_API_CREATE_INVOICE_CALL(1060),
|
||||
UM_API_QUERY_INVOICE_CALL(1070),
|
||||
UM_API_RED_REVERSE_CALL(1080),
|
||||
UM_API_RED_REVERSE_CALL_SUCCESS(1081),
|
||||
UM_API_PUSH_ORDER_STATE_CALL(1090),
|
||||
UM_API_PUSH_ORDER_STATE_CALL_GET_HL_STATE_FAIL(1091),
|
||||
UM_API_PUSH_DRIVER_CALL(1100),
|
||||
UM_API_PUSH_DRIVER_CALL_API_FAIL(1101),
|
||||
UM_API_QUERY_PRICE_CALL(1110),
|
||||
UM_API_CREATE_ORDER_CALL(1120),
|
||||
UM_API_QUERY_ORDER_DETAIL_CALL(1130),
|
||||
JPUSH_API_CALL(1140),
|
||||
UM_CONTROLLER_MAKE_INVOICE_CALL(1150), UM_API_PUSH_TEMP_DRIVER_CALL(1160),
|
||||
ENUOYUN_INVOICE_CALL(1170),
|
||||
UM_API_CALL_UM_CHANGE_ORDER_STATE(1180),
|
||||
API_CHARGEBACK_CALL(1190),
|
||||
API_REDISTRIBUTE_CALL(1200), API_DRIVER_LOGIN_CALL(1210), NULL(-1),
|
||||
API_CHANGXING_HANGLV_CHONGXIN_SHANGCHUAN(1220),
|
||||
API_CHANGXING_HANGLV_FAPIAO_ZUOFEI(1230);
|
||||
private final Integer value;
|
||||
|
||||
OperationLogType(Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.chaozhanggui.system.cashierservice.bean;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author: ZhangSong
|
||||
* @create: 2024-05-23 19:01
|
||||
*/
|
||||
@Getter
|
||||
public enum Plat {
|
||||
TT(1),
|
||||
CX(2),
|
||||
RZ(3),
|
||||
JS(5),
|
||||
UNDEFINED(-1);
|
||||
|
||||
private final Integer value;
|
||||
|
||||
Plat(Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.chaozhanggui.system.cashierservice.bean;
|
||||
|
||||
public enum ShopWxMsgTypeEnum {
|
||||
ALL_MSG(-1),
|
||||
STOCK_MSG(0),
|
||||
CONSUMABLES_MSG(1),
|
||||
OPERATION_MSG(2);
|
||||
private final Integer type;
|
||||
|
||||
ShopWxMsgTypeEnum(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
|
@ -51,4 +51,13 @@ public class LoginContoller {
|
|||
@RequestHeader("clientType") String clientType){
|
||||
return loginService.getShopInfo(token);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "getStaffDiscount")
|
||||
public Result getStaffDiscount(@RequestHeader("token") String token,
|
||||
@RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType){
|
||||
return loginService.getStaffDiscount(token);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.annotation.MyLog;
|
||||
import com.chaozhanggui.system.cashierservice.bean.LogTag;
|
||||
import com.chaozhanggui.system.cashierservice.entity.OrderVo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.CartVo;
|
||||
import com.chaozhanggui.system.cashierservice.service.OrderService;
|
||||
|
|
@ -11,9 +14,6 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
@Slf4j
|
||||
|
|
@ -36,20 +36,29 @@ public class OrderController {
|
|||
cartVo.getSkuId(),cartVo.getNumber(),userId,clientType,cartVo.getCartId(),cartVo.getIsGift(),
|
||||
cartVo.getIsPack(),cartVo.getUuid(),cartVo.getType());
|
||||
}
|
||||
|
||||
@MyLog(value = "查询购物车信息", tag = LogTag.CART)
|
||||
@GetMapping("/queryCart")
|
||||
public Result queryCart(@RequestHeader("token") String token,
|
||||
@RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType,
|
||||
@RequestParam("masterId") String masterId,
|
||||
@RequestParam(value = "masterId", required = false) String masterId,
|
||||
@RequestParam(required = false) String tableId,
|
||||
@RequestParam("shopId") String shopId
|
||||
){
|
||||
if (tableId == null && StrUtil.isBlank(masterId)) {
|
||||
return Result.fail("masterId和tableId不能同时为空");
|
||||
}
|
||||
return orderService.queryCart(masterId,shopId);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/delCart")
|
||||
public Result delCart(@RequestHeader("token") String token,
|
||||
@RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType,
|
||||
@RequestParam("masterId") String masterId,
|
||||
@RequestParam(required = false) String tableId,
|
||||
@RequestParam(value = "masterId", required = false) String masterId,
|
||||
@RequestParam("cartId") Integer cartId
|
||||
){
|
||||
return orderService.delCart(masterId,cartId);
|
||||
|
|
|
|||
|
|
@ -1,13 +1,18 @@
|
|||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ProductStatusDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ProductStockDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.QuerySpecDTO;
|
||||
import com.chaozhanggui.system.cashierservice.service.ProductService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Map;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
|
|
@ -21,6 +26,23 @@ public class ProductController {
|
|||
private ProductService productService;
|
||||
|
||||
|
||||
@PutMapping("/productStatus")
|
||||
public Result productStatus(
|
||||
@Valid @RequestBody ProductStatusDTO productStatusDTO
|
||||
) {
|
||||
productService.updateState(productStatusDTO);
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
@PutMapping("/productStock")
|
||||
public Result productStock(
|
||||
@Valid @RequestBody ProductStockDTO productStockDTO
|
||||
) {
|
||||
productService.updateStock(productStockDTO);
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "queryCommodityInfo")
|
||||
public Result queryCommodityInfo(
|
||||
@RequestHeader("token") String token,
|
||||
|
|
@ -37,6 +59,15 @@ public class ProductController {
|
|||
return productService.queryCommodityInfo(shopId,categoryId,commdityName,page,pageSize,masterId);
|
||||
}
|
||||
|
||||
@GetMapping("querySpec")
|
||||
public Result querySpec(
|
||||
@RequestParam Integer shopId,
|
||||
@RequestParam Integer productId
|
||||
) {
|
||||
return Result.success(CodeEnum.SUCCESS, productService.querySpec(shopId, productId));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "queryNewCommodityInfo")
|
||||
public Result queryNewCommodityInfo(
|
||||
@RequestHeader("token") String token,
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@ package com.chaozhanggui.system.cashierservice.dao;
|
|||
import com.chaozhanggui.system.cashierservice.entity.TbCashierCart;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.CartPo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.QueryCartPo;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -30,9 +32,12 @@ public interface TbCashierCartMapper {
|
|||
TbCashierCart selectByDetail(@Param("masterId") String masterId, @Param("productId") String productId,
|
||||
@Param("shopId") String shopId, @Param("skuId") String skuId, @Param("day") String day,@Param("uuid") String uuid);
|
||||
|
||||
TbCashierCart selectDetailByQrcode(@Param("tableId") String tableId, @Param("productId") String productId,
|
||||
@Param("shopId") String shopId, @Param("skuId") String skuId, @Param("uuid") String uuid);
|
||||
|
||||
List<TbCashierCart> selectByMaskerId(@Param("masterId")String masterId, @Param("shopId")Integer shopId,@Param("status") String status,@Param("day") String day);
|
||||
|
||||
void deleteByCartId(@Param("masterId") String masterId, @Param("cartId")Integer cartId);
|
||||
void deleteByCartIdOrTableId(@Param("masterId") String masterId, @Param("cartId")Integer cartId, @Param("qrcode") String qrcode);
|
||||
|
||||
void updateStatus(@Param("masterId") Integer id,@Param("status") String status);
|
||||
|
||||
|
|
@ -60,4 +65,11 @@ public interface TbCashierCartMapper {
|
|||
|
||||
|
||||
List<TbCashierCart> selectByOrderId(@Param("orderId") String orderId,@Param("status") String status);
|
||||
}
|
||||
|
||||
List<TbCashierCart> selectActivateByQrcode(@Param("tableId") String tableId, @Param("shopId") Integer shopId);
|
||||
|
||||
QueryCartPo selectProductNumByQrcode(@Param("qrcode") String qrcode, @Param("shopId") Integer shopId);
|
||||
|
||||
@Delete("delete from tb_cashier_cart where master_id=#{masterId} and id=#{cartId}")
|
||||
int deleteByCartId(@Param("masterId") String masterId, @Param("cartId")Integer cartId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,4 +52,6 @@ public interface TbOrderInfoMapper {
|
|||
|
||||
|
||||
TbOrderInfo selectById(Integer id);
|
||||
|
||||
List<TbOrderInfo> selectActivateOrder(@Param("shopId") String shopId, @Param("tableId") String qrcodeId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs;
|
|||
import com.chaozhanggui.system.cashierservice.entity.po.ProConsSkuInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
|
@ -35,6 +36,7 @@ public interface TbProductMapper {
|
|||
|
||||
List<TbProductWithBLOBs> selectByShopIdAndShopType(@Param("shopId") String shopId, @Param("categoryId") String categoryId,@Param("commdityName") String commdityName);
|
||||
List<TbProductWithBLOBs> selectByShopIdAndShopTypeCheckGrounding(@Param("shopId") String shopId, @Param("categoryId") String categoryId,@Param("commdityName") String commdityName);
|
||||
List<TbProductWithBLOBs> selectByShopIdAndShopTypeUnGrounding(@Param("shopId") String shopId,@Param("commdityName") String commdityName);
|
||||
|
||||
|
||||
|
||||
|
|
@ -53,4 +55,24 @@ public interface TbProductMapper {
|
|||
|
||||
@Update("update tb_product set stock_number=stock_number-#{num} WHERE id=#{id}")
|
||||
int decrStockUnCheck(String id, int num);
|
||||
|
||||
@Select("select * from tb_product product where product.id=#{productId} and product.shop_id=#{shopId} and product.is_del=0")
|
||||
TbProduct selectByShopIdAndId(@Param("productId") Integer productId, @Param("shopId") Integer shopId);
|
||||
|
||||
@Update("update tb_product_sku set is_grounding=#{isGrounding} where product_id=#{productId}")
|
||||
int updateGroundingByProId(@Param("productId") Integer productId, @Param("isGrounding") int isGrounding);
|
||||
|
||||
@Update("update tb_product_sku set is_grounding=#{status} where id=#{skuId}")
|
||||
int updateGrounding(@Param("skuId") Integer skuId, @Param("status") int status);
|
||||
|
||||
@Update("update tb_product set is_pause_sale=#{state} where id=#{id} and shop_id=#{shopId}")
|
||||
int pauseSale(@Param("id") Integer id, @Param("shopId") Integer shopId, @Param("state") Integer state);
|
||||
|
||||
@Update("update tb_product_sku set is_pause_sale=#{state} where product_id=#{id} and shop_id=#{shopId}")
|
||||
int pauseSkuSale(@Param("id") Integer proId, @Param("shopId") Integer shopId, @Param("state") Integer state);
|
||||
|
||||
|
||||
|
||||
@Update("update tb_product set stock_number=#{stock} where id=#{productId} and shop_id=#{shopId}")
|
||||
int updateStock(@Param("shopId") Integer shopId, @Param("productId") Integer productId, @Param("stock") Integer stock);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,9 +51,18 @@ public interface TbProductSkuMapper {
|
|||
@Update("update tb_product_sku set stock_number=stock_number-#{num} WHERE id=#{id} ")
|
||||
int decrStockUnCheck(String id, int num);
|
||||
|
||||
@Select("select * from tb_product_sku where is_grounding=1 and product_id=#{id}")
|
||||
@Select("select * from tb_product_sku where is_grounding=1 and product_id=#{id} and is_del=0")
|
||||
List<TbProductSku> selectByProductCheckGrounding(@Param("id") Integer id);
|
||||
|
||||
@Select("select * from tb_product_sku where is_grounding=1 and is_del=0 and product_id=#{id}")
|
||||
List<TbProductSku> selectGroundingByProId(Integer id);
|
||||
List<TbProductSku> selectGroundingByProId(@Param("id") Integer id);
|
||||
|
||||
@Update("update tb_product_sku set is_pause_sale=#{state} where id=#{skuId} and shop_id=#{shopId}")
|
||||
int pauseSale(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId, @Param("state") Integer state);
|
||||
|
||||
@Update("update tb_product_sku set stock_number=#{stock} where product_id=#{skuId} and shop_id=#{shopId}")
|
||||
int updateStock(@Param("shopId") Integer shopId, @Param("skuId") Integer skuId, @Param("stock") Integer stock);
|
||||
|
||||
@Select("select * from tb_product_sku where product_id=#{id} and is_del=0")
|
||||
List<TbProductSku> selectByProductId(Integer id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,12 +24,14 @@ public interface TbProskuConMapper {
|
|||
|
||||
|
||||
List<TbProskuCon> selectBySkuIdAndShopId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
|
||||
List<TbProskuCon> selectBySkuIdAndShopIdAngCheck(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
|
||||
|
||||
|
||||
List<Integer> selectIdBySkuIdAndShopId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
|
||||
|
||||
List<TbProskuCon> selectByShopIdAndSkuIdAndProductId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId,@Param("productId") Integer productId);
|
||||
List<TbProskuCon> selectByShopIdAndSkuIdAndProductIdAndCheck(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId,@Param("productId") Integer productId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopOpenId;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -27,4 +28,7 @@ public interface TbShopOpenIdMapper {
|
|||
|
||||
@Select("select * from tb_shop_open_id where shop_id=#{shopId} and status=1")
|
||||
List<TbShopOpenId> selectByShopId(Integer integer);
|
||||
|
||||
@Select("select * from tb_shop_open_id where shop_id=#{shopId} and status=1 and (type=#{type} or type=-1) group by open_id;")
|
||||
List<TbShopOpenId> selectStateByShopIdAndType(@Param("shopId") String shopId, @Param("type") int type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ public class TbConsInfo implements Serializable {
|
|||
|
||||
private Date updateTime;
|
||||
|
||||
private String isCheck;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
|
|
@ -156,4 +158,12 @@ public class TbConsInfo implements Serializable {
|
|||
public void setPrice(BigDecimal price) {
|
||||
this.price = price;
|
||||
}
|
||||
}
|
||||
|
||||
public String getIsCheck() {
|
||||
return isCheck;
|
||||
}
|
||||
|
||||
public void setIsCheck(String isCheck) {
|
||||
this.isCheck = isCheck;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
public class TbProductWithBLOBs extends TbProduct implements Serializable {
|
||||
private Object groundingSpecInfo;
|
||||
private String images;
|
||||
|
||||
private String video;
|
||||
|
|
@ -20,58 +24,34 @@ public class TbProductWithBLOBs extends TbProduct implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public List<?> getSkuList() {
|
||||
return skuList;
|
||||
public void setGroundingSpecInfo(Object groundingSpecInfo) {
|
||||
this.groundingSpecInfo = groundingSpecInfo;
|
||||
}
|
||||
|
||||
public void setSkuList(List<?> skuList) {
|
||||
this.skuList = skuList;
|
||||
}
|
||||
|
||||
public String getImages() {
|
||||
return images;
|
||||
}
|
||||
|
||||
public void setImages(String images) {
|
||||
this.images = images == null ? null : images.trim();
|
||||
}
|
||||
|
||||
public String getVideo() {
|
||||
return video;
|
||||
}
|
||||
|
||||
public void setVideo(String video) {
|
||||
this.video = video == null ? null : video.trim();
|
||||
}
|
||||
|
||||
public String getNotice() {
|
||||
return notice;
|
||||
}
|
||||
|
||||
public void setNotice(String notice) {
|
||||
this.notice = notice == null ? null : notice.trim();
|
||||
}
|
||||
|
||||
public String getGroupSnap() {
|
||||
return groupSnap;
|
||||
}
|
||||
|
||||
public void setGroupSnap(String groupSnap) {
|
||||
this.groupSnap = groupSnap == null ? null : groupSnap.trim();
|
||||
}
|
||||
|
||||
public String getSpecInfo() {
|
||||
return specInfo;
|
||||
}
|
||||
|
||||
public void setSpecInfo(String specInfo) {
|
||||
this.specInfo = specInfo == null ? null : specInfo.trim();
|
||||
}
|
||||
|
||||
public String getSelectSpec() {
|
||||
return selectSpec;
|
||||
}
|
||||
|
||||
public void setSelectSpec(String selectSpec) {
|
||||
this.selectSpec = selectSpec == null ? null : selectSpec.trim();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,176 @@
|
|||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
* @TableName tb_shop_msg_state
|
||||
*/
|
||||
public class TbShopMsgState implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer shopId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Integer getShopId() {
|
||||
return shopId;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setShopId(Integer shopId) {
|
||||
this.shopId = shopId;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setType(Integer type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Integer getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setState(Integer state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
TbShopMsgState other = (TbShopMsgState) that;
|
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||
&& (this.getShopId() == null ? other.getShopId() == null : this.getShopId().equals(other.getShopId()))
|
||||
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
|
||||
&& (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()))
|
||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
|
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
||||
result = prime * result + ((getShopId() == null) ? 0 : getShopId().hashCode());
|
||||
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
|
||||
result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
|
||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
|
||||
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", id=").append(id);
|
||||
sb.append(", shopId=").append(shopId);
|
||||
sb.append(", type=").append(type);
|
||||
sb.append(", state=").append(state);
|
||||
sb.append(", createTime=").append(createTime);
|
||||
sb.append(", updateTime=").append(updateTime);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -34,6 +34,16 @@ public class TbShopTable implements Serializable {
|
|||
|
||||
private Long updatedAt;
|
||||
|
||||
private String qrcode;
|
||||
|
||||
public String getQrcode() {
|
||||
return qrcode;
|
||||
}
|
||||
|
||||
public void setQrcode(String qrcode) {
|
||||
this.qrcode = qrcode;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
|
|
@ -155,4 +165,4 @@ public class TbShopTable implements Serializable {
|
|||
public void setUpdatedAt(Long updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class ProductStatusDTO {
|
||||
@NotNull
|
||||
private Integer productId;
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
@NotNull
|
||||
@Range(min = 0, max = 1)
|
||||
private Integer state;
|
||||
// 0上下架 1售罄
|
||||
@Range(min = 0, max = 1)
|
||||
@NotNull
|
||||
private Integer type;
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class ProductStockDTO {
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
@NotNull
|
||||
private Integer productId;
|
||||
@NotNull
|
||||
@Min(0)
|
||||
private Integer stock;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class QuerySpecDTO {
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
private Integer productId;
|
||||
}
|
||||
|
|
@ -5,7 +5,10 @@ import lombok.Data;
|
|||
@Data
|
||||
public class CartVo {
|
||||
private String productId;
|
||||
|
||||
// orderId不为空为代客下单
|
||||
private String masterId;
|
||||
private String tableId;
|
||||
private String shopId;
|
||||
private Integer skuId;
|
||||
private Integer number;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
package com.chaozhanggui.system.cashierservice.mapper;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopMsgState;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【tb_shop_msg_state】的数据库操作Mapper
|
||||
* @createDate 2024-08-12 14:27:26
|
||||
* @Entity com.chaozhanggui.system.cashierservice.entity.TbShopMsgState
|
||||
*/
|
||||
public interface TbShopMsgStateMapper {
|
||||
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int insert(TbShopMsgState record);
|
||||
|
||||
int insertSelective(TbShopMsgState record);
|
||||
|
||||
TbShopMsgState selectByPrimaryKey(Long id);
|
||||
|
||||
int updateByPrimaryKeySelective(TbShopMsgState record);
|
||||
|
||||
int updateByPrimaryKey(TbShopMsgState record);
|
||||
|
||||
@Select("select * from tb_shop_msg_state where shop_id=#{shopId} and type=#{type};")
|
||||
TbShopMsgState selectByType(@Param("type") Integer type, @Param("shopId") Integer shopId);
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ 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.bean.ShopWxMsgTypeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.util.*;
|
||||
|
|
@ -93,9 +94,10 @@ public class ConsMsgConsumer {
|
|||
}
|
||||
|
||||
|
||||
List<TbProskuCon> tbProskuCons = tbProskuConMapper.selectBySkuIdAndShopId(skuId, shopId);
|
||||
// List<TbProskuCon> tbProskuCons = tbProskuConMapper.selectBySkuIdAndShopId(skuId, shopId);
|
||||
List<TbProskuCon> tbProskuCons = tbProskuConMapper.selectBySkuIdAndShopIdAngCheck(skuId, shopId);
|
||||
if (Objects.isNull(tbProskuCons) || tbProskuCons.size() <= 0) {
|
||||
log.info("耗材信息未配置");
|
||||
log.info("耗材信息未配置或未开启校验");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -122,7 +124,8 @@ public class ConsMsgConsumer {
|
|||
log.info("耗材名称: {}, conwarning:{},stockNumber:{}",tbConsInfo.getConName(),
|
||||
tbConsInfo.getConWarning(),tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()));
|
||||
if (N.egt(tbConsInfo.getConWarning(), tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()))) {
|
||||
List<TbUserShopMsg> tbUserShopMsgs = tbUserShopMsgMapper.selectAllByShopId(tbConsInfo.getShopId());
|
||||
List<TbShopOpenId> tbUserShopMsgs = shopOpenIdMapper
|
||||
.selectStateByShopIdAndType(product.getShopId(), ShopWxMsgTypeEnum.CONSUMABLES_MSG.getType());
|
||||
log.info("待推送openId列表: {}", tbUserShopMsgs);
|
||||
if (Objects.nonNull(tbUserShopMsgs) && tbUserShopMsgs.size()>0) {
|
||||
tbUserShopMsgs.parallelStream().forEach(tbUserShopMsg->{
|
||||
|
|
@ -132,7 +135,8 @@ public class ConsMsgConsumer {
|
|||
log.info("开始推送耗材模板消息,rediskey:{}", value);
|
||||
if (Objects.isNull(value)) {
|
||||
JSONObject jsonObject = wxAccountUtil.sendStockWarnMsg("耗材库存不足", tbConsInfo.getConName(),
|
||||
tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()).toBigInteger().intValue(), tbUserShopMsg.getOpenId());
|
||||
tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()).toBigInteger().intValue(), tbUserShopMsg.getOpenId(),
|
||||
ShopWxMsgTypeEnum.CONSUMABLES_MSG, shopId);
|
||||
if (jsonObject != null) {
|
||||
log.info("写入redis:{}",key);
|
||||
redisUtil.saveMessage(key, "1", 30 * 60);
|
||||
|
|
|
|||
|
|
@ -47,4 +47,8 @@ public interface RabbitConstants {
|
|||
|
||||
String EXCHANGE_STOCK_RECORD = "exchange.stock.record";
|
||||
String ROUTING_STOCK_RECORD_SALE = "routing.stock.record.sale";
|
||||
|
||||
// 库存记录
|
||||
public static final String QUEUE_STOCK_RECORD = "queue.stock.record";
|
||||
public static final String ROUTING_STOCK_RECORD= "routing.stock.record";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,4 +71,9 @@ public class RabbitProducer implements RabbitTemplate.ConfirmCallback {
|
|||
public <T> void sendStockSaleMsg(T data) {
|
||||
sendMsg(RabbitConstants.EXCHANGE_STOCK_RECORD, RabbitConstants.ROUTING_STOCK_RECORD_SALE, data, "商品售出增加库存记录");
|
||||
}
|
||||
|
||||
public <T> void sendStockRecordMsg(T data) {
|
||||
sendMsg(RabbitConstants.EXCHANGE_STOCK_RECORD, RabbitConstants.ROUTING_STOCK_RECORD, data, "增加库存记录");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,11 +66,13 @@ public class ConsService {
|
|||
List<TbConsInfoFlow> consInfoFlows=new ArrayList<>();
|
||||
|
||||
for (TbOrderDetail orderDetail : orderDetails) {
|
||||
List<TbProskuCon> proskuCons= tbProskuConMapper.selectByShopIdAndSkuIdAndProductId(orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
|
||||
// List<TbProskuCon> proskuCons= tbProskuConMapper.selectByShopIdAndSkuIdAndProductId(orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
|
||||
List<TbProskuCon> proskuCons= tbProskuConMapper.selectByShopIdAndSkuIdAndProductIdAndCheck(orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
|
||||
if(Objects.isNull(proskuCons)||proskuCons.size()<=0){
|
||||
log.info("不存在的耗材信息配置:orderId:{},skuId:{},shopId:{},productId:{}",orderDetail.getOrderId(),orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
|
||||
log.info("耗材信息未配置或未开启校验:orderId:{},skuId:{},shopId:{},productId:{}",orderDetail.getOrderId(),orderDetail.getProductSkuId(),orderDetail.getShopId(),orderDetail.getProductId());
|
||||
continue;
|
||||
}
|
||||
|
||||
for (TbProskuCon proskuCon : proskuCons) {
|
||||
TbConsInfo tbConsInfo= tbConsInfoMapper.selectByPrimaryKey(proskuCon.getConInfoId());
|
||||
if(Objects.nonNull(tbConsInfo)&&"1".equals(tbConsInfo.getStatus())){
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
|
@ -191,4 +192,23 @@ public class LoginService {
|
|||
|
||||
return Result.success(SUCCESS,shopInfo);
|
||||
}
|
||||
|
||||
|
||||
public Result getStaffDiscount(String token){
|
||||
|
||||
JSONObject jsonObject= TokenUtil.parseParamFromToken(token);
|
||||
if(Objects.isNull(jsonObject)){
|
||||
return Result.fail(CodeEnum.TOKENTERROR);
|
||||
}
|
||||
|
||||
Integer staffId=Integer.valueOf(jsonObject.getString("staffId"));
|
||||
|
||||
TbPlussShopStaff staff= tbPlussShopStaffMapper.selectByPrimaryKey(staffId);
|
||||
if(Objects.nonNull(staff)&&Objects.nonNull(staff.getMaxDiscountAmount())){
|
||||
return Result.success(SUCCESS,staff.getMaxDiscountAmount());
|
||||
}
|
||||
|
||||
return Result.success(SUCCESS, BigDecimal.ZERO);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ 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.bean.ShopWxMsgTypeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.*;
|
||||
|
|
@ -77,6 +78,12 @@ public class OrderService {
|
|||
|
||||
private final TbShopOpenIdMapper shopOpenIdMapper;
|
||||
|
||||
@Autowired
|
||||
private TbProskuConMapper tbProskuConMapper;
|
||||
|
||||
@Autowired
|
||||
TbConsInfoMapper tbConsInfoMapper;
|
||||
|
||||
|
||||
private static ConcurrentHashMap<String, HashSet<Integer>> codeMap = new ConcurrentHashMap<>();
|
||||
private static ConcurrentHashMap<String, HashSet<String>> userMap = new ConcurrentHashMap<>();
|
||||
|
|
@ -123,6 +130,30 @@ public class OrderService {
|
|||
|
||||
|
||||
|
||||
List<TbProskuCon> proskuConList= tbProskuConMapper.selectByShopIdAndSkuIdAndProductId(skuId,shopInfo.getId(),product.getId());
|
||||
if(Objects.nonNull(proskuConList)&&proskuConList.size()>0){
|
||||
for (TbProskuCon proskuCon : proskuConList) {
|
||||
if("1".equals(proskuCon.getStatus())){
|
||||
TbConsInfo consInfo= tbConsInfoMapper.selectByPrimaryKey(proskuCon.getConInfoId());
|
||||
if("1".equals(consInfo.getIsCheck())){
|
||||
if(N.egt(proskuCon.getSurplusStock(),consInfo.getStockNumber().abs().subtract(consInfo.getStockConsume().abs()))){
|
||||
return Result.fail("商品:".concat(product.getName()).concat("对应的:").concat(consInfo.getConName()).concat("耗材不足"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String exists = redisUtil.getMessage(RedisCst.ORDER_CART_EXISTS + cartId);
|
||||
|
||||
// 首次加入购物车,并且拥有起售数,设置为起售数
|
||||
|
|
@ -162,24 +193,43 @@ public class OrderService {
|
|||
}
|
||||
TbCashierCart cart = cashierCartMapper.selectByPrimaryKey(cartId);
|
||||
if (Objects.nonNull(cart)) {
|
||||
cart.setSkuId(skuId.toString());
|
||||
cart.setNumber(number);
|
||||
cart.setIsGift(isGift);
|
||||
cart.setIsPack(isPack);
|
||||
if (isPack.equals("false")){
|
||||
cart.setPackFee(BigDecimal.ZERO);
|
||||
|
||||
//查询现有规格商品
|
||||
if("edit".equals(type)&&!cart.getSkuId().equals(skuId.toString())){
|
||||
TbCashierCart cashierCart = cashierCartMapper.selectByDetail(masterId, productId, shopId, skuId.toString(), DateUtils.getDay(), uuid);
|
||||
if(Objects.nonNull(cashierCart)){
|
||||
cashierCart.setNumber(cashierCart.getNumber()+number);
|
||||
cashierCart.setTotalNumber(cashierCart.getNumber()+number);
|
||||
cashierCart.setUpdatedAt(System.currentTimeMillis());
|
||||
cashierCartMapper.updateByPrimaryKey(cashierCart);
|
||||
|
||||
cashierCartMapper.deleteByPrimaryKey(cart.getId());
|
||||
redisUtil.deleteByKey(RedisCst.ORDER_CART_EXISTS + cart.getId());
|
||||
cart=cashierCart;
|
||||
}
|
||||
}else {
|
||||
cart.setPackFee(new BigDecimal(number).multiply(product.getPackFee()));
|
||||
}
|
||||
if (isGift.equals("false")) {
|
||||
cart.setTotalAmount(new BigDecimal(number).multiply(skuWithBLOBs.getSalePrice()).add(cart.getPackFee()));
|
||||
} else {
|
||||
cart.setTotalAmount(BigDecimal.ZERO);
|
||||
cart.setSkuId(skuId.toString());
|
||||
cart.setNumber(number);
|
||||
cart.setIsGift(isGift);
|
||||
cart.setIsPack(isPack);
|
||||
if (isPack.equals("false")){
|
||||
cart.setPackFee(BigDecimal.ZERO);
|
||||
}else {
|
||||
cart.setPackFee(new BigDecimal(number).multiply(product.getPackFee()));
|
||||
}
|
||||
if (isGift.equals("false")) {
|
||||
cart.setTotalAmount(new BigDecimal(number).multiply(skuWithBLOBs.getSalePrice()).add(cart.getPackFee()));
|
||||
} else {
|
||||
cart.setTotalAmount(BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
cart.setTotalNumber(number);
|
||||
cart.setUuid(uuid);
|
||||
cashierCartMapper.updateByPrimaryKeySelective(cart);
|
||||
}
|
||||
|
||||
cart.setTotalNumber(number);
|
||||
cart.setUuid(uuid);
|
||||
cashierCartMapper.updateByPrimaryKeySelective(cart);
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
List<TbCashierCart> list = cashierCartMapper.selectALlByMasterId(masterId, "create");
|
||||
|
|
@ -265,7 +315,8 @@ public class OrderService {
|
|||
* @param productSku sku
|
||||
*/
|
||||
private void checkWarnLineAndSendMsg(TbProductSku productSku, TbProduct product, Integer shopId, Integer num) {
|
||||
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(shopId);
|
||||
log.info("下单,开始校验库存预警,商品信息:{}, {}, {}", product, productSku, num);
|
||||
|
||||
if (productSku.getWarnLine() == null) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -285,10 +336,10 @@ public class OrderService {
|
|||
(product.getIsDistribute() == 1 && product.getStockNumber() - num <= productSku.getWarnLine())
|
||||
|| (product.getIsDistribute() != 1) && productSku.getStockNumber() - num <= productSku.getWarnLine()
|
||||
) {
|
||||
List<TbShopOpenId> shopOpenIds = shopOpenIdMapper.selectByShopId(Integer.valueOf(product.getShopId()));
|
||||
List<TbShopOpenId> shopOpenIds = shopOpenIdMapper.selectStateByShopIdAndType(product.getShopId(), ShopWxMsgTypeEnum.STOCK_MSG.getType());
|
||||
shopOpenIds.forEach(item -> {
|
||||
wxAccountUtil.sendStockWarnMsg("商品库存不足", product.getName(),
|
||||
product.getIsDistribute() == 1 ? product.getStockNumber()-num : (int) (productSku.getStockNumber() - num), item.getOpenId());
|
||||
product.getIsDistribute() == 1 ? product.getStockNumber()-num : (int) (productSku.getStockNumber() - num), item.getOpenId(), ShopWxMsgTypeEnum.STOCK_MSG, shopId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -515,7 +566,6 @@ public class OrderService {
|
|||
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
|
||||
TbProductSkuWithBLOBs skuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getSkuId()));
|
||||
|
||||
log.info("下单,开始校验库存预警,购物车id:{}", cashierCart.getId());
|
||||
CompletableFuture.runAsync(() -> checkWarnLineAndSendMsg(skuWithBLOBs, product, Integer.valueOf(cashierCart.getShopId()), cashierCart.getNumber()));
|
||||
|
||||
// 已经添加的商品,修改数量
|
||||
|
|
@ -770,7 +820,6 @@ public class OrderService {
|
|||
|
||||
if (flag) {
|
||||
redisUtil.deleteByKey("SHOP:CODE:USER:" + clientType + ":" + shopId + ":" + day + userId);
|
||||
;
|
||||
}
|
||||
} else {
|
||||
|
||||
|
|
|
|||
|
|
@ -7,9 +7,13 @@ import com.alibaba.fastjson.JSONArray;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ProductStatusDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ProductStockDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.QuerySpecDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.ShopCategoryVo;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.interceptor.LimitSubmitAspect;
|
||||
import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
||||
|
|
@ -44,6 +48,12 @@ public class ProductService {
|
|||
@Autowired
|
||||
private LimitSubmitAspect limitSubmitAspect;
|
||||
|
||||
private final RabbitProducer producer;
|
||||
|
||||
public ProductService(RabbitProducer producer) {
|
||||
this.producer = producer;
|
||||
}
|
||||
|
||||
|
||||
public Result queryCategory(String shopId,Integer page,Integer pageSize){
|
||||
PageHelperUtil.startPage(page, pageSize);
|
||||
|
|
@ -106,7 +116,11 @@ public class ProductService {
|
|||
if(ObjectUtil.isEmpty(categoryId)){
|
||||
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndCheckGrounding(shopId,commdityName);
|
||||
}else {
|
||||
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndShopTypeCheckGrounding(shopId,categoryId,commdityName);
|
||||
if (Integer.valueOf(categoryId).equals(-1)) {
|
||||
tbProductWithBLOBs = tbProductMapper.selectByShopIdAndShopTypeUnGrounding(shopId,commdityName);
|
||||
}else {
|
||||
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndShopTypeCheckGrounding(shopId,categoryId,commdityName);
|
||||
}
|
||||
}
|
||||
|
||||
String day = DateUtils.getDay();
|
||||
|
|
@ -121,72 +135,20 @@ public class ProductService {
|
|||
it.setTbProductSpec(tbProductSpec);
|
||||
|
||||
TbProductSkuResult skuResult=tbProductSkuResultMapper.selectByPrimaryKey(it.getId());
|
||||
|
||||
|
||||
// 上下架对应的sku
|
||||
String selectSpec = it.getSelectSpec();
|
||||
|
||||
List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectGroundingByProId(it.getId());
|
||||
HashSet<String> specSet = new HashSet<>();
|
||||
tbProductSkus.forEach(item -> {
|
||||
String specSnap = item.getSpecSnap();
|
||||
if (specSnap != null) {
|
||||
specSet.addAll(Arrays.asList(specSnap.split(",")));
|
||||
}
|
||||
});
|
||||
String tagSnap = skuResult != null ? skuResult.getTagSnap() : null;
|
||||
if (tagSnap != null) {
|
||||
JSONArray tagSnaps = JSONObject.parseArray(tagSnap);
|
||||
JSONObject snapJSON;
|
||||
|
||||
JSONArray finalSnap = new JSONArray();
|
||||
|
||||
HashMap<String, String> snapMap = new HashMap<>();
|
||||
for (Object snap : tagSnaps) {
|
||||
StringBuilder finalValues = new StringBuilder();
|
||||
snapJSON = (JSONObject) snap;
|
||||
String values = snapJSON.getString("value");
|
||||
if (StrUtil.isNotBlank(values)) {
|
||||
String[] valueList = values.split(",");
|
||||
for (String value : valueList) {
|
||||
if (specSet.contains(value)) {
|
||||
finalValues.append(value).append(",");
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(finalValues.toString())) {
|
||||
finalValues = new StringBuilder(StrUtil.removeSuffix(finalValues.toString(), ","));
|
||||
snapJSON.put("value", finalValues.toString());
|
||||
finalSnap.add(snapJSON);
|
||||
snapMap.put(snapJSON.getString("name"), snapJSON.getString("value"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (selectSpec != null) {
|
||||
JSONArray selectSpecJSON = JSONObject.parseArray(selectSpec);
|
||||
for (Object selectSpecInfo : selectSpecJSON) {
|
||||
JSONObject specInfo = (JSONObject) selectSpecInfo;
|
||||
String name = snapMap.get(specInfo.getString("name"));
|
||||
if (name != null) {
|
||||
specInfo.put("value", name.split(","));
|
||||
specInfo.put("selectSpecResult", name.split(","));
|
||||
}
|
||||
}
|
||||
|
||||
it.setSelectSpec(selectSpecJSON.toJSONString());
|
||||
}
|
||||
|
||||
skuResult.setTagSnap(finalSnap.toJSONString());
|
||||
}
|
||||
it.setProductSkuResult(skuResult);
|
||||
|
||||
|
||||
|
||||
// 查询sku信息
|
||||
List<TbProductSku> skuWithBLOBs = tbProductSkuMapper.selectByProductCheckGrounding(it.getId());
|
||||
List<TbProductSku> skus = tbProductSkuMapper.selectByProductId(it.getId());
|
||||
if (it.getIsDistribute() == 0) {
|
||||
int num = 0;
|
||||
for (TbProductSku item : skus) {
|
||||
num += item.getStockNumber();
|
||||
}
|
||||
it.setStockNumber(num);
|
||||
}
|
||||
it.setSkuList(skuWithBLOBs);
|
||||
|
||||
it.setGroundingSpecInfo(querySpec(Integer.valueOf(shopId), it.getId()));
|
||||
});
|
||||
}
|
||||
PageInfo pageInfo=new PageInfo(tbProductWithBLOBs);
|
||||
|
|
@ -222,4 +184,115 @@ public class ProductService {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateState(ProductStatusDTO productStatusDTO) {
|
||||
TbProduct product = tbProductMapper.selectByShopIdAndId(productStatusDTO.getProductId(), productStatusDTO.getShopId());
|
||||
if (productStatusDTO.getType().equals(0)) {
|
||||
tbProductMapper.updateGroundingByProId(product.getId(), productStatusDTO.getState());
|
||||
}else {
|
||||
tbProductMapper.pauseSale(productStatusDTO.getProductId(), productStatusDTO.getShopId(), productStatusDTO.getState());
|
||||
tbProductMapper.pauseSkuSale(productStatusDTO.getProductId(), productStatusDTO.getShopId(), productStatusDTO.getState());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void updateStock(ProductStockDTO productStockDTO) {
|
||||
TbProduct product = tbProductMapper.selectByShopIdAndId(productStockDTO.getProductId(), productStockDTO.getShopId());
|
||||
if (product == null) {
|
||||
throw new MsgException("商品不存在");
|
||||
}
|
||||
|
||||
if (product.getIsDistribute() != 1 && product.getTypeEnum().equals("sku")) {
|
||||
throw new MsgException("多规格非共享商品暂不支持修改库存");
|
||||
}else {
|
||||
tbProductMapper.updateStock(productStockDTO.getShopId(), productStockDTO.getProductId(), productStockDTO.getStock());
|
||||
tbProductSkuMapper.updateStock(productStockDTO.getShopId(), productStockDTO.getProductId(), productStockDTO.getStock());
|
||||
|
||||
List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectByProductId(product.getId());
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("shopId", productStockDTO.getShopId());
|
||||
data.put("skuId", tbProductSkus.isEmpty() ? null : tbProductSkus.get(0).getId());
|
||||
data.put("productId", productStockDTO.getProductId());
|
||||
data.put("type", "pc收银机修改库存");
|
||||
data.put("subType", product.getStockNumber() > productStockDTO.getStock() ? -1 : 1);
|
||||
data.put("number",productStockDTO.getStock() - product.getStockNumber());
|
||||
producer.sendStockRecordMsg(data);
|
||||
}
|
||||
}
|
||||
|
||||
private static void generateCombinations(List<List<String>> valuesList, int index, List<String> current, List<String> result) {
|
||||
if (index == valuesList.size()) {
|
||||
result.add(String.join(",", current));
|
||||
return;
|
||||
}
|
||||
|
||||
for (String value : valuesList.get(index)) {
|
||||
current.add(value);
|
||||
generateCombinations(valuesList, index + 1, current, result);
|
||||
current.remove(current.size() - 1); // 回溯
|
||||
}
|
||||
}
|
||||
|
||||
public Object querySpec(Integer shopId, Integer productId) {
|
||||
TbProduct tbProduct = tbProductMapper.selectByPrimaryKey(productId);
|
||||
if (tbProduct == null) {
|
||||
throw new MsgException("商品不存在");
|
||||
}
|
||||
TbProductSkuResult skuResult = tbProductSkuResultMapper.selectByPrimaryKey(productId);
|
||||
|
||||
// 重组有效规格数据
|
||||
String tagSnap = skuResult != null ? skuResult.getTagSnap() : null;
|
||||
List<TbProductSku> tbProductSkus = tbProductSkuMapper.selectGroundingByProId(productId);
|
||||
|
||||
JSONArray finalSnap = new JSONArray();
|
||||
|
||||
List<String> result = new ArrayList<>();
|
||||
if (tagSnap != null) {
|
||||
JSONArray tagSnaps = JSONObject.parseArray(tagSnap);
|
||||
List<List<String>> valuesList = new ArrayList<>();
|
||||
|
||||
// 提取所有 value 的列表
|
||||
for (int i = 0; i < tagSnaps.size(); i++) {
|
||||
JSONObject jsonObject = tagSnaps.getJSONObject(i);
|
||||
if (jsonObject.containsKey("value")) {
|
||||
String[] values = jsonObject.getString("value").split(",");
|
||||
valuesList.add(Arrays.asList(values));
|
||||
}
|
||||
}
|
||||
// 生成所有可能的排列组合
|
||||
generateCombinations(valuesList, 0, new ArrayList<>(), result);
|
||||
|
||||
}
|
||||
|
||||
ArrayList<HashMap<String, Object>> specList = new ArrayList<>();
|
||||
tbProductSkus.forEach(item -> {
|
||||
HashMap<String, Object> itemMap = new HashMap<>();
|
||||
itemMap.put("specSnap", item.getSpecSnap());
|
||||
itemMap.put("skuId", item.getId());
|
||||
specList.add(itemMap);
|
||||
});
|
||||
|
||||
|
||||
ArrayList<HashMap<String, Object>> otherVal = new ArrayList<>();
|
||||
for (String res : result) {
|
||||
boolean found = false;
|
||||
for (HashMap<String, Object> spec : specList) {
|
||||
if (res.equals(spec.get("specSnap").toString())) {
|
||||
spec.put("isGrounding", true);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
HashMap<String, Object> itemMap = new HashMap<>();
|
||||
itemMap.put("specSnap", res);
|
||||
itemMap.put("skuId", null);
|
||||
itemMap.put("isGrounding", false);
|
||||
otherVal.add(itemMap);
|
||||
}
|
||||
}
|
||||
specList.addAll(otherVal);
|
||||
return specList;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
|
|
@ -33,6 +35,11 @@ public class ShopInfoService {
|
|||
ShopUserDutyMapper shopUserDutyMapper;
|
||||
@Autowired
|
||||
ShopUserDutyDetailMapper shopUserDutyDetailMapper;
|
||||
private final TbOrderInfoMapper orderInfoMapper;
|
||||
|
||||
public ShopInfoService(TbOrderInfoMapper orderInfoMapper) {
|
||||
this.orderInfoMapper = orderInfoMapper;
|
||||
}
|
||||
|
||||
public Result queryShopArea(String shopId){
|
||||
List<TbShopArea> list= tbShopAreaMapper.selectByShopId(shopId);
|
||||
|
|
@ -48,6 +55,7 @@ public class ShopInfoService {
|
|||
PageHelperUtil.startPage(page, pageSize);
|
||||
List<TbShopTable> shopTables=tbShopTableMapper.selectByShopIdAndStatus(shopId,areaId,status);
|
||||
PageInfo pageInfo=new PageInfo(shopTables);
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS,pageInfo);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,10 @@ import cn.hutool.core.util.StrUtil;
|
|||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.bean.ShopWxMsgTypeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopMsgState;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.mapper.TbShopMsgStateMapper;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
|
@ -25,7 +28,7 @@ public class WxAccountUtil {
|
|||
private static String secrete = "8492a7e8d55bbb1b57f5c8276ea1add0";
|
||||
@Value("${wx.ysk.warnMsgTmpId}")
|
||||
private static String msgTmpId = "C08OUr80x6wGmUN1zpFhSQ3Sv7VF5vksdZigiEx2pD0";
|
||||
|
||||
private final TbShopMsgStateMapper shopMsgStateMapper;
|
||||
static LinkedHashMap<String,String> linkedHashMap=new LinkedHashMap<>();
|
||||
|
||||
static {
|
||||
|
|
@ -97,7 +100,17 @@ public class WxAccountUtil {
|
|||
throw new RuntimeException(linkedHashMap.getOrDefault(resObj.get("errcode") + "", "未知错误"));
|
||||
}
|
||||
|
||||
public JSONObject sendStockWarnMsg(String shopName, String productName, Integer stock, String toUserOpenId) {
|
||||
public JSONObject sendStockWarnMsg(String shopName, String productName, Integer stock, String toUserOpenId, ShopWxMsgTypeEnum typeEnum, Integer shopId) {
|
||||
TbShopMsgState allState = shopMsgStateMapper.selectByType(ShopWxMsgTypeEnum.ALL_MSG.getType(), shopId);
|
||||
if (allState == null || allState.getState().equals(0)) {
|
||||
log.info("店铺未开启全局推送:{}", allState);
|
||||
return null;
|
||||
}
|
||||
TbShopMsgState shopMsgState = shopMsgStateMapper.selectByType(typeEnum.getType(), shopId);
|
||||
if (shopMsgState == null || shopMsgState.getState().equals(0)) {
|
||||
log.info("店铺未开启推送:{}", shopMsgState);
|
||||
return null;
|
||||
}
|
||||
stock = stock < 0 ? 0 : stock;
|
||||
Integer finalStock = stock;
|
||||
Map<String, Object> data = new HashMap<String, Object>() {{
|
||||
|
|
|
|||
|
|
@ -59,6 +59,16 @@
|
|||
and uuid = #{uuid}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectDetailByQrcode" resultType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from tb_cashier_cart where table_id = #{tableId} and product_id = #{productId} and shop_id = #{shopId} and
|
||||
sku_id = #{skuId}
|
||||
<if test="uuid != null">
|
||||
and uuid = #{uuid}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByMaskerId" resultType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
||||
select *
|
||||
from tb_cashier_cart where master_id = #{masterId} and shop_id = #{shopId} and status = #{status} and trade_day = #{day} order by id desc
|
||||
|
|
@ -92,8 +102,15 @@
|
|||
delete from tb_cashier_cart
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<delete id="deleteByCartId">
|
||||
delete from tb_cashier_cart where id = #{cartId} and master_id = #{masterId}
|
||||
<delete id="deleteByCartIdOrTableId">
|
||||
delete from tb_cashier_cart where id = #{cartId} and
|
||||
<if test="masterId != null">
|
||||
master_id = #{masterId}
|
||||
</if>
|
||||
|
||||
<if test="qrcode != null">
|
||||
table_id =#{qrcode}
|
||||
</if>
|
||||
</delete>
|
||||
<delete id="deleteBymasterId">
|
||||
delete from tb_cashier_cart where master_id = #{masterId} and shop_id = #{shopId}
|
||||
|
|
@ -103,22 +120,22 @@
|
|||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into tb_cashier_cart (id, master_id, order_id,
|
||||
ref_order_id, total_amount, product_id,
|
||||
cover_img, is_sku, sku_id,
|
||||
name, sale_price, number,
|
||||
total_number, refund_number, category_id,
|
||||
status, type, merchant_id,
|
||||
shop_id, created_at, updated_at, pack_fee,trade_day,is_pack,is_gift,uuid
|
||||
insert into tb_cashier_cart (id, master_id, order_id,
|
||||
ref_order_id, total_amount, product_id,
|
||||
cover_img, is_sku, sku_id,
|
||||
name, sale_price, number,
|
||||
total_number, refund_number, category_id,
|
||||
status, type, merchant_id,
|
||||
shop_id, created_at, updated_at, pack_fee,trade_day,is_pack,is_gift,uuid, table_id
|
||||
)
|
||||
values (#{id,jdbcType=INTEGER}, #{masterId,jdbcType=VARCHAR}, #{orderId,jdbcType=VARCHAR},
|
||||
#{refOrderId,jdbcType=VARCHAR}, #{totalAmount,jdbcType=DECIMAL}, #{productId,jdbcType=VARCHAR},
|
||||
#{coverImg,jdbcType=VARCHAR}, #{isSku,jdbcType=TINYINT}, #{skuId,jdbcType=VARCHAR},
|
||||
#{name,jdbcType=VARCHAR}, #{salePrice,jdbcType=DECIMAL}, #{number,jdbcType=REAL},
|
||||
#{totalNumber,jdbcType=REAL}, #{refundNumber,jdbcType=REAL}, #{categoryId,jdbcType=VARCHAR},
|
||||
#{status,jdbcType=VARCHAR}, #{type,jdbcType=TINYINT}, #{merchantId,jdbcType=VARCHAR},
|
||||
values (#{id,jdbcType=INTEGER}, #{masterId,jdbcType=VARCHAR}, #{orderId,jdbcType=VARCHAR},
|
||||
#{refOrderId,jdbcType=VARCHAR}, #{totalAmount,jdbcType=DECIMAL}, #{productId,jdbcType=VARCHAR},
|
||||
#{coverImg,jdbcType=VARCHAR}, #{isSku,jdbcType=TINYINT}, #{skuId,jdbcType=VARCHAR},
|
||||
#{name,jdbcType=VARCHAR}, #{salePrice,jdbcType=DECIMAL}, #{number,jdbcType=REAL},
|
||||
#{totalNumber,jdbcType=REAL}, #{refundNumber,jdbcType=REAL}, #{categoryId,jdbcType=VARCHAR},
|
||||
#{status,jdbcType=VARCHAR}, #{type,jdbcType=TINYINT}, #{merchantId,jdbcType=VARCHAR},
|
||||
#{shopId,jdbcType=VARCHAR}, #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT}, #{packFee,jdbcType=DECIMAL}
|
||||
, #{tradeDay,jdbcType=VARCHAR}, #{isPack,jdbcType=VARCHAR}, #{isGift,jdbcType=VARCHAR}, #{uuid,jdbcType=VARCHAR}
|
||||
, #{tradeDay,jdbcType=VARCHAR}, #{isPack,jdbcType=VARCHAR}, #{isGift,jdbcType=VARCHAR}, #{uuid,jdbcType=VARCHAR},#{tableId,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
||||
|
|
@ -389,5 +406,16 @@
|
|||
select * from tb_cashier_cart where master_id = #{masterId} and trade_day = #{day} and shop_id = #{shopId} and status = 'create'
|
||||
</select>
|
||||
|
||||
<select id="selectActivateByQrcode"
|
||||
resultType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
||||
select * from tb_cashier_cart where table_id = #{tableId} and shop_id = #{shopId} and status = 'create'
|
||||
</select>
|
||||
<select id="selectProductNumByQrcode"
|
||||
resultType="com.chaozhanggui.system.cashierservice.entity.po.QueryCartPo">
|
||||
select ifnull(count(*),0) as productNum,ifnull(sum(number),0)as productSum
|
||||
from (select count(*),number
|
||||
from tb_cashier_cart where table_id = #{qrcode} and shop_id = #{shopId} group by product_id ) a
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -17,10 +17,13 @@
|
|||
<result column="con_warning" jdbcType="DECIMAL" property="conWarning" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="is_check" jdbcType="VARCHAR" property="isCheck" />
|
||||
|
||||
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, shop_id, con_type_id, con_type_name, con_code, con_name, stock_number,price,stock_consume,status, con_unit,
|
||||
laster_in_stock, con_warning, create_time, update_time
|
||||
laster_in_stock, con_warning, create_time, update_time,is_check
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
|
|
|
|||
|
|
@ -627,5 +627,9 @@ select * from tb_order_info where trade_day = #{day} and table_id = #{masterId}
|
|||
|
||||
|
||||
|
||||
</select>
|
||||
<select id="selectActivateOrder" resultType="com.chaozhanggui.system.cashierservice.entity.TbOrderInfo">
|
||||
SELECT * FROM `tb_order_info` where shop_id=#{shopId} and
|
||||
table_id=#{tableId} and order_type != 'return' and `status` not in ('closed', 'refund', 'merge')
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -938,6 +938,18 @@
|
|||
</if>
|
||||
and b.is_grounding=1 GROUP BY a.id ORDER BY a.`sort`
|
||||
|
||||
</select>
|
||||
<select id="selectByShopIdAndShopTypeUnGrounding" resultMap="ResultMapWithBLOBs">
|
||||
|
||||
select a.* from tb_product as a
|
||||
left join tb_product_sku as b on a.id = b.product_id
|
||||
where a.shop_id=#{shopId} and a.status=1 and a.is_show_cash = 1 and a.type_enum in ('normal','sku','currentPrice','weight')
|
||||
|
||||
<if test="commdityName != null and commdityName!='' ">
|
||||
and a.name like CONCAT('%',#{commdityName},'%')
|
||||
</if>
|
||||
and b.is_grounding=0 GROUP BY a.id ORDER BY a.`sort`
|
||||
|
||||
</select>
|
||||
|
||||
<select id="countOrderByshopIdAndProductId" resultType="INTEGER">
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
id, shop_id,product_id ,product_sku_id, con_info_id, surplus_stock, status, create_time
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_prosku_con
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
|
|
@ -25,11 +25,11 @@
|
|||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
|
||||
insert into tb_prosku_con (id, shop_id, product_sku_id,
|
||||
con_info_id, surplus_stock, status,
|
||||
insert into tb_prosku_con (id, shop_id, product_sku_id,
|
||||
con_info_id, surplus_stock, status,
|
||||
create_time)
|
||||
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{productSkuId,jdbcType=INTEGER},
|
||||
#{conInfoId,jdbcType=INTEGER}, #{surplusStock,jdbcType=DECIMAL}, #{status,jdbcType=VARCHAR},
|
||||
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{productSkuId,jdbcType=INTEGER},
|
||||
#{conInfoId,jdbcType=INTEGER}, #{surplusStock,jdbcType=DECIMAL}, #{status,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=TIMESTAMP})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
|
||||
|
|
@ -123,6 +123,12 @@
|
|||
select * from tb_prosku_con where product_sku_id=#{skuId} and shop_id=#{shopId} and status=1
|
||||
</select>
|
||||
|
||||
<select id="selectBySkuIdAndShopIdAngCheck" resultMap="BaseResultMap">
|
||||
select a.* from tb_prosku_con as a
|
||||
left join tb_cons_info as b on a.con_info_id=b.id
|
||||
where a.product_sku_id=#{skuId} and a.shop_id=#{shopId} and a.status=1 and b.is_check=1
|
||||
</select>
|
||||
|
||||
<select id="selectIdBySkuIdAndShopId" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
p.con_info_id
|
||||
|
|
@ -139,4 +145,11 @@
|
|||
|
||||
select * from tb_prosku_con where product_sku_id=#{skuId} and shop_id=#{shopId} and product_id=#{productId} and status=1
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
<select id="selectByShopIdAndSkuIdAndProductIdAndCheck" resultMap="BaseResultMap">
|
||||
|
||||
select a.* from tb_prosku_con as a
|
||||
left join tb_cons_info as b on a.con_info_id=b.id
|
||||
where a.product_sku_id=#{skuId} and a.shop_id=#{shopId} and a.product_id=#{productId} and a.status=1 and b.is_check=1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,91 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chaozhanggui.system.cashierservice.mapper.TbShopMsgStateMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbShopMsgState">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
|
||||
<result property="type" column="type" jdbcType="INTEGER"/>
|
||||
<result property="state" column="state" jdbcType="INTEGER"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,shop_id,type,
|
||||
state,create_time,update_time
|
||||
</sql>
|
||||
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_shop_msg_state
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from tb_shop_msg_state
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopMsgState" useGeneratedKeys="true">
|
||||
insert into tb_shop_msg_state
|
||||
( id,shop_id,type
|
||||
,state,create_time,update_time
|
||||
)
|
||||
values (#{id,jdbcType=INTEGER},#{shopId,jdbcType=INTEGER},#{type,jdbcType=INTEGER}
|
||||
,#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopMsgState" useGeneratedKeys="true">
|
||||
insert into tb_shop_msg_state
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="shopId != null">shop_id,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="state != null">state,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id,jdbcType=INTEGER},</if>
|
||||
<if test="shopId != null">#{shopId,jdbcType=INTEGER},</if>
|
||||
<if test="type != null">#{type,jdbcType=INTEGER},</if>
|
||||
<if test="state != null">#{state,jdbcType=INTEGER},</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.TbShopMsgState">
|
||||
update tb_shop_msg_state
|
||||
<set>
|
||||
<if test="shopId != null">
|
||||
shop_id = #{shopId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
type = #{type,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="state != null">
|
||||
state = #{state,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopMsgState">
|
||||
update tb_shop_msg_state
|
||||
set
|
||||
shop_id = #{shopId,jdbcType=INTEGER},
|
||||
type = #{type,jdbcType=INTEGER},
|
||||
state = #{state,jdbcType=INTEGER},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
@ -18,11 +18,11 @@
|
|||
<result column="icon" jdbcType="VARCHAR" property="icon" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, pay_type, pay_name, is_show_shortcut, shop_id, is_refundable, is_open_cash_drawer,
|
||||
id, pay_type, pay_name, is_show_shortcut, shop_id, is_refundable, is_open_cash_drawer,
|
||||
is_system, is_ideal, is_display, sorts, created_at, updated_at, icon
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_shop_pay_type
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
|
|
@ -32,15 +32,15 @@
|
|||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopPayType">
|
||||
insert into tb_shop_pay_type (id, pay_type, pay_name,
|
||||
is_show_shortcut, shop_id, is_refundable,
|
||||
is_open_cash_drawer, is_system, is_ideal,
|
||||
is_display, sorts, created_at,
|
||||
insert into tb_shop_pay_type (id, pay_type, pay_name,
|
||||
is_show_shortcut, shop_id, is_refundable,
|
||||
is_open_cash_drawer, is_system, is_ideal,
|
||||
is_display, sorts, created_at,
|
||||
updated_at, icon)
|
||||
values (#{id,jdbcType=INTEGER}, #{payType,jdbcType=VARCHAR}, #{payName,jdbcType=VARCHAR},
|
||||
#{isShowShortcut,jdbcType=TINYINT}, #{shopId,jdbcType=VARCHAR}, #{isRefundable,jdbcType=TINYINT},
|
||||
#{isOpenCashDrawer,jdbcType=TINYINT}, #{isSystem,jdbcType=TINYINT}, #{isIdeal,jdbcType=TINYINT},
|
||||
#{isDisplay,jdbcType=TINYINT}, #{sorts,jdbcType=INTEGER}, #{createdAt,jdbcType=BIGINT},
|
||||
values (#{id,jdbcType=INTEGER}, #{payType,jdbcType=VARCHAR}, #{payName,jdbcType=VARCHAR},
|
||||
#{isShowShortcut,jdbcType=TINYINT}, #{shopId,jdbcType=VARCHAR}, #{isRefundable,jdbcType=TINYINT},
|
||||
#{isOpenCashDrawer,jdbcType=TINYINT}, #{isSystem,jdbcType=TINYINT}, #{isIdeal,jdbcType=TINYINT},
|
||||
#{isDisplay,jdbcType=TINYINT}, #{sorts,jdbcType=INTEGER}, #{createdAt,jdbcType=BIGINT},
|
||||
#{updatedAt,jdbcType=BIGINT}, #{icon,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopPayType">
|
||||
|
|
@ -205,4 +205,4 @@
|
|||
|
||||
select count(id) from tb_shop_pay_type where shop_id=#{shopId} and is_display=1 and pay_type=#{payType}
|
||||
</select>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -17,13 +17,14 @@
|
|||
<result column="view" jdbcType="VARCHAR" property="view" />
|
||||
<result column="created_at" jdbcType="BIGINT" property="createdAt" />
|
||||
<result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
|
||||
<result column="qrcode" jdbcType="VARCHAR" property="qrcode" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, name, shop_id, max_capacity, sort, area_id, is_predate, predate_amount, status,
|
||||
id, name, shop_id, max_capacity, sort, area_id, is_predate, predate_amount, status,
|
||||
type, amount, perhour, view, created_at, updated_at
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_shop_table
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
|
|
@ -33,16 +34,16 @@
|
|||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopTable">
|
||||
insert into tb_shop_table (id, name, shop_id,
|
||||
max_capacity, sort, area_id,
|
||||
is_predate, predate_amount, status,
|
||||
type, amount, perhour,
|
||||
insert into tb_shop_table (id, name, shop_id,
|
||||
max_capacity, sort, area_id,
|
||||
is_predate, predate_amount, status,
|
||||
type, amount, perhour,
|
||||
view, created_at, updated_at
|
||||
)
|
||||
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{shopId,jdbcType=INTEGER},
|
||||
#{maxCapacity,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER}, #{areaId,jdbcType=INTEGER},
|
||||
#{isPredate,jdbcType=TINYINT}, #{predateAmount,jdbcType=DECIMAL}, #{status,jdbcType=VARCHAR},
|
||||
#{type,jdbcType=TINYINT}, #{amount,jdbcType=DECIMAL}, #{perhour,jdbcType=DECIMAL},
|
||||
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{shopId,jdbcType=INTEGER},
|
||||
#{maxCapacity,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER}, #{areaId,jdbcType=INTEGER},
|
||||
#{isPredate,jdbcType=TINYINT}, #{predateAmount,jdbcType=DECIMAL}, #{status,jdbcType=VARCHAR},
|
||||
#{type,jdbcType=TINYINT}, #{amount,jdbcType=DECIMAL}, #{perhour,jdbcType=DECIMAL},
|
||||
#{view,jdbcType=VARCHAR}, #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT}
|
||||
)
|
||||
</insert>
|
||||
|
|
@ -227,4 +228,4 @@
|
|||
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue