Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2b7ca62abf | |||
| da9f1ab68f | |||
| eb424d8eb4 | |||
| a12a1d2e1f | |||
|
|
af3ea12121 | ||
|
|
653254f9f3 | ||
| d8027c92b2 | |||
| 8d9deb43a3 | |||
|
|
6b436da4d3 | ||
| 796f43299f | |||
| 46133d7d16 | |||
| 61157d730c | |||
|
|
563541d929 | ||
|
|
8f7ea02d06 | ||
| cee4643925 | |||
|
|
4d462a1d3e | ||
|
|
397c1b4df3 | ||
| 38b03b556c | |||
|
|
178f3c0831 | ||
| df75a74822 | |||
| dad47eb0c8 | |||
| b0243a9ddd | |||
| 5a0112132d | |||
|
|
4a0a548565 | ||
|
|
6c6a447a5e | ||
| 146cb0f00b | |||
|
|
dc6df17a3f | ||
|
|
780707e55c | ||
|
|
b5bc0f2e0a | ||
| e640226629 | |||
|
|
d93bfd24a1 |
85
pom.xml
85
pom.xml
@@ -48,11 +48,11 @@
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>4.5.18</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.alibaba</groupId>-->
|
||||
<!-- <artifactId>fastjson</artifactId>-->
|
||||
<!-- <version>1.2.9</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.alibaba</groupId>-->
|
||||
<!-- <artifactId>fastjson</artifactId>-->
|
||||
<!-- <version>1.2.9</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
@@ -185,30 +185,57 @@
|
||||
<version>2.2.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus</artifactId>
|
||||
<version>3.3.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis-spring</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.3.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis-spring</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<!-- <profiles>-->
|
||||
<!-- <profile>-->
|
||||
<!-- <id>dev</id>-->
|
||||
<!-- <properties>-->
|
||||
<!-- <env>dev</env>-->
|
||||
<!-- </properties>-->
|
||||
<!-- <activation>-->
|
||||
<!-- <activeByDefault>true</activeByDefault>-->
|
||||
<!-- </activation>-->
|
||||
<!-- </profile>-->
|
||||
<!-- <profile>-->
|
||||
<!-- <id>test</id>-->
|
||||
<!-- <properties>-->
|
||||
<!-- <env>test</env>-->
|
||||
<!-- </properties>-->
|
||||
<!-- </profile>-->
|
||||
<!-- <profile>-->
|
||||
<!-- <id>pro</id>-->
|
||||
<!-- <properties>-->
|
||||
<!-- <env>pro</env>-->
|
||||
<!-- </properties>-->
|
||||
<!-- </profile>-->
|
||||
<!-- </profiles>-->
|
||||
<!-- <profiles>-->
|
||||
<!-- <profile>-->
|
||||
<!-- <id>dev</id>-->
|
||||
<!-- <properties>-->
|
||||
<!-- <env>dev</env>-->
|
||||
<!-- </properties>-->
|
||||
<!-- <activation>-->
|
||||
<!-- <activeByDefault>true</activeByDefault>-->
|
||||
<!-- </activation>-->
|
||||
<!-- </profile>-->
|
||||
<!-- <profile>-->
|
||||
<!-- <id>test</id>-->
|
||||
<!-- <properties>-->
|
||||
<!-- <env>test</env>-->
|
||||
<!-- </properties>-->
|
||||
<!-- </profile>-->
|
||||
<!-- <profile>-->
|
||||
<!-- <id>pro</id>-->
|
||||
<!-- <properties>-->
|
||||
<!-- <env>pro</env>-->
|
||||
<!-- </properties>-->
|
||||
<!-- </profile>-->
|
||||
<!-- </profiles>-->
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
@@ -266,4 +293,4 @@
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
||||
@@ -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("=========================启动完成==========================");
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import lombok.Getter;
|
||||
@Getter
|
||||
public enum LogTag {
|
||||
JPUSH("极光"), CLIENT("安卓"),
|
||||
LOGIN("登录"), SYSTEM("系统"), CART("订单购物车");
|
||||
LOGIN("登录"), SYSTEM("系统"), CART("订单购物车"), PLACE("下单");
|
||||
private final String value;
|
||||
|
||||
LogTag(String value) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,12 +6,15 @@ 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.dto.UpdateVipDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.CartVo;
|
||||
import com.chaozhanggui.system.cashierservice.service.OrderService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import com.chaozhanggui.system.cashierservice.util.TokenUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@@ -24,6 +27,14 @@ public class OrderController {
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
|
||||
@PutMapping("/updateVip")
|
||||
@MyLog(value = "代客下单 修改会员", tag = LogTag.PLACE)
|
||||
public ResponseEntity<Object> updateVip(
|
||||
@Validated @RequestBody UpdateVipDTO updateVipDTO
|
||||
) {
|
||||
return ResponseEntity.ok(orderService.updateVip(updateVipDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/createCart")
|
||||
public Result createCart(@RequestHeader("token") String token,
|
||||
@RequestHeader("loginName") String loginName,
|
||||
@@ -34,7 +45,7 @@ public class OrderController {
|
||||
String userId = jsonObject.getString("accountId");
|
||||
return orderService.createCart(cartVo.getMasterId(),cartVo.getProductId(),cartVo.getShopId(),
|
||||
cartVo.getSkuId(),cartVo.getNumber(),userId,clientType,cartVo.getCartId(),cartVo.getIsGift(),
|
||||
cartVo.getIsPack(),cartVo.getUuid(),cartVo.getType(), cartVo.getTableId(), cartVo.getVipUserId());
|
||||
cartVo.getIsPack(),cartVo.getUuid(),cartVo.getType(), cartVo.getVipUserId(), cartVo.getTableId());
|
||||
}
|
||||
|
||||
@MyLog(value = "查询购物车信息", tag = LogTag.CART)
|
||||
@@ -43,14 +54,13 @@ public class OrderController {
|
||||
@RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType,
|
||||
@RequestParam(value = "masterId", required = false) String masterId,
|
||||
@RequestParam(required = false) Integer tableId,
|
||||
@RequestParam(required = false) Integer vipUserId,
|
||||
@RequestParam(required = false) String tableId,
|
||||
@RequestParam("shopId") String shopId
|
||||
){
|
||||
if (tableId == null && StrUtil.isBlank(masterId)) {
|
||||
return Result.fail("masterId和tableId不能同 时为空");
|
||||
return Result.fail("masterId和tableId不能同时为空");
|
||||
}
|
||||
return orderService.queryCart(masterId,shopId, tableId, vipUserId);
|
||||
return orderService.queryCart(masterId,shopId, tableId);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +68,7 @@ public class OrderController {
|
||||
public Result delCart(@RequestHeader("token") String token,
|
||||
@RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType,
|
||||
@RequestParam(required = false) String tableId,
|
||||
@RequestParam(value = "masterId", required = false) String masterId,
|
||||
@RequestParam("cartId") Integer cartId
|
||||
){
|
||||
@@ -90,7 +101,8 @@ public class OrderController {
|
||||
JSONObject jsonObject = TokenUtil.parseParamFromToken(token);
|
||||
String userId = jsonObject.getString("accountId");
|
||||
String code = jsonObject.getString("code");
|
||||
return orderService.cartStatus(Integer.valueOf(cartVo.getShopId()),cartVo.getMasterId(),cartVo.getStatus(),userId,cartVo.getUuid(),clientType);
|
||||
return orderService.cartStatus(Integer.valueOf(cartVo.getShopId()),cartVo.getMasterId(),
|
||||
cartVo.getStatus(),userId,cartVo.getUuid(),clientType, cartVo.getVipUserId(), cartVo.getTableId());
|
||||
}
|
||||
@PostMapping("/createOrder")
|
||||
public Result createOrder(@RequestHeader("token") String token, @RequestHeader("loginName") String loginName,
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@@ -55,10 +56,12 @@ public class PayController {
|
||||
@RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType,
|
||||
@RequestParam("orderId") String orderId,
|
||||
@RequestParam("payAmount") BigDecimal payAmount,
|
||||
@RequestParam("discountAmount") BigDecimal discountAmount,
|
||||
@RequestParam("authCode") String authCode
|
||||
|
||||
) {
|
||||
return payService.scanPay(orderId,authCode, IpUtil.getIpAddr(request),token);
|
||||
return payService.scanPay(orderId,authCode, IpUtil.getIpAddr(request),token,payAmount,discountAmount);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,9 +82,11 @@ public class PayController {
|
||||
@RequestHeader("clientType") String clientType,
|
||||
@RequestParam("orderId") String orderId,
|
||||
@RequestParam("memberId") String memberId,
|
||||
@RequestParam("memberAccount") String memberAccount
|
||||
@RequestParam("memberAccount") String memberAccount,
|
||||
@RequestParam("payAmount") BigDecimal payAmount,
|
||||
@RequestParam("discountAmount") BigDecimal discountAmount
|
||||
){
|
||||
return payService.accountPay(orderId,memberId,token,memberAccount);
|
||||
return payService.accountPay(orderId,memberId,token,memberAccount,payAmount,discountAmount);
|
||||
}
|
||||
|
||||
|
||||
@@ -164,9 +169,11 @@ public class PayController {
|
||||
@RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType,
|
||||
@RequestParam("orderId") String orderId,
|
||||
@RequestParam("memberCode") String memberCode
|
||||
@RequestParam("memberCode") String memberCode,
|
||||
@RequestParam("payAmount") BigDecimal payAmount,
|
||||
@RequestParam("discountAmount") BigDecimal discountAmount
|
||||
){
|
||||
return payService.memberScanPay(orderId,memberCode,token);
|
||||
return payService.memberScanPay(orderId,memberCode,token,payAmount,discountAmount);
|
||||
}
|
||||
|
||||
|
||||
@@ -184,8 +191,10 @@ public class PayController {
|
||||
public Result cashPay(@RequestHeader("token") String token,
|
||||
@RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType,
|
||||
@RequestParam("orderId") String orderId){
|
||||
return payService.cashPay(orderId,token);
|
||||
@RequestParam("orderId") String orderId,
|
||||
@RequestParam("payAmount") BigDecimal payAmount,
|
||||
@RequestParam("discountAmount") BigDecimal discountAmount){
|
||||
return payService.cashPay(orderId,token,payAmount,discountAmount);
|
||||
}
|
||||
|
||||
|
||||
@@ -204,8 +213,10 @@ public class PayController {
|
||||
public Result bankPay(@RequestHeader("token") String token,
|
||||
@RequestHeader("loginName") String loginName,
|
||||
@RequestHeader("clientType") String clientType,
|
||||
@RequestParam("orderId") String orderId){
|
||||
return payService.bankPay(orderId,token);
|
||||
@RequestParam("orderId") String orderId,
|
||||
@RequestParam("payAmount") BigDecimal payAmount,
|
||||
@RequestParam("discountAmount") BigDecimal discountAmount){
|
||||
return payService.bankPay(orderId,token, payAmount, discountAmount);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ 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;
|
||||
@@ -58,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,8 +32,8 @@ 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") Integer tableId, @Param("productId") String productId,
|
||||
@Param("shopId") String shopId, @Param("skuId") String skuId, @Param("userId") Integer userId);
|
||||
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);
|
||||
|
||||
@@ -45,12 +47,7 @@ public interface TbCashierCartMapper {
|
||||
@Param("status") String status, @Param("day") String day, @Param("uuid") String uuid);
|
||||
|
||||
List<TbCashierCart> selectAllCreateOrder(@Param("masterId") String masterId, @Param("shopId") Integer shopId,
|
||||
@Param("day") String day, @Param("status") String status,
|
||||
@Param("uuid") String uuid);
|
||||
|
||||
List<TbCashierCart> selectAllCreateOrder2(@Param("masterId") String masterId, @Param("shopId") Integer shopId,
|
||||
@Param("day") String day, @Param("status") String status,
|
||||
@Param("uuid") String uuid, @Param("tableId") Integer tableId, @Param("vipUserId") Integer vipUserId);
|
||||
@Param("day") String day, @Param("status") String status,@Param("uuid") String uuid);
|
||||
List<CartPo> selectCartList( @Param("cartId") String shopId);
|
||||
|
||||
int updateByOrderId(@Param("orderId") String orderId,@Param("status") String status);
|
||||
@@ -69,7 +66,10 @@ public interface TbCashierCartMapper {
|
||||
|
||||
List<TbCashierCart> selectByOrderId(@Param("orderId") String orderId,@Param("status") String status);
|
||||
|
||||
List<TbCashierCart> selectActivateByQrcode(@Param("tableId") Integer tableId, @Param("shopId") Integer shopId, @Param("userId") Integer userId);
|
||||
List<TbCashierCart> selectActivateByQrcode(@Param("tableId") String tableId, @Param("shopId") Integer shopId);
|
||||
|
||||
QueryCartPo selectProductNumByQrcode(@Param("tableId") Integer tableId, @Param("shopId") Integer shopId, @Param("vipUserId") Integer vipUserId);
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ 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}")
|
||||
@@ -62,4 +62,7 @@ public interface TbProductSkuMapper {
|
||||
|
||||
@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);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ 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);")
|
||||
@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);
|
||||
}
|
||||
|
||||
@@ -12,4 +12,6 @@ public class OrderVo {
|
||||
private Integer shopId;
|
||||
private String userId;
|
||||
private Integer merchantId;
|
||||
private String tableId;
|
||||
private Integer vipUserId;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -57,8 +58,12 @@ public class TbCashierCart implements Serializable {
|
||||
private Long updatedAt;
|
||||
private Integer userId;
|
||||
private String tableId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private TbProductSpec tbProductSpec;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String selectSpec="";
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +100,8 @@ public class TbOrderInfo implements Serializable {
|
||||
|
||||
private String outNumber;
|
||||
|
||||
private Integer staffId;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public TbOrderInfo(){
|
||||
super();
|
||||
|
||||
@@ -14,6 +14,8 @@ public class TbPlussShopStaff implements Serializable {
|
||||
|
||||
private String password;
|
||||
|
||||
private String discountType;
|
||||
|
||||
private BigDecimal maxDiscountAmount;
|
||||
|
||||
private Boolean status;
|
||||
@@ -72,6 +74,14 @@ public class TbPlussShopStaff implements Serializable {
|
||||
this.password = password == null ? null : password.trim();
|
||||
}
|
||||
|
||||
public String getDiscountType() {
|
||||
return discountType;
|
||||
}
|
||||
|
||||
public void setDiscountType(String discountType) {
|
||||
this.discountType = discountType;
|
||||
}
|
||||
|
||||
public BigDecimal getMaxDiscountAmount() {
|
||||
return maxDiscountAmount;
|
||||
}
|
||||
|
||||
@@ -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,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;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class UpdateVipDTO {
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
@NotEmpty
|
||||
private String tableId;
|
||||
@NotNull
|
||||
private String masterId;
|
||||
|
||||
private Integer vipUserId;
|
||||
@NotNull
|
||||
@Range(min = 0, max = 1)
|
||||
private Integer type;
|
||||
}
|
||||
|
||||
@@ -5,11 +5,6 @@ import lombok.Data;
|
||||
@Data
|
||||
public class CartVo {
|
||||
private String productId;
|
||||
|
||||
// orderId不为空为代客下单
|
||||
private String masterId;
|
||||
private Integer tableId;
|
||||
private Integer vipUserId;
|
||||
private String shopId;
|
||||
private Integer skuId;
|
||||
private Integer number;
|
||||
@@ -19,4 +14,7 @@ public class CartVo {
|
||||
private String uuid;
|
||||
private String type;
|
||||
private Integer cartId;
|
||||
private String masterId;
|
||||
private String tableId;
|
||||
private Integer vipUserId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.chaozhanggui.system.cashierservice.mybatis;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbCashierCart;
|
||||
|
||||
public interface MPCashierCartMapper extends BaseMapper<TbCashierCart> {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.chaozhanggui.system.cashierservice.mybatis;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbCashierCart;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopTable;
|
||||
|
||||
public interface MpShopTableMapper extends BaseMapper<TbShopTable> {
|
||||
}
|
||||
@@ -94,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;
|
||||
}
|
||||
|
||||
@@ -123,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->{
|
||||
@@ -133,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(), ShopWxMsgTypeEnum.CONSUMABLES_MSG, shopId);
|
||||
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";
|
||||
}
|
||||
|
||||
@@ -37,8 +37,6 @@ public class RabbitProducer implements RabbitTemplate.ConfirmCallback {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void cons(String content){
|
||||
CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
|
||||
rabbitTemplate.convertAndSend(RabbitConstants.CONS_COLLECT_PUT, RabbitConstants.CONS_COLLECT_ROUTINGKEY_PUT, content, correlationId);
|
||||
@@ -71,4 +69,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,11 +7,17 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
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.dto.UpdateVipDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.CartVo;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.mybatis.MPCashierCartMapper;
|
||||
import com.chaozhanggui.system.cashierservice.mybatis.MpShopTableMapper;
|
||||
import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
@@ -67,6 +73,7 @@ public class OrderService {
|
||||
RedisUtil redisUtil;
|
||||
|
||||
private final WxAccountUtil wxAccountUtil;
|
||||
private final MPCashierCartMapper mpCashierCartMapper;
|
||||
|
||||
@Autowired
|
||||
RabbitProducer producer;
|
||||
@@ -76,6 +83,13 @@ public class OrderService {
|
||||
private final TbUserShopMsgMapper tbUserShopMsgMapper;
|
||||
|
||||
private final TbShopOpenIdMapper shopOpenIdMapper;
|
||||
private final MpShopTableMapper mpShopTableMapper;
|
||||
|
||||
@Autowired
|
||||
private TbProskuConMapper tbProskuConMapper;
|
||||
|
||||
@Autowired
|
||||
TbConsInfoMapper tbConsInfoMapper;
|
||||
|
||||
|
||||
private static ConcurrentHashMap<String, HashSet<Integer>> codeMap = new ConcurrentHashMap<>();
|
||||
@@ -83,16 +97,18 @@ public class OrderService {
|
||||
@Autowired
|
||||
private ProductService productService;
|
||||
|
||||
public OrderService(WxAccountUtil wxAccountUtil, WechatUtil wechatUtil, TbUserShopMsgMapper tbUserShopMsgMapper, TbShopOpenIdMapper shopOpenIdMapper) {
|
||||
public OrderService(WxAccountUtil wxAccountUtil, MPCashierCartMapper mpCashierCartMapper, WechatUtil wechatUtil, TbUserShopMsgMapper tbUserShopMsgMapper, TbShopOpenIdMapper shopOpenIdMapper, MpShopTableMapper mpShopTableMapper) {
|
||||
this.wxAccountUtil = wxAccountUtil;
|
||||
this.mpCashierCartMapper = mpCashierCartMapper;
|
||||
this.wechatUtil = wechatUtil;
|
||||
this.tbUserShopMsgMapper = tbUserShopMsgMapper;
|
||||
this.shopOpenIdMapper = shopOpenIdMapper;
|
||||
this.mpShopTableMapper = mpShopTableMapper;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result createCart(String masterId, String productId, String shopId, Integer skuId, Integer number,
|
||||
String userId, String clientType, Integer cartId, String isGift, String isPack, String uuid, String type, Integer tableId, Integer vipId) {
|
||||
String userId, String clientType, Integer cartId, String isGift, String isPack, String uuid, String type, Integer vipUserId, String tableId) {
|
||||
if (Objects.isNull(number) || number < 0) {
|
||||
return Result.fail(CodeEnum.NUMBER);
|
||||
}
|
||||
@@ -121,6 +137,31 @@ public class OrderService {
|
||||
return Result.fail(CodeEnum.PRODUCTSKUERROR);
|
||||
}
|
||||
|
||||
// 台桌点单
|
||||
if ((StrUtil.isNotBlank(tableId))) {
|
||||
TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaUpdateWrapper<TbShopTable>()
|
||||
.eq(TbShopTable::getQrcode, tableId)
|
||||
.in(TbShopTable::getStatus, "idle", "using", "pending"));
|
||||
|
||||
if (shopTable == null) {
|
||||
return Result.fail("台桌不处于开台或空闲状态");
|
||||
}
|
||||
}
|
||||
|
||||
// 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.gt(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);
|
||||
|
||||
// 首次加入购物车,并且拥有起售数,设置为起售数
|
||||
@@ -145,6 +186,7 @@ public class OrderService {
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(masterId)) {
|
||||
boolean flag = redisUtil.exists("SHOP:CODE:" + clientType + ":" + shopId);
|
||||
if (flag) {
|
||||
String code = redisUtil.getMessage("SHOP:CODE:" + clientType + ":" + shopId).toString();
|
||||
@@ -156,36 +198,49 @@ public class OrderService {
|
||||
redisUtil.saveMessage("SHOP:CODE:" + clientType + ":" + shopId, "1");
|
||||
masterId = "#" + String.format("%03d", 1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
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());
|
||||
cashierCart.setUserId(vipUserId);
|
||||
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);
|
||||
cart.setUserId(vipUserId);
|
||||
|
||||
cart.setTotalNumber(number);
|
||||
cart.setUuid(uuid);
|
||||
cashierCartMapper.updateByPrimaryKeySelective(cart);
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
List<TbCashierCart> list = userId == null && tableId == null ? cashierCartMapper.selectALlByMasterId(masterId, "create")
|
||||
: cashierCartMapper.selectActivateByQrcode(tableId, Integer.valueOf(shopId), vipId);
|
||||
|
||||
TbCashierCart cashierCart = userId == null && tableId == null ? cashierCartMapper.selectByDetail(masterId, productId, shopId, skuId.toString(), DateUtils.getDay(), uuid)
|
||||
: cashierCartMapper.selectDetailByQrcode(tableId, productId, shopId, skuId.toString(), vipId);
|
||||
|
||||
List<TbCashierCart> list = cashierCartMapper.selectALlByMasterId(masterId, "create");
|
||||
TbCashierCart cashierCart = cashierCartMapper.selectByDetail(masterId, productId, shopId, skuId.toString(), DateUtils.getDay(), uuid);
|
||||
if (number > 0) {
|
||||
if (Objects.isNull(cashierCart)) {
|
||||
cashierCart = new TbCashierCart();
|
||||
@@ -193,9 +248,6 @@ public class OrderService {
|
||||
cashierCart.setCreatedAt(System.currentTimeMillis());
|
||||
cashierCart.setIsSku(product.getTypeEnum());
|
||||
cashierCart.setMasterId(masterId);
|
||||
if (tableId != null) {
|
||||
cashierCart.setTableId(String.valueOf(tableId));
|
||||
}
|
||||
cashierCart.setUuid(uuid);
|
||||
cashierCart.setMerchantId(userId);
|
||||
cashierCart.setName(product.getName());
|
||||
@@ -207,7 +259,7 @@ public class OrderService {
|
||||
cashierCart.setStatus("create");
|
||||
cashierCart.setIsPack(isPack);
|
||||
cashierCart.setIsGift(isGift);
|
||||
cashierCart.setUserId(vipId == null ? Integer.valueOf(userId) : vipId);
|
||||
cashierCart.setUserId(vipUserId);
|
||||
if (isGift.equals("false")) {
|
||||
cashierCart.setTotalAmount(new BigDecimal(number).multiply(skuWithBLOBs.getSalePrice()));
|
||||
} else {
|
||||
@@ -221,6 +273,7 @@ public class OrderService {
|
||||
|
||||
}
|
||||
cashierCart.setTotalNumber(number);
|
||||
cashierCart.setUserId(Integer.valueOf(userId));
|
||||
cashierCart.setNumber(number);
|
||||
cashierCart.setUuid(uuid);
|
||||
cashierCart.setCategoryId(product.getCategoryId());
|
||||
@@ -228,6 +281,7 @@ public class OrderService {
|
||||
cashierCartMapper.insert(cashierCart);
|
||||
cart=cashierCart;
|
||||
} else {
|
||||
cashierCart.setUserId(vipUserId);
|
||||
if (type.equals("add")) {
|
||||
cashierCart.setNumber(cashierCart.getNumber() + number);
|
||||
|
||||
@@ -239,8 +293,9 @@ public class OrderService {
|
||||
}else {
|
||||
cashierCart.setPackFee(new BigDecimal(number).multiply(product.getPackFee()));
|
||||
}
|
||||
cashierCart.setUserId(vipUserId);
|
||||
cashierCart.setTotalAmount(new BigDecimal(cashierCart.getNumber()).multiply(skuWithBLOBs.getSalePrice()).add(cashierCart.getPackFee()));
|
||||
cashierCartMapper.updateByPrimaryKeySelective(cashierCart);
|
||||
mpCashierCartMapper.updateById(cashierCart);
|
||||
}
|
||||
} else {
|
||||
cashierCartMapper.updateStatus(cashierCart.getId(), "close");
|
||||
@@ -257,9 +312,7 @@ public class OrderService {
|
||||
skuWithBLOBs.setUpdatedAt(System.currentTimeMillis());
|
||||
tbProductSkuMapper.updateByPrimaryKey(skuWithBLOBs);
|
||||
|
||||
if (StrUtil.isNotBlank(masterId)) {
|
||||
redisUtil.saveMessage("SHOP:CODE:SET" + clientType + ":" + shopId + ":" + DateUtils.getDay(), masterId.substring(1,masterId.length()));
|
||||
}
|
||||
redisUtil.saveMessage("SHOP:CODE:SET" + clientType + ":" + shopId + ":" + DateUtils.getDay(),masterId.substring(1,masterId.length()));
|
||||
|
||||
|
||||
|
||||
@@ -272,7 +325,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;
|
||||
}
|
||||
@@ -300,33 +354,54 @@ public class OrderService {
|
||||
}
|
||||
}
|
||||
|
||||
public Result queryCart(String masterId, String shopId, Integer tableId, Integer vipUserId) {
|
||||
public Result queryCart(String masterId, String shopId, String tableId) {
|
||||
if (StringUtils.isEmpty(shopId)) {
|
||||
return Result.fail(CodeEnum.SHOPINFONOEXIST);
|
||||
}
|
||||
String day = DateUtils.getDay();
|
||||
|
||||
List<TbCashierCart> list;
|
||||
if (tableId != null) {
|
||||
list = cashierCartMapper.selectActivateByQrcode(tableId, Integer.valueOf(shopId), vipUserId);
|
||||
}else {
|
||||
list = cashierCartMapper.selectByMaskerId(masterId, Integer.valueOf(shopId),"create",day);
|
||||
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getShopId, shopId);
|
||||
|
||||
// 普通点单
|
||||
if (StrUtil.isBlank(tableId)) {
|
||||
queryWrapper.eq(TbCashierCart::getMasterId, masterId);
|
||||
queryWrapper.isNull(TbCashierCart::getTableId);
|
||||
// 台桌点单
|
||||
}else if (StrUtil.isNotBlank(tableId)) {
|
||||
queryWrapper.eq(TbCashierCart::getTableId, tableId)
|
||||
.and(query -> {
|
||||
query.eq(TbCashierCart::getMasterId, masterId)
|
||||
.or()
|
||||
.isNull(TbCashierCart::getMasterId);
|
||||
});
|
||||
}
|
||||
if (StrUtil.isNotBlank(masterId) && list.isEmpty()){
|
||||
list = cashierCartMapper.selectByMaskerId(masterId, Integer.valueOf(shopId), "refund",day);
|
||||
|
||||
|
||||
// List<TbCashierCart> list = cashierCartMapper.selectByMaskerId(masterId, Integer.valueOf(shopId),"create",day);
|
||||
List<TbCashierCart> list = mpCashierCartMapper.selectList(queryWrapper.eq(TbCashierCart::getStatus, "create"));
|
||||
if (list.isEmpty()){
|
||||
list = mpCashierCartMapper.selectList(queryWrapper.eq(TbCashierCart::getStatus, "refund"));
|
||||
// list = cashierCartMapper.selectByMaskerId(masterId, Integer.valueOf(shopId), "refund",day);
|
||||
if (!list.isEmpty()){
|
||||
if (list.isEmpty()) {
|
||||
return Result.fail(CodeEnum.CARTJH);
|
||||
}
|
||||
int orderId = 0;
|
||||
String uuid = "";
|
||||
ArrayList<Integer> ids = new ArrayList<>();
|
||||
for (TbCashierCart cashierCart : list) {
|
||||
if (StringUtils.isNotEmpty(cashierCart.getOrderId())) {
|
||||
orderId = Integer.valueOf(cashierCart.getOrderId());
|
||||
break;
|
||||
orderId = Integer.parseInt(cashierCart.getOrderId());
|
||||
}
|
||||
cashierCart.setStatus("create");
|
||||
ids.add(cashierCart.getId());
|
||||
}
|
||||
cashierCartMapper.updateStatusByMaster(Integer.valueOf(shopId), masterId, "create", day, uuid);
|
||||
// mpCashierCartMapper.insertOrUpdate(list);
|
||||
// cashierCartMapper.updateStatusByMaster(Integer.valueOf(shopId), masterId, "create", day, uuid);
|
||||
mpCashierCartMapper.update(null, new LambdaUpdateWrapper<TbCashierCart>()
|
||||
.set(TbCashierCart::getStatus, "create")
|
||||
.in(TbCashierCart::getId, ids));
|
||||
if (orderId > 0) {
|
||||
tbOrderInfoMapper.updateStatusById(orderId, "cancelled");
|
||||
orderDetailMapper.updateStatusByOrderId(orderId, "cancelled");
|
||||
@@ -357,13 +432,7 @@ public class OrderService {
|
||||
}
|
||||
// TbProductSkuResult skuResult = tbProductSkuResultMapper.selectByPr imaryKey(Integer.valueOf(cashierCart.getProductId()));
|
||||
}
|
||||
|
||||
QueryCartPo queryCartPo;
|
||||
if (tableId == null) {
|
||||
queryCartPo = cashierCartMapper.selectProductNumByMarketId(day, shopId, masterId);
|
||||
}else {
|
||||
queryCartPo = cashierCartMapper.selectProductNumByQrcode(tableId, Integer.valueOf(shopId), vipUserId);
|
||||
}
|
||||
QueryCartPo queryCartPo = cashierCartMapper.selectProductNumByMarketId(day, shopId, masterId);
|
||||
queryCartPo.setPackAmount(packAmount);
|
||||
queryCartPo.setTotalAmount(totalAmount);
|
||||
// queryCartPo.setTotalAmount(totalAmount.add(packAmount));
|
||||
@@ -406,7 +475,7 @@ public class OrderService {
|
||||
List<String> skuIds=new ArrayList<>();
|
||||
skuIds.add(cashierCart.getSkuId());
|
||||
|
||||
cashierCartMapper.deleteByCartIdOrTableId(masterId, cartId, null);
|
||||
cashierCartMapper.deleteByCartId(masterId, cartId);
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS);
|
||||
}
|
||||
@@ -414,9 +483,32 @@ public class OrderService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result createOrder(OrderVo orderVo, String clientType, String token) {
|
||||
String day = DateUtils.getDay();
|
||||
List<TbCashierCart> list = cashierCartMapper.selectAllCreateOrder(orderVo.getMasterId(), orderVo.getShopId(), day, "create", orderVo.getUuid());
|
||||
if (list.size() < 1) {
|
||||
list = cashierCartMapper.selectAllCreateOrder(orderVo.getMasterId(), orderVo.getShopId(), day, "create", orderVo.getUuid());
|
||||
|
||||
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getShopId, orderVo.getShopId())
|
||||
.eq(TbCashierCart::getStatus, "create");
|
||||
|
||||
|
||||
// 普通点单
|
||||
if (StrUtil.isBlank(orderVo.getTableId())) {
|
||||
queryWrapper.eq(TbCashierCart::getMasterId, orderVo.getMasterId())
|
||||
.eq(TbCashierCart::getTradeDay, day);
|
||||
queryWrapper.isNull(TbCashierCart::getTableId);
|
||||
// 台桌点单
|
||||
}else if (StrUtil.isNotBlank(orderVo.getTableId()) && orderVo.getVipUserId() == null) {
|
||||
queryWrapper.eq(TbCashierCart::getTableId, orderVo.getTableId())
|
||||
.and(query -> {
|
||||
query.eq(TbCashierCart::getMasterId, orderVo.getMasterId())
|
||||
.or()
|
||||
.isNull(TbCashierCart::getMasterId);
|
||||
});
|
||||
}
|
||||
|
||||
List<TbCashierCart> list = mpCashierCartMapper.selectList(queryWrapper);
|
||||
// List<TbCashierCart> list = cashierCartMapper.selectAllCreateOrder(orderVo.getMasterId(), orderVo.getShopId(), day, "create", orderVo.getUuid());
|
||||
if (list.isEmpty()) {
|
||||
list = mpCashierCartMapper.selectList(queryWrapper);
|
||||
// list = cashierCartMapper.selectAllCreateOrder(orderVo.getMasterId(), orderVo.getShopId(), day, "create", orderVo.getUuid());
|
||||
}
|
||||
|
||||
if(ObjectUtil.isEmpty(list)||ObjectUtil.isNull(list)||list.size()<=0){
|
||||
@@ -534,7 +626,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()));
|
||||
|
||||
// 已经添加的商品,修改数量
|
||||
@@ -704,11 +795,34 @@ public class OrderService {
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result cartStatus(Integer shopId, String masterId, String status, String userId, String uuid, String clientType) {
|
||||
public Result cartStatus(Integer shopId, String masterId, String status, String userId, String uuid,
|
||||
String clientType, Integer vipUserId, String tableId) {
|
||||
String newUuid = redisUtil.getMessage("CART:UUID:" + shopId + userId)+"";
|
||||
String day = DateUtils.getDay();
|
||||
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getShopId, shopId);
|
||||
|
||||
|
||||
// 普通点单
|
||||
if (StrUtil.isBlank(tableId)) {
|
||||
queryWrapper.eq(TbCashierCart::getMasterId, masterId);
|
||||
queryWrapper.isNull(TbCashierCart::getTableId);
|
||||
// 台桌点单
|
||||
}else if (StrUtil.isNotBlank(tableId) && vipUserId == null) {
|
||||
queryWrapper.eq(TbCashierCart::getTableId, tableId)
|
||||
.eq(TbCashierCart::getMasterId, masterId);
|
||||
// 会员点单
|
||||
}else {
|
||||
queryWrapper
|
||||
.eq(TbCashierCart::getTableId, tableId)
|
||||
.eq(TbCashierCart::getUserId, vipUserId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ("true".equals(status)) {
|
||||
List<TbCashierCart> list = cashierCartMapper.selectAllCreateOrder(masterId, shopId, day, "create", uuid);
|
||||
List<TbCashierCart> list = mpCashierCartMapper.selectList(queryWrapper);
|
||||
// List<TbCashierCart> list = cashierCartMapper.selectAllCreateOrder(masterId, shopId, day, "create", uuid);
|
||||
if (list.size() < 1) {
|
||||
return Result.fail(CodeEnum.CREATEORDER);
|
||||
}
|
||||
@@ -779,32 +893,40 @@ public class OrderService {
|
||||
if (StringUtils.isNotEmpty(cashierCart.getOrderId())) {
|
||||
flag = false;
|
||||
}
|
||||
cashierCart.setUserId(vipUserId);
|
||||
cashierCart.setOrderId(orderId + "");
|
||||
cashierCart.setUpdatedAt(System.currentTimeMillis());
|
||||
cashierCart.setPendingAt(System.currentTimeMillis());
|
||||
cashierCart.setStatus("refund");
|
||||
cashierCart.setUuid(newUuid);
|
||||
cashierCartMapper.updateByPrimaryKeySelective(cashierCart);
|
||||
mpCashierCartMapper.updateById(cashierCart);
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
redisUtil.deleteByKey("SHOP:CODE:USER:" + clientType + ":" + shopId + ":" + day + userId);
|
||||
;
|
||||
}
|
||||
} else {
|
||||
|
||||
List<TbCashierCart> list = cashierCartMapper.selectAllCreateOrder(masterId, shopId, "", "refund", uuid);
|
||||
if (list.size() < 1) {
|
||||
List<TbCashierCart> list = mpCashierCartMapper.selectList(queryWrapper
|
||||
.eq(TbCashierCart::getStatus, "refund"));
|
||||
// List<TbCashierCart> list = cashierCartMapper.selectAllCreateOrder(masterId, shopId, "", "refund", uuid);
|
||||
if (list.isEmpty()) {
|
||||
return Result.fail(CodeEnum.CARTJH);
|
||||
}
|
||||
int orderId = 0;
|
||||
ArrayList<Integer> ids = new ArrayList<>();
|
||||
for (TbCashierCart cashierCart : list) {
|
||||
if (StringUtils.isNotEmpty(cashierCart.getOrderId())) {
|
||||
orderId = Integer.valueOf(cashierCart.getOrderId());
|
||||
break;
|
||||
orderId = Integer.parseInt(cashierCart.getOrderId());
|
||||
}
|
||||
ids.add(cashierCart.getId());
|
||||
// cashierCart.setStatus("create");
|
||||
// }
|
||||
|
||||
}
|
||||
cashierCartMapper.updateStatusByMaster(shopId, masterId, "create", day, uuid);
|
||||
mpCashierCartMapper.update(null, new LambdaUpdateWrapper<TbCashierCart>()
|
||||
.set(TbCashierCart::getStatus, "create")
|
||||
.in(TbCashierCart::getId, ids));
|
||||
// cashierCartMapper.updateStatusByMaster(shopId, masterId, "create", day, uuid);
|
||||
if (orderId > 0) {
|
||||
tbOrderInfoMapper.updateStatusById(orderId, "cancelled");
|
||||
orderDetailMapper.updateStatusByOrderId(orderId, "cancelled");
|
||||
@@ -851,11 +973,30 @@ public class OrderService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result clearCart(CartVo cartVo) {
|
||||
String day = DateUtils.getDay();
|
||||
List<TbCashierCart> list = cashierCartMapper.selectAllCreateOrder2(
|
||||
cartVo.getMasterId(), Integer.valueOf(cartVo.getShopId()), day, "create", cartVo.getUuid(), cartVo.getTableId(), cartVo.getVipUserId());
|
||||
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getShopId, cartVo.getShopId())
|
||||
.eq(TbCashierCart::getTradeDay, day)
|
||||
.eq(TbCashierCart::getStatus, "create");
|
||||
|
||||
|
||||
// 普通点单
|
||||
if (StrUtil.isBlank(cartVo.getTableId())) {
|
||||
queryWrapper.eq(TbCashierCart::getMasterId, cartVo.getMasterId());
|
||||
queryWrapper.isNull(TbCashierCart::getTableId);
|
||||
// 台桌点单
|
||||
}else if (StrUtil.isNotBlank(cartVo.getTableId()) && cartVo.getVipUserId() == null) {
|
||||
queryWrapper.eq(TbCashierCart::getTableId, cartVo.getTableId())
|
||||
.eq(TbCashierCart::getMasterId, cartVo.getMasterId());
|
||||
// 会员点单
|
||||
}else {
|
||||
queryWrapper.eq(TbCashierCart::getUserId, cartVo.getVipUserId());
|
||||
}
|
||||
|
||||
List<TbCashierCart> list = mpCashierCartMapper.selectList(queryWrapper);
|
||||
// List<TbCashierCart> list = cashierCartMapper.selectAllCreateOrder(cartVo.getMasterId(), Integer.valueOf(cartVo.getShopId()), day, "create", cartVo.getUuid());
|
||||
int orderId = 0;
|
||||
List<ProductSkuPo> productSkuPos=new ArrayList<>();
|
||||
List<String> skuIds=new ArrayList<>();
|
||||
List<ProductSkuPo> productSkuPos = new ArrayList<>();
|
||||
List<String> skuIds = new ArrayList<>();
|
||||
for (TbCashierCart cashierCart : list) {
|
||||
// 数量减少, 返还库存
|
||||
String message = redisUtil.getMessage(RedisCst.ORDER_PRODUCT_NUM + cashierCart.getId());
|
||||
@@ -1350,4 +1491,19 @@ public class OrderService {
|
||||
JSONObject jsonObject = JSON.parseObject(HttpClientUtil.doGet(requestUrl,requestUrlParam));
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
public Object updateVip(UpdateVipDTO updateVipDTO) {
|
||||
LambdaUpdateWrapper<TbCashierCart> queryWrapper = new LambdaUpdateWrapper<>();
|
||||
queryWrapper.eq(TbCashierCart::getTableId, updateVipDTO.getTableId())
|
||||
.eq(TbCashierCart::getShopId, updateVipDTO.getShopId())
|
||||
.eq(TbCashierCart::getMasterId, updateVipDTO.getMasterId());
|
||||
|
||||
if (updateVipDTO.getType().equals(0)) {
|
||||
queryWrapper.set(TbCashierCart::getUserId, null);
|
||||
queryWrapper.eq(TbCashierCart::getUserId, updateVipDTO.getVipUserId());
|
||||
}else {
|
||||
queryWrapper.set(TbCashierCart::getUserId, updateVipDTO.getVipUserId());
|
||||
}
|
||||
return mpCashierCartMapper.update(null, queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
|
||||
import static com.chaozhanggui.system.cashierservice.sign.CodeEnum.ACCOUNTEIXST;
|
||||
import static com.chaozhanggui.system.cashierservice.sign.CodeEnum.SUCCESS;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@@ -115,6 +116,10 @@ public class PayService {
|
||||
TbmerchantAccountMapper tbmerchantAccountMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
TbPlussShopStaffMapper tbPlussShopStaffMapper;
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
System.out.printf("%.2f%n", new BigDecimal(1).setScale(2, RoundingMode.DOWN));
|
||||
@@ -126,7 +131,7 @@ public class PayService {
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result scanPay(String orderId, String authCode, String ip, String token) {
|
||||
public Result scanPay(String orderId, String authCode, String ip, String token,BigDecimal payAmount,BigDecimal discountAmount) {
|
||||
if (ObjectUtil.isEmpty(orderId) || ObjectUtil.isEmpty(authCode) || ObjectUtil.isEmpty(ip)) {
|
||||
return Result.fail(CodeEnum.PARAM);
|
||||
}
|
||||
@@ -143,6 +148,26 @@ public class PayService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
JSONObject tokeObj= TokenUtil.parseParamFromToken(token);
|
||||
if(Objects.isNull(tokeObj)){
|
||||
return Result.fail(CodeEnum.TOKENTERROR);
|
||||
}
|
||||
|
||||
Integer staffId=Integer.valueOf(tokeObj.containsKey("staffId")?tokeObj.getString("staffId"):"0");
|
||||
|
||||
TbPlussShopStaff staff= tbPlussShopStaffMapper.selectByPrimaryKey(staffId);
|
||||
|
||||
if(ObjectUtil.isNotNull(staff)&&ObjectUtil.isNotNull(payAmount)&&ObjectUtil.isNotNull(discountAmount)&&ObjectUtil.isNotEmpty(payAmount)&&ObjectUtil.isNotEmpty(discountAmount)){
|
||||
if("0".equals(staff.getDiscountType())){
|
||||
if(N.gt(discountAmount,staff.getMaxDiscountAmount())){
|
||||
return Result.fail(CodeEnum.STAFFDISCOUNTAMOUNTHIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderId, null);
|
||||
if (ObjectUtil.isEmpty(cashierCarts) || ObjectUtil.isNull(cashierCarts)) {
|
||||
return Result.fail(CodeEnum.CARTEXIST);
|
||||
@@ -194,7 +219,7 @@ public class PayService {
|
||||
if (ObjectUtil.isEmpty(payment) || payment == null) {
|
||||
payment = new TbOrderPayment();
|
||||
payment.setPayTypeId("ysk");
|
||||
payment.setAmount(orderInfo.getOrderAmount());
|
||||
payment.setAmount(ObjectUtil.isEmpty(payAmount)?orderInfo.getOrderAmount():payAmount);
|
||||
payment.setPaidAmount(orderInfo.getPayAmount());
|
||||
payment.setHasRefundAmount(BigDecimal.ZERO);
|
||||
payment.setPayName(payName);
|
||||
@@ -214,9 +239,12 @@ public class PayService {
|
||||
}
|
||||
|
||||
|
||||
orderInfo.setPayAmount(orderInfo.getOrderAmount());
|
||||
orderInfo.setPayAmount(ObjectUtil.isEmpty(payAmount)?orderInfo.getOrderAmount():payAmount);
|
||||
orderInfo.setDiscountAmount(ObjectUtil.isEmpty(discountAmount)?BigDecimal.ZERO:discountAmount);
|
||||
orderInfo.setDiscountRatio(ObjectUtil.isNotEmpty(payAmount)?payAmount.divide(orderInfo.getOrderAmount()).setScale(2,BigDecimal.ROUND_DOWN):null);
|
||||
orderInfo.setPayType(qpay);
|
||||
orderInfo.setUpdatedAt(System.currentTimeMillis());
|
||||
orderInfo.setStaffId(ObjectUtil.isNotNull(staff)?staff.getId():null);
|
||||
tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo);
|
||||
|
||||
if ("ysk".equals(thirdPayType)) {
|
||||
@@ -432,7 +460,7 @@ public class PayService {
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result accountPay(String orderId, String memberId, String token,String memberAccount) {
|
||||
public Result accountPay(String orderId, String memberId, String token,String memberAccount,BigDecimal payAmount,BigDecimal discountAmount) {
|
||||
if (ObjectUtil.isEmpty(orderId) ) {
|
||||
if(ObjectUtil.isEmpty(memberAccount)){
|
||||
if(ObjectUtil.isEmpty(memberId)){
|
||||
@@ -460,12 +488,33 @@ public class PayService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
int count = tbShopPayTypeMapper.countSelectByShopIdAndPayType(orderInfo.getShopId(), "deposit");
|
||||
if (count < 1) {
|
||||
return Result.fail(CodeEnum.PAYTYPENOEXIST);
|
||||
}
|
||||
|
||||
|
||||
|
||||
JSONObject tokeObj= TokenUtil.parseParamFromToken(token);
|
||||
if(Objects.isNull(tokeObj)){
|
||||
return Result.fail(CodeEnum.TOKENTERROR);
|
||||
}
|
||||
|
||||
Integer staffId=Integer.valueOf(tokeObj.containsKey("staffId")?tokeObj.getString("staffId"):"0");
|
||||
|
||||
TbPlussShopStaff staff= tbPlussShopStaffMapper.selectByPrimaryKey(staffId);
|
||||
|
||||
if(ObjectUtil.isNotNull(staff)&&ObjectUtil.isNotNull(payAmount)&&ObjectUtil.isNotNull(discountAmount)&&ObjectUtil.isNotEmpty(payAmount)&&ObjectUtil.isNotEmpty(discountAmount)){
|
||||
if("0".equals(staff.getDiscountType())){
|
||||
if(N.gt(discountAmount,staff.getMaxDiscountAmount())){
|
||||
return Result.fail(CodeEnum.STAFFDISCOUNTAMOUNTHIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
TbShopUser user =null;
|
||||
|
||||
if(ObjectUtil.isNotEmpty(memberId)){
|
||||
@@ -510,7 +559,10 @@ public class PayService {
|
||||
tbShopUserFlowMapper.insert(flow);
|
||||
|
||||
|
||||
orderInfo.setPayAmount(orderInfo.getOrderAmount());
|
||||
orderInfo.setPayAmount(ObjectUtil.isEmpty(payAmount)?orderInfo.getOrderAmount():payAmount);
|
||||
orderInfo.setDiscountAmount(ObjectUtil.isEmpty(discountAmount)?BigDecimal.ZERO:discountAmount);
|
||||
orderInfo.setDiscountRatio(ObjectUtil.isNotEmpty(payAmount)?payAmount.divide(orderInfo.getOrderAmount()).setScale(2,BigDecimal.ROUND_DOWN):null);
|
||||
orderInfo.setStaffId(ObjectUtil.isEmpty(staff)?null:staff.getId());
|
||||
orderInfo.setUserId(user.getUserId());
|
||||
orderInfo.setMemberId(user.getId().toString());
|
||||
orderInfo.setPayType("deposit");
|
||||
@@ -546,7 +598,7 @@ public class PayService {
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result memberScanPay(String orderId, String memberCode, String token) {
|
||||
public Result memberScanPay(String orderId, String memberCode, String token,BigDecimal payAmount,BigDecimal discountAmount) {
|
||||
if (ObjectUtil.isEmpty(orderId) || ObjectUtil.isEmpty(memberCode)) {
|
||||
return Result.fail(CodeEnum.PARAM);
|
||||
}
|
||||
@@ -569,6 +621,26 @@ public class PayService {
|
||||
}
|
||||
|
||||
|
||||
JSONObject tokeObj= TokenUtil.parseParamFromToken(token);
|
||||
if(Objects.isNull(tokeObj)){
|
||||
return Result.fail(CodeEnum.TOKENTERROR);
|
||||
}
|
||||
|
||||
Integer staffId=Integer.valueOf(tokeObj.containsKey("staffId")?tokeObj.getString("staffId"):"0");
|
||||
|
||||
TbPlussShopStaff staff= tbPlussShopStaffMapper.selectByPrimaryKey(staffId);
|
||||
|
||||
if(ObjectUtil.isNotNull(staff)&&ObjectUtil.isNotNull(payAmount)&&ObjectUtil.isNotNull(discountAmount)&&ObjectUtil.isNotEmpty(payAmount)&&ObjectUtil.isNotEmpty(discountAmount)){
|
||||
if("0".equals(staff.getDiscountType())){
|
||||
if(N.gt(discountAmount,staff.getMaxDiscountAmount())){
|
||||
return Result.fail(CodeEnum.STAFFDISCOUNTAMOUNTHIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
TbUserInfo tbUserInfo = tbUserInfoMapper.selectByCardNo(memberCode);
|
||||
if (ObjectUtil.isEmpty(tbUserInfo)) {
|
||||
return Result.fail(ACCOUNTEIXST);
|
||||
@@ -601,8 +673,10 @@ public class PayService {
|
||||
flow.setCreateTime(new Date());
|
||||
tbShopUserFlowMapper.insert(flow);
|
||||
|
||||
|
||||
orderInfo.setPayAmount(orderInfo.getOrderAmount());
|
||||
orderInfo.setPayAmount(ObjectUtil.isEmpty(payAmount)?orderInfo.getOrderAmount():payAmount);
|
||||
orderInfo.setDiscountAmount(ObjectUtil.isEmpty(discountAmount)?BigDecimal.ZERO:discountAmount);
|
||||
orderInfo.setDiscountRatio(ObjectUtil.isNotEmpty(payAmount)?payAmount.divide(orderInfo.getOrderAmount()).setScale(2,BigDecimal.ROUND_DOWN):null);
|
||||
orderInfo.setStaffId(ObjectUtil.isEmpty(staff)?null:staff.getId());
|
||||
orderInfo.setMemberId(user.getUserId());
|
||||
orderInfo.setPayType("deposit");
|
||||
orderInfo.setStatus("closed");
|
||||
@@ -637,7 +711,7 @@ public class PayService {
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result cashPay(String orderId, String token) {
|
||||
public Result cashPay(String orderId, String token,BigDecimal payAmount,BigDecimal discountAmount) {
|
||||
if (ObjectUtil.isEmpty(orderId)) {
|
||||
return Result.fail(CodeEnum.PARAM);
|
||||
}
|
||||
@@ -654,13 +728,34 @@ public class PayService {
|
||||
}
|
||||
|
||||
|
||||
JSONObject tokeObj= TokenUtil.parseParamFromToken(token);
|
||||
if(Objects.isNull(tokeObj)){
|
||||
return Result.fail(CodeEnum.TOKENTERROR);
|
||||
}
|
||||
|
||||
Integer staffId=Integer.valueOf(tokeObj.containsKey("staffId")?tokeObj.getString("staffId"):"0");
|
||||
|
||||
TbPlussShopStaff staff= tbPlussShopStaffMapper.selectByPrimaryKey(staffId);
|
||||
|
||||
if(ObjectUtil.isNotNull(staff)&&ObjectUtil.isNotNull(payAmount)&&ObjectUtil.isNotNull(discountAmount)&&ObjectUtil.isNotEmpty(payAmount)&&ObjectUtil.isNotEmpty(discountAmount)){
|
||||
if("0".equals(staff.getDiscountType())){
|
||||
if(N.gt(discountAmount,staff.getMaxDiscountAmount())){
|
||||
return Result.fail(CodeEnum.STAFFDISCOUNTAMOUNTHIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int count = tbShopPayTypeMapper.countSelectByShopIdAndPayType(orderInfo.getShopId(), "cash");
|
||||
if (count < 1) {
|
||||
return Result.fail(CodeEnum.PAYTYPENOEXIST);
|
||||
}
|
||||
|
||||
|
||||
orderInfo.setPayAmount(orderInfo.getOrderAmount());
|
||||
orderInfo.setPayAmount(ObjectUtil.isEmpty(payAmount)?orderInfo.getOrderAmount():payAmount);
|
||||
orderInfo.setDiscountAmount(ObjectUtil.isEmpty(discountAmount)?BigDecimal.ZERO:discountAmount);
|
||||
orderInfo.setStaffId(ObjectUtil.isEmpty(staff)?null:staff.getId());
|
||||
orderInfo.setDiscountRatio(ObjectUtil.isNotEmpty(payAmount)?payAmount.divide(orderInfo.getOrderAmount()).setScale(2,BigDecimal.ROUND_DOWN):null);
|
||||
orderInfo.setPayType("cash");
|
||||
orderInfo.setStatus("closed");
|
||||
orderInfo.setPayOrderNo("cash".concat(SnowFlakeUtil.generateOrderNo()));
|
||||
@@ -691,7 +786,7 @@ public class PayService {
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result bankPay(String orderId, String token) {
|
||||
public Result bankPay(String orderId, String token,BigDecimal payAmount,BigDecimal discountAmount) {
|
||||
if (ObjectUtil.isEmpty(orderId)) {
|
||||
return Result.fail(CodeEnum.PARAM);
|
||||
}
|
||||
@@ -713,8 +808,29 @@ public class PayService {
|
||||
return Result.fail(CodeEnum.PAYTYPENOEXIST);
|
||||
}
|
||||
|
||||
JSONObject tokeObj= TokenUtil.parseParamFromToken(token);
|
||||
if(Objects.isNull(tokeObj)){
|
||||
return Result.fail(CodeEnum.TOKENTERROR);
|
||||
}
|
||||
|
||||
orderInfo.setPayAmount(orderInfo.getOrderAmount());
|
||||
Integer staffId=Integer.valueOf(tokeObj.containsKey("staffId")?tokeObj.getString("staffId"):"0");
|
||||
|
||||
TbPlussShopStaff staff= tbPlussShopStaffMapper.selectByPrimaryKey(staffId);
|
||||
|
||||
if(ObjectUtil.isNotNull(staff)&&ObjectUtil.isNotNull(payAmount)&&ObjectUtil.isNotNull(discountAmount)&&ObjectUtil.isNotEmpty(payAmount)&&ObjectUtil.isNotEmpty(discountAmount)){
|
||||
if("0".equals(staff.getDiscountType())){
|
||||
if(N.gt(discountAmount,staff.getMaxDiscountAmount())){
|
||||
return Result.fail(CodeEnum.STAFFDISCOUNTAMOUNTHIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
orderInfo.setPayAmount(ObjectUtil.isEmpty(payAmount)?orderInfo.getOrderAmount():payAmount);
|
||||
orderInfo.setDiscountAmount(ObjectUtil.isEmpty(discountAmount)?BigDecimal.ZERO:discountAmount);
|
||||
orderInfo.setStaffId(ObjectUtil.isEmpty(staff)?null:staff.getId());
|
||||
orderInfo.setDiscountRatio(ObjectUtil.isNotEmpty(payAmount)?payAmount.divide(orderInfo.getOrderAmount()).setScale(2,BigDecimal.ROUND_DOWN):null);
|
||||
orderInfo.setPayType("cash");
|
||||
orderInfo.setStatus("closed");
|
||||
orderInfo.setPayOrderNo("cash".concat(SnowFlakeUtil.generateOrderNo()));
|
||||
@@ -835,6 +951,9 @@ public class PayService {
|
||||
saleAmount = saleAmount.add(it.getPrice());
|
||||
payAmount = payAmount.add(it.getPriceAmount().divide(new BigDecimal(it.getNum()), 2, RoundingMode.DOWN)
|
||||
.multiply(new BigDecimal(map1.get(it.getId()))));
|
||||
if(ObjectUtil.isNotEmpty(orderInfo.getDiscountRatio())&&ObjectUtil.isNotNull(orderInfo.getDiscountRatio())){
|
||||
payAmount=payAmount.multiply(orderInfo.getDiscountRatio()).setScale(2,BigDecimal.ROUND_DOWN);
|
||||
}
|
||||
// payAmount=payAmount.add(it.getPriceAmount());
|
||||
packAMount = packAMount.add(it.getPackAmount().divide(new BigDecimal(it.getNum()), 2, RoundingMode.DOWN).multiply(new BigDecimal(map1.get(it.getId()))));
|
||||
|
||||
|
||||
@@ -9,9 +9,11 @@ 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;
|
||||
@@ -46,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);
|
||||
@@ -127,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);
|
||||
@@ -251,6 +207,92 @@ public class ProductService {
|
||||
}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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -104,6 +104,11 @@ public enum CodeEnum {
|
||||
PWDERROE("100038",false,"操作密码错误","fail"),
|
||||
|
||||
|
||||
STAFFNOEXISTERROE("100039",false,"员工信息不存在","fail"),
|
||||
|
||||
STAFFDISCOUNTAMOUNTHIGHT("100040",false,"优惠金额不能大于员工授权额度","fail"),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.chaozhanggui.system.cashierservice.thirdpay.req;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Data
|
||||
public class MainScanReq implements Serializable {
|
||||
@@ -25,7 +26,13 @@ public class MainScanReq implements Serializable {
|
||||
|
||||
private String notifyUrl;
|
||||
|
||||
public MainScanReq(String subject, String body, Long amount, String subAppid, String currency, String authCode, String mchOrderNo, String storeId, String notifyUrl) {
|
||||
private int divisionMode;
|
||||
|
||||
private ArrayList divList;
|
||||
|
||||
private String divTemplateNo;
|
||||
|
||||
public MainScanReq(String subject, String body, Long amount, String subAppid, String currency, String authCode, String mchOrderNo, String storeId, String notifyUrl,int divisionMode,String divTemplateNo,ArrayList divList) {
|
||||
this.subject = subject;
|
||||
this.body = body;
|
||||
this.amount = amount;
|
||||
@@ -35,6 +42,9 @@ public class MainScanReq implements Serializable {
|
||||
this.mchOrderNo = mchOrderNo;
|
||||
this.storeId = storeId;
|
||||
this.notifyUrl = notifyUrl;
|
||||
this.divisionMode=divisionMode;
|
||||
this.divList=divList;
|
||||
this.divTemplateNo=divTemplateNo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.chaozhanggui.system.cashierservice.thirdpay.req;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Data
|
||||
public class WxScanPayReq implements Serializable {
|
||||
@@ -28,11 +29,20 @@ public class WxScanPayReq implements Serializable {
|
||||
|
||||
private String storeId;
|
||||
|
||||
private int divisionMode;
|
||||
|
||||
private ArrayList divList;
|
||||
|
||||
private String divTemplateNo;
|
||||
|
||||
private String notifyUrl;
|
||||
|
||||
private String returnUrl;
|
||||
|
||||
public WxScanPayReq(String subject, String body, Long amount, String currency, String payType, String subAppid, String userId, String clientIp, String mchOrderNo, String storeId, String notifyUrl, String returnUrl) {
|
||||
public WxScanPayReq(String subject, String body, Long amount, String currency, String payType, String subAppid, String userId, String clientIp, String mchOrderNo, String storeId,
|
||||
int divisionMode,ArrayList divList,String divTemplateNo,
|
||||
|
||||
String notifyUrl, String returnUrl) {
|
||||
this.subject = subject;
|
||||
this.body = body;
|
||||
this.amount = amount;
|
||||
@@ -45,5 +55,8 @@ public class WxScanPayReq implements Serializable {
|
||||
this.storeId = storeId;
|
||||
this.notifyUrl = notifyUrl;
|
||||
this.returnUrl = returnUrl;
|
||||
this.divisionMode=divisionMode;
|
||||
this.divList=divList;
|
||||
this.divTemplateNo=divTemplateNo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,8 +47,17 @@ public class ThirdPayService {
|
||||
public PublicResp<MainScanResp> mainScan(String url,String appId, String subject, String body, Long amount, String subAppId, String authCode, String orderNo, String storeId, String notifyUrl,
|
||||
String key
|
||||
) {
|
||||
MainScanReq mainScanReq=null;
|
||||
if("66bab943ae82f63b50ae3cff".equals(appId)){
|
||||
|
||||
mainScanReq = new MainScanReq(subject, body, amount, subAppId, "cny", authCode, orderNo, storeId, notifyUrl,1,"TA1824003985261588482",null);
|
||||
url="https://paymentweb.sxczgkj.cn";
|
||||
}else {
|
||||
mainScanReq = new MainScanReq(subject, body, amount, subAppId, "cny", authCode, orderNo, storeId, notifyUrl,0,null,null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
MainScanReq mainScanReq = new MainScanReq(subject, body, amount, subAppId, "cny", authCode, orderNo, storeId, notifyUrl);
|
||||
PublicParam param = new PublicParam(appId, "", SignTypeEnum.MD5.getValue(), null, DateUtils.getSdfTimes(), "1.0", String.valueOf(System.currentTimeMillis()));
|
||||
|
||||
|
||||
@@ -99,7 +108,14 @@ public class ThirdPayService {
|
||||
|
||||
String clinetIp,String orderNo, String storeId, String notifyUrl,String returnUrl,
|
||||
String key){
|
||||
WxScanPayReq scanPayReq=new WxScanPayReq(subject,body,amount,"cny",payType,subAppId,userId,clinetIp,orderNo,storeId,notifyUrl,returnUrl);
|
||||
WxScanPayReq scanPayReq=null;
|
||||
if("66bab943ae82f63b50ae3cff".equals(appId)){
|
||||
scanPayReq=new WxScanPayReq(subject,body,amount,"cny",payType,subAppId,userId,clinetIp,orderNo,storeId,1,null,"TA1824003985261588482",notifyUrl,returnUrl);
|
||||
url="https://paymentweb.sxczgkj.cn";
|
||||
}else {
|
||||
scanPayReq=new WxScanPayReq(subject,body,amount,"cny",payType,subAppId,userId,clinetIp,orderNo,storeId,0,null,null,notifyUrl,returnUrl);
|
||||
}
|
||||
|
||||
PublicParam param=new PublicParam(appId,null,SignTypeEnum.MD5.getValue(),null,DateUtils.getSdfTimes(), "1.0", String.valueOf(System.currentTimeMillis()));
|
||||
|
||||
|
||||
|
||||
@@ -101,6 +101,11 @@ public class WxAccountUtil {
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@@ -57,5 +57,8 @@ wx:
|
||||
warnMsgTmpId: C08OUr80x6wGmUN1zpFhSQ3Sv7VF5vksdZigiEx2pD0
|
||||
|
||||
|
||||
|
||||
mybatis-plus:
|
||||
global-config:
|
||||
db-config:
|
||||
id-type: auto
|
||||
|
||||
|
||||
@@ -65,8 +65,8 @@
|
||||
<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="userId != null">
|
||||
and user_id = #{userId}
|
||||
<if test="uuid != null">
|
||||
and uuid = #{uuid}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByMaskerId" resultType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
||||
@@ -91,27 +91,6 @@
|
||||
and trade_day = #{day}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectAllCreateOrder2" resultType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from tb_cashier_cart where shop_id = #{shopId} and status = #{status}
|
||||
<if test="uuid != null and uuid != ''">
|
||||
and uuid = #{uuid}
|
||||
</if>
|
||||
<if test="day != null and day !=''">
|
||||
and trade_day = #{day}
|
||||
</if>
|
||||
<if test="tableId != null and vipUserId != null">
|
||||
and (table_id = #{tableId} or user_id=#{vipUserId})
|
||||
</if>
|
||||
<if test="tableId != null and vipUserId == null">
|
||||
and table_id = #{tableId} and master_id = #{masterId}
|
||||
</if>
|
||||
<if test="tableId == null and vipUserId == null">
|
||||
and master_id = #{masterId}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectProductNumByMarketId" 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 trade_day = #{day} and master_id = #{masterId} and shop_id = #{shopId} group by product_id ) a
|
||||
</select>
|
||||
@@ -429,22 +408,13 @@
|
||||
|
||||
<select id="selectActivateByQrcode"
|
||||
resultType="com.chaozhanggui.system.cashierservice.entity.TbCashierCart">
|
||||
select * from tb_cashier_cart where shop_id = #{shopId} and status = 'create'
|
||||
and table_id = #{tableId}
|
||||
<if test="userId != null">
|
||||
and user_id=#{userId}
|
||||
</if>
|
||||
|
||||
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 = #{tableId} and shop_id = #{shopId}
|
||||
<if test="vipUserId != null">
|
||||
and user_id=#{vipUserId}
|
||||
</if>
|
||||
group by product_id ) a
|
||||
from tb_cashier_cart where table_id = #{qrcode} and shop_id = #{shopId} group by product_id ) a
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -515,6 +515,10 @@
|
||||
<if test="remark != null and remark!=''">
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
||||
<if test="staffId != null and staffId!=''">
|
||||
staff_id = #{staffId,jdbcType=INTEGER},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="account" jdbcType="VARCHAR" property="account" />
|
||||
<result column="password" jdbcType="VARCHAR" property="password" />
|
||||
<result column="discount_type" jdbcType="VARCHAR" property="discountType" />
|
||||
<result column="max_discount_amount" jdbcType="DECIMAL" property="maxDiscountAmount" />
|
||||
<result column="status" jdbcType="BIT" property="status" />
|
||||
<result column="employee" jdbcType="VARCHAR" property="employee" />
|
||||
@@ -19,7 +20,7 @@
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id
|
||||
, code, name, account, password, max_discount_amount, status, employee, shop_id,
|
||||
, code, name, account, password,discount_type, max_discount_amount, status, employee, shop_id,
|
||||
created_at, updated_at, type,is_manage,is_pc
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user