Merge remote-tracking branch 'origin/test' into dev
This commit is contained in:
1
pom.xml
1
pom.xml
@@ -14,6 +14,7 @@
|
||||
<version>1.0.0</version>
|
||||
|
||||
<properties>
|
||||
<skipTests>true</skipTests>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
@@ -20,6 +20,23 @@ public interface TableConstant {
|
||||
}
|
||||
}
|
||||
|
||||
class Product {
|
||||
@Getter
|
||||
public enum Type {
|
||||
NORMAL("normal"), PACKAGE("package");
|
||||
private final String value;
|
||||
|
||||
Type(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public boolean equalsVals(String value) {
|
||||
return this.value.equals(value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class ShopTable {
|
||||
@Getter
|
||||
public enum State {
|
||||
@@ -32,6 +49,18 @@ public interface TableConstant {
|
||||
}
|
||||
}
|
||||
|
||||
class ThirdPartyCoupon {
|
||||
@Getter
|
||||
public enum Plat {
|
||||
MEI_TUAN("meituan");
|
||||
private final String value;
|
||||
|
||||
Plat(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class OrderInfo {
|
||||
@Getter
|
||||
public enum Status {
|
||||
@@ -51,7 +80,7 @@ public interface TableConstant {
|
||||
public enum UseType {
|
||||
TAKEOUT("takeout"),
|
||||
DINE_IN_AFTER("dine-in-after"),
|
||||
DINE_IN_BEFORE("dine-in-before");
|
||||
DINE_IN_BEFORE("dine-in-before"), NONE_TABLE("dine-in");
|
||||
private final String value;
|
||||
|
||||
UseType(String value) {
|
||||
|
||||
@@ -4,9 +4,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.entity.OrderVo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ChoseCountDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ReturnCartDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.UpdateVipDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.CartVo;
|
||||
import com.chaozhanggui.system.cashierservice.service.OrderService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
@@ -18,6 +16,8 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
@Slf4j
|
||||
@@ -42,9 +42,34 @@ 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.getIsPack(), cartVo.getUuid(), cartVo.getType(), cartVo.getTableId(), cartVo.getIsPrint(), cartVo.getGroupProductIdList());
|
||||
}
|
||||
|
||||
@PutMapping("/print")
|
||||
public Result print(@RequestBody CartPrintDTO printDTO) {
|
||||
return orderService.updatePrint(printDTO);
|
||||
}
|
||||
|
||||
@PostMapping("/temporaryDishes")
|
||||
public Result addTemporaryDishes(@Valid @RequestBody AddTemporaryDishesDTO temporaryDishesDTO) {
|
||||
return Result.success(CodeEnum.SUCCESS, orderService.addTemporaryDishes(temporaryDishesDTO));
|
||||
}
|
||||
/**
|
||||
* 美团核销
|
||||
*/
|
||||
@PostMapping("checkCoupon")
|
||||
public Result checkCoupon(@Validated @RequestBody ThirdCouponCheckDTO checkDTO) {
|
||||
return Result.success(CodeEnum.SUCCESS, orderService.checkCoupon(checkDTO));
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/updatePrice")
|
||||
public Result updatePrice(@Valid @RequestBody UpdatePriceDTO updatePriceDTO) {
|
||||
return Result.success(CodeEnum.SUCCESS, orderService.updatePrice(updatePriceDTO));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/queryCart")
|
||||
public Result queryCart(@RequestHeader("token") String token,
|
||||
@RequestHeader("loginName") String loginName,
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.chaozhanggui.system.cashierservice.entity.TbOrderDetail;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbOrderInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ReturnGroupOrderDto;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ReturnOrderDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.VipPayDTO;
|
||||
import com.chaozhanggui.system.cashierservice.model.PaymentReq;
|
||||
import com.chaozhanggui.system.cashierservice.service.PayService;
|
||||
@@ -34,10 +35,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
@@ -196,6 +194,7 @@ public class PayController {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 会员支付
|
||||
*
|
||||
@@ -246,7 +245,20 @@ public class PayController {
|
||||
@RequestBody List<TbOrderDetail> list,
|
||||
@RequestParam("pwd") String pwd,
|
||||
@RequestParam(defaultValue = "true") boolean isOnline) {
|
||||
return payService.returnOrder(list, token, pwd, isOnline);
|
||||
ReturnOrderDTO returnOrderDTO = new ReturnOrderDTO();
|
||||
returnOrderDTO.setOrderId(list.get(0).getOrderId());
|
||||
returnOrderDTO.setNote(list.get(0).getRemark());
|
||||
returnOrderDTO.setPwd(pwd);
|
||||
ArrayList<ReturnOrderDTO.OrderDetail> orderDetails = new ArrayList<>();
|
||||
list.forEach(item -> {
|
||||
ReturnOrderDTO.OrderDetail orderDetail = new ReturnOrderDTO.OrderDetail();
|
||||
orderDetail.setId(item.getId());
|
||||
orderDetail.setNum(item.getNum());
|
||||
orderDetails.add(orderDetail);
|
||||
});
|
||||
returnOrderDTO.setOrderDetails(orderDetails);
|
||||
returnOrderDTO.setIsOnline(isOnline);
|
||||
return Result.success(CodeEnum.SUCCESS, payService.returnOrder(returnOrderDTO));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.service.TbShopUnitService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/unit")
|
||||
public class ShopUnitController {
|
||||
private final TbShopUnitService shopUnitService;
|
||||
|
||||
public ShopUnitController(TbShopUnitService shopUnitService) {
|
||||
this.shopUnitService = shopUnitService;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public Result getShopUnit(@RequestParam Integer shopId, @RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "20") Integer size, @RequestParam(required = false) String name) {
|
||||
return Result.success(CodeEnum.SUCCESS, shopUnitService.getShopUnit(shopId, page, size, name));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.thirdcoupon.CheckCouponDTO;
|
||||
import com.chaozhanggui.system.cashierservice.service.ThirdPartyCouponService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 三方团购券
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/thirdPartyCoupon")
|
||||
public class ThirdPartyCouponController {
|
||||
|
||||
private final ThirdPartyCouponService thirdPartyCouponService;
|
||||
|
||||
public ThirdPartyCouponController(ThirdPartyCouponService thirdPartyCouponService) {
|
||||
this.thirdPartyCouponService = thirdPartyCouponService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取绑定状态
|
||||
* @return 绑定状态
|
||||
*/
|
||||
@GetMapping("/state")
|
||||
public Result getState(@RequestParam Integer shopId) {
|
||||
return Result.success(CodeEnum.SUCCESS, thirdPartyCouponService.getState(shopId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取美团绑定链接
|
||||
* @return 美团绑定链接
|
||||
*/
|
||||
@GetMapping("bindUrl")
|
||||
public Result getBindUrl(@RequestParam Integer shopId) {
|
||||
return Result.success(CodeEnum.SUCCESS, thirdPartyCouponService.getBindUrl(shopId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 解绑美团商家
|
||||
* @return 美团解绑链接
|
||||
*/
|
||||
@GetMapping("unBindUrl")
|
||||
public Result getUnBindUrl(@RequestParam Integer shopId) {
|
||||
return Result.success(CodeEnum.SUCCESS, thirdPartyCouponService.getUnBindUrl(shopId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取门店客核销券
|
||||
* @return 所有券
|
||||
*/
|
||||
@GetMapping("list")
|
||||
public Result getActivateCoupon(@RequestParam Integer shopId, @RequestParam String code) {
|
||||
return Result.success(CodeEnum.SUCCESS, thirdPartyCouponService.getActivateCoupon(shopId, code));
|
||||
}
|
||||
|
||||
/**
|
||||
* 核销券
|
||||
*/
|
||||
@PostMapping
|
||||
public Result checkCoupon(@RequestBody CheckCouponDTO checkCouponDTO) {
|
||||
return Result.success(CodeEnum.SUCCESS, thirdPartyCouponService.checkCoupon(checkCouponDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤销券核销
|
||||
*/
|
||||
@DeleteMapping("revoke")
|
||||
public Result revokeCoupon(@RequestBody CheckCouponDTO checkCouponDTO) {
|
||||
return Result.success(CodeEnum.SUCCESS, thirdPartyCouponService.revokeCoupon(checkCouponDTO));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbActivateInRecord;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
@@ -64,5 +65,10 @@ public interface TbActivateInRecordMapper {
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
|
||||
@Update("update tb_activate_in_record" +
|
||||
" set over_num = #{overNum}" +
|
||||
" where id = #{id}")
|
||||
int updateOverNum(@Param("id") Integer id, @Param("overNum") Integer overNum);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbActivateOutRecord;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
@@ -64,5 +65,10 @@ public interface TbActivateOutRecordMapper {
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
|
||||
@Update("update tb_activate_out_record" +
|
||||
" set ref_num = ref_num + #{refNum}" +
|
||||
" where id = #{id}")
|
||||
int updateRefNum(@Param("id") Integer id, @Param("refNum") Integer refNum);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,58 +1,40 @@
|
||||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbProduct;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProConsSkuInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
public interface TbProductMapper {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(TbProductWithBLOBs record);
|
||||
|
||||
int insertSelective(TbProductWithBLOBs record);
|
||||
|
||||
TbProductWithBLOBs selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByPrimaryKeySelective(TbProductWithBLOBs record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(TbProductWithBLOBs record);
|
||||
|
||||
int updateByPrimaryKey(TbProduct record);
|
||||
|
||||
|
||||
List<TbProductWithBLOBs> selectByShopId(@Param("shopId") String shopId,@Param("commdityName") String commdityName);
|
||||
List<TbProductWithBLOBs> selectByShopIdAndCheckGrounding(@Param("shopId") String shopId,@Param("commdityName") String commdityName);
|
||||
|
||||
|
||||
|
||||
List<TbProductWithBLOBs> selectByShopIdAndShopType(@Param("shopId") String shopId, @Param("categoryId") String categoryId,@Param("commdityName") String commdityName);
|
||||
List<TbProductWithBLOBs> selectByShopIdAndShopTypeCheckGrounding(@Param("shopId") String shopId, @Param("categoryId") String categoryId,@Param("commdityName") String commdityName);
|
||||
List<TbProductWithBLOBs> selectByShopIdAndShopTypeUnGrounding(@Param("shopId") String shopId,@Param("commdityName") String commdityName);
|
||||
TbProduct selectByPrimaryKey(Integer id);
|
||||
|
||||
List<TbProduct> selectByShopId(@Param("shopId") String shopId,@Param("commdityName") String commdityName);
|
||||
List<TbProduct> selectByShopIdAndCheckGrounding(@Param("shopId") String shopId,@Param("commdityName") String commdityName);
|
||||
|
||||
List<TbProduct> selectByShopIdAndShopType(@Param("shopId") String shopId, @Param("categoryId") String categoryId,@Param("commdityName") String commdityName);
|
||||
List<TbProduct> selectByShopIdAndShopTypeCheckGrounding(@Param("shopId") String shopId, @Param("categoryId") String categoryId,@Param("commdityName") String commdityName);
|
||||
List<TbProduct> selectByShopIdAndShopTypeUnGrounding(@Param("shopId") String shopId,@Param("commdityName") String commdityName);
|
||||
|
||||
Integer countOrderByshopIdAndProductId(@Param("shopId") String shopId, @Param("productId") String productId, @Param("masterId") String masterId,@Param("day") String day, @Param("tableId") String tableId);
|
||||
|
||||
@Update("update tb_product set stock_number = stock_number - #{num,jdbcType=INTEGER} where id = #{productId}")
|
||||
void updateStockById(@Param("productId")Integer productId, @Param("num")Integer num);
|
||||
|
||||
|
||||
List<ProConsSkuInfo> selectBySkuId(Integer skuId);
|
||||
|
||||
@Update("update tb_product set stock_number=stock_number+#{num} WHERE id=#{id}")
|
||||
int incrStock(String id, int num);
|
||||
int incrStock(String id, BigDecimal num);
|
||||
|
||||
@Update("update tb_product set stock_number=stock_number-#{num} WHERE id=#{id} and stock_number-#{num} >= 0")
|
||||
int decrStock(String id, int num);
|
||||
int decrStock(String id, BigDecimal num);
|
||||
|
||||
@Update("update tb_product set stock_number=stock_number-#{num} WHERE id=#{id}")
|
||||
int decrStockUnCheck(String id, int num);
|
||||
int decrStockUnCheck(String id, BigDecimal num);
|
||||
|
||||
@Select("select * from tb_product product where product.id=#{productId} and product.shop_id=#{shopId} and product.is_del=0")
|
||||
TbProduct selectByShopIdAndId(@Param("productId") Integer productId, @Param("shopId") Integer shopId);
|
||||
|
||||
@@ -19,8 +19,6 @@ public class OrderVo {
|
||||
private Integer type;
|
||||
|
||||
private String sendType;
|
||||
|
||||
private String eatModel;
|
||||
@Min(1)
|
||||
private Integer seatNum;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
@Data
|
||||
public class TbCashierCart implements Serializable {
|
||||
@@ -12,9 +16,9 @@ public class TbCashierCart implements Serializable {
|
||||
|
||||
private String masterId;
|
||||
|
||||
private String orderId;
|
||||
private Integer orderId;
|
||||
|
||||
private String refOrderId;
|
||||
private Integer refOrderId;
|
||||
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
@@ -29,64 +33,147 @@ public class TbCashierCart implements Serializable {
|
||||
private String name;
|
||||
|
||||
private BigDecimal salePrice;
|
||||
private BigDecimal packFee;
|
||||
|
||||
private Integer number;
|
||||
private BigDecimal number;
|
||||
|
||||
private Integer totalNumber;
|
||||
private BigDecimal totalNumber;
|
||||
|
||||
private Integer refundNumber;
|
||||
private BigDecimal refundNumber;
|
||||
|
||||
private String categoryId;
|
||||
private String tradeDay;
|
||||
|
||||
private String status;
|
||||
|
||||
private Byte type;
|
||||
private Integer type;
|
||||
|
||||
private String merchantId;
|
||||
|
||||
private String shopId;
|
||||
private String isPack;
|
||||
private String isGift;
|
||||
private String skuName;
|
||||
private String uuid;
|
||||
|
||||
private Long createdAt;
|
||||
private Long pendingAt;
|
||||
|
||||
private Long updatedAt;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private String tableId;
|
||||
private String useType;
|
||||
|
||||
private BigDecimal packFee;
|
||||
|
||||
private String tradeDay;
|
||||
|
||||
private String isPack;
|
||||
|
||||
private String isGift;
|
||||
|
||||
private Long pendingAt;
|
||||
|
||||
private String uuid;
|
||||
private String skuName;
|
||||
private Integer placeNum;
|
||||
private String note;
|
||||
private String useType;
|
||||
private String platformType;
|
||||
private BigDecimal memberPrice;
|
||||
// 优惠券id
|
||||
private Integer userCouponId;
|
||||
private BigDecimal memberPrice = BigDecimal.ZERO;
|
||||
private Integer isMember;
|
||||
// 是否临时菜品
|
||||
private Integer isTemporary;
|
||||
private String unit;
|
||||
private BigDecimal discountSaleAmount;
|
||||
private String discountSaleNote;
|
||||
private Integer isPrint;
|
||||
private String useCouponInfo;
|
||||
private int isThirdCoupon;
|
||||
private String proGroupInfo;
|
||||
private String typeEnum;
|
||||
private Integer groupType;
|
||||
|
||||
@TableField(exist = false)
|
||||
private TbProductSpec tbProductSpec;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String selectSpec="";
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
public void copy(TbCashierCart source) {
|
||||
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据是否会员充值价格
|
||||
*/
|
||||
public void resetTotalAmount() {
|
||||
if (isThirdCoupon == 1) {
|
||||
totalAmount = BigDecimal.ZERO;
|
||||
return;
|
||||
}
|
||||
if ("false".equals(isPack)) {
|
||||
packFee = BigDecimal.ZERO;
|
||||
}
|
||||
if ("true".equals(isGift)) {
|
||||
totalAmount = packFee;
|
||||
} else {
|
||||
discountSaleAmount = discountSaleAmount == null ? BigDecimal.ZERO : discountSaleAmount;
|
||||
BigDecimal subtract;
|
||||
if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) {
|
||||
totalAmount = BigDecimal.valueOf(totalNumber).multiply(memberPrice).add(packFee);
|
||||
subtract = memberPrice.subtract(discountSaleAmount);
|
||||
} else {
|
||||
totalAmount = BigDecimal.valueOf(totalNumber).multiply(salePrice).add(packFee);
|
||||
subtract = salePrice.subtract(discountSaleAmount);
|
||||
}
|
||||
totalAmount = totalNumber.multiply(subtract.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : subtract).add(packFee).setScale(2, RoundingMode.DOWN);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据是否会员充值价格
|
||||
*/
|
||||
public void resetTotalAmount(BigDecimal discountRadio) {
|
||||
if (isThirdCoupon == 1) {
|
||||
totalAmount = BigDecimal.ZERO;
|
||||
return;
|
||||
}
|
||||
if (discountRadio == null) {
|
||||
discountRadio = BigDecimal.ONE;
|
||||
}
|
||||
if ("false".equals(isPack)) {
|
||||
packFee = BigDecimal.ZERO;
|
||||
}
|
||||
if ("true".equals(isGift)) {
|
||||
totalAmount = packFee;
|
||||
} else {
|
||||
discountSaleAmount = discountSaleAmount == null ? BigDecimal.ZERO : discountSaleAmount;
|
||||
BigDecimal subtract;
|
||||
if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) {
|
||||
subtract = memberPrice.subtract(discountSaleAmount);
|
||||
totalAmount = totalNumber.multiply(subtract).add(packFee).multiply(discountRadio).setScale(2, RoundingMode.DOWN);
|
||||
} else {
|
||||
subtract = salePrice.subtract(discountSaleAmount);
|
||||
totalAmount = totalNumber.multiply(subtract)
|
||||
.add(packFee).multiply(discountRadio).setScale(2, RoundingMode.DOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取总价不包含打包费
|
||||
*
|
||||
*/
|
||||
public BigDecimal getTotalAmountByNum(BigDecimal num, BigDecimal discountRadio) {
|
||||
if (isThirdCoupon == 1) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
if (discountRadio == null) {
|
||||
discountRadio = new BigDecimal("1");
|
||||
}
|
||||
if (num == null) {
|
||||
num = totalNumber;
|
||||
}
|
||||
|
||||
if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) {
|
||||
return num.multiply(memberPrice).multiply(discountRadio).add(packFee).setScale(2, RoundingMode.DOWN);
|
||||
}else {
|
||||
return num.multiply(discountSaleAmount != null ? discountSaleAmount : salePrice).add(packFee).multiply(discountRadio).setScale(2, RoundingMode.DOWN);
|
||||
}
|
||||
// if (isMember != null && isMember == 1 && memberPrice != null && memberPrice.compareTo(BigDecimal.ZERO) > 0) {
|
||||
// return num.multiply(memberPrice);
|
||||
// } else {
|
||||
// return num.multiply(discountSaleAmount != null ? discountSaleAmount : salePrice);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 会员积分
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-10-25
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@TableName("tb_shop_user")
|
||||
public class TbMemberPoints {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
/**
|
||||
* 会员id
|
||||
*/
|
||||
@TableField(value = "id", insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
|
||||
private Long memberId;
|
||||
/**
|
||||
* 会员名称
|
||||
*/
|
||||
@TableField("name")
|
||||
private String memberName;
|
||||
/**
|
||||
* 会员头像
|
||||
*/
|
||||
@TableField("head_img")
|
||||
private String avatarUrl;
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
@TableField("telephone")
|
||||
private String mobile;
|
||||
/**
|
||||
* 账户积分
|
||||
*/
|
||||
@TableField("account_points")
|
||||
private Integer accountPoints;
|
||||
/**
|
||||
* 最近一次积分变动时间
|
||||
*/
|
||||
@TableField("last_points_change_time")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date lastPointsChangeTime;
|
||||
/**
|
||||
* 最近一次浮动积分
|
||||
*/
|
||||
@TableField("last_float_points")
|
||||
private Integer lastFloatPoints;
|
||||
/**
|
||||
* 是否会员 1-是 0-否
|
||||
*/
|
||||
@TableField("is_vip")
|
||||
private Integer vip;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 会员积分变动记录
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-10-25
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@TableName("tb_member_points_log")
|
||||
public class TbMemberPointsLog {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
/**
|
||||
* 会员id
|
||||
*/
|
||||
private Long memberId;
|
||||
/**
|
||||
* 会员名称
|
||||
*/
|
||||
private String memberName;
|
||||
/**
|
||||
* 会员头像
|
||||
*/
|
||||
private String avatarUrl;
|
||||
/**
|
||||
* 摘要信息(如:兑换某个商品/消费多少钱/充值多少钱/新会员赠送积分等)
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
private String mobile;
|
||||
/**
|
||||
* 浮动类型 add-累加 subtract-扣减
|
||||
*/
|
||||
private String floatType;
|
||||
/**
|
||||
* 浮动积分(非0正负数)
|
||||
*/
|
||||
private Integer floatPoints;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -19,8 +19,8 @@ public class TbOrderDetail implements Serializable {
|
||||
|
||||
private Integer productSkuId;
|
||||
|
||||
private Integer num;
|
||||
private Integer returnNum;
|
||||
private BigDecimal num;
|
||||
private BigDecimal returnNum;
|
||||
|
||||
private String productName;
|
||||
private String status;
|
||||
@@ -50,4 +50,18 @@ public class TbOrderDetail implements Serializable {
|
||||
private BigDecimal memberPrice;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Integer isMember;
|
||||
private Integer isTemporary;
|
||||
private Integer isThirdCoupon;
|
||||
private Integer isWaitCall;
|
||||
private Integer userCouponId;
|
||||
private String useCouponInfo;
|
||||
private BigDecimal canReturnAmount;
|
||||
private BigDecimal returnAmount;
|
||||
private Integer isPrint;
|
||||
|
||||
private BigDecimal discountSaleAmount;
|
||||
private String discountSaleNote;
|
||||
private String proGroupInfo;
|
||||
|
||||
}
|
||||
|
||||
@@ -117,6 +117,11 @@ public class TbOrderInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private int isPostpaid;
|
||||
private String couponInfoList;
|
||||
private BigDecimal fullCouponDiscountAmount;
|
||||
private BigDecimal pointsDiscountAmount;
|
||||
private String refundRemark;
|
||||
private Integer pointsNum;
|
||||
|
||||
public TbOrderInfo(){
|
||||
super();
|
||||
@@ -181,4 +186,6 @@ public class TbOrderInfo implements Serializable {
|
||||
this.payType=payType;
|
||||
this.tableName=tableName;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.ProductGroupVo;
|
||||
import lombok.Data;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TbProduct implements Serializable {
|
||||
@@ -15,12 +17,6 @@ public class TbProduct implements Serializable {
|
||||
|
||||
private Integer specId;
|
||||
|
||||
private String sourcePath;
|
||||
|
||||
private Integer brandId;
|
||||
|
||||
private String merchantId;
|
||||
|
||||
private String shopId;
|
||||
|
||||
private String name;
|
||||
@@ -33,103 +29,34 @@ public class TbProduct implements Serializable {
|
||||
|
||||
private BigDecimal lowPrice;
|
||||
|
||||
private BigDecimal lowMemberPrice;
|
||||
|
||||
private String unitId;
|
||||
|
||||
private String unitSnap;
|
||||
|
||||
private String coverImg;
|
||||
|
||||
private String shareImg;
|
||||
|
||||
private String videoCoverImg;
|
||||
|
||||
private Integer sort;
|
||||
|
||||
private Integer limitNumber;
|
||||
|
||||
private Integer productScore;
|
||||
|
||||
private Byte status;
|
||||
|
||||
private String failMsg;
|
||||
|
||||
private Byte isRecommend;
|
||||
|
||||
private Byte isHot;
|
||||
|
||||
private Byte isNew;
|
||||
|
||||
private Byte isOnSale;
|
||||
|
||||
private Byte isShow;
|
||||
|
||||
private String typeEnum;
|
||||
|
||||
/**
|
||||
* 是否共享库存
|
||||
*/
|
||||
private Byte isDistribute;
|
||||
|
||||
private Byte isDel;
|
||||
|
||||
private Byte isStock;
|
||||
|
||||
private Byte isPauseSale;
|
||||
|
||||
private Byte isFreeFreight;
|
||||
|
||||
private Long freightId;
|
||||
|
||||
private String strategyType;
|
||||
|
||||
private Integer strategyId;
|
||||
|
||||
private Byte isVip;
|
||||
|
||||
private Byte isDelete;
|
||||
|
||||
private Long createdAt;
|
||||
|
||||
private Long updatedAt;
|
||||
|
||||
private Double baseSalesNumber;
|
||||
|
||||
private Integer realSalesNumber;
|
||||
|
||||
private Integer salesNumber;
|
||||
|
||||
private Integer thumbCount;
|
||||
|
||||
private Integer storeCount;
|
||||
|
||||
private Integer furnishMeal;
|
||||
|
||||
private Integer furnishExpress;
|
||||
|
||||
private Integer furnishDraw;
|
||||
|
||||
private Integer furnishVir;
|
||||
|
||||
private Byte isCombo;
|
||||
|
||||
private Byte isShowCash;
|
||||
|
||||
private Byte isShowMall;
|
||||
|
||||
private Byte isNeedExamine;
|
||||
|
||||
private Byte showOnMallStatus;
|
||||
|
||||
private Long showOnMallTime;
|
||||
|
||||
private String showOnMallErrorMsg;
|
||||
|
||||
private Byte enableLabel;
|
||||
|
||||
private String taxConfigId;
|
||||
|
||||
private String specTableHeaders;
|
||||
|
||||
private Integer stockNumber;
|
||||
@@ -151,5 +78,21 @@ public class TbProduct implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String images;
|
||||
private String groupSnap;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<TbProductSku> skuList;
|
||||
@TableField(exist = false)
|
||||
private Object groundingSpecInfo;
|
||||
private String specInfo;
|
||||
private String selectSpec;
|
||||
private Integer groupType;
|
||||
@TableField(exist = false)
|
||||
private String unitName;
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private List<ProductGroupVo> proGroupVo;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public class TbProductStockDetail implements Serializable {
|
||||
|
||||
private String productName;
|
||||
|
||||
private Byte isStock;
|
||||
private Integer isStock;
|
||||
|
||||
private String specSnap;
|
||||
|
||||
@@ -90,11 +90,11 @@ public class TbProductStockDetail implements Serializable {
|
||||
this.productName = productName == null ? null : productName.trim();
|
||||
}
|
||||
|
||||
public Byte getIsStock() {
|
||||
public Integer getIsStock() {
|
||||
return isStock;
|
||||
}
|
||||
|
||||
public void setIsStock(Byte isStock) {
|
||||
public void setIsStock(Integer isStock) {
|
||||
this.isStock = isStock;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
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;
|
||||
|
||||
private String notice;
|
||||
|
||||
private String groupSnap;
|
||||
|
||||
private String specInfo;
|
||||
|
||||
private String selectSpec;
|
||||
|
||||
private List<?> skuList;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public void setGroundingSpecInfo(Object groundingSpecInfo) {
|
||||
this.groundingSpecInfo = groundingSpecInfo;
|
||||
}
|
||||
|
||||
public void setSkuList(List<?> skuList) {
|
||||
this.skuList = skuList;
|
||||
}
|
||||
|
||||
public void setImages(String images) {
|
||||
this.images = images == null ? null : images.trim();
|
||||
}
|
||||
|
||||
public void setVideo(String video) {
|
||||
this.video = video == null ? null : video.trim();
|
||||
}
|
||||
|
||||
public void setNotice(String notice) {
|
||||
this.notice = notice == null ? null : notice.trim();
|
||||
}
|
||||
|
||||
public void setGroupSnap(String groupSnap) {
|
||||
this.groupSnap = groupSnap == null ? null : groupSnap.trim();
|
||||
}
|
||||
|
||||
public void setSpecInfo(String specInfo) {
|
||||
this.specInfo = specInfo == null ? null : specInfo.trim();
|
||||
}
|
||||
|
||||
public void setSelectSpec(String selectSpec) {
|
||||
this.selectSpec = selectSpec == null ? null : selectSpec.trim();
|
||||
}
|
||||
}
|
||||
@@ -1,107 +1,270 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 商品单位
|
||||
* @TableName tb_shop_unit
|
||||
*/
|
||||
@TableName(value ="tb_shop_unit")
|
||||
public class TbShopUnit implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 小数位(个数大于0,表示小数据精度位数)
|
||||
*/
|
||||
private Integer decimalsDigits;
|
||||
|
||||
/**
|
||||
* 单位类型(weight代表重量,小数单位,为number代表个数)
|
||||
*/
|
||||
private String unitType;
|
||||
|
||||
private Byte isSystem;
|
||||
/**
|
||||
* 0后台添加 -1系统默认 (公斤、瓶)
|
||||
*/
|
||||
private Integer isSystem;
|
||||
|
||||
private Byte status;
|
||||
/**
|
||||
* 预留字段1-正常
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String merchantId;
|
||||
|
||||
/**
|
||||
* 店铺Id
|
||||
*/
|
||||
private String shopId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long createdAt;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long updatedAt;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name == null ? null : name.trim();
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 小数位(个数大于0,表示小数据精度位数)
|
||||
*/
|
||||
public Integer getDecimalsDigits() {
|
||||
return decimalsDigits;
|
||||
}
|
||||
|
||||
/**
|
||||
* 小数位(个数大于0,表示小数据精度位数)
|
||||
*/
|
||||
public void setDecimalsDigits(Integer decimalsDigits) {
|
||||
this.decimalsDigits = decimalsDigits;
|
||||
}
|
||||
|
||||
/**
|
||||
* 单位类型(weight代表重量,小数单位,为number代表个数)
|
||||
*/
|
||||
public String getUnitType() {
|
||||
return unitType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 单位类型(weight代表重量,小数单位,为number代表个数)
|
||||
*/
|
||||
public void setUnitType(String unitType) {
|
||||
this.unitType = unitType == null ? null : unitType.trim();
|
||||
this.unitType = unitType;
|
||||
}
|
||||
|
||||
public Byte getIsSystem() {
|
||||
/**
|
||||
* 0后台添加 -1系统默认 (公斤、瓶)
|
||||
*/
|
||||
public Integer getIsSystem() {
|
||||
return isSystem;
|
||||
}
|
||||
|
||||
public void setIsSystem(Byte isSystem) {
|
||||
/**
|
||||
* 0后台添加 -1系统默认 (公斤、瓶)
|
||||
*/
|
||||
public void setIsSystem(Integer isSystem) {
|
||||
this.isSystem = isSystem;
|
||||
}
|
||||
|
||||
public Byte getStatus() {
|
||||
/**
|
||||
* 预留字段1-正常
|
||||
*/
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Byte status) {
|
||||
/**
|
||||
* 预留字段1-正常
|
||||
*/
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String getMerchantId() {
|
||||
return merchantId;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setMerchantId(String merchantId) {
|
||||
this.merchantId = merchantId == null ? null : merchantId.trim();
|
||||
this.merchantId = merchantId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺Id
|
||||
*/
|
||||
public String getShopId() {
|
||||
return shopId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺Id
|
||||
*/
|
||||
public void setShopId(String shopId) {
|
||||
this.shopId = shopId == null ? null : shopId.trim();
|
||||
this.shopId = shopId;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Long getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setCreatedAt(Long createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Long getUpdatedAt() {
|
||||
return updatedAt;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setUpdatedAt(Long updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
TbShopUnit other = (TbShopUnit) that;
|
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
|
||||
&& (this.getDecimalsDigits() == null ? other.getDecimalsDigits() == null : this.getDecimalsDigits().equals(other.getDecimalsDigits()))
|
||||
&& (this.getUnitType() == null ? other.getUnitType() == null : this.getUnitType().equals(other.getUnitType()))
|
||||
&& (this.getIsSystem() == null ? other.getIsSystem() == null : this.getIsSystem().equals(other.getIsSystem()))
|
||||
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
|
||||
&& (this.getMerchantId() == null ? other.getMerchantId() == null : this.getMerchantId().equals(other.getMerchantId()))
|
||||
&& (this.getShopId() == null ? other.getShopId() == null : this.getShopId().equals(other.getShopId()))
|
||||
&& (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()))
|
||||
&& (this.getUpdatedAt() == null ? other.getUpdatedAt() == null : this.getUpdatedAt().equals(other.getUpdatedAt()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
||||
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
|
||||
result = prime * result + ((getDecimalsDigits() == null) ? 0 : getDecimalsDigits().hashCode());
|
||||
result = prime * result + ((getUnitType() == null) ? 0 : getUnitType().hashCode());
|
||||
result = prime * result + ((getIsSystem() == null) ? 0 : getIsSystem().hashCode());
|
||||
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
|
||||
result = prime * result + ((getMerchantId() == null) ? 0 : getMerchantId().hashCode());
|
||||
result = prime * result + ((getShopId() == null) ? 0 : getShopId().hashCode());
|
||||
result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
|
||||
result = prime * result + ((getUpdatedAt() == null) ? 0 : getUpdatedAt().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", id=").append(id);
|
||||
sb.append(", name=").append(name);
|
||||
sb.append(", decimalsDigits=").append(decimalsDigits);
|
||||
sb.append(", unitType=").append(unitType);
|
||||
sb.append(", isSystem=").append(isSystem);
|
||||
sb.append(", status=").append(status);
|
||||
sb.append(", merchantId=").append(merchantId);
|
||||
sb.append(", shopId=").append(shopId);
|
||||
sb.append(", createdAt=").append(createdAt);
|
||||
sb.append(", updatedAt=").append(updatedAt);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,271 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
* @TableName tb_third_party_coupon_record
|
||||
*/
|
||||
@TableName(value ="tb_third_party_coupon_record")
|
||||
public class TbThirdPartyCouponRecord implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 订单id
|
||||
*/
|
||||
private Integer orderId;
|
||||
|
||||
/**
|
||||
* 核销状态 1 成功
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
/**
|
||||
* 平台 meituan
|
||||
*/
|
||||
private String plat;
|
||||
|
||||
/**
|
||||
* 券码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 核销时间
|
||||
*/
|
||||
private Date checkTime;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Integer shopId;
|
||||
|
||||
/**
|
||||
* 使用数量
|
||||
*/
|
||||
private Integer num;
|
||||
|
||||
/**
|
||||
* 抵扣的购物车id
|
||||
*/
|
||||
private String cartIdList;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单id
|
||||
*/
|
||||
public Integer getOrderId() {
|
||||
return orderId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单id
|
||||
*/
|
||||
public void setOrderId(Integer orderId) {
|
||||
this.orderId = orderId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 核销状态 1 成功
|
||||
*/
|
||||
public Integer getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* 核销状态 1 成功
|
||||
*/
|
||||
public void setState(Integer state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
/**
|
||||
* 平台 meituan
|
||||
*/
|
||||
public String getPlat() {
|
||||
return plat;
|
||||
}
|
||||
|
||||
/**
|
||||
* 平台 meituan
|
||||
*/
|
||||
public void setPlat(String plat) {
|
||||
this.plat = plat;
|
||||
}
|
||||
|
||||
/**
|
||||
* 券码
|
||||
*/
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 券码
|
||||
*/
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 核销时间
|
||||
*/
|
||||
public Date getCheckTime() {
|
||||
return checkTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 核销时间
|
||||
*/
|
||||
public void setCheckTime(Date checkTime) {
|
||||
this.checkTime = checkTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
public Integer getShopId() {
|
||||
return shopId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
public void setShopId(Integer shopId) {
|
||||
this.shopId = shopId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用数量
|
||||
*/
|
||||
public Integer getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用数量
|
||||
*/
|
||||
public void setNum(Integer num) {
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
/**
|
||||
* 抵扣的购物车id
|
||||
*/
|
||||
public String getCartIdList() {
|
||||
return cartIdList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 抵扣的购物车id
|
||||
*/
|
||||
public void setCartIdList(String cartIdList) {
|
||||
this.cartIdList = cartIdList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
TbThirdPartyCouponRecord other = (TbThirdPartyCouponRecord) that;
|
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||
&& (this.getOrderId() == null ? other.getOrderId() == null : this.getOrderId().equals(other.getOrderId()))
|
||||
&& (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()))
|
||||
&& (this.getPlat() == null ? other.getPlat() == null : this.getPlat().equals(other.getPlat()))
|
||||
&& (this.getCode() == null ? other.getCode() == null : this.getCode().equals(other.getCode()))
|
||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
|
||||
&& (this.getCheckTime() == null ? other.getCheckTime() == null : this.getCheckTime().equals(other.getCheckTime()))
|
||||
&& (this.getShopId() == null ? other.getShopId() == null : this.getShopId().equals(other.getShopId()))
|
||||
&& (this.getNum() == null ? other.getNum() == null : this.getNum().equals(other.getNum()))
|
||||
&& (this.getCartIdList() == null ? other.getCartIdList() == null : this.getCartIdList().equals(other.getCartIdList()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
||||
result = prime * result + ((getOrderId() == null) ? 0 : getOrderId().hashCode());
|
||||
result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
|
||||
result = prime * result + ((getPlat() == null) ? 0 : getPlat().hashCode());
|
||||
result = prime * result + ((getCode() == null) ? 0 : getCode().hashCode());
|
||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
|
||||
result = prime * result + ((getCheckTime() == null) ? 0 : getCheckTime().hashCode());
|
||||
result = prime * result + ((getShopId() == null) ? 0 : getShopId().hashCode());
|
||||
result = prime * result + ((getNum() == null) ? 0 : getNum().hashCode());
|
||||
result = prime * result + ((getCartIdList() == null) ? 0 : getCartIdList().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", id=").append(id);
|
||||
sb.append(", orderId=").append(orderId);
|
||||
sb.append(", state=").append(state);
|
||||
sb.append(", plat=").append(plat);
|
||||
sb.append(", code=").append(code);
|
||||
sb.append(", createTime=").append(createTime);
|
||||
sb.append(", checkTime=").append(checkTime);
|
||||
sb.append(", shopId=").append(shopId);
|
||||
sb.append(", num=").append(num);
|
||||
sb.append(", cartIdList=").append(cartIdList);
|
||||
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class AddTemporaryDishesDTO {
|
||||
@NotEmpty
|
||||
private String masterId;
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
private String tableId;
|
||||
@NotBlank(message = "菜品名不为空")
|
||||
private String name;
|
||||
@NotNull(message = "分类不为空")
|
||||
private Integer categoryId;
|
||||
@Min(value = 0, message = "价格最低为0")
|
||||
private BigDecimal price;
|
||||
@NotNull
|
||||
@DecimalMin(value = "0.01")
|
||||
private BigDecimal num;
|
||||
@NotBlank(message = "单位不为空")
|
||||
private String unit;
|
||||
private String note;
|
||||
private Integer vipUserId;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class CartPrintDTO {
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
@NotNull
|
||||
private Integer cartId;
|
||||
private Integer isPrint;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbActivateOutRecord;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class OrderInfoCouponInfoDTO {
|
||||
private List<TbActivateOutRecord> outRecordList;
|
||||
private Collection<OrderInfoUserCouponVo> fullReductionCoupon;
|
||||
private Collection<OrderInfoUserCouponVo> productCoupon;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.TbUserCouponVo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class OrderInfoUserCouponVo extends TbUserCouponVo {
|
||||
private int returnNum = 0;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ReturnOrderDTO {
|
||||
|
||||
@Data
|
||||
public static class OrderDetail{
|
||||
@NotNull
|
||||
private Integer id;
|
||||
@NotNull
|
||||
@Min(1)
|
||||
private BigDecimal num;
|
||||
}
|
||||
@NotNull
|
||||
private Integer orderId;
|
||||
@NotEmpty
|
||||
private String note;
|
||||
// @NotEmpty
|
||||
private String pwd;
|
||||
@Valid
|
||||
private List<OrderDetail> orderDetails;
|
||||
private Boolean isOnline;
|
||||
}
|
||||
@@ -7,13 +7,24 @@ import lombok.Data;
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class ShopEatTypeInfoDTO {
|
||||
// 是否外带
|
||||
private boolean isTakeout;
|
||||
// 是否快餐
|
||||
private boolean isMunchies;
|
||||
// 是否后付费
|
||||
private boolean isDineInAfter;
|
||||
// 是否先付费
|
||||
private boolean isDineInBefore;
|
||||
// 是否需要餐位费
|
||||
private boolean needSeatFee;
|
||||
// 是否无桌台下单
|
||||
private boolean isNoneTable;
|
||||
// 是否增加masterId
|
||||
private boolean isIncrMaterId;
|
||||
private boolean isMemberPrice;
|
||||
private TbShopInfo shopInfo;
|
||||
private String useType;
|
||||
private Object shopId;
|
||||
private String tableId;
|
||||
private String sendType;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ThirdCouponCheckDTO {
|
||||
private String type = "meituan";
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
@NotBlank
|
||||
private String code;
|
||||
@Min(1)
|
||||
private Integer num;
|
||||
@NotNull
|
||||
private Integer orderId;
|
||||
// 核销的对应商品
|
||||
@NotEmpty
|
||||
private List<Integer> cartId;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.DecimalMin;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class UpdatePriceDTO {
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
@NotNull
|
||||
private Integer cartId;
|
||||
@DecimalMin("0.01")
|
||||
@NotNull
|
||||
private BigDecimal amount;
|
||||
// @NotBlank(message = "折扣原因不能为空")
|
||||
private String note;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class WaitCallDTO {
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
@NotNull
|
||||
private Integer isWaitCall;
|
||||
private Integer orderId;
|
||||
private String code;
|
||||
@NotBlank
|
||||
private String useType;
|
||||
private String tableId;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto.thirdcoupon;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class BaseQueryDTO {
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto.thirdcoupon;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class CheckCouponDTO extends BaseQueryDTO {
|
||||
@NotBlank
|
||||
private String couponCode;
|
||||
@NotNull
|
||||
@Min(1)
|
||||
private Integer num;
|
||||
@NotBlank
|
||||
private String title;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto.thirdcoupon;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class GetActivateCouponDTO extends BaseQueryDTO{
|
||||
@NotBlank
|
||||
private String code;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.dto.thirdcoupon;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class RevokeCouponDTO extends BaseQueryDTO{
|
||||
@NotBlank
|
||||
private String couponCode;
|
||||
}
|
||||
@@ -9,9 +9,12 @@ public class SkuInfoPo {
|
||||
|
||||
private String productName;
|
||||
private String productSkuName;
|
||||
private Integer num;
|
||||
private BigDecimal num;
|
||||
private BigDecimal priceAmount;
|
||||
private BigDecimal discountSaleAmount;
|
||||
private BigDecimal packAmount;
|
||||
private String categoryId;
|
||||
private BigDecimal price;
|
||||
private BigDecimal memberPrice;
|
||||
private String proGroupInfo;
|
||||
}
|
||||
|
||||
@@ -2,9 +2,12 @@ package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.DecimalMin;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CartVo {
|
||||
@@ -12,8 +15,9 @@ public class CartVo {
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
private Integer skuId;
|
||||
@Min(1)
|
||||
private Integer number;
|
||||
@NotNull
|
||||
@DecimalMin("0.01")
|
||||
private BigDecimal number;
|
||||
private String isPack;
|
||||
private String isGift;
|
||||
private String status;
|
||||
@@ -23,4 +27,8 @@ public class CartVo {
|
||||
private String masterId;
|
||||
private String tableId;
|
||||
private Integer orderId;
|
||||
private Integer isPrint;
|
||||
|
||||
// 套餐商品选择的id信息
|
||||
private List<Integer> groupProductIdList;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class ProductGroupVo {
|
||||
|
||||
private Integer count;
|
||||
//选几个
|
||||
private Integer number;
|
||||
//类别
|
||||
private String title;
|
||||
|
||||
//食物
|
||||
private List<Food> goods=new ArrayList<>();
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public static class Food {
|
||||
private Integer proId;
|
||||
private String proName;
|
||||
private Integer skuId;
|
||||
private String skuName;
|
||||
private BigDecimal price;
|
||||
private String number;
|
||||
private String unitName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class TbUserCouponVo {
|
||||
private Integer id;
|
||||
private BigDecimal fullAmount;
|
||||
private BigDecimal discountAmount;
|
||||
private Integer couponId;
|
||||
private Integer proId;
|
||||
// 商品名称
|
||||
private String productName;
|
||||
private String productCover;
|
||||
//优惠券名称
|
||||
private String name;
|
||||
|
||||
//优惠券类型 1 满减 2 商品券
|
||||
private Integer type;
|
||||
//数量
|
||||
private Integer num;
|
||||
//到期时间
|
||||
private Date endTime;
|
||||
private Long expireTime;
|
||||
private String useRestrictions;
|
||||
private boolean isUse = false;
|
||||
//当前使用数量
|
||||
private BigDecimal currentUseNum;
|
||||
private Integer finalUseNum;
|
||||
private BigDecimal finalDiscountAmount = new BigDecimal(0);
|
||||
|
||||
|
||||
public void setEndTime(Date endTime) {
|
||||
this.endTime = endTime;
|
||||
if(endTime!=null){
|
||||
expireTime=endTime.getTime();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.chaozhanggui.system.cashierservice.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbProductStockDetail;
|
||||
|
||||
public interface MpProductStockDetailMapper extends BaseMapper<TbProductStockDetail> {
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.chaozhanggui.system.cashierservice.mapper;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopUnit;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【tb_shop_unit(商品单位)】的数据库操作Mapper
|
||||
* @createDate 2024-11-26 09:36:19
|
||||
* @Entity com.chaozhanggui.system.cashierservice.entity.TbShopUnit
|
||||
*/
|
||||
@Mapper
|
||||
public interface MpShopUnitMapper extends BaseMapper<TbShopUnit> {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.chaozhanggui.system.cashierservice.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbMemberPointsLog;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 会员积分变动记录
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-10-25
|
||||
*/
|
||||
@Mapper
|
||||
public interface TbMemberPointsLogMapper extends BaseMapper<TbMemberPointsLog> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.chaozhanggui.system.cashierservice.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbMemberPoints;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 会员积分
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-10-25
|
||||
*/
|
||||
@Mapper
|
||||
public interface TbMemberPointsMapper extends BaseMapper<TbMemberPoints> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.chaozhanggui.system.cashierservice.mapper;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbThirdPartyCouponRecord;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【tb_third_party_coupon_record】的数据库操作Mapper
|
||||
* @createDate 2024-11-26 15:06:35
|
||||
* @Entity com.chaozhanggui.system.cashierservice.entity.TbThirdPartyCouponRecord
|
||||
*/
|
||||
public interface TbThirdPartyCouponRecordMapper extends BaseMapper<TbThirdPartyCouponRecord> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -49,12 +49,14 @@ public class OrderDetailPO implements Serializable {
|
||||
private String amount;
|
||||
|
||||
private String spec;
|
||||
private String proGroupInfo;
|
||||
|
||||
public Detail(String productName, String number, String amount, String spec) {
|
||||
public Detail(String productName, String number, String amount, String spec, String proGroupInfo) {
|
||||
this.productName = productName;
|
||||
this.number = number;
|
||||
this.amount = amount;
|
||||
this.spec = spec;
|
||||
this.proGroupInfo = proGroupInfo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,4 +10,7 @@ import java.math.BigDecimal;
|
||||
public interface MpShopUserMapper extends BaseMapper<TbShopUser> {
|
||||
@Update("update tb_shop_user set amount=amount-#{orderAmount}, consume_amount=consume_amount+#{orderAmount} where id=#{vipUserId} and amount-#{orderAmount} >= 0")
|
||||
long decrBalance(@Param("vipUserId") Integer vipUserId, @Param("orderAmount") BigDecimal orderAmount);
|
||||
|
||||
@Update("update tb_shop_user set amount=amount+#{returnAmount}, consume_amount=consume_amount-#{returnAmount}, updated_at=#{current} where id=#{userId}")
|
||||
void incrBalance(@Param("userId") Integer userId, @Param("shopId") Integer shopId, @Param("returnAmount") BigDecimal returnAmount, @Param("current") long current);
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public class ConsMsgConsumer {
|
||||
return;
|
||||
}
|
||||
|
||||
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(skuWithBLOBs.getProductId()));
|
||||
TbProduct product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(skuWithBLOBs.getProductId()));
|
||||
if (Objects.isNull(product)) {
|
||||
log.info("商品信息不存在");
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.chaozhanggui.system.cashierservice.rabbit;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -19,6 +20,7 @@ import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -167,21 +169,28 @@ public class PrintMechineConsumer {
|
||||
List<OrderDetailPO.Detail> detailList = new ArrayList<>();
|
||||
tbOrderDetails.parallelStream().forEach(it -> {
|
||||
String categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||
|
||||
String classifyPrint = tbPrintMachineWithBLOBs.getClassifyPrint();
|
||||
Long count = categoryInfos.stream().filter(c ->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
log.info("获取当前类别是否未打印类别:{}", count);
|
||||
// 如果是部分打印,并且所属分类不在设置的列表中,则不打印
|
||||
if ("1".equals(classifyPrint) && count == 0) {
|
||||
|
||||
|
||||
} else {
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getProductSkuId()));
|
||||
String remark = "";
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getProductName(), it.getNum().toString(), NumberUtil.mul(it.getNum(),it.getPrice()).toPlainString(), remark);
|
||||
BigDecimal unitPrice = it.getPrice();
|
||||
if (it.getIsMember() == 1) {
|
||||
unitPrice = it.getMemberPrice();
|
||||
}
|
||||
BigDecimal subTotal = NumberUtil.mul(it.getNum(), unitPrice.subtract(NumberUtil.null2Zero(it.getDiscountSaleAmount())));
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getProductName(), it.getNum().toString(), subTotal.toPlainString(), remark, it.getProGroupInfo());
|
||||
detailList.add(detail);
|
||||
|
||||
}
|
||||
});
|
||||
String balance = "0";
|
||||
|
||||
@@ -194,7 +203,8 @@ public class PrintMechineConsumer {
|
||||
|
||||
|
||||
if (ObjectUtil.isNotEmpty(detailList) && detailList.size() > 0) {
|
||||
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", ObjectUtil.isEmpty(orderInfo.getMasterId()) || ObjectUtil.isNull(orderInfo.getMasterId()) ? orderInfo.getTableName() : orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getPayAmount().toPlainString(), balance, orderInfo.getPayType(), "0", detailList, orderInfo.getRemark(), null, null);
|
||||
BigDecimal originAmount = detailList.stream().map(obj -> Convert.toBigDecimal(obj.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", ObjectUtil.isEmpty(orderInfo.getMasterId()) || ObjectUtil.isNull(orderInfo.getMasterId()) ? orderInfo.getTableName() : orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", originAmount.toPlainString(), balance, orderInfo.getPayType(), "0", detailList, orderInfo.getRemark(), null, null);
|
||||
|
||||
String printType = "退款单";
|
||||
|
||||
@@ -215,19 +225,26 @@ public class PrintMechineConsumer {
|
||||
List<OrderDetailPO.Detail> detailList = new ArrayList<>();
|
||||
tbOrderDetails.stream().forEach(it -> {
|
||||
String categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||
|
||||
String classifyPrint = tbPrintMachineWithBLOBs.getClassifyPrint();
|
||||
Long count = categoryInfos.stream().filter(c ->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
log.info("获取当前类别是否未打印类别:{}", count);
|
||||
// 如果是部分打印,并且所属分类不在设置的列表中,则不打印
|
||||
if ("1".equals(classifyPrint) && count == 0) {
|
||||
|
||||
if (count > 0) {
|
||||
} else {
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getProductSkuId()));
|
||||
String remark = "";
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getProductName(), it.getNum().toString(), NumberUtil.mul(it.getNum(),it.getPrice()).toPlainString(), remark);
|
||||
BigDecimal unitPrice = it.getPrice();
|
||||
if (it.getIsMember() == 1) {
|
||||
unitPrice = it.getMemberPrice();
|
||||
}
|
||||
BigDecimal subTotal = NumberUtil.mul(it.getNum(), unitPrice.subtract(NumberUtil.null2Zero(it.getDiscountSaleAmount())));
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getProductName(), it.getNum().toString(), subTotal.toPlainString(), remark, it.getProGroupInfo());
|
||||
detailList.add(detail);
|
||||
}
|
||||
});
|
||||
@@ -241,11 +258,11 @@ public class PrintMechineConsumer {
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(detailList) && detailList.size() > 0) {
|
||||
|
||||
BigDecimal originAmount = detailList.stream().map(obj -> Convert.toBigDecimal(obj.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印",
|
||||
orderInfo.getOrderType().equals("miniapp") ? orderInfo.getTableName() : orderInfo.getMasterId(),
|
||||
orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())),
|
||||
"【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance,
|
||||
"【POS-1】001", originAmount.toPlainString(), balance,
|
||||
(ObjectUtil.isEmpty(orderInfo.getPayType()) || ObjectUtil.isNull(orderInfo.getPayType()) ? "" : orderInfo.getPayType()),
|
||||
"0", detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() != null ? orderInfo.getDiscountAmount().toPlainString() : null,
|
||||
orderInfo.getDiscountRatio() != null ? orderInfo.getDiscountRatio().toPlainString() : null);
|
||||
@@ -284,14 +301,25 @@ public class PrintMechineConsumer {
|
||||
// 重置打印数据
|
||||
redisTemplate.delete(printKey);
|
||||
if (!tbOrderDetails.isEmpty()) {
|
||||
tbOrderDetails.forEach(it -> {
|
||||
tbOrderDetails.parallelStream().filter(o -> ObjectUtil.defaultIfNull(o.getIsPrint(), 0) == 1).forEach(it -> {
|
||||
log.info("开始打印一菜一品票据,:{}", it.getProductName());
|
||||
long count;
|
||||
Integer isWaitCall = ObjectUtil.defaultIfNull(it.getIsWaitCall(), 0);
|
||||
if (isWaitCall == 1) {
|
||||
it.setProductName("【等叫】" + it.getProductName());
|
||||
}
|
||||
if (it.getIsTemporary() == 1) {
|
||||
it.setProductId(0);
|
||||
it.setProductSkuId(0);
|
||||
it.setProductName("【临】" + it.getProductName());
|
||||
count = 1;
|
||||
} else {
|
||||
String categoryId = tbProductMapper.selectByPrimaryKey(it.getProductId()).getCategoryId();
|
||||
|
||||
long count = categoryInfos.stream().filter(c ->
|
||||
count = categoryInfos.stream().filter(c ->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
|
||||
}
|
||||
log.info("获取当前类别是否未打印类别:{}", count);
|
||||
if (count > 0) {
|
||||
// 统计已打数量
|
||||
@@ -311,19 +339,21 @@ public class PrintMechineConsumer {
|
||||
|
||||
|
||||
if (info != null) {
|
||||
isReturn = it.getNum() - Integer.parseInt(info) < 0;
|
||||
printerNum = it.getNum() - Integer.parseInt(info);
|
||||
isReturn = it.getNum().intValue() - Integer.parseInt(info) < 0;
|
||||
printerNum = it.getNum().intValue() - Integer.parseInt(info);
|
||||
} else {
|
||||
printerNum = it.getNum();
|
||||
printerNum = it.getNum().intValue();
|
||||
}
|
||||
|
||||
log.info("已打印数量, {}, 未打印数量: {}", info, printerNum);
|
||||
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(it.getProductSkuId());
|
||||
String remark = "";
|
||||
if (it.getIsTemporary() == 0) {
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(it.getProductSkuId());
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
}
|
||||
|
||||
// 将已打印信息加入redis
|
||||
it.setRemark(remark);
|
||||
@@ -331,7 +361,7 @@ public class PrintMechineConsumer {
|
||||
redisTemplate.expire(printKey, 24, TimeUnit.HOURS);
|
||||
|
||||
// 已打印不再打印
|
||||
if (info != null && it.getNum() - Integer.parseInt(info) == 0) {
|
||||
if (info != null && it.getNum().intValue() - Integer.parseInt(info) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -341,14 +371,14 @@ public class PrintMechineConsumer {
|
||||
|
||||
data = PrinterUtils.getPrintData("return",
|
||||
StrUtil.isBlank(orderInfo.getTableName()) ? orderInfo.getMasterId() : orderInfo.getTableName(),
|
||||
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(), Math.abs(printerNum), remark, null);
|
||||
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(), Math.abs(printerNum), remark, null, it.getProGroupInfo());
|
||||
voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
|
||||
} else {
|
||||
data = PrinterUtils.getPrintData("", orderInfo.getMasterId(),
|
||||
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(),
|
||||
printerNum, remark, null);
|
||||
printerNum, remark, null, it.getProGroupInfo());
|
||||
voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
|
||||
@@ -366,7 +396,8 @@ public class PrintMechineConsumer {
|
||||
TbOrderDetail orderDetail = (TbOrderDetail) item;
|
||||
String data = PrinterUtils.getPrintData("return",
|
||||
StrUtil.isBlank(orderInfo.getTableName()) ? orderInfo.getMasterId() : orderInfo.getTableName(),
|
||||
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(), orderDetail.getNum(), orderDetail.getRemark(), null);
|
||||
// todo 修改为bigdecimal
|
||||
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(), orderDetail.getNum().intValue(), orderDetail.getRemark(), null, orderDetail.getProGroupInfo());
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
|
||||
@@ -432,9 +463,10 @@ public class PrintMechineConsumer {
|
||||
printProductSet.forEach(item -> {
|
||||
log.info("已删除订单,打印退款票据, {}", item);
|
||||
TbOrderDetail orderDetail = (TbOrderDetail) item;
|
||||
// todo 修改为bigdecimal
|
||||
String data = PrinterUtils.getPrintData("return",
|
||||
StrUtil.isBlank(orderInfo.getTableName()) ? orderInfo.getMasterId() : orderInfo.getTableName(),
|
||||
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(), orderDetail.getNum(), orderDetail.getRemark(), null);
|
||||
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(), orderDetail.getNum().intValue(), orderDetail.getRemark(), null, orderDetail.getProGroupInfo());
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson, 3, 1, machine.getAddress(), data);
|
||||
|
||||
@@ -461,22 +493,25 @@ public class PrintMechineConsumer {
|
||||
if ("postPay".equals(orderInfo.getUseType()) && isPrint(it, orderInfo.getId())) {
|
||||
return;
|
||||
}
|
||||
String classifyPrint = tbPrintMachineWithBLOBs.getClassifyPrint();
|
||||
String categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||
|
||||
Long count = categoryInfos.stream().filter(c ->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
log.info("获取当前类别是否未打印类别:{}", count);
|
||||
// 如果是部分打印,并且所属分类不在设置的列表中,则不打印
|
||||
if ("1".equals(classifyPrint) && count == 0) {
|
||||
|
||||
if (count > 0) {
|
||||
} else {
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getProductSkuId()));
|
||||
String remark = "";
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
// todo 修改为bigdecimal
|
||||
String data = PrinterUtils.getPrintData("", orderInfo.getMasterId(),
|
||||
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(),
|
||||
it.getNum(), remark, null);
|
||||
it.getNum().intValue(), remark, null, it.getProGroupInfo());
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
}
|
||||
@@ -490,20 +525,38 @@ public class PrintMechineConsumer {
|
||||
private void printReturnTicket(TbPrintMachineWithBLOBs tbPrintMachineWithBLOBs, TbOrderInfo orderInfo, String printerNum, List<CategoryInfo> categoryInfos, String orderId) {
|
||||
List<TbOrderDetail> details = tbOrderDetailMapper.selectAllByOrderId(Integer.valueOf(orderId));
|
||||
if (ObjectUtil.isNotEmpty(details) && details.size() > 0) {
|
||||
details.parallelStream().forEach(it -> {
|
||||
details.parallelStream().filter(o -> ObjectUtil.defaultIfNull(o.getIsPrint(), 0) == 1).forEach(it -> {
|
||||
long count = 0;
|
||||
Integer isWaitCall = ObjectUtil.defaultIfNull(it.getIsWaitCall(), 0);
|
||||
if (isWaitCall == 1) {
|
||||
it.setProductName("【等叫】" + it.getProductName());
|
||||
}
|
||||
if (it.getIsTemporary() == 1) {
|
||||
it.setProductId(0);
|
||||
it.setProductSkuId(0);
|
||||
it.setProductName("【临】" + it.getProductName());
|
||||
} else {
|
||||
String categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||
Long count = categoryInfos.stream().filter(c ->
|
||||
count = categoryInfos.stream().filter(c ->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
}
|
||||
String classifyPrint = tbPrintMachineWithBLOBs.getClassifyPrint();
|
||||
// 如果是部分打印,并且所属分类不在设置的列表中,则不打印
|
||||
if ("1".equals(classifyPrint) && count == 0) {
|
||||
|
||||
if (count > 0) {
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getProductSkuId()));
|
||||
} else {
|
||||
String remark = "";
|
||||
if (it.getIsTemporary() == 0) {
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getProductSkuId()));
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
}
|
||||
// todo 修改为bigdecimal
|
||||
|
||||
String data = PrinterUtils.getPrintData("return", orderInfo.getPayType().equals("wx_lite") ?
|
||||
orderInfo.getTableName() : orderInfo.getMasterId(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(), it.getNum(), remark, null);
|
||||
orderInfo.getTableName() : orderInfo.getMasterId(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(), it.getNum().intValue(), remark, null, it.getProGroupInfo());
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson, 3, 1, tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
}
|
||||
@@ -524,7 +577,7 @@ public class PrintMechineConsumer {
|
||||
if (info == null) {
|
||||
return false;
|
||||
}
|
||||
orderDetail.setNum(orderDetail.getNum() - Integer.parseInt(info));
|
||||
orderDetail.setNum(orderDetail.getNum().subtract(new BigDecimal(info)));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -537,22 +590,18 @@ public class PrintMechineConsumer {
|
||||
if (ObjectUtil.isNotEmpty(tbOrderDetails) && tbOrderDetails.size() > 0) {
|
||||
List<OrderDetailPO.Detail> detailList = new ArrayList<>();
|
||||
tbOrderDetails.parallelStream().forEach(it -> {
|
||||
String categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||
|
||||
Long count = categoryInfos.stream().filter(c ->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
log.info("获取当前类别是否未打印类别:{}", count);
|
||||
|
||||
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getProductSkuId()));
|
||||
String remark = "";
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getProductName(), it.getNum().toString(), NumberUtil.mul(it.getNum(),it.getPrice()).toPlainString(), remark);
|
||||
BigDecimal unitPrice = it.getPrice();
|
||||
if (it.getIsMember() == 1) {
|
||||
unitPrice = it.getMemberPrice();
|
||||
}
|
||||
BigDecimal subTotal = NumberUtil.mul(it.getNum(), unitPrice.subtract(NumberUtil.null2Zero(it.getDiscountSaleAmount())));
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getProductName(), it.getNum().toString(), subTotal.toPlainString(), remark, it.getProGroupInfo());
|
||||
detailList.add(detail);
|
||||
|
||||
});
|
||||
String balance = "0";
|
||||
|
||||
@@ -566,11 +615,12 @@ public class PrintMechineConsumer {
|
||||
|
||||
if (ObjectUtil.isNotEmpty(detailList) && detailList.size() > 0) {
|
||||
// OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0", detailList);
|
||||
BigDecimal originAmount = detailList.stream().map(obj -> Convert.toBigDecimal(obj.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(),
|
||||
"普通打印", ObjectUtil.isEmpty(orderInfo.getMasterId()) || ObjectUtil.isNull(orderInfo.getMasterId())
|
||||
? orderInfo.getTableName() : orderInfo.getMasterId(), orderInfo.getOrderNo(),
|
||||
DateUtils.getTime(new Date(orderInfo.getCreatedAt())),
|
||||
"【POS-1】001", orderInfo.getOrderAmount().toPlainString(),
|
||||
"【POS-1】001", originAmount.toPlainString(),
|
||||
balance, orderInfo.getPayType(), "0",
|
||||
detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() == null ? null : orderInfo.getDiscountAmount().toPlainString(),
|
||||
orderInfo.getDiscountRatio() == null ? null : orderInfo.getDiscountRatio().toPlainString());
|
||||
@@ -596,19 +646,25 @@ public class PrintMechineConsumer {
|
||||
} else {
|
||||
categoryId = it.getCategoryId();
|
||||
}
|
||||
|
||||
|
||||
String classifyPrint = tbPrintMachineWithBLOBs.getClassifyPrint();
|
||||
Long count = categoryInfos.stream().filter(c ->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
// 如果是部分打印,并且所属分类不在设置的列表中,则不打印
|
||||
if ("1".equals(classifyPrint) && count == 0) {
|
||||
|
||||
if (count > 0) {
|
||||
} else {
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getSkuId()));
|
||||
String remark = "";
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getName(), it.getNumber().toString(), it.getTotalAmount().toPlainString(), remark);
|
||||
BigDecimal unitPrice = it.getSalePrice();
|
||||
if (it.getIsMember() == 1) {
|
||||
unitPrice = it.getMemberPrice();
|
||||
}
|
||||
BigDecimal subTotal = NumberUtil.mul(it.getNumber(), unitPrice.subtract(NumberUtil.null2Zero(it.getDiscountSaleAmount())));
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getName(), it.getNumber().toString(), subTotal.toPlainString(), remark, it.getProGroupInfo());
|
||||
detailList.add(detail);
|
||||
}
|
||||
|
||||
@@ -623,7 +679,8 @@ public class PrintMechineConsumer {
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(detailList) && detailList.size() > 0) {
|
||||
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getOrderType().equals("miniapp") ? orderInfo.getTableName() : orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, (ObjectUtil.isEmpty(orderInfo.getPayType()) || ObjectUtil.isNull(orderInfo.getPayType()) ? "" : orderInfo.getPayType()), "0", detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() == null ? null : orderInfo.getDiscountAmount().toPlainString(), orderInfo.getDiscountRatio() == null ? null : orderInfo.getDiscountRatio().toPlainString());
|
||||
BigDecimal originAmount = detailList.stream().map(obj -> Convert.toBigDecimal(obj.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getOrderType().equals("miniapp") ? orderInfo.getTableName() : orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", originAmount.toPlainString(), balance, (ObjectUtil.isEmpty(orderInfo.getPayType()) || ObjectUtil.isNull(orderInfo.getPayType()) ? "" : orderInfo.getPayType()), "0", detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() == null ? null : orderInfo.getDiscountAmount().toPlainString(), orderInfo.getDiscountRatio() == null ? null : orderInfo.getDiscountRatio().toPlainString());
|
||||
String printType = "结算单";
|
||||
|
||||
if ("return".equals(orderInfo.getOrderType())) {
|
||||
@@ -651,8 +708,7 @@ public class PrintMechineConsumer {
|
||||
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderId, "final");
|
||||
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||
|
||||
cashierCarts.parallelStream().forEach(it -> {
|
||||
|
||||
cashierCarts.parallelStream().filter(o -> ObjectUtil.defaultIfNull(o.getIsPrint(), 0) == 1).forEach(it -> {
|
||||
String categoryId;
|
||||
if (ObjectUtil.isEmpty(it.getCategoryId())) {
|
||||
categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||
@@ -661,11 +717,14 @@ public class PrintMechineConsumer {
|
||||
}
|
||||
|
||||
|
||||
String classifyPrint = tbPrintMachineWithBLOBs.getClassifyPrint();
|
||||
Long count = categoryInfos.stream().filter(c ->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
// 如果是部分打印,并且所属分类不在设置的列表中,则不打印
|
||||
if ("1".equals(classifyPrint) && count == 0) {
|
||||
|
||||
if (count > 0) {
|
||||
} else {
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getSkuId()));
|
||||
String remark = "";
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
@@ -673,7 +732,7 @@ public class PrintMechineConsumer {
|
||||
}
|
||||
|
||||
|
||||
FeieyunPrintUtil.getPrintData(tbPrintMachineWithBLOBs.getAddress(), orderInfo, DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getName(), it.getNumber(), remark);
|
||||
FeieyunPrintUtil.getPrintData(tbPrintMachineWithBLOBs.getAddress(), orderInfo, DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getName(), it.getNumber().intValue(), remark, it.getProGroupInfo());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -695,21 +754,21 @@ public class PrintMechineConsumer {
|
||||
categoryId = it.getCategoryId();
|
||||
}
|
||||
|
||||
|
||||
String classifyPrint = tbPrintMachineWithBLOBs.getClassifyPrint();
|
||||
Long count = categoryInfos.stream().filter(c ->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
|
||||
log.info("获取当前类别是否未打印类别:{}", count);
|
||||
// 如果是部分打印,并且所属分类不在设置的列表中,则不打印
|
||||
if ("1".equals(classifyPrint) && count == 0) {
|
||||
|
||||
|
||||
if (count > 0) {
|
||||
} else {
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getSkuId()));
|
||||
String remark = "";
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
for (int i = 0; i < it.getNumber(); i++) {
|
||||
for (int i = 0; i < it.getNumber().intValue(); i++) {
|
||||
FeieyunPrintUtil.printLabelMsg(tbPrintMachineWithBLOBs.getAddress(), orderInfo.getTableName(), it.getName(), 1, DateUtils.getTimes(new Date(orderInfo.getCreatedAt())), it.getSalePrice().toPlainString(), remark);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,4 +70,12 @@ public interface RabbitConstants {
|
||||
// 排号打印
|
||||
String QUEUE_PRINT_CALL_TABLE = "queue.print.call.table";
|
||||
String ROUTING_KEY_CALL_TABLE = "routing.call.table";
|
||||
// 会员余额记录
|
||||
String EXCHANGE_BALANCE = "balance_put";
|
||||
String ROUTING_KEY_BALANCE = "balance_routingkey_put";
|
||||
|
||||
|
||||
// 耗材
|
||||
String EXCHANGE_CONS = "cons_collect_put";
|
||||
String ROUTING_KEY_CONS = "cons_collect_routingkey_put";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.chaozhanggui.system.cashierservice.rabbit.print;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
@@ -24,6 +25,7 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -64,23 +66,25 @@ public class FeiPrinter extends PrinterHandler {
|
||||
@Override
|
||||
protected void normalDishesPrint(TbOrderInfo orderInfo, TbOrderDetail orderDetail, TbPrintMachine machine) {
|
||||
TbProductSkuWithBLOBs sku = tbProductSkuMapper.selectByPrimaryKey(orderDetail.getProductSkuId());
|
||||
if (sku == null) {
|
||||
if (sku == null && orderDetail.getIsTemporary() == 0) {
|
||||
log.warn("打印菜品票失败 sku商品不存在: {}", orderDetail);
|
||||
return;
|
||||
}
|
||||
String remark = sku.getSpecSnap();
|
||||
String remark = sku == null ? "" : sku.getSpecSnap();
|
||||
// todo 修改为bigdecimal
|
||||
String[] resp = FeieyunPrintUtil.getPrintData(machine.getAddress(), orderInfo,
|
||||
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(), orderDetail.getNum(), remark);
|
||||
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(), orderDetail.getNum().intValue(), remark, orderDetail.getProGroupInfo());
|
||||
shopPrintLogService.save(machine, "新订单", resp[0], resp[1]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void returnOrderPrint(TbOrderInfo orderInfo, TbPrintMachine machine, String balance, List<OrderDetailPO.Detail> detailList) {
|
||||
TbShopInfo shopInfo = mpShopInfoMapper.selectById(orderInfo.getShopId());
|
||||
BigDecimal originAmount = detailList.stream().map(obj -> Convert.toBigDecimal(obj.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印",
|
||||
orderInfo.getOrderType().equals("miniapp") ? orderInfo.getTableName() : orderInfo.getMasterId(),
|
||||
orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())),
|
||||
"【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance,
|
||||
"【POS-1】001", originAmount.toPlainString(), balance,
|
||||
(ObjectUtil.isEmpty(orderInfo.getPayType()) || ObjectUtil.isNull(orderInfo.getPayType()) ? "" : orderInfo.getPayType()),
|
||||
"0", detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() == null ? null : orderInfo.getDiscountAmount().toPlainString(), orderInfo.getDiscountRatio() == null ? null : orderInfo.getDiscountRatio().toPlainString());
|
||||
String printType = "退款单";
|
||||
@@ -97,10 +101,11 @@ public class FeiPrinter extends PrinterHandler {
|
||||
@Override
|
||||
protected void normalOrderPrint(TbOrderInfo orderInfo, TbPrintMachine machine, String balance, List<OrderDetailPO.Detail> detailList) {
|
||||
TbShopInfo shopInfo = mpShopInfoMapper.selectById(orderInfo.getShopId());
|
||||
BigDecimal originAmount = detailList.stream().map(obj -> Convert.toBigDecimal(obj.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印",
|
||||
orderInfo.getOrderType().equals("miniapp") ? orderInfo.getTableName() : orderInfo.getMasterId(),
|
||||
orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())),
|
||||
"【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance,
|
||||
"【POS-1】001", originAmount.toPlainString(), balance,
|
||||
(ObjectUtil.isEmpty(orderInfo.getPayType()) || ObjectUtil.isNull(orderInfo.getPayType()) ? "" : orderInfo.getPayType()),
|
||||
"0", detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() == null ? null : orderInfo.getDiscountAmount().toPlainString(), orderInfo.getDiscountRatio() == null ? null : orderInfo.getDiscountRatio().toPlainString());
|
||||
String printType = "结算单";
|
||||
|
||||
@@ -47,7 +47,9 @@ public class LocalLabelPrinter extends PrinterHandler {
|
||||
log.warn("打印菜品标签票失败 sku商品不存在: {}", orderDetail);
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < orderDetail.getNum(); i++) {
|
||||
// todo 修改为bigdecimal
|
||||
|
||||
for (int i = 0; i < orderDetail.getNum().intValue(); i++) {
|
||||
String[] resp = FeieyunPrintUtil.printLabelMsg(machine.getAddress(), orderInfo.getTableName(), orderDetail.getProductName(),
|
||||
1, DateUtils.getTimes(new Date(orderInfo.getCreatedAt())), sku.getSalePrice().toPlainString(), sku.getSpecSnap());
|
||||
shopPrintLogService.save(machine, "新订单", resp[0], resp[1]);
|
||||
|
||||
@@ -19,6 +19,7 @@ import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -83,32 +84,56 @@ public abstract class PrinterHandler {
|
||||
* 仅打印制作单「厨房」
|
||||
*/
|
||||
private void onlyKitchen(TbPrintMachine machine, TbOrderInfo orderInfo, List<TbOrderDetail> tbOrderDetailList, List<CategoryInfo> categoryInfos, boolean isReturn) {
|
||||
tbOrderDetailList.forEach(item -> {
|
||||
tbOrderDetailList.parallelStream().filter(o -> ObjectUtil.defaultIfNull(o.getIsPrint(), 0) == 1).forEach(item -> {
|
||||
log.info("开始打印退单菜品,商品名:{}", item.getProductName());
|
||||
Integer isWaitCall = ObjectUtil.defaultIfNull(item.getIsWaitCall(), 0);
|
||||
if (isWaitCall == 1) {
|
||||
if (!item.getProductName().startsWith("【等叫】")) {
|
||||
item.setProductName("【等叫】" + item.getProductName());
|
||||
}
|
||||
}
|
||||
Integer isTemporary = ObjectUtil.defaultIfNull(item.getIsTemporary(), 0);
|
||||
String categoryId = "0";
|
||||
if (isTemporary == 1) {
|
||||
item.setProductId(0);
|
||||
item.setProductSkuId(0);
|
||||
if (!item.getProductName().startsWith("【临】")) {
|
||||
item.setProductName("【临】" + item.getProductName());
|
||||
}
|
||||
}
|
||||
// 台位费不打印
|
||||
if (item.getProductId().equals(-999)) {
|
||||
log.info("台位费商品,不打印");
|
||||
return;
|
||||
}
|
||||
String categoryId = tbProductMapper.selectByPrimaryKey(item.getProductId()).getCategoryId();
|
||||
|
||||
TbProduct product = tbProductMapper.selectByPrimaryKey(item.getProductId());
|
||||
if (isTemporary == 0) {
|
||||
categoryId = product.getCategoryId();
|
||||
}
|
||||
TbProductSkuWithBLOBs sku = tbProductSkuMapper.selectByPrimaryKey(item.getProductSkuId());
|
||||
if (sku == null) {
|
||||
if (isTemporary == 0 && sku == null) {
|
||||
log.error("商品不存在, id: {}", item.getProductSkuId());
|
||||
return;
|
||||
} else if (isTemporary == 1) {
|
||||
sku = new TbProductSkuWithBLOBs();
|
||||
}
|
||||
if (StrUtil.isEmpty(machine.getClassifyPrint())) {
|
||||
log.error("分类打印是空, classifyPrint: {}", machine.getClassifyPrint());
|
||||
return;
|
||||
}
|
||||
String finalCategoryId = categoryId;
|
||||
long count = categoryInfos.stream().filter(c ->
|
||||
c.getId().toString().equals(categoryId)
|
||||
c.getId().toString().equals(finalCategoryId)
|
||||
).count();
|
||||
|
||||
if (machine.getClassifyPrint() != null && "1".equals(machine.getClassifyPrint()) && count == 0) {
|
||||
log.warn("分类未添加菜品: {} : {}", item.getProductName(), sku.getSpecSnap());
|
||||
return;
|
||||
if (isTemporary == 1) {
|
||||
count = 1;
|
||||
}
|
||||
String classifyPrint = machine.getClassifyPrint();
|
||||
// 如果是部分打印,并且所属分类不在设置的列表中,则不打印
|
||||
if("1".equals(classifyPrint) && count == 0) {
|
||||
|
||||
}else{
|
||||
String remark = StrUtil.isNotBlank(sku.getSpecSnap()) ? sku.getSpecSnap() : "";
|
||||
item.setRemark(remark);
|
||||
if (isReturn) {
|
||||
@@ -116,6 +141,7 @@ public abstract class PrinterHandler {
|
||||
} else {
|
||||
normalDishesPrint(orderInfo, item, machine);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -129,12 +155,27 @@ public abstract class PrinterHandler {
|
||||
}
|
||||
List<OrderDetailPO.Detail> detailList = new ArrayList<>();
|
||||
tbOrderDetailList.forEach(it -> {
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(it.getProductSkuId());
|
||||
Integer isTemporary = ObjectUtil.defaultIfNull(it.getIsTemporary(), 0);
|
||||
String remark = "";
|
||||
if (isTemporary == 0) {
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(it.getProductSkuId());
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getProductName(), it.getNum().toString(), NumberUtil.mul(it.getNum(),it.getPrice()).toPlainString(), remark);
|
||||
}
|
||||
Integer isWaitCall = ObjectUtil.defaultIfNull(it.getIsWaitCall(), 0);
|
||||
if (isWaitCall == 1) {
|
||||
it.setProductName("【等叫】" + it.getProductName());
|
||||
}
|
||||
if (isTemporary == 1) {
|
||||
it.setProductName("【临】" + it.getProductName());
|
||||
}
|
||||
BigDecimal unitPrice = it.getPrice();
|
||||
if(it.getIsMember() == 1){
|
||||
unitPrice = it.getMemberPrice();
|
||||
}
|
||||
BigDecimal subTotal = NumberUtil.mul(it.getNum(), unitPrice.subtract(NumberUtil.null2Zero(it.getDiscountSaleAmount())));
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getProductName(), it.getNum().toString(), subTotal.toPlainString(), remark, it.getProGroupInfo());
|
||||
detailList.add(detail);
|
||||
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.chaozhanggui.system.cashierservice.rabbit.print;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -23,6 +24,7 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -62,10 +64,11 @@ public class YxyPrinter extends PrinterHandler {
|
||||
|
||||
@Override
|
||||
protected void returnDishesPrint(TbOrderInfo orderInfo, TbOrderDetail orderDetail, TbPrintMachine machine) {
|
||||
// todo 修改为bigdecimal
|
||||
|
||||
String data = PrinterUtils.getPrintData("return", getPickupNum(orderInfo),
|
||||
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(),
|
||||
Math.abs(orderDetail.getNum()), orderDetail.getRemark(), orderDetail.getNote());
|
||||
orderDetail.getNum().abs().intValue(), orderDetail.getRemark(), orderDetail.getNote(), orderDetail.getProGroupInfo());
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
|
||||
// String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||
String resp = PrinterUtils.printTickets(voiceJson, 3, 1, machine.getAddress(), data);
|
||||
@@ -74,9 +77,11 @@ public class YxyPrinter extends PrinterHandler {
|
||||
|
||||
@Override
|
||||
protected void normalDishesPrint(TbOrderInfo orderInfo, TbOrderDetail orderDetail, TbPrintMachine machine) {
|
||||
// todo 修改为bigdecimal
|
||||
|
||||
String data = PrinterUtils.getPrintData("", getPickupNum(orderInfo),
|
||||
DateUtils.getTime(new Date(orderInfo.getCreatedAt())), orderDetail.getProductName(),
|
||||
orderDetail.getNum(), orderDetail.getRemark(), orderDetail.getNote());
|
||||
orderDetail.getNum().intValue(), orderDetail.getRemark(), orderDetail.getNote(), orderDetail.getProGroupInfo());
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
// String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||
String resp = PrinterUtils.printTickets(voiceJson, 3, 1, machine.getAddress(), data);
|
||||
@@ -86,9 +91,10 @@ public class YxyPrinter extends PrinterHandler {
|
||||
@Override
|
||||
protected void returnOrderPrint(TbOrderInfo orderInfo, TbPrintMachine machine, String balance, List<OrderDetailPO.Detail> detailList) {
|
||||
TbShopInfo shopInfo = shopInfoMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getShopId()));
|
||||
BigDecimal originAmount = detailList.stream().map(obj -> Convert.toBigDecimal(obj.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", getPickupNum(orderInfo),
|
||||
orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())),
|
||||
"【POS-1】001", orderInfo.getPayAmount().toPlainString(), balance, orderInfo.getPayType(),
|
||||
"【POS-1】001", originAmount.toPlainString(), balance, orderInfo.getPayType(),
|
||||
"0", detailList, orderInfo.getRemark(), null, null);
|
||||
|
||||
String printType = "退款单";
|
||||
@@ -103,11 +109,11 @@ public class YxyPrinter extends PrinterHandler {
|
||||
@Override
|
||||
protected void normalOrderPrint(TbOrderInfo orderInfo, TbPrintMachine machine, String balance, List<OrderDetailPO.Detail> detailList) {
|
||||
TbShopInfo shopInfo = shopInfoMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getShopId()));
|
||||
|
||||
BigDecimal originAmount = detailList.stream().map(obj -> Convert.toBigDecimal(obj.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印",
|
||||
getPickupNum(orderInfo),
|
||||
orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())),
|
||||
"【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance,
|
||||
"【POS-1】001", originAmount.toPlainString(), balance,
|
||||
(ObjectUtil.isEmpty(orderInfo.getPayType()) || ObjectUtil.isNull(orderInfo.getPayType()) ? "" : orderInfo.getPayType()),
|
||||
"0", detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() != null ? orderInfo.getDiscountAmount().toPlainString() : null,
|
||||
orderInfo.getDiscountRatio() != null ? orderInfo.getDiscountRatio().toPlainString() : null);
|
||||
@@ -157,7 +163,7 @@ public class YxyPrinter extends PrinterHandler {
|
||||
public static void main(String[] args) {
|
||||
String data = PrinterUtils.getPrintData("", "#3",
|
||||
DateUtils.getTime(DateUtil.date()), "九度",
|
||||
Integer.valueOf("20"), "少冰", "加菜防守打法火速地方啊地上1三大法宝苏俄倒海翻江");
|
||||
Integer.valueOf("20"), "少冰", "加菜防守打法火速地方啊地上1三大法宝苏俄倒海翻江","");
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"\"}";
|
||||
PrinterUtils.printTickets(voiceJson, 3, 1, "ZF544PG03W00005", data);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.chaozhanggui.system.cashierservice.resp;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PhpCommonResp<T> {
|
||||
private String code;
|
||||
private String msg;
|
||||
private long time;
|
||||
private T data;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -175,22 +176,40 @@ public class CloudPrinterService {
|
||||
if ("return".equals(orderInfo.getOrderType())) {
|
||||
List<TbOrderDetail> details = tbOrderDetailMapper.selectAllByOrderId(Integer.valueOf(orderId));
|
||||
if (ObjectUtil.isNotEmpty(details) && details.size() > 0) {
|
||||
details.parallelStream().forEach(it -> {
|
||||
|
||||
|
||||
details.parallelStream().filter(o -> ObjectUtil.defaultIfNull(o.getIsPrint(), 0) == 1).forEach(it -> {
|
||||
long count = 0;
|
||||
Integer isWaitCall = ObjectUtil.defaultIfNull(it.getIsWaitCall(), 0);
|
||||
if (isWaitCall == 1) {
|
||||
it.setProductName("【等叫】" + it.getProductName());
|
||||
}
|
||||
if (it.getIsTemporary() == 1) {
|
||||
it.setProductId(0);
|
||||
it.setProductSkuId(0);
|
||||
it.setProductName("【临】" + it.getProductName());
|
||||
count = 1;
|
||||
} else {
|
||||
String categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||
Long count = categoryInfos.stream().filter(c ->
|
||||
count = categoryInfos.stream().filter(c ->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
}
|
||||
|
||||
if (count > 0) {
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getProductSkuId()));
|
||||
String classifyPrint = tbPrintMachineWithBLOBs.getClassifyPrint();
|
||||
// 如果是部分打印,并且所属分类不在设置的列表中,则不打印
|
||||
if ("1".equals(classifyPrint) && count == 0) {
|
||||
|
||||
} else {
|
||||
String remark = "";
|
||||
if (it.getIsTemporary() == 0) {
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getProductSkuId()));
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
}
|
||||
// todo 修改为bigdecimal
|
||||
|
||||
String data = PrinterUtils.getPrintData("return", orderInfo.getPayType().equals("wx_lite") ?
|
||||
orderInfo.getTableName() : orderInfo.getMasterId(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(), it.getNum(), remark, null);
|
||||
orderInfo.getTableName() : orderInfo.getMasterId(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getProductName(), it.getNum().intValue(), remark, null, it.getProGroupInfo());
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔退款订单,请及时处理\"}";
|
||||
PrinterUtils.printTickets(voiceJson, 3, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
}
|
||||
@@ -215,17 +234,21 @@ public class CloudPrinterService {
|
||||
Long count = categoryInfos.stream().filter(c ->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
String classifyPrint = tbPrintMachineWithBLOBs.getClassifyPrint();
|
||||
// 如果是部分打印,并且所属分类不在设置的列表中,则不打印
|
||||
if ("1".equals(classifyPrint) && count == 0) {
|
||||
|
||||
if (count > 0) {
|
||||
} else {
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getSkuId()));
|
||||
String remark = "";
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
|
||||
// todo 修改为bigdecimal
|
||||
|
||||
String data = PrinterUtils.getPrintData("", orderInfo.getOrderType().equals("miniapp") ?
|
||||
orderInfo.getTableName() : orderInfo.getMasterId(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getName(), it.getNumber(), remark, null);
|
||||
orderInfo.getTableName() : orderInfo.getMasterId(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getName(), it.getNumber().intValue(), remark, null, it.getProGroupInfo());
|
||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一笔新的订单,请及时处理\"}";
|
||||
|
||||
PrinterUtils.printTickets(voiceJson, 3, Integer.valueOf(printerNum), tbPrintMachineWithBLOBs.getAddress(), data);
|
||||
@@ -249,22 +272,18 @@ public class CloudPrinterService {
|
||||
if (ObjectUtil.isNotEmpty(tbOrderDetails) && tbOrderDetails.size() > 0) {
|
||||
List<OrderDetailPO.Detail> detailList = new ArrayList<>();
|
||||
tbOrderDetails.parallelStream().forEach(it -> {
|
||||
String categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||
|
||||
Long count = categoryInfos.stream().filter(c ->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
log.info("获取当前类别是否未打印类别:{}", count);
|
||||
|
||||
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getProductSkuId()));
|
||||
String remark = "";
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getProductName(), it.getNum().toString(), NumberUtil.mul(it.getNum(), it.getPrice()).toPlainString(), remark);
|
||||
BigDecimal unitPrice = it.getPrice();
|
||||
if (it.getIsMember() == 1) {
|
||||
unitPrice = it.getMemberPrice();
|
||||
}
|
||||
BigDecimal subTotal = NumberUtil.mul(it.getNum(), unitPrice.subtract(NumberUtil.null2Zero(it.getDiscountSaleAmount())));
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getProductName(), it.getNum().toString(), subTotal.toPlainString(), remark, it.getProGroupInfo());
|
||||
detailList.add(detail);
|
||||
|
||||
});
|
||||
String balance = "0";
|
||||
|
||||
@@ -278,10 +297,11 @@ public class CloudPrinterService {
|
||||
|
||||
if (ObjectUtil.isNotEmpty(detailList) && detailList.size() > 0) {
|
||||
// OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0", detailList);
|
||||
BigDecimal originAmount = detailList.stream().map(obj -> Convert.toBigDecimal(obj.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印",
|
||||
ObjectUtil.isEmpty(orderInfo.getMasterId()) || ObjectUtil.isNull(orderInfo.getMasterId()) ? orderInfo.getTableName() : orderInfo.getMasterId(),
|
||||
orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())),
|
||||
"【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0",
|
||||
"【POS-1】001", originAmount.toPlainString(), balance, orderInfo.getPayType(), "0",
|
||||
detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() == null ? null : orderInfo.getDiscountAmount().toPlainString(), orderInfo.getDiscountRatio() == null ? null : orderInfo.getDiscountRatio().toPlainString());
|
||||
detailPO.setOutNumber(orderInfo.getOutNumber());
|
||||
String printType = "退款单";
|
||||
@@ -302,7 +322,7 @@ public class CloudPrinterService {
|
||||
if (ispre) {
|
||||
cashierCarts = tbCashierCartMapper.selectByOrderId(orderInfo.getId().toString(), "create");
|
||||
} else {
|
||||
cashierCarts = tbCashierCartMapper.selectByOrderId(orderInfo.getId().toString(), "final");
|
||||
cashierCarts = tbCashierCartMapper.selectByOrderId(orderInfo.getId().toString(), "closed");
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||
@@ -314,19 +334,25 @@ public class CloudPrinterService {
|
||||
} else {
|
||||
categoryId = it.getCategoryId();
|
||||
}
|
||||
|
||||
|
||||
String classifyPrint = tbPrintMachineWithBLOBs.getClassifyPrint();
|
||||
Long count = categoryInfos.stream().filter(c ->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
// 如果是部分打印,并且所属分类不在设置的列表中,则不打印
|
||||
if ("1".equals(classifyPrint) && count == 0) {
|
||||
|
||||
if (count > 0) {
|
||||
} else {
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getSkuId()));
|
||||
String remark = "";
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getName(), it.getNumber().toString(), it.getTotalAmount().toPlainString(), remark);
|
||||
BigDecimal unitPrice = it.getSalePrice();
|
||||
if (it.getIsMember() == 1) {
|
||||
unitPrice = it.getMemberPrice();
|
||||
}
|
||||
BigDecimal subTotal = NumberUtil.mul(it.getNumber(), unitPrice.subtract(NumberUtil.null2Zero(it.getDiscountSaleAmount())));
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getName(), it.getNumber().toString(), subTotal.toPlainString(), remark, it.getProGroupInfo());
|
||||
detailList.add(detail);
|
||||
}
|
||||
|
||||
@@ -344,10 +370,11 @@ public class CloudPrinterService {
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(detailList) && detailList.size() > 0) {
|
||||
BigDecimal originAmount = detailList.stream().map(obj -> Convert.toBigDecimal(obj.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印",
|
||||
orderInfo.getOrderType().equals("miniapp") ? orderInfo.getTableName() : orderInfo.getMasterId(),
|
||||
orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())),
|
||||
"【POS-1】001", orderInfo.getOrderAmount().toPlainString(),
|
||||
"【POS-1】001", originAmount.toPlainString(),
|
||||
balance, (ObjectUtil.isEmpty(orderInfo.getPayType()) || ObjectUtil.isNull(orderInfo.getPayType()) ? "" : orderInfo.getPayType()), "0",
|
||||
detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() != null ? orderInfo.getDiscountAmount().toPlainString() : null, orderInfo.getDiscountRatio() != null ? orderInfo.getDiscountRatio().toPlainString() : null);
|
||||
String printType = "结算单";
|
||||
@@ -384,22 +411,18 @@ public class CloudPrinterService {
|
||||
if (ObjectUtil.isNotEmpty(tbOrderDetails) && tbOrderDetails.size() > 0) {
|
||||
List<OrderDetailPO.Detail> detailList = new ArrayList<>();
|
||||
tbOrderDetails.parallelStream().forEach(it -> {
|
||||
String categoryId = tbProductMapper.selectByPrimaryKey(Integer.valueOf(it.getProductId())).getCategoryId();
|
||||
|
||||
Long count = categoryInfos.stream().filter(c ->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
log.info("获取当前类别是否未打印类别:{}", count);
|
||||
|
||||
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getProductSkuId()));
|
||||
String remark = "";
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getProductName(), it.getNum().toString(), NumberUtil.mul(it.getNum(), it.getPrice()).toPlainString(), remark);
|
||||
BigDecimal unitPrice = it.getPrice();
|
||||
if (it.getIsMember() == 1) {
|
||||
unitPrice = it.getMemberPrice();
|
||||
}
|
||||
BigDecimal subTotal = NumberUtil.mul(it.getNum(), unitPrice.subtract(NumberUtil.null2Zero(it.getDiscountSaleAmount())));
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getProductName(), it.getNum().toString(), subTotal.toPlainString(), remark, it.getProGroupInfo());
|
||||
detailList.add(detail);
|
||||
|
||||
});
|
||||
String balance = "0";
|
||||
|
||||
@@ -413,7 +436,8 @@ public class CloudPrinterService {
|
||||
|
||||
if (ObjectUtil.isNotEmpty(detailList) && detailList.size() > 0) {
|
||||
// OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0", detailList);
|
||||
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", ObjectUtil.isEmpty(orderInfo.getMasterId()) || ObjectUtil.isNull(orderInfo.getMasterId()) ? orderInfo.getTableName() : orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", orderInfo.getOrderAmount().toPlainString(), balance, orderInfo.getPayType(), "0", detailList, orderInfo.getRemark(), null, null);
|
||||
BigDecimal originAmount = detailList.stream().map(obj -> Convert.toBigDecimal(obj.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印", ObjectUtil.isEmpty(orderInfo.getMasterId()) || ObjectUtil.isNull(orderInfo.getMasterId()) ? orderInfo.getTableName() : orderInfo.getMasterId(), orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())), "【POS-1】001", originAmount.toPlainString(), balance, orderInfo.getPayType(), "0", detailList, orderInfo.getRemark(), null, null);
|
||||
|
||||
String printType = "退款单";
|
||||
|
||||
@@ -443,20 +467,18 @@ public class CloudPrinterService {
|
||||
categoryId = it.getCategoryId();
|
||||
}
|
||||
|
||||
|
||||
Long count = categoryInfos.stream().filter(c ->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
|
||||
if (count > 0) {
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getSkuId()));
|
||||
String remark = "";
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getName(), it.getNumber().toString(), it.getTotalAmount().toPlainString(), remark);
|
||||
detailList.add(detail);
|
||||
BigDecimal unitPrice = it.getSalePrice();
|
||||
if (it.getIsMember() == 1) {
|
||||
unitPrice = it.getMemberPrice();
|
||||
}
|
||||
BigDecimal subTotal = NumberUtil.mul(it.getNumber(), unitPrice.subtract(NumberUtil.null2Zero(it.getDiscountSaleAmount())));
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getName(), it.getNumber().toString(), subTotal.toPlainString(), remark, it.getProGroupInfo());
|
||||
detailList.add(detail);
|
||||
|
||||
});
|
||||
|
||||
@@ -469,10 +491,11 @@ public class CloudPrinterService {
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(detailList) && detailList.size() > 0) {
|
||||
BigDecimal originAmount = detailList.stream().map(obj -> Convert.toBigDecimal(obj.getAmount())).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
OrderDetailPO detailPO = new OrderDetailPO(shopInfo.getShopName(), "普通打印",
|
||||
orderInfo.getOrderType().equals("miniapp") ? orderInfo.getTableName() : orderInfo.getMasterId(),
|
||||
orderInfo.getOrderNo(), DateUtils.getTime(new Date(orderInfo.getCreatedAt())),
|
||||
"【POS-1】001", orderInfo.getOrderAmount().toPlainString(),
|
||||
"【POS-1】001", originAmount.toPlainString(),
|
||||
balance, (ObjectUtil.isEmpty(orderInfo.getPayType()) || ObjectUtil.isNull(orderInfo.getPayType()) ? "" : orderInfo.getPayType()),
|
||||
"0", detailList, orderInfo.getRemark(), orderInfo.getDiscountAmount() == null ? null : orderInfo.getDiscountAmount().toPlainString(), orderInfo.getDiscountRatio() == null ? null : orderInfo.getDiscountRatio().toPlainString());
|
||||
String printType = "结算单";
|
||||
@@ -506,7 +529,7 @@ public class CloudPrinterService {
|
||||
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderId, "final");
|
||||
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||
|
||||
cashierCarts.parallelStream().forEach(it -> {
|
||||
cashierCarts.parallelStream().filter(o -> ObjectUtil.defaultIfNull(o.getIsPrint(), 0) == 1).forEach(it -> {
|
||||
|
||||
String categoryId;
|
||||
if (ObjectUtil.isEmpty(it.getCategoryId())) {
|
||||
@@ -519,15 +542,19 @@ public class CloudPrinterService {
|
||||
Long count = categoryInfos.stream().filter(c ->
|
||||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
String classifyPrint = tbPrintMachineWithBLOBs.getClassifyPrint();
|
||||
// 如果是部分打印,并且所属分类不在设置的列表中,则不打印
|
||||
if ("1".equals(classifyPrint) && count == 0) {
|
||||
|
||||
if (count > 0) {
|
||||
} else {
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getSkuId()));
|
||||
String remark = "";
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
// todo 修改为bigdecimal
|
||||
|
||||
FeieyunPrintUtil.getPrintData(tbPrintMachineWithBLOBs.getAddress(), orderInfo, DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getName(), it.getNumber(), remark);
|
||||
FeieyunPrintUtil.getPrintData(tbPrintMachineWithBLOBs.getAddress(), orderInfo, DateUtils.getTime(new Date(orderInfo.getCreatedAt())), it.getName(), it.getNumber().intValue(), remark, it.getProGroupInfo());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -545,24 +572,27 @@ public class CloudPrinterService {
|
||||
if (ispre) {
|
||||
return Result.fail("预结算单不打印标签");
|
||||
}
|
||||
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderInfo.getId().toString(), "final");
|
||||
List<TbCashierCart> cashierCarts = tbCashierCartMapper.selectByOrderId(orderInfo.getId().toString(), "closed");
|
||||
if (ObjectUtil.isNotEmpty(cashierCarts) && cashierCarts.size() > 0) {
|
||||
cashierCarts.parallelStream().forEach(it -> {
|
||||
String classifyPrint = tbPrintMachineWithBLOBs.getClassifyPrint();
|
||||
Long count = categoryInfos.stream().filter(c ->
|
||||
c.getId().toString().equals(it.getCategoryId().toString())
|
||||
).count();
|
||||
// 如果是部分打印,并且所属分类不在设置的列表中,则不打印
|
||||
if ("1".equals(classifyPrint) && count == 0) {
|
||||
|
||||
if (count > 0) {
|
||||
} else {
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByPrimaryKey(Integer.valueOf(it.getSkuId()));
|
||||
String remark = "";
|
||||
if (ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs) && ObjectUtil.isNotEmpty(tbProductSkuWithBLOBs.getSpecSnap())) {
|
||||
remark = tbProductSkuWithBLOBs.getSpecSnap();
|
||||
}
|
||||
// todo 修改为bigdecimal
|
||||
|
||||
for (int i = 0; i < it.getNumber(); i++) {
|
||||
for (int i = 0; i < it.getNumber().intValue(); i++) {
|
||||
FeieyunPrintUtil.printLabelMsg(tbPrintMachineWithBLOBs.getAddress(), orderInfo.getOrderType().equals("miniapp") ? orderInfo.getTableName() : orderInfo.getMasterId(), it.getName(), 1, DateUtils.getTimes(new Date(orderInfo.getCreatedAt())), it.getSalePrice().toPlainString(), remark);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public class ConsService {
|
||||
flow.setConName(tbConsInfo.getConName());
|
||||
flow.setProSkuId(proskuCon.getProductSkuId());
|
||||
if("create".equals(type)){
|
||||
amount=proskuCon.getSurplusStock().multiply(new BigDecimal(orderDetail.getNum()));
|
||||
amount=proskuCon.getSurplusStock().multiply(orderDetail.getNum());
|
||||
|
||||
flow.setAmount(amount);
|
||||
|
||||
@@ -96,7 +96,7 @@ public class ConsService {
|
||||
tbConsInfo.setUpdateTime(new Timestamp(System.currentTimeMillis()));
|
||||
|
||||
}else if("delete".equals(type)){
|
||||
amount=proskuCon.getSurplusStock().multiply(new BigDecimal(orderDetail.getNum())).negate();
|
||||
amount=proskuCon.getSurplusStock().multiply(orderDetail.getNum()).negate();
|
||||
|
||||
flow.setAmount(amount.abs());
|
||||
flow.setBizCode("cancelCart");
|
||||
|
||||
@@ -181,14 +181,16 @@ public class DutyService {
|
||||
ShopUserDutyDetail shopUserDutyDetail = new ShopUserDutyDetail();
|
||||
shopUserDutyDetail.setDutyId(shopUserDuty.getId());
|
||||
shopUserDutyDetail.setAmount(orderDetail.getPriceAmount());
|
||||
shopUserDutyDetail.setNum(orderDetail.getNum());
|
||||
// todo 修改为bigdecimal
|
||||
shopUserDutyDetail.setNum(orderDetail.getNum().intValue());
|
||||
shopUserDutyDetail.setSkuId(orderDetail.getProductSkuId());
|
||||
shopUserDutyDetail.setSkuName(orderDetail.getProductSkuName());
|
||||
shopUserDutyDetail.setProductId(orderDetail.getProductId());
|
||||
shopUserDutyDetail.setProductName(orderDetail.getProductName());
|
||||
detaiList.add(shopUserDutyDetail);
|
||||
// productSkuMapper.updateByskuId(orderDetail.getProductSkuId(), orderDetail.getNum());
|
||||
subInventory(shopId, orderDetail.getProductSkuId(), orderDetail.getNum());
|
||||
// todo 修改为bigdecimal
|
||||
subInventory(shopId, orderDetail.getProductSkuId(), orderDetail.getNum().intValue());
|
||||
}
|
||||
if (detaiList.size() > 0) {
|
||||
shopUserDutyDetailMapper.batchInsert(detaiList);
|
||||
@@ -214,14 +216,15 @@ public class DutyService {
|
||||
for (TbOrderDetail orderDetail : list) {
|
||||
if (map.containsKey(orderDetail.getProductSkuId())) {
|
||||
ShopUserDutyDetail shopUserDutyDetail = map.get(orderDetail.getProductSkuId());
|
||||
shopUserDutyDetail.setNum(shopUserDutyDetail.getNum() + orderDetail.getNum());
|
||||
// todo 修改为bigdecimal
|
||||
shopUserDutyDetail.setNum(shopUserDutyDetail.getNum() + orderDetail.getNum().intValue());
|
||||
shopUserDutyDetail.setAmount(shopUserDutyDetail.getAmount().add(orderDetail.getPriceAmount().add(orderDetail.getPackAmount())));
|
||||
shopUserDutyDetailMapper.updateByPrimaryKeySelective(shopUserDutyDetail);
|
||||
} else {
|
||||
ShopUserDutyDetail shopUserDutyDetail = new ShopUserDutyDetail();
|
||||
shopUserDutyDetail.setDutyId(shopUserDuty.getId());
|
||||
shopUserDutyDetail.setAmount(orderDetail.getPriceAmount());
|
||||
shopUserDutyDetail.setNum(orderDetail.getNum());
|
||||
shopUserDutyDetail.setNum(orderDetail.getNum().intValue());
|
||||
shopUserDutyDetail.setSkuId(orderDetail.getProductSkuId());
|
||||
shopUserDutyDetail.setSkuName(orderDetail.getProductSkuName());
|
||||
shopUserDutyDetail.setProductId(orderDetail.getProductId());
|
||||
@@ -230,7 +233,8 @@ public class DutyService {
|
||||
|
||||
}
|
||||
// productSkuMapper.updateByskuId(orderDetail.getProductSkuId(), orderDetail.getNum());
|
||||
subInventory(shopId, orderDetail.getProductSkuId(), orderDetail.getNum());
|
||||
// todo 修改为bigdecimal
|
||||
subInventory(shopId, orderDetail.getProductSkuId(), orderDetail.getNum().intValue());
|
||||
}
|
||||
if (detaiList.size() > 0) {
|
||||
shopUserDutyDetailMapper.batchInsert(detaiList);
|
||||
@@ -295,7 +299,9 @@ public class DutyService {
|
||||
ShopUserDutyDetail shopUserDutyDetail = new ShopUserDutyDetail();
|
||||
shopUserDutyDetail.setDutyId(shopUserDuty.getId());
|
||||
shopUserDutyDetail.setAmount(orderDetail.getPriceAmount());
|
||||
shopUserDutyDetail.setNum(orderDetail.getNum());
|
||||
// todo 修改为bigdecimal
|
||||
|
||||
shopUserDutyDetail.setNum(orderDetail.getNum().intValue());
|
||||
shopUserDutyDetail.setSkuId(orderDetail.getProductSkuId());
|
||||
shopUserDutyDetail.setSkuName(orderDetail.getProductSkuName());
|
||||
shopUserDutyDetail.setProductId(orderDetail.getProductId());
|
||||
@@ -326,14 +332,16 @@ public class DutyService {
|
||||
for (TbOrderDetail orderDetail : list) {
|
||||
if (map.containsKey(orderDetail.getProductSkuId())) {
|
||||
ShopUserDutyDetail shopUserDutyDetail = map.get(orderDetail.getProductSkuId());
|
||||
shopUserDutyDetail.setNum(shopUserDutyDetail.getNum() + orderDetail.getNum());
|
||||
// todo 修改为bigdecimal
|
||||
shopUserDutyDetail.setNum(shopUserDutyDetail.getNum() + orderDetail.getNum().intValue());
|
||||
shopUserDutyDetail.setAmount(shopUserDutyDetail.getAmount().add(orderDetail.getPriceAmount().add(orderDetail.getPackAmount())));
|
||||
shopUserDutyDetailMapper.updateByPrimaryKeySelective(shopUserDutyDetail);
|
||||
} else {
|
||||
ShopUserDutyDetail shopUserDutyDetail = new ShopUserDutyDetail();
|
||||
shopUserDutyDetail.setDutyId(shopUserDuty.getId());
|
||||
shopUserDutyDetail.setAmount(orderDetail.getPriceAmount());
|
||||
shopUserDutyDetail.setNum(orderDetail.getNum());
|
||||
// todo 修改为bigdecimal
|
||||
shopUserDutyDetail.setNum(orderDetail.getNum().intValue());
|
||||
shopUserDutyDetail.setSkuId(orderDetail.getProductSkuId());
|
||||
shopUserDutyDetail.setSkuName(orderDetail.getProductSkuName());
|
||||
shopUserDutyDetail.setProductId(orderDetail.getProductId());
|
||||
@@ -386,7 +394,7 @@ public class DutyService {
|
||||
if (tbProductSku == null) {
|
||||
return;
|
||||
}
|
||||
TbProductWithBLOBs product = productMapper.selectByPrimaryKey(Integer.valueOf(tbProductSku.getProductId()));
|
||||
TbProduct product = productMapper.selectByPrimaryKey(Integer.valueOf(tbProductSku.getProductId()));
|
||||
|
||||
|
||||
if (ObjectUtil.isNotEmpty(product)) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.chaozhanggui.system.cashierservice.bean.constant.TableConstant;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbCashierCart;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbOrderDetail;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ShopEatTypeInfoDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -36,5 +37,29 @@ public interface MpCashierCartService extends IService<TbCashierCart> {
|
||||
*/
|
||||
List<TbCashierCart> selectCart(String useType, String masterId, Integer orderId, Integer shopId, TableConstant.OrderInfo.Status... statusList);
|
||||
|
||||
|
||||
/**
|
||||
* 根据就餐信息查询购物车信息
|
||||
* @param shopEatTypeInfoDTO 就餐信息
|
||||
* @return 购物车信息
|
||||
*/
|
||||
TbCashierCart selectOneCartByShopEatType(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId, Integer productId, Integer skuId, boolean isGift, boolean isTemp, String proName);
|
||||
|
||||
|
||||
/**
|
||||
* 根据店铺id和购物车id查询信息
|
||||
* @param shopId 店铺id
|
||||
* @param cartId 购物车id
|
||||
* @param statuses 状态
|
||||
*/
|
||||
TbCashierCart selectByShopIdAndId(Integer shopId, Integer cartId, TableConstant.OrderInfo.Status... statuses);
|
||||
/**
|
||||
* 根据id查询购物车数据
|
||||
* @param shopId 店铺id
|
||||
* @param orderId 订单id
|
||||
* @param ids 购物车id
|
||||
* @param statuses 状态
|
||||
*/
|
||||
List<TbCashierCart> selectByIds(Integer shopId, Integer orderId, List<Integer> ids, TableConstant.OrderInfo.Status... statuses);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.chaozhanggui.system.cashierservice.bean.constant.TableConstant;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbOrderDetail;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopPermission;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -36,6 +38,26 @@ public interface MpOrderDetailService extends IService<TbOrderDetail> {
|
||||
* 根据订单id删除详情
|
||||
* @param orderId 订单id
|
||||
*/
|
||||
boolean removeByOrderId(String orderId);
|
||||
boolean removeByOrderId(Integer orderId);
|
||||
|
||||
/**
|
||||
* 根据购物车id修改detail价格
|
||||
* @param cartId 购物车id
|
||||
* @param totalAmount 总价格
|
||||
*/
|
||||
boolean updatePriceByCartId(Integer cartId, BigDecimal saleAmount, BigDecimal totalAmount);
|
||||
|
||||
|
||||
boolean updateFieldByCartId(SFunction<TbOrderDetail, ?> field, Object val, List<Integer> cartIds);
|
||||
|
||||
/**
|
||||
* 根据orderId和id修改detail状态
|
||||
* @param oldOrderStatusEnums 原始订单状态
|
||||
* @param orderStatusEnums 状态
|
||||
* @param orderId 订单id
|
||||
* @param orderDetails detailIds
|
||||
* @return 影响数量
|
||||
*/
|
||||
boolean updateStatusByOrderIdAndIds(TableConstant.OrderInfo.Status oldOrderStatusEnums, TableConstant.OrderInfo.Status orderStatusEnums, Integer orderId, List<Integer> orderDetails);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.chaozhanggui.system.cashierservice.bean.constant.TableConstant;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbOrderDetail;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbOrderInfo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -23,5 +24,12 @@ public interface MpOrderInfoService extends IService<TbOrderInfo> {
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean updateStateById(Integer shopId, Integer orderId, TableConstant.Status status);
|
||||
|
||||
boolean incrAmount(Integer orderId, BigDecimal subtract);
|
||||
|
||||
/**
|
||||
* 储值卡退款
|
||||
*/
|
||||
void depositReturn(Integer userId, Integer shopId, BigDecimal returnAmount);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,29 +1,31 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chaozhanggui.system.cashierservice.dao.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ProductStatusDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ProductStockDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.QuerySpecDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.ProductGroupVo;
|
||||
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.mapper.MpShopUnitMapper;
|
||||
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;
|
||||
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
||||
import com.chaozhanggui.system.cashierservice.util.PageHelperUtil;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@@ -49,6 +51,10 @@ public class ProductService {
|
||||
private LimitSubmitAspect limitSubmitAspect;
|
||||
|
||||
private final RabbitProducer producer;
|
||||
@Autowired
|
||||
private TbShopUnitMapper tbShopUnitMapper;
|
||||
@Autowired
|
||||
private MpShopUnitMapper mpShopUnitMapper;
|
||||
|
||||
public ProductService(RabbitProducer producer) {
|
||||
this.producer = producer;
|
||||
@@ -71,7 +77,7 @@ public class ProductService {
|
||||
|
||||
|
||||
public Result queryCommodityInfo(String shopId, String categoryId, String commdityName, Integer page, Integer pageSize, String masterId){
|
||||
List<TbProductWithBLOBs> tbProductWithBLOBs=null;
|
||||
List<TbProduct> tbProductWithBLOBs=null;
|
||||
if(ObjectUtil.isEmpty(categoryId)){
|
||||
tbProductWithBLOBs=tbProductMapper.selectByShopId(shopId,commdityName);
|
||||
}else {
|
||||
@@ -111,7 +117,7 @@ public class ProductService {
|
||||
}
|
||||
|
||||
public Result queryNewCommodityInfo(String shopId, String categoryId, String commdityName, String tableId, int page, int pageSize, String masterId) {
|
||||
List<TbProductWithBLOBs> tbProductWithBLOBs=null;
|
||||
List<TbProduct> tbProductWithBLOBs=null;
|
||||
PageHelperUtil.startPage(page,pageSize);
|
||||
if(ObjectUtil.isEmpty(categoryId)){
|
||||
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndCheckGrounding(shopId,commdityName);
|
||||
@@ -122,9 +128,19 @@ public class ProductService {
|
||||
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndShopTypeCheckGrounding(shopId,categoryId,commdityName);
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, TbShopUnit> shopUnitsMap = new HashMap<>();
|
||||
Set<String> unitIds = tbProductWithBLOBs.stream().map(TbProduct::getUnitId).collect(Collectors.toSet());
|
||||
if (!unitIds.isEmpty()) {
|
||||
List<TbShopUnit> shopUnits = mpShopUnitMapper.selectBatchIds(unitIds);
|
||||
shopUnitsMap = shopUnits.stream()
|
||||
.collect(Collectors.toMap(
|
||||
unit -> String.valueOf(unit.getId()), // 将 id 转换为 String 类型
|
||||
unit -> unit // 直接使用 TbShopUnit 作为值
|
||||
));
|
||||
}
|
||||
String day = DateUtils.getDay();
|
||||
if(ObjectUtil.isNotEmpty(tbProductWithBLOBs)){
|
||||
Map<String, TbShopUnit> finalShopUnitsMap = shopUnitsMap;
|
||||
tbProductWithBLOBs.parallelStream().forEach(it->{
|
||||
Integer orderCount=tbProductMapper.countOrderByshopIdAndProductId(it.getShopId(),it.getId().toString(),masterId,day, tableId);
|
||||
it.setOrderCount((ObjectUtil.isNull(orderCount)||ObjectUtil.isEmpty(orderCount))?0:orderCount);
|
||||
@@ -141,18 +157,23 @@ public class ProductService {
|
||||
it.setSkuList(skuWithBLOBs);
|
||||
|
||||
it.setGroundingSpecInfo(querySpec(Integer.valueOf(shopId), it.getId()));
|
||||
TbShopUnit tbShopUnit = finalShopUnitsMap.get(it.getUnitId());
|
||||
it.setUnitName(tbShopUnit == null ? null : tbShopUnit.getName());
|
||||
if ("package".equals(it.getType())) {
|
||||
it.setProGroupVo(JSONUtil.parseListTNewList(it.getGroupSnap(), ProductGroupVo.class));
|
||||
}
|
||||
});
|
||||
}
|
||||
PageInfo pageInfo=new PageInfo(tbProductWithBLOBs);
|
||||
return Result.success(CodeEnum.SUCCESS,pageInfo);
|
||||
}
|
||||
|
||||
public void incrStock(String productId, String skuId, int addNum) {
|
||||
public void incrStock(String productId, String skuId, BigDecimal addNum) {
|
||||
tbProductMapper.incrStock(productId, addNum);
|
||||
}
|
||||
|
||||
public void decrStock(String productId, String skuId, int decrNum) {
|
||||
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(productId));
|
||||
public void decrStock(String productId, String skuId, BigDecimal decrNum) {
|
||||
TbProduct product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(productId));
|
||||
if (product.getIsStock() == 1) {
|
||||
if (tbProductMapper.decrStock(productId, decrNum) < 1) {
|
||||
throw new MsgException("库存不足,下单失败");
|
||||
|
||||
@@ -50,7 +50,7 @@ public class TbGroupOrderInfoService {
|
||||
*/
|
||||
public Result queryById(Integer id) {
|
||||
TbGroupOrderInfo tbGroupOrderInfo = tbGroupOrderInfoMapper.queryById(id);
|
||||
TbProductWithBLOBs tbProduct = productMapper.selectByPrimaryKey(tbGroupOrderInfo.getProId());
|
||||
TbProduct tbProduct = productMapper.selectByPrimaryKey(tbGroupOrderInfo.getProId());
|
||||
TbProductSkuWithBLOBs tbProductSku = skuMapper.selectByProduct(tbGroupOrderInfo.getProId());
|
||||
|
||||
GroupOrderInfoVo productInfo = new GroupOrderInfoVo();
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbMemberPoints;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 会员积分
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-10-25
|
||||
*/
|
||||
public interface TbMemberPointsService extends IService<TbMemberPoints> {
|
||||
|
||||
|
||||
/**
|
||||
* 追加积分
|
||||
*
|
||||
* @param memberId 会员id
|
||||
* @param points 积分
|
||||
* @param content 摘要信息(如:兑换积分商品/积分抵扣账单/消费赠送积分/新会员送积分/储值赠送积分)
|
||||
* @param orderId 订单id,可以为空
|
||||
* @throws Exception
|
||||
*/
|
||||
boolean addPoints(Long memberId, int points, String content, Long orderId);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbActivateOutRecord;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopCoupon;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 优惠券(TbShopCoupon)表服务接口
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-10-22 15:43:25
|
||||
*/
|
||||
public interface TbShopCouponService {
|
||||
|
||||
boolean refund(List<TbActivateOutRecord> param);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopUnit;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【tb_shop_unit(商品单位)】的数据库操作Service
|
||||
* @createDate 2024-11-26 09:36:19
|
||||
*/
|
||||
public interface TbShopUnitService extends IService<TbShopUnit> {
|
||||
|
||||
Page<TbShopUnit> getShopUnit(Integer shopId, Integer page, Integer size, String name);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbThirdPartyCouponRecord;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【tb_third_party_coupon_record】的数据库操作Service
|
||||
* @createDate 2024-11-26 15:06:35
|
||||
*/
|
||||
public interface TbThirdPartyCouponRecordService extends IService<TbThirdPartyCouponRecord> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.thirdcoupon.CheckCouponDTO;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface ThirdPartyCouponService {
|
||||
|
||||
String getBindUrl(Integer shopId);
|
||||
|
||||
String getUnBindUrl(Integer shopId);
|
||||
|
||||
Map<String, Object> getActivateCoupon(Integer shopId, String code);
|
||||
|
||||
Map<String, Object> checkCoupon(CheckCouponDTO checkCouponDTO);
|
||||
|
||||
Map<String, Object> revokeCoupon(CheckCouponDTO checkCouponDTO);
|
||||
|
||||
Map<String, Object> getState(Integer shopId);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.chaozhanggui.system.cashierservice.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
@@ -9,6 +10,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.chaozhanggui.system.cashierservice.bean.constant.TableConstant;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbCashierCart;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbOrderDetail;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ShopEatTypeInfoDTO;
|
||||
import com.chaozhanggui.system.cashierservice.mybatis.MPCashierCartMapper;
|
||||
import com.chaozhanggui.system.cashierservice.mybatis.MPOrderDetailMapper;
|
||||
import com.chaozhanggui.system.cashierservice.service.MpCashierCartService;
|
||||
@@ -59,5 +61,56 @@ public class MpCashierCartServiceImpl extends ServiceImpl<MPCashierCartMapper, T
|
||||
}
|
||||
return list(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbCashierCart selectOneCartByShopEatType(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId, Integer productId, Integer skuId, boolean isGift, boolean isTemp, String proName) {
|
||||
LambdaQueryWrapper<TbCashierCart> query = new LambdaQueryWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getShopId, shopEatTypeInfoDTO.getShopId())
|
||||
.gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime())
|
||||
.isNull(TbCashierCart::getPlaceNum)
|
||||
.eq(TbCashierCart::getUseType, shopEatTypeInfoDTO.getUseType())
|
||||
.eq(TbCashierCart::getStatus, "create")
|
||||
.eq(TbCashierCart::getIsGift, isGift)
|
||||
.and(q -> q.eq(TbCashierCart::getMasterId, masterId).or().isNull(TbCashierCart::getMasterId));
|
||||
if (isTemp) {
|
||||
query.isNull(TbCashierCart::getProductId).isNull(TbCashierCart::getSkuId).eq(TbCashierCart::getIsTemporary, 1)
|
||||
.eq(TbCashierCart::getSkuName, proName);
|
||||
}else {
|
||||
query.eq(TbCashierCart::getProductId, productId)
|
||||
.eq(TbCashierCart::getSkuId, skuId);
|
||||
}
|
||||
|
||||
// 外带只查询pc和收银机商品
|
||||
if (shopEatTypeInfoDTO.isTakeout()) {
|
||||
query.and(q -> q.isNull(TbCashierCart::getTableId).or().eq(TbCashierCart::getTableId, ""))
|
||||
.in(TbCashierCart::getPlatformType, "pc", "cash");
|
||||
} else {
|
||||
query.eq(TbCashierCart::getTableId, shopEatTypeInfoDTO.getTableId());
|
||||
}
|
||||
|
||||
return getOne(query);
|
||||
}
|
||||
@Override
|
||||
public TbCashierCart selectByShopIdAndId(Integer shopId, Integer cartId, TableConstant.OrderInfo.Status... statuses) {
|
||||
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getShopId, shopId)
|
||||
.eq(TbCashierCart::getId, cartId);
|
||||
if (statuses.length != 0) {
|
||||
queryWrapper.in(TbCashierCart::getStatus, CollUtil.newArrayList(statuses));
|
||||
}
|
||||
return getOne(queryWrapper);
|
||||
}
|
||||
@Override
|
||||
public List<TbCashierCart> selectByIds(Integer shopId, Integer orderId, List<Integer> ids, TableConstant.OrderInfo.Status... statuses) {
|
||||
LambdaQueryWrapper<TbCashierCart> queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getShopId, shopId)
|
||||
.eq(TbCashierCart::getOrderId, orderId)
|
||||
.in(TbCashierCart::getId, ids);
|
||||
if (statuses.length != 0) {
|
||||
queryWrapper.in(TbCashierCart::getStatus, CollUtil.newArrayList(statuses));
|
||||
}
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.chaozhanggui.system.cashierservice.service.impl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.chaozhanggui.system.cashierservice.bean.constant.TableConstant;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbOrderDetailMapper;
|
||||
@@ -20,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -46,9 +48,39 @@ public class MpOrderDetailServiceImpl extends ServiceImpl<MPOrderDetailMapper, T
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeByOrderId(String orderId) {
|
||||
public boolean removeByOrderId(Integer orderId) {
|
||||
return remove(new LambdaQueryWrapper<TbOrderDetail>()
|
||||
.eq(TbOrderDetail::getOrderId, orderId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updatePriceByCartId(Integer cartId, BigDecimal saleAmount, BigDecimal totalAmount) {
|
||||
return update(new LambdaUpdateWrapper<TbOrderDetail>()
|
||||
.eq(TbOrderDetail::getCartId, cartId)
|
||||
.set(TbOrderDetail::getPrice, saleAmount)
|
||||
.set(TbOrderDetail::getPriceAmount, totalAmount));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateFieldByCartId(SFunction<TbOrderDetail, ?> field, Object val, List<Integer> cartIds) {
|
||||
LambdaUpdateWrapper<TbOrderDetail> query = new LambdaUpdateWrapper<TbOrderDetail>()
|
||||
.set(field, val);
|
||||
if (!cartIds.isEmpty()) {
|
||||
query.in(TbOrderDetail::getCartId, cartIds);
|
||||
}
|
||||
return update(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateStatusByOrderIdAndIds(TableConstant.OrderInfo.Status oldOrderStatusEnums, TableConstant.OrderInfo.Status orderStatusEnums, Integer orderId, List<Integer> orderDetails) {
|
||||
LambdaUpdateWrapper<TbOrderDetail> wrapper = new LambdaUpdateWrapper<TbOrderDetail>()
|
||||
.eq(TbOrderDetail::getOrderId, orderId)
|
||||
.in(TbOrderDetail::getId, orderDetails)
|
||||
.set(TbOrderDetail::getStatus, orderStatusEnums.getValue());
|
||||
if (oldOrderStatusEnums != null) {
|
||||
wrapper.eq(TbOrderDetail::getStatus, oldOrderStatusEnums.getValue());
|
||||
}
|
||||
return update(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,28 @@
|
||||
package com.chaozhanggui.system.cashierservice.service.impl;
|
||||
|
||||
import cn.hutool.Hutool;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.chaozhanggui.system.cashierservice.bean.constant.TableConstant;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbOrderDetail;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbOrderInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopUser;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopUserFlow;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.mybatis.MPOrderDetailMapper;
|
||||
import com.chaozhanggui.system.cashierservice.mybatis.MPOrderInfoMapper;
|
||||
import com.chaozhanggui.system.cashierservice.mybatis.MpShopUserFlowMapper;
|
||||
import com.chaozhanggui.system.cashierservice.mybatis.MpShopUserMapper;
|
||||
import com.chaozhanggui.system.cashierservice.service.MpOrderDetailService;
|
||||
import com.chaozhanggui.system.cashierservice.service.MpOrderInfoService;
|
||||
import com.chaozhanggui.system.cashierservice.util.RabbitMsgUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -23,6 +34,16 @@ import java.util.List;
|
||||
@Service
|
||||
public class MpOrderInfoServiceImpl extends ServiceImpl<MPOrderInfoMapper, TbOrderInfo> implements MpOrderInfoService {
|
||||
|
||||
private final MpShopUserMapper mpShopUserMapper;
|
||||
private final MpShopUserFlowMapper mpShopUserFlowMapper;
|
||||
private final RabbitMsgUtils rabbitMsgUtils;
|
||||
|
||||
public MpOrderInfoServiceImpl(MpShopUserMapper mpShopUserMapper, MpShopUserFlowMapper mpShopUserFlowMapper, RabbitMsgUtils rabbitMsgUtils) {
|
||||
this.mpShopUserMapper = mpShopUserMapper;
|
||||
this.mpShopUserFlowMapper = mpShopUserFlowMapper;
|
||||
this.rabbitMsgUtils = rabbitMsgUtils;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateStateById(Integer shopId, Integer orderId, TableConstant.Status status) {
|
||||
return update(new LambdaUpdateWrapper<TbOrderInfo>()
|
||||
@@ -30,5 +51,50 @@ public class MpOrderInfoServiceImpl extends ServiceImpl<MPOrderInfoMapper, TbOrd
|
||||
.eq(TbOrderInfo::getId, orderId)
|
||||
.set(TbOrderInfo::getStatus, status.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean incrAmount(Integer orderId, BigDecimal subtract) {
|
||||
return update(new LambdaUpdateWrapper<TbOrderInfo>()
|
||||
.eq(TbOrderInfo::getId, orderId)
|
||||
.eq(TbOrderInfo::getStatus, TableConstant.OrderInfo.Status.UNPAID.getValue())
|
||||
.apply(StrUtil.format("settlement_amount + {} >= 0", subtract))
|
||||
.setSql(StrUtil.format("settlement_amount=settlement_amount+{}", subtract))
|
||||
.setSql(StrUtil.format("order_amount=order_amount+{}", subtract))
|
||||
.setSql(StrUtil.format("amount=amount+{}", subtract))
|
||||
.setSql(StrUtil.format("origin_amount=origin_amount+{}", subtract))
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void depositReturn(Integer userId, Integer shopId, BigDecimal returnAmount) {
|
||||
TbShopUser user = mpShopUserMapper.selectOne(new LambdaQueryWrapper<TbShopUser>()
|
||||
.eq(TbShopUser::getShopId, shopId)
|
||||
.eq(TbShopUser::getUserId, userId));
|
||||
if (user == null) {
|
||||
throw new MsgException("用户信息不存在");
|
||||
}
|
||||
mpShopUserMapper.incrBalance(user.getId(), shopId, returnAmount, DateUtil.date().getTime());
|
||||
|
||||
TbShopUserFlow flow = new TbShopUserFlow();
|
||||
flow.setShopUserId(user.getId());
|
||||
flow.setBizCode("accountReturnPay");
|
||||
flow.setBizName("会员储值卡退款");
|
||||
flow.setType("+");
|
||||
flow.setAmount(returnAmount);
|
||||
flow.setBalance(user.getAmount().add(returnAmount));
|
||||
flow.setCreateTime(cn.hutool.core.date.DateUtil.date().toTimestamp());
|
||||
flow.setIsReturn("0");
|
||||
mpShopUserFlowMapper.insert(flow);
|
||||
|
||||
JSONObject baObj = new JSONObject();
|
||||
baObj.put("userId", user.getUserId());
|
||||
baObj.put("shopId", user.getShopId());
|
||||
baObj.put("amount", returnAmount);
|
||||
baObj.put("balance", user.getAmount());
|
||||
baObj.put("type", "退款");
|
||||
baObj.put("time", flow.getCreateTime());
|
||||
rabbitMsgUtils.addBalanceRecord(baObj);
|
||||
// producer.balance(baObj.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.chaozhanggui.system.cashierservice.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.map.MapProxy;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbOrderInfoMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbMemberPoints;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbMemberPointsLog;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbOrderInfo;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.mapper.TbMemberPointsLogMapper;
|
||||
import com.chaozhanggui.system.cashierservice.mapper.TbMemberPointsMapper;
|
||||
import com.chaozhanggui.system.cashierservice.service.TbMemberPointsService;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 会员积分
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-10-25
|
||||
*/
|
||||
@Service
|
||||
@Primary
|
||||
public class TbMemberPointsServiceImpl extends ServiceImpl<TbMemberPointsMapper, TbMemberPoints> implements TbMemberPointsService {
|
||||
|
||||
@Resource
|
||||
private TbMemberPointsLogMapper tbMemberPointsLogMapper;
|
||||
@Resource
|
||||
private TbOrderInfoMapper tbOrderInfoMapper;
|
||||
|
||||
|
||||
|
||||
public TbMemberPoints initMemberPoints(Long memberId) {
|
||||
TbMemberPoints entity = super.getOne(Wrappers.<TbMemberPoints>lambdaQuery().eq(TbMemberPoints::getMemberId, memberId));
|
||||
if (entity == null) {
|
||||
throw new MsgException("会员信息不存在");
|
||||
}
|
||||
if (entity.getAccountPoints() == null) {
|
||||
entity.setAccountPoints(0);
|
||||
}
|
||||
super.updateById(entity);
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean addPoints(Long memberId, int points, String content, Long orderId) {
|
||||
TbMemberPoints entity = initMemberPoints(memberId);
|
||||
// 增加账户积分
|
||||
entity.setAccountPoints(entity.getAccountPoints() + points);
|
||||
entity.setLastPointsChangeTime(new Date());
|
||||
entity.setLastFloatPoints(points);
|
||||
// 记录积分变动记录
|
||||
TbMemberPointsLog log = new TbMemberPointsLog();
|
||||
log.setShopId(entity.getShopId());
|
||||
log.setMemberId(entity.getMemberId());
|
||||
log.setMemberName(entity.getMemberName());
|
||||
log.setAvatarUrl(entity.getAvatarUrl());
|
||||
log.setMobile(entity.getMobile());
|
||||
log.setContent(content);
|
||||
log.setFloatType("add");
|
||||
log.setFloatPoints(points);
|
||||
log.setCreateTime(new Date());
|
||||
// 有关联订单的需要回置订单表的相关积分使用字段
|
||||
if (orderId != null) {
|
||||
TbOrderInfo orderInfo = tbOrderInfoMapper.selectById(Math.toIntExact(orderId));
|
||||
if (orderInfo != null) {
|
||||
log.setOrderNo(orderInfo.getOrderNo());
|
||||
}
|
||||
}
|
||||
super.updateById(entity);
|
||||
tbMemberPointsLogMapper.insert(log);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.chaozhanggui.system.cashierservice.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbActivateInRecordMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbActivateOutRecordMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbShopCouponMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbActivateInRecord;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbActivateOutRecord;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopCoupon;
|
||||
import com.chaozhanggui.system.cashierservice.service.TbShopCouponService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 优惠券(TbShopCoupon)表服务实现类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-10-22 15:43:25
|
||||
*/
|
||||
@Service("tbShopCouponService")
|
||||
@Primary
|
||||
public class TbShopCouponServiceImpl implements TbShopCouponService {
|
||||
|
||||
@Autowired
|
||||
private TbActivateInRecordMapper inRecordMapper;
|
||||
@Autowired
|
||||
private TbActivateOutRecordMapper outRecordMapper;
|
||||
|
||||
/**
|
||||
* 退还券
|
||||
*
|
||||
* @param param giveId和 refNum 必传
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean refund(List<TbActivateOutRecord> param) {
|
||||
for (TbActivateOutRecord outRecord : param) {
|
||||
outRecord.setUpdateTime(new Date());
|
||||
outRecordMapper.updateRefNum(outRecord.getId(), outRecord.getRefNum());
|
||||
TbActivateInRecord inRecord = inRecordMapper.queryById(outRecord.getGiveId());
|
||||
inRecord.setOverNum(inRecord.getOverNum() + outRecord.getRefNum());
|
||||
inRecordMapper.updateOverNum(inRecord.getId(), inRecord.getOverNum());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.chaozhanggui.system.cashierservice.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopUnit;
|
||||
import com.chaozhanggui.system.cashierservice.mapper.MpShopUnitMapper;
|
||||
import com.chaozhanggui.system.cashierservice.service.TbShopUnitService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【tb_shop_unit(商品单位)】的数据库操作Service实现
|
||||
* @createDate 2024-11-26 09:36:19
|
||||
*/
|
||||
@Service
|
||||
public class TbShopUnitServiceImpl extends ServiceImpl<MpShopUnitMapper, TbShopUnit>
|
||||
implements TbShopUnitService{
|
||||
|
||||
@Override
|
||||
public Page<TbShopUnit> getShopUnit(Integer shopId, Integer page, Integer size, String name) {
|
||||
LambdaQueryWrapper<TbShopUnit> query = new LambdaQueryWrapper<TbShopUnit>().eq(TbShopUnit::getShopId, shopId);
|
||||
if (StrUtil.isNotBlank(name)) {
|
||||
query.like(TbShopUnit::getName, name);
|
||||
}
|
||||
return page(new Page<>(page, size), query);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.chaozhanggui.system.cashierservice.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbThirdPartyCouponRecord;
|
||||
import com.chaozhanggui.system.cashierservice.service.TbThirdPartyCouponRecordService;
|
||||
import com.chaozhanggui.system.cashierservice.mapper.TbThirdPartyCouponRecordMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @description 针对表【tb_third_party_coupon_record】的数据库操作Service实现
|
||||
* @createDate 2024-11-26 15:06:35
|
||||
*/
|
||||
@Service
|
||||
public class TbThirdPartyCouponRecordServiceImpl extends ServiceImpl<TbThirdPartyCouponRecordMapper, TbThirdPartyCouponRecord>
|
||||
implements TbThirdPartyCouponRecordService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.chaozhanggui.system.cashierservice.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.thirdcoupon.CheckCouponDTO;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.mybatis.MpShopInfoMapper;
|
||||
import com.chaozhanggui.system.cashierservice.resp.PhpCommonResp;
|
||||
import com.chaozhanggui.system.cashierservice.service.ThirdPartyCouponService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class ThirdPartyCouponServiceImpl implements ThirdPartyCouponService {
|
||||
|
||||
private final MpShopInfoMapper mpShopInfoMapper;
|
||||
@Value("${phpServer}")
|
||||
private String phpServerUrl;
|
||||
|
||||
public ThirdPartyCouponServiceImpl(RestTemplate restTemplate, MpShopInfoMapper mpShopInfoMapper) {
|
||||
this.restTemplate = restTemplate;
|
||||
this.mpShopInfoMapper = mpShopInfoMapper;
|
||||
}
|
||||
private final RestTemplate restTemplate;
|
||||
|
||||
private <R, T> R exec(String url, Integer shopId, T data) {
|
||||
// 获取店铺信息
|
||||
TbShopInfo shopInfo = mpShopInfoMapper.selectById(shopId);
|
||||
if (shopInfo == null) {
|
||||
throw new MsgException("店铺信息不存在");
|
||||
}
|
||||
|
||||
// 设置请求头
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.set("account", shopId.toString());
|
||||
|
||||
// 构造请求实体,根据 data 是否为空设置请求体
|
||||
HttpEntity<Object> entity;
|
||||
if (data != null) {
|
||||
Map<String, Object> map;
|
||||
if (data instanceof Map) {
|
||||
map = (Map<String, Object>) data;
|
||||
}else {
|
||||
map = BeanUtil.beanToMap(data, false, false);
|
||||
}
|
||||
map.put("title", shopInfo.getShopName());
|
||||
entity = new HttpEntity<>(map, headers);
|
||||
} else {
|
||||
entity = new HttpEntity<>(new HashMap<String, Object>(){{
|
||||
put("title", shopInfo.getShopName());
|
||||
}},headers);
|
||||
}
|
||||
|
||||
// 发起请求
|
||||
ResponseEntity<PhpCommonResp> response = restTemplate.exchange(
|
||||
phpServerUrl + url,
|
||||
HttpMethod.POST, // 使用 POST 请求发送 body 数据
|
||||
entity,
|
||||
PhpCommonResp.class
|
||||
);
|
||||
|
||||
// 处理响应
|
||||
PhpCommonResp<?> resp = response.getBody();
|
||||
if (resp == null) {
|
||||
throw new MsgException("请求php服务器失败");
|
||||
}
|
||||
if (!"1".equals(resp.getCode())) {
|
||||
throw new MsgException(resp.getMsg());
|
||||
}
|
||||
|
||||
// 返回数据
|
||||
return (R) resp.getData();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getBindUrl(Integer shopId) {
|
||||
return exec("/meituan/getuisdkurl", shopId, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnBindUrl(Integer shopId) {
|
||||
return exec("/meituan/getuisdkuniurl", shopId, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getActivateCoupon(Integer shopId, String code) {
|
||||
return exec("/meituan/fulfilmentcertificateprepare", shopId, new HashMap<String, Object>(){{
|
||||
put("code", code);
|
||||
}});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> checkCoupon(CheckCouponDTO checkCouponDTO) {
|
||||
return exec("/meituan/certificateprepare", checkCouponDTO.getShopId(), checkCouponDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> revokeCoupon(CheckCouponDTO checkCouponDTO) {
|
||||
return exec("/meituan/fulfilmentcertificatecancel", checkCouponDTO.getShopId(), checkCouponDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getState(Integer shopId) {
|
||||
return exec("/meituan/searchstorestatus", shopId, null);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.chaozhanggui.system.cashierservice.bean.OrderUseTypeEnum;
|
||||
@@ -27,6 +28,7 @@ import org.apache.http.util.EntityUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
@@ -120,24 +122,29 @@ public class FeieyunPrintUtil {
|
||||
|
||||
}
|
||||
|
||||
public static String buildPrintContent(String pickupNumber, String date, String productName, Integer number, String remark) {
|
||||
public static String buildPrintContent(String pickupNumber, String date, String productName, Integer number, String remark, String proGroupInfo) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("<CB>" + pickupNumber + "</CB><BR><BR>");
|
||||
builder.append("<L>时间: " + date + " </L><BR><BR><BR>");
|
||||
remark = StrUtil.emptyToDefault(remark, "");
|
||||
if (productName.length() > 4 || remark.length() > 4) {
|
||||
builder.append("<B><BOLD>" + productName + " x " + number + "</BOLD></B><BR><BR>");
|
||||
builder.append("<B><BOLD>" + remark + " </BOLD></B><BR>");
|
||||
} else {
|
||||
builder.append("<B><BOLD>" + productName + " x " + number + "</BOLD></B><BR><BR>");
|
||||
builder.append("<B><BOLD>" + remark + " </BOLD></B><BR>");
|
||||
builder.append("<B><BOLD>" + remark + " </BOLD></B><BR><BR>");
|
||||
if (!StrUtil.isBlank(proGroupInfo) && cn.hutool.json.JSONUtil.isJsonArray(proGroupInfo)) {
|
||||
JSONArray subItems = cn.hutool.json.JSONUtil.parseArray(proGroupInfo);
|
||||
for (int i = 0; i < subItems.size(); i++) {
|
||||
String proName = subItems.getJSONObject(i).getStr("proName");
|
||||
int qty = subItems.getJSONObject(i).getInt("number");
|
||||
builder.append("<B>("+(i+1)+")"+proName + " x " + qty + "</B><BR>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//builder.append("<CUT>");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public static String[] getPrintData(String sn, TbOrderInfo orderInfo, String date, String productName, Integer number, String remark) {
|
||||
String content = buildPrintContent(getPickupNum(orderInfo), date, productName, number, remark);
|
||||
public static String[] getPrintData(String sn, TbOrderInfo orderInfo, String date, String productName, Integer number, String remark, String proGroupInfo) {
|
||||
String content = buildPrintContent(getPickupNum(orderInfo), date, productName, number, remark, proGroupInfo);
|
||||
|
||||
System.out.println("content:".concat(content));
|
||||
|
||||
@@ -230,37 +237,50 @@ public class FeieyunPrintUtil {
|
||||
for (OrderDetailPO.Detail detail : detailPO.getDetailList()) {
|
||||
String productName = detail.getProductName();
|
||||
String number = detail.getNumber();
|
||||
String amount = detail.getAmount();
|
||||
String amount = toPlainStr(detail.getAmount());
|
||||
//58mm的机器,一行打印16个汉字,32个字母; 80mm的机器,一行打印24个汉字,48个字母
|
||||
//展示4列 b1代表名称列占用(14个字节) b2单价列(6个字节) b3数量列(3个字节) b4金额列(6个字节)-->这里的字节数可按自己需求自由改写,14+6+3+6再加上代码写的3个空格就是32了,58mm打印机一行总占32字节
|
||||
//String row = FeieYunUtil.getRow(productName, "",number, amount, 14, 6,3, 6)
|
||||
//展示3列 b1代表名称列占用(20个字节) b2单价列(0个字节) b3数量列(3个字节) b4金额列(6个字节)-->这里的字节数可按自己需求自由改写,20+0+3+6再加上代码写的3个空格就是32了,58mm打印机一行总占32字节
|
||||
String row = FeieYunUtil.getRow(productName, "", number, amount, 20, 0, 3, 6);
|
||||
data.append(row);
|
||||
if (StrUtil.isBlank(detail.getSpec())) {
|
||||
if (StrUtil.isNotBlank(detail.getSpec())) {
|
||||
data.append("规格:" + detail.getSpec() + "<BR>");
|
||||
}
|
||||
String proGroupInfo = detail.getProGroupInfo();
|
||||
if (StrUtil.isBlank(proGroupInfo)) {
|
||||
continue;
|
||||
}
|
||||
data.append("规格:" + detail.getSpec() + "<BR>");
|
||||
if (!JSONUtil.isJsonArray(proGroupInfo)) {
|
||||
continue;
|
||||
}
|
||||
JSONArray subItems = JSONUtil.parseArray(proGroupInfo);
|
||||
for (int i = 0; i < subItems.size(); i++) {
|
||||
String proName = subItems.getJSONObject(i).getStr("proName");
|
||||
int qty = subItems.getJSONObject(i).getInt("number");
|
||||
String subRow = FeieYunUtil.getRow(" - "+proName, "", qty+".00", "0.00", 20, 0, 3, 6);
|
||||
data.append(subRow);
|
||||
}
|
||||
}
|
||||
log.error("打印数据>>>>>>>>>>>>>>>>>>>>>:{}{}", detailPO.getDiscountAmount(), detailPO.getDiscountAdio());
|
||||
if (ObjectUtil.isNotNull(detailPO.getDiscountAmount()) && ObjectUtil.isNotNull(detailPO.getDiscountAdio())) {
|
||||
data.append("--------------------------------<BR>");
|
||||
data.append(StrUtil.format("原价:{}<BR>", detailPO.getReceiptsAmount()));
|
||||
data.append(StrUtil.format("折扣:-{}<BR>", NumberUtil.null2Zero(new BigDecimal(detailPO.getDiscountAmount())).toPlainString()));
|
||||
data.append(StrUtil.format("原价:{}<BR>", toPlainStr(detailPO.getReceiptsAmount())));
|
||||
data.append(StrUtil.format("折扣:-{}<BR>", toPlainStr(detailPO.getDiscountAmount())));
|
||||
}
|
||||
data.append("--------------------------------<BR>");
|
||||
String t = "¥" + (ObjectUtil.isEmpty(detailPO.getDiscountAmount()) || ObjectUtil.isNull(detailPO.getDiscountAmount()) ? detailPO.getReceiptsAmount() : new BigDecimal(detailPO.getReceiptsAmount()).subtract(new BigDecimal(detailPO.getDiscountAmount())).toPlainString());
|
||||
String t = "¥" + (ObjectUtil.isEmpty(detailPO.getDiscountAmount()) || ObjectUtil.isNull(detailPO.getDiscountAmount()) ? toPlainStr(detailPO.getReceiptsAmount()) : NumberUtil.sub(new BigDecimal(detailPO.getReceiptsAmount()), new BigDecimal(detailPO.getDiscountAmount())).setScale(2, RoundingMode.DOWN).toPlainString());
|
||||
if (orderType.equals("return")) {
|
||||
data.append(StrUtil.format("<B>应退:{}</B><BR>", t));
|
||||
} else {
|
||||
data.append(StrUtil.format("<B>应收:{}</B><BR>", t));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(detailPO.getPayType()) && ObjectUtil.isNotNull(detailPO.getPayType()) && detailPO.getPayType().equals("deposit")) {
|
||||
data.append(StrUtil.format("储值:{}<BR>", detailPO.getReceiptsAmount()));
|
||||
data.append("--------------------------------<BR>");
|
||||
if (ObjectUtil.isNotEmpty(detailPO.getPayType()) && ObjectUtil.isNotNull(detailPO.getPayType()) && detailPO.getPayType().equals("deposit")) {
|
||||
data.append(StrUtil.format("储值:{}<BR>", toPlainStr(detailPO.getReceiptsAmount())));
|
||||
data.append(StrUtil.format("积分:{}<BR>", detailPO.getIntegral()));
|
||||
}
|
||||
data.append(StrUtil.format("余额:{}<BR>", detailPO.getBalance()));
|
||||
data.append(StrUtil.format("余额:{}<BR>", toPlainStr(detailPO.getBalance())));
|
||||
data.append("--------------------------------<BR>");
|
||||
if (ObjectUtil.isNotEmpty(detailPO.getRemark()) && ObjectUtil.isNotNull(detailPO.getRemark())) {
|
||||
data.append(StrUtil.format("<L><BOLD>备注:{}</BOLD></L><BR>", detailPO.getRemark()));
|
||||
@@ -270,6 +290,13 @@ public class FeieyunPrintUtil {
|
||||
return data.toString();
|
||||
}
|
||||
|
||||
private static String toPlainStr(String str) {
|
||||
if (StrUtil.isBlank(str)) {
|
||||
return "0";
|
||||
}
|
||||
return NumberUtil.roundDown(new BigDecimal(str), 2).toPlainString();
|
||||
}
|
||||
|
||||
public static String[] getCashPrintData(OrderDetailPO detailPO, String sn, String type, String orderType, String printerNum) {
|
||||
String content = buildPrintContent(detailPO, type, orderType);
|
||||
|
||||
@@ -488,12 +515,17 @@ public class FeieyunPrintUtil {
|
||||
public static void main(String[] args) {
|
||||
//testPrint();
|
||||
//testPrint2();
|
||||
testPrint3();
|
||||
String a = "12.0000";
|
||||
String s = new BigDecimal(a).setScale(2, RoundingMode.DOWN).toPlainString();
|
||||
System.out.println(s);
|
||||
String s1 = toPlainStr(a);
|
||||
System.out.println(s1);
|
||||
//testPrint3();
|
||||
}
|
||||
|
||||
public static void testPrint() {
|
||||
String STIME = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
String content = buildPrintContent("123456789", "2024-10-10 18:11:11", "澳洲大龙虾", 1, "一只吃爽爽");
|
||||
String content = buildPrintContent("123456789", "2024-10-10 18:11:11", "澳洲大龙虾", 1, "一只吃爽爽","");
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
// 参考文档:https://help.feieyun.com/home/doc/zh;nav=0-2
|
||||
paramMap.put("user", USER);
|
||||
@@ -516,7 +548,7 @@ public class FeieyunPrintUtil {
|
||||
*/
|
||||
public static void testPrint2() {
|
||||
String STIME = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
String content = buildPrintContent("123456789", "2024-10-10 18:11:11", "澳洲大龙虾", 1, "一只吃爽爽");
|
||||
String content = buildPrintContent("123456789", "2024-10-10 18:11:11", "澳洲大龙虾", 1, "一只吃爽爽","");
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
// 参考文档:https://help.feieyun.com/home/doc/zh;nav=0-2
|
||||
paramMap.put("user", USER);
|
||||
@@ -536,7 +568,7 @@ public class FeieyunPrintUtil {
|
||||
*/
|
||||
public static void testPrint3() {
|
||||
String STIME = String.valueOf(System.currentTimeMillis() / 1000);
|
||||
String content = buildPrintContent("123456789", "2024-10-10 18:11:11", "澳洲大龙虾", 1, "一只吃爽爽");
|
||||
String content = buildPrintContent("123456789", "2024-10-10 18:11:11", "澳洲大龙虾", 1, "一只吃爽爽","");
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
// 参考文档:https://help.feieyun.com/home/doc/zh;nav=0-2
|
||||
paramMap.put("user", USER);
|
||||
@@ -551,7 +583,4 @@ public class FeieyunPrintUtil {
|
||||
System.out.println(UnicodeUtil.toString(resp));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.chaozhanggui.system.cashierservice.util;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.CallNumPrintPO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProductInfoPO;
|
||||
@@ -18,6 +20,7 @@ import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -77,7 +80,7 @@ public class PrinterUtils {
|
||||
* @param remark sku规格名
|
||||
* @param note 备注
|
||||
*/
|
||||
public static String getPrintData(String type, String pickupNumber, String date, String productName, Integer number, String remark, String note) {
|
||||
public static String getPrintData(String type, String pickupNumber, String date, String productName, Integer number, String remark, String note, String proGroupInfo) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
if ("return".equals(type)) {
|
||||
builder.append("<C><B>").append(pickupNumber).append("【退】</B></C><BR><BR>");
|
||||
@@ -87,12 +90,12 @@ public class PrinterUtils {
|
||||
builder.append("<S><L>时间: ").append(date).append(" </L></S><BR><BR><BR>");
|
||||
remark = StrUtil.emptyToDefault(remark, "");
|
||||
if (productName.length() > 4 || remark.length() > 4) {
|
||||
builder.append("<CS:32>").append(productName).append(" ").append(number).append("</CS><BR>");
|
||||
builder.append("<CS:32>").append(productName).append(" x ").append(number).append("</CS><BR>");
|
||||
if (StrUtil.isNotBlank(remark)) {
|
||||
builder.append("<CS:32>").append(remark).append(" </CS><BR>");
|
||||
}
|
||||
} else {
|
||||
builder.append("<B>").append(productName).append(" ").append(number).append("</B><BR>");
|
||||
builder.append("<B>").append(productName).append(" x ").append(number).append("</B><BR>");
|
||||
if (StrUtil.isNotBlank(remark)) {
|
||||
builder.append("<B>").append(remark).append(" </B><BR>");
|
||||
}
|
||||
@@ -100,6 +103,14 @@ public class PrinterUtils {
|
||||
if (StrUtil.isNotBlank(note)) {
|
||||
builder.append("<S><L>备注: ").append(note == null ? "" : note).append(" </L></S><BR>");
|
||||
}
|
||||
if (!StrUtil.isBlank(proGroupInfo) && cn.hutool.json.JSONUtil.isJsonArray(proGroupInfo)) {
|
||||
JSONArray subItems = cn.hutool.json.JSONUtil.parseArray(proGroupInfo);
|
||||
for (int i = 0; i < subItems.size(); i++) {
|
||||
String proName = subItems.getJSONObject(i).getStr("proName");
|
||||
int qty = subItems.getJSONObject(i).getInt("number");
|
||||
builder.append("<CS:32>("+(i+1)+")"+proName + " x " + qty + "</CS><BR>");
|
||||
}
|
||||
}
|
||||
builder.append("<OUT:150>");
|
||||
builder.append("<PCUT>");
|
||||
return builder.toString();
|
||||
@@ -107,91 +118,81 @@ public class PrinterUtils {
|
||||
|
||||
|
||||
public static String getCashPrintData(OrderDetailPO detailPO, String type, String orderType) {
|
||||
|
||||
log.info("getCashPrintData detailPO:{},type:{},orderType:{}", JSONUtil.toJSONString(detailPO), type, orderType);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("<C><B>").append(detailPO.getMerchantName()).append("</B></C><BR><BR>");
|
||||
sb.append("<C><BOLD>").append(type).append("【").append(detailPO.getMasterId()).append("】</BOLD></C><BR><BR>");
|
||||
if (Objects.nonNull(detailPO.getOutNumber())) {
|
||||
sb.append("<CB><BOLD>").append(detailPO.getOutNumber()).append("</BOLD></CB><BR><BR>");
|
||||
}
|
||||
|
||||
sb.append("<S><L>订单号: ").append(detailPO.getOrderNo()).append(" </L></S><BR>");
|
||||
sb.append("<S><L>交易时间: ").append(detailPO.getTradeDate()).append(" </L></S><BR>");
|
||||
sb.append("<S><L>收银员: ").append(detailPO.getOperator()).append(" </L></S><BR><BR><BR>");
|
||||
char paddingCharacter = ' ';
|
||||
sb.append("<S>").append(String.format("%-15s", "品名").replace(' ', paddingCharacter)).append(String.format("%-4s", "数量").replace(' ', paddingCharacter)).append(String.format("%4s", "小计").replace(' ', paddingCharacter)).append("<S><BR>");
|
||||
sb.append("------------------------<BR>");
|
||||
StringBuffer data = new StringBuffer();
|
||||
data.append(StrUtil.format("<C><F>{}</F></C><BR>", detailPO.getMerchantName()));
|
||||
data.append("<BR>");
|
||||
data.append("<OUT:30>");
|
||||
data.append(StrUtil.format("<C><BOLD>{}【{}】</BOLD></C><BR>", type, detailPO.getMasterId()));
|
||||
//if (Objects.nonNull(detailPO.getOutNumber())) {
|
||||
// data.append(StrUtil.format("<CB><BOLD>{}</BOLD></CB>",detailPO.getOutNumber()));
|
||||
//}
|
||||
data.append("<OUT:30>");
|
||||
data.append("<BR>");
|
||||
data.append(StrUtil.format("<S>订单号:{}</S><BR>", detailPO.getOrderNo()));
|
||||
data.append(StrUtil.format("<S>交易时间:{}</S><BR>", detailPO.getTradeDate()));
|
||||
data.append(StrUtil.format("<S>收银员:{}</S><BR>", detailPO.getOperator()));
|
||||
data.append("<OUT:15>");
|
||||
data.append("<BR>");
|
||||
data.append("<S>品名 数量 小计</S><BR>");
|
||||
data.append("<S>--------------------------------</S><BR>");
|
||||
for (OrderDetailPO.Detail detail : detailPO.getDetailList()) {
|
||||
|
||||
if (detail.getProductName().length() > 4 && detail.getProductName().length() <= 10) {
|
||||
|
||||
int count = getProducrName(detail.getProductName());
|
||||
if (count <= 0) {
|
||||
int length = 15 - (detail.getProductName().length() - 4);
|
||||
sb.append("<S>").append(String.format("%-" + length + "s", detail.getProductName()).replace(' ', paddingCharacter)).append(String.format("%-4s", detail.getNumber()).replace(' ', paddingCharacter)).append(String.format("%8s", detail.getAmount()).replace(' ', paddingCharacter)).append("</S><BR>");
|
||||
} else {
|
||||
int length = 15 + count - (detail.getProductName().length() - 4);
|
||||
sb.append("<S>").append(String.format("%-" + length + "s", detail.getProductName()).replace(' ', paddingCharacter)).append(String.format("%-4s", detail.getNumber()).replace(' ', paddingCharacter)).append(String.format("%8s", detail.getAmount()).replace(' ', paddingCharacter)).append("</S><BR>");
|
||||
String number = detail.getNumber();
|
||||
String row = YunXiangYinUtil.getRow(detail.getProductName(), "", number, toPlainStr(detail.getAmount()), 20, 0, 3, 6);
|
||||
data.append(row);
|
||||
if (StrUtil.isNotBlank(detail.getSpec())) {
|
||||
data.append("<S>规格:").append(detail.getSpec()).append("</S><BR>");
|
||||
}
|
||||
|
||||
} else if (detail.getProductName().length() > 10) {
|
||||
|
||||
sb.append("<S>").append(detail.getProductName()).append("</S><BR>");
|
||||
sb.append("<S>").append(String.format("%20s", detail.getNumber()).replace(' ', paddingCharacter)).append(String.format("%11s", detail.getAmount()).replace(' ', paddingCharacter)).append("</S><BR>");
|
||||
|
||||
} else {
|
||||
sb.append("<S>").append(String.format("%-15s", detail.getProductName()).replace(' ', paddingCharacter)).append(String.format("%-4s", detail.getNumber()).replace(' ', paddingCharacter)).append(String.format("%8s", detail.getAmount()).replace(' ', paddingCharacter)).append("</S><BR>");
|
||||
String proGroupInfo = detail.getProGroupInfo();
|
||||
if (StrUtil.isBlank(proGroupInfo)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (detail.getSpec() != null && ObjectUtil.isNotEmpty(detail.getSpec())) {
|
||||
sb.append("<S>规格:").append(detail.getSpec()).append("</S><BR>");
|
||||
if (!cn.hutool.json.JSONUtil.isJsonArray(proGroupInfo)) {
|
||||
continue;
|
||||
}
|
||||
JSONArray subItems = cn.hutool.json.JSONUtil.parseArray(proGroupInfo);
|
||||
for (int i = 0; i < subItems.size(); i++) {
|
||||
String proName = subItems.getJSONObject(i).getStr("proName");
|
||||
int qty = subItems.getJSONObject(i).getInt("number");
|
||||
String subRow = YunXiangYinUtil.getRow(" - "+proName, "", qty+".00", "0.00", 20, 0, 3, 6);
|
||||
data.append(subRow);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotNull(detailPO.getDiscountAmount()) && ObjectUtil.isNotNull(detailPO.getDiscountAdio())) {
|
||||
sb.append("------------------------<BR>");
|
||||
sb.append("<S>原价:".concat(String.format("%15s", detailPO.getReceiptsAmount()).replace(' ', paddingCharacter)).concat("</S><BR>"));
|
||||
sb.append("<S>折扣: ".concat(String.format("%15s", "-".concat(new BigDecimal(detailPO.getDiscountAmount()).toPlainString())).replace(' ', paddingCharacter)).concat("</S><BR>"));
|
||||
data.append("<S>--------------------------------</S><BR>");
|
||||
data.append(StrUtil.format("<S>原价:{}</S><BR>", toPlainStr(detailPO.getReceiptsAmount())));
|
||||
data.append(StrUtil.format("<S>折扣:-{}</S><BR>", toPlainStr(detailPO.getDiscountAmount())));
|
||||
}
|
||||
|
||||
|
||||
sb.append("------------------------<BR>");
|
||||
String t = "¥" + (ObjectUtil.isEmpty(detailPO.getDiscountAmount()) || ObjectUtil.isNull(detailPO.getDiscountAmount()) ? detailPO.getReceiptsAmount() : new BigDecimal(detailPO.getReceiptsAmount()).subtract(new BigDecimal(detailPO.getDiscountAmount())).toPlainString());
|
||||
t = String.format("%11s", t).replace(' ', paddingCharacter);
|
||||
data.append("<S>--------------------------------</S><BR>");
|
||||
String t = "¥" + (ObjectUtil.isEmpty(detailPO.getDiscountAmount()) || ObjectUtil.isNull(detailPO.getDiscountAmount()) ? toPlainStr(detailPO.getReceiptsAmount()) : NumberUtil.sub(new BigDecimal(detailPO.getReceiptsAmount()), new BigDecimal(detailPO.getDiscountAmount())).setScale(2, RoundingMode.DOWN).toPlainString());
|
||||
if (orderType.equals("return")) {
|
||||
sb.append("<F>应退" + t + "</F><BR>");
|
||||
data.append("<F>应退" + t + "</F><BR>");
|
||||
data.append(StrUtil.format("<F>应收:{}</F><BR>", t));
|
||||
} else {
|
||||
sb.append("<F>实付" + t + "</F><BR>");
|
||||
|
||||
data.append(StrUtil.format("<F>应收:{}</F><BR>", t));
|
||||
}
|
||||
data.append("<S>--------------------------------</S><BR>");
|
||||
if (ObjectUtil.isNotEmpty(detailPO.getPayType()) && ObjectUtil.isNotNull(detailPO.getPayType()) && detailPO.getPayType().equals("deposit")) {
|
||||
sb.append("<S>储值¥" + detailPO.getReceiptsAmount() + " </S><BR>");
|
||||
sb.append("------------------------<BR>");
|
||||
sb.append("<S>积分:" + detailPO.getIntegral() + "</S><BR>");
|
||||
data.append(StrUtil.format("<S>储值:{}</S><BR>", toPlainStr(detailPO.getReceiptsAmount())));
|
||||
data.append(StrUtil.format("<S>积分:{}</S><BR>", detailPO.getIntegral()));
|
||||
}
|
||||
|
||||
sb.append("<S>余额:" + detailPO.getBalance() + "</S><BR>");
|
||||
sb.append("------------------------<BR>");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(detailPO.getRemark()) && ObjectUtil.isNotNull(detailPO.getRemark())) {
|
||||
sb.append("<L>备注:" + detailPO.getRemark() + "</L><BR>");
|
||||
}
|
||||
|
||||
|
||||
data.append(StrUtil.format("<S>余额:{}</S><BR>", toPlainStr(detailPO.getBalance())));
|
||||
data.append("<S>--------------------------------</S><BR>");
|
||||
data.append(StrUtil.format("<L><BOLD>备注:{}</BOLD></L><BR>", detailPO.getRemark()));
|
||||
if (Objects.nonNull(detailPO.getOutNumber())) {
|
||||
sb.append("<QR>".concat(detailPO.getOutNumber()).concat("</QR><BR>"));
|
||||
data.append("<QR>".concat(detailPO.getOutNumber()).concat("</QR><BR>"));
|
||||
}
|
||||
data.append("<S>打印时间:" + DateUtils.getTime(new Date()) + "</S><BR>");
|
||||
data.append("<OUT:180>");
|
||||
data.append("<PCUT>");
|
||||
return data.toString();
|
||||
}
|
||||
|
||||
|
||||
sb.append("<S>打印时间:" + DateUtils.getTime(new Date()) + "</S><BR>");
|
||||
|
||||
sb.append("<OUT:180>");
|
||||
sb.append("<PCUT>");
|
||||
return sb.toString();
|
||||
|
||||
private static String toPlainStr(String str) {
|
||||
if (StrUtil.isBlank(str)) {
|
||||
return "0";
|
||||
}
|
||||
return NumberUtil.roundDown(new BigDecimal(str), 2).toPlainString();
|
||||
}
|
||||
|
||||
public static String getCallNumPrintData(CallNumPrintPO po) {
|
||||
@@ -383,21 +384,11 @@ public class PrinterUtils {
|
||||
header.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
||||
|
||||
HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(multiValueMap, header);
|
||||
String httpResponse;
|
||||
try {
|
||||
httpResponse = restTemplate.postForObject(URL_STR,
|
||||
String httpResponse = restTemplate.postForObject(URL_STR,
|
||||
httpEntity, String.class);
|
||||
|
||||
System.out.println("map" + httpResponse);
|
||||
return httpResponse;
|
||||
} catch (Exception e) {
|
||||
if (StrUtil.containsAny(e.getMessage(), "timed out")) {
|
||||
log.error("请求云享印超时,请稍后再试");
|
||||
httpResponse = "{\"code\":-1, \"msg\":\"请求云享印超时,请稍后再试\"}";
|
||||
} else {
|
||||
httpResponse = "{\"code\":-2, \"msg\":\"请求云享印出错,请稍后再试\"}";
|
||||
}
|
||||
}
|
||||
return httpResponse;
|
||||
}
|
||||
|
||||
|
||||
@@ -465,7 +456,11 @@ public class PrinterUtils {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
String str = "{\"bizType\":\"2\",\"broadCastType\":\"1\",\"money\":\"10000000\"}";
|
||||
printTickets(str, 2, 1, "BSJQG01YJ0001", null);
|
||||
if (1 == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
List<HandoverInfo.PayInfo> payInfos = new ArrayList<>();
|
||||
|
||||
@@ -73,4 +73,11 @@ public class RabbitMsgUtils implements RabbitTemplate.ConfirmCallback {
|
||||
}
|
||||
|
||||
|
||||
public void addBalanceRecord(JSONObject baObj) {
|
||||
sendMsg(RabbitConstants.EXCHANGE_BALANCE, RabbitConstants.ROUTING_KEY_BALANCE, baObj, "储值卡记录", true);
|
||||
}
|
||||
|
||||
public void updateCons(JSONObject jsonObject1) {
|
||||
sendMsg(RabbitConstants.EXCHANGE_CONS, RabbitConstants.ROUTING_KEY_CONS, jsonObject1, "储值卡记录", true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
package com.chaozhanggui.system.cashierservice.util;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author tankaikai
|
||||
* @since 2024-10-15 15:12
|
||||
*/
|
||||
@UtilityClass
|
||||
public class YunXiangYinUtil {
|
||||
|
||||
public String titleAddSpace(String str, int b1) {
|
||||
int k = 0;
|
||||
int b = b1;
|
||||
try {
|
||||
k = str.getBytes("GBK").length;
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
for (int i = 0; i < b - k; i++) {
|
||||
str += " ";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public static String getStringByEnter(int length, String string) throws Exception {
|
||||
for (int i = 1; i <= string.length(); i++) {
|
||||
if (string.substring(0, i).getBytes("GBK").length > length) {
|
||||
return "<S>" + string.substring(0, i - 1) + "</S><BR>" + getStringByEnter(length, string.substring(i - 1));
|
||||
}
|
||||
}
|
||||
return "<S>" + string + "</S>";
|
||||
}
|
||||
|
||||
public static String addSpace(String str, int size) {
|
||||
int len = str.length();
|
||||
if (len < size) {
|
||||
for (int i = 0; i < size - len; i++) {
|
||||
str += " ";
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public static Boolean isEn(String str) {
|
||||
Boolean b = false;
|
||||
try {
|
||||
b = str.getBytes("GBK").length == str.length();
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
public static List<String> getStrList(String inputString, int length) {
|
||||
int size = inputString.length() / length;
|
||||
if (inputString.length() % length != 0) {
|
||||
size += 1;
|
||||
}
|
||||
return getStrList(inputString, length, size);
|
||||
}
|
||||
|
||||
public static List<String> getStrList(String inputString, int length, int size) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
for (int index = 0; index < size; index++) {
|
||||
String childStr = substring(inputString, index * length, (index + 1) * length);
|
||||
list.add(childStr);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static String substring(String str, int f, int t) {
|
||||
if (f > str.length()) {
|
||||
return null;
|
||||
}
|
||||
if (t > str.length()) {
|
||||
return str.substring(f, str.length());
|
||||
} else {
|
||||
return str.substring(f, t);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取对齐后的小票明细行数据
|
||||
* 58mm的机器,一行打印16个汉字,32个字母;80mm的机器,一行打印24个汉字,48个字母
|
||||
* b1代表名称列占用字节 b2单价列 b3数量列 b4金额列-->这里的字节数可按自己需求自由改写
|
||||
*
|
||||
* @param title 品名
|
||||
* @param price 单价
|
||||
* @param num 数量
|
||||
* @param total 小计
|
||||
* @param b1 品名占用字节
|
||||
* @param b2 单价占用字节
|
||||
* @param b3 数量占用字节
|
||||
* @param b4 小计占用字节
|
||||
* @return 对齐后的行数据
|
||||
*/
|
||||
public static String getRow(String title, String price, String num, String total, int b1, int b2, int b3, int b4) {
|
||||
price = addSpace(price, b2);
|
||||
num = addSpace(num, b3);
|
||||
total = addSpace(total, b4);
|
||||
String otherStr = " " + price + num + " " + total;
|
||||
int tl = 0;
|
||||
try {
|
||||
tl = title.getBytes("GBK").length;
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
int spaceNum = (tl / b1 + 1) * b1 - tl;
|
||||
if (tl < b1) {
|
||||
for (int k = 0; k < spaceNum; k++) {
|
||||
title += " ";
|
||||
}
|
||||
title += otherStr;
|
||||
title = "<S>" + title + "</S>";
|
||||
} else if (tl == b1) {
|
||||
title += otherStr;
|
||||
title = "<S>" + title + "</S>";
|
||||
} else {
|
||||
List<String> list = null;
|
||||
if (isEn(title)) {
|
||||
list = getStrList(title, b1);
|
||||
} else {
|
||||
list = getStrList(title, b1 / 2);
|
||||
}
|
||||
String s0 = titleAddSpace(list.get(0), b1);
|
||||
title = "<S>"+s0 + otherStr + "</S><BR>";// 添加 单价 数量 总额
|
||||
String s = "";
|
||||
for (int k = 1; k < list.size(); k++) {
|
||||
s += list.get(k);
|
||||
}
|
||||
try {
|
||||
s = getStringByEnter(b1, s);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
title += s;
|
||||
}
|
||||
return title + "<BR>";
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,19 @@
|
||||
#PRE_DATABASE: fycashier_pre
|
||||
#PRE_HOST: 121.40.109.122
|
||||
server:
|
||||
port: 10589
|
||||
spring:
|
||||
application:
|
||||
name: cashierService
|
||||
datasource:
|
||||
url: jdbc:p6spy:mysql://rm-bp1kn7h89nz62cno1ro.mysql.rds.aliyuncs.com:3306/fycashier_test?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=Asia/Shanghai&useSSL=false&allowMultiQueries=true
|
||||
url: jdbc:p6spy:mysql://rm-bp1kn7h89nz62cno1ro.mysql.rds.aliyuncs.com:3306/${PRE_DATABASE:fycashier_test}?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=Asia/Shanghai&useSSL=false&allowMultiQueries=true
|
||||
username: cashier
|
||||
password: Cashier@1@
|
||||
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
|
||||
# url: jdbc:mysql://rm-bp1b572nblln4jho2po.mysql.rds.aliyuncs.com/fycashier?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=Asia/Shanghai&useSSL=false&allowMultiQueries=true
|
||||
# username: root
|
||||
# password: Czg666888
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
initialSize: 5
|
||||
minIdle: 5
|
||||
maxActive: 20
|
||||
@@ -16,7 +22,8 @@ spring:
|
||||
# redis数据库索引(默认为0),我们使用索引为3的数据库,避免和其他数据库冲突
|
||||
database: 0
|
||||
# redis服务器地址(默认为localhost)
|
||||
host: 101.37.12.135
|
||||
host: ${PRE_HOSE:101.37.12.135}
|
||||
# host: 121.40.128.145
|
||||
# host: 127.0.0.1
|
||||
# redis端口(默认为6379)
|
||||
port: 6379
|
||||
|
||||
@@ -39,6 +39,7 @@ logging:
|
||||
# file-name-pattern: log/%d{yyyy-MM}/cashier-client.%d{yyyy-MM-dd}.%i.log.gz
|
||||
|
||||
|
||||
|
||||
gateway:
|
||||
url: https://gateway.api.sxczgkj.cn/gate-service/
|
||||
|
||||
@@ -72,3 +73,6 @@ mybatis-plus:
|
||||
db-config:
|
||||
id-type: auto
|
||||
|
||||
|
||||
# php服务器地址
|
||||
phpServer: https://czgdoumei.sxczgkj.com/index.php/api
|
||||
|
||||
@@ -18,10 +18,12 @@
|
||||
<result column="price" jdbcType="DECIMAL" property="price"/>
|
||||
<result column="price_amount" jdbcType="DECIMAL" property="priceAmount"/>
|
||||
<result column="pack_amount" jdbcType="DECIMAL" property="packAmount"/>
|
||||
<result column="is_temporary" jdbcType="INTEGER" property="isTemporary"/>
|
||||
<result column="is_wait_call" jdbcType="INTEGER" property="isWaitCall"/>
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, order_id, shop_id, product_id, product_sku_id, num, product_name, product_sku_name,
|
||||
product_img, create_time, update_time, price, price_amount,status,pack_amount,return_num
|
||||
product_img, create_time, update_time, price, price_amount,status,pack_amount,return_num,is_temporary,is_wait_call
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
|
||||
@@ -611,12 +611,16 @@ select * from tb_order_info where trade_day = #{day} and table_id = #{masterId}
|
||||
d.product_sku_name AS productSkuName,
|
||||
c.category_id AS categoryId,
|
||||
d.price_amount as priceAmount,
|
||||
d.discount_sale_amount as discountSaleAmount,
|
||||
d.pack_amount as packAmount,
|
||||
d.price as price
|
||||
d.price as price,
|
||||
d.member_price as memberPrice,
|
||||
|
||||
d.pro_group_info as proGroupInfo
|
||||
FROM
|
||||
tb_order_detail d
|
||||
LEFT JOIN tb_cashier_cart c ON d.order_id = c.order_id
|
||||
AND d.product_sku_id = c.sku_id
|
||||
AND d.cart_id = c.id
|
||||
where c.order_id=#{orderId}
|
||||
</select>
|
||||
|
||||
@@ -631,8 +635,11 @@ select * from tb_order_info where trade_day = #{day} and table_id = #{masterId}
|
||||
d.product_sku_name AS productSkuName,
|
||||
'' AS categoryId,
|
||||
d.price_amount as priceAmount,
|
||||
d.discount_sale_amount as discountSaleAmount,
|
||||
d.pack_amount as packAmount,
|
||||
d.price as price
|
||||
d.price as price,
|
||||
d.member_price as memberPrice,
|
||||
d.pro_group_info as proGroupInfo
|
||||
FROM
|
||||
tb_order_detail d
|
||||
where d.order_id=#{orderId}
|
||||
|
||||
@@ -5,87 +5,46 @@
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="category_id" jdbcType="VARCHAR" property="categoryId" />
|
||||
<result column="spec_id" jdbcType="INTEGER" property="specId" />
|
||||
<result column="source_path" jdbcType="VARCHAR" property="sourcePath" />
|
||||
<result column="brand_id" jdbcType="INTEGER" property="brandId" />
|
||||
<result column="merchant_id" jdbcType="VARCHAR" property="merchantId" />
|
||||
<result column="shop_id" jdbcType="VARCHAR" property="shopId" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="short_title" jdbcType="VARCHAR" property="shortTitle" />
|
||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||
<result column="pack_fee" jdbcType="DECIMAL" property="packFee" />
|
||||
<result column="low_price" jdbcType="DECIMAL" property="lowPrice" />
|
||||
<result column="low_member_price" jdbcType="DECIMAL" property="lowMemberPrice" />
|
||||
<result column="unit_id" jdbcType="VARCHAR" property="unitId" />
|
||||
<result column="unit_snap" jdbcType="VARCHAR" property="unitSnap" />
|
||||
<result column="cover_img" jdbcType="VARCHAR" property="coverImg" />
|
||||
<result column="share_img" jdbcType="VARCHAR" property="shareImg" />
|
||||
<result column="video_cover_img" jdbcType="VARCHAR" property="videoCoverImg" />
|
||||
<result column="sort" jdbcType="INTEGER" property="sort" />
|
||||
<result column="limit_number" jdbcType="INTEGER" property="limitNumber" />
|
||||
<result column="product_score" jdbcType="INTEGER" property="productScore" />
|
||||
<result column="status" jdbcType="TINYINT" property="status" />
|
||||
<result column="fail_msg" jdbcType="VARCHAR" property="failMsg" />
|
||||
<result column="is_recommend" jdbcType="TINYINT" property="isRecommend" />
|
||||
<result column="is_hot" jdbcType="TINYINT" property="isHot" />
|
||||
<result column="is_new" jdbcType="TINYINT" property="isNew" />
|
||||
<result column="is_on_sale" jdbcType="TINYINT" property="isOnSale" />
|
||||
<result column="is_show" jdbcType="TINYINT" property="isShow" />
|
||||
<result column="type_enum" jdbcType="VARCHAR" property="typeEnum" />
|
||||
<result column="is_distribute" jdbcType="TINYINT" property="isDistribute" />
|
||||
<result column="is_del" jdbcType="TINYINT" property="isDel" />
|
||||
<result column="is_stock" jdbcType="TINYINT" property="isStock" />
|
||||
<result column="is_pause_sale" jdbcType="TINYINT" property="isPauseSale" />
|
||||
<result column="is_free_freight" jdbcType="TINYINT" property="isFreeFreight" />
|
||||
<result column="freight_id" jdbcType="BIGINT" property="freightId" />
|
||||
<result column="strategy_type" jdbcType="VARCHAR" property="strategyType" />
|
||||
<result column="strategy_id" jdbcType="INTEGER" property="strategyId" />
|
||||
<result column="is_vip" jdbcType="TINYINT" property="isVip" />
|
||||
<result column="is_delete" jdbcType="TINYINT" property="isDelete" />
|
||||
<result column="created_at" jdbcType="BIGINT" property="createdAt" />
|
||||
<result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
|
||||
<result column="base_sales_number" jdbcType="DOUBLE" property="baseSalesNumber" />
|
||||
<result column="real_sales_number" jdbcType="INTEGER" property="realSalesNumber" />
|
||||
<result column="sales_number" jdbcType="INTEGER" property="salesNumber" />
|
||||
<result column="thumb_count" jdbcType="INTEGER" property="thumbCount" />
|
||||
<result column="store_count" jdbcType="INTEGER" property="storeCount" />
|
||||
<result column="furnish_meal" jdbcType="INTEGER" property="furnishMeal" />
|
||||
<result column="furnish_express" jdbcType="INTEGER" property="furnishExpress" />
|
||||
<result column="furnish_draw" jdbcType="INTEGER" property="furnishDraw" />
|
||||
<result column="furnish_vir" jdbcType="INTEGER" property="furnishVir" />
|
||||
<result column="is_combo" jdbcType="TINYINT" property="isCombo" />
|
||||
<result column="is_show_cash" jdbcType="TINYINT" property="isShowCash" />
|
||||
<result column="is_show_mall" jdbcType="TINYINT" property="isShowMall" />
|
||||
<result column="is_need_examine" jdbcType="TINYINT" property="isNeedExamine" />
|
||||
<result column="show_on_mall_status" jdbcType="TINYINT" property="showOnMallStatus" />
|
||||
<result column="show_on_mall_time" jdbcType="BIGINT" property="showOnMallTime" />
|
||||
<result column="show_on_mall_error_msg" jdbcType="VARCHAR" property="showOnMallErrorMsg" />
|
||||
<result column="enable_label" jdbcType="TINYINT" property="enableLabel" />
|
||||
<result column="tax_config_id" jdbcType="VARCHAR" property="taxConfigId" />
|
||||
<result column="spec_table_headers" jdbcType="VARCHAR" property="specTableHeaders" />
|
||||
<result column="stock_number" jdbcType="INTEGER" property="stockNumber" />
|
||||
<result column="warn_line" jdbcType="INTEGER" property="warnLine" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs">
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chaozhanggui.system.cashierservice.entity.TbProduct">
|
||||
<result column="images" jdbcType="LONGVARCHAR" property="images" />
|
||||
<result column="video" jdbcType="LONGVARCHAR" property="video" />
|
||||
<result column="notice" jdbcType="LONGVARCHAR" property="notice" />
|
||||
<result column="group_snap" jdbcType="LONGVARCHAR" property="groupSnap" />
|
||||
<result column="spec_info" jdbcType="LONGVARCHAR" property="specInfo" />
|
||||
<result column="select_spec" jdbcType="LONGVARCHAR" property="selectSpec" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, category_id, spec_id, source_path, brand_id, merchant_id, shop_id, name, short_title,
|
||||
type, pack_fee, low_price, low_member_price, unit_id, unit_snap, cover_img, share_img,
|
||||
video_cover_img, sort, limit_number, product_score, status, fail_msg, is_recommend,
|
||||
is_hot, is_new, is_on_sale, is_show, type_enum, is_distribute, is_del, is_stock,
|
||||
is_pause_sale, is_free_freight, freight_id, strategy_type, strategy_id, is_vip, is_delete,
|
||||
created_at, updated_at, base_sales_number, real_sales_number, sales_number, thumb_count,
|
||||
store_count, furnish_meal, furnish_express, furnish_draw, furnish_vir, is_combo,
|
||||
is_show_cash, is_show_mall, is_need_examine, show_on_mall_status, show_on_mall_time,
|
||||
show_on_mall_error_msg, enable_label, tax_config_id, spec_table_headers, stock_number,warn_line
|
||||
id, category_id, spec_id, shop_id, name, short_title,
|
||||
type, pack_fee, low_price, unit_id, cover_img,
|
||||
sort, status, fail_msg,
|
||||
is_hot, type_enum, is_del, is_stock,
|
||||
is_pause_sale,
|
||||
created_at, updated_at, real_sales_number,
|
||||
spec_table_headers, stock_number,warn_line
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
images, video, notice, group_snap, spec_info, select_spec
|
||||
images, group_snap, spec_info, select_spec
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
@@ -99,56 +58,42 @@
|
||||
delete from tb_product
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs">
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProduct">
|
||||
insert into tb_product (id, category_id, spec_id,
|
||||
source_path, brand_id, merchant_id,
|
||||
shop_id, name, short_title,
|
||||
type, pack_fee, low_price,
|
||||
low_member_price, unit_id, unit_snap,
|
||||
cover_img, share_img, video_cover_img,
|
||||
sort, limit_number, product_score,
|
||||
status, fail_msg, is_recommend,
|
||||
is_hot, is_new, is_on_sale,
|
||||
is_show, type_enum, is_distribute,
|
||||
unit_id,
|
||||
cover_img,
|
||||
sort, status, fail_msg,
|
||||
is_hot,
|
||||
type_enum,
|
||||
is_del, is_stock, is_pause_sale,
|
||||
is_free_freight, freight_id, strategy_type,
|
||||
strategy_id, is_vip, is_delete,
|
||||
created_at, updated_at, base_sales_number,
|
||||
real_sales_number, sales_number, thumb_count,
|
||||
store_count, furnish_meal, furnish_express,
|
||||
furnish_draw, furnish_vir, is_combo,
|
||||
is_show_cash, is_show_mall, is_need_examine,
|
||||
show_on_mall_status, show_on_mall_time, show_on_mall_error_msg,
|
||||
enable_label, tax_config_id, spec_table_headers,
|
||||
images, video, notice,
|
||||
group_snap, spec_info, select_spec, stock_number,warn_line
|
||||
created_at, updated_at,
|
||||
real_sales_number,
|
||||
spec_table_headers,
|
||||
images,
|
||||
group_snap, spec_info, select_spec, stock_number
|
||||
)
|
||||
values (#{id,jdbcType=INTEGER}, #{categoryId,jdbcType=VARCHAR}, #{specId,jdbcType=INTEGER},
|
||||
#{sourcePath,jdbcType=VARCHAR}, #{brandId,jdbcType=INTEGER}, #{merchantId,jdbcType=VARCHAR},
|
||||
#{shopId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{shortTitle,jdbcType=VARCHAR},
|
||||
#{type,jdbcType=VARCHAR}, #{packFee,jdbcType=DECIMAL}, #{lowPrice,jdbcType=DECIMAL},
|
||||
#{lowMemberPrice,jdbcType=DECIMAL}, #{unitId,jdbcType=VARCHAR}, #{unitSnap,jdbcType=VARCHAR},
|
||||
#{coverImg,jdbcType=VARCHAR}, #{shareImg,jdbcType=VARCHAR}, #{videoCoverImg,jdbcType=VARCHAR},
|
||||
#{sort,jdbcType=INTEGER}, #{limitNumber,jdbcType=INTEGER}, #{productScore,jdbcType=INTEGER},
|
||||
#{status,jdbcType=TINYINT}, #{failMsg,jdbcType=VARCHAR}, #{isRecommend,jdbcType=TINYINT},
|
||||
#{unitId,jdbcType=VARCHAR},
|
||||
#{coverImg,jdbcType=VARCHAR},
|
||||
#{sort,jdbcType=INTEGER}, #{productScore,jdbcType=INTEGER},
|
||||
#{status,jdbcType=TINYINT}, #{failMsg,jdbcType=VARCHAR},
|
||||
#{isHot,jdbcType=TINYINT}, #{isNew,jdbcType=TINYINT}, #{isOnSale,jdbcType=TINYINT},
|
||||
#{isShow,jdbcType=TINYINT}, #{typeEnum,jdbcType=VARCHAR}, #{isDistribute,jdbcType=TINYINT},
|
||||
#{typeEnum,jdbcType=VARCHAR},
|
||||
#{isDel,jdbcType=TINYINT}, #{isStock,jdbcType=TINYINT}, #{isPauseSale,jdbcType=TINYINT},
|
||||
#{isFreeFreight,jdbcType=TINYINT}, #{freightId,jdbcType=BIGINT}, #{strategyType,jdbcType=VARCHAR},
|
||||
#{strategyId,jdbcType=INTEGER}, #{isVip,jdbcType=TINYINT}, #{isDelete,jdbcType=TINYINT},
|
||||
#{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT}, #{baseSalesNumber,jdbcType=DOUBLE},
|
||||
#{realSalesNumber,jdbcType=INTEGER}, #{salesNumber,jdbcType=INTEGER}, #{thumbCount,jdbcType=INTEGER},
|
||||
#{storeCount,jdbcType=INTEGER}, #{furnishMeal,jdbcType=INTEGER}, #{furnishExpress,jdbcType=INTEGER},
|
||||
#{furnishDraw,jdbcType=INTEGER}, #{furnishVir,jdbcType=INTEGER}, #{isCombo,jdbcType=TINYINT},
|
||||
#{isShowCash,jdbcType=TINYINT}, #{isShowMall,jdbcType=TINYINT}, #{isNeedExamine,jdbcType=TINYINT},
|
||||
#{showOnMallStatus,jdbcType=TINYINT}, #{showOnMallTime,jdbcType=BIGINT}, #{showOnMallErrorMsg,jdbcType=VARCHAR},
|
||||
#{enableLabel,jdbcType=TINYINT}, #{taxConfigId,jdbcType=VARCHAR}, #{specTableHeaders,jdbcType=VARCHAR},
|
||||
#{images,jdbcType=LONGVARCHAR}, #{video,jdbcType=LONGVARCHAR}, #{notice,jdbcType=LONGVARCHAR},
|
||||
#{strategyId,jdbcType=INTEGER},
|
||||
#{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT},
|
||||
#{realSalesNumber,jdbcType=INTEGER},
|
||||
#{specTableHeaders,jdbcType=VARCHAR},
|
||||
#{images,jdbcType=LONGVARCHAR},
|
||||
#{groupSnap,jdbcType=LONGVARCHAR}, #{specInfo,jdbcType=LONGVARCHAR}, #{selectSpec,jdbcType=LONGVARCHAR},
|
||||
#{stockNumber,jdbcType=INTEGER},#{warnLine,jdbcType=INTEGER}
|
||||
#{stockNumber,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs">
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProduct">
|
||||
insert into tb_product
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
@@ -160,15 +105,7 @@
|
||||
<if test="specId != null">
|
||||
spec_id,
|
||||
</if>
|
||||
<if test="sourcePath != null">
|
||||
source_path,
|
||||
</if>
|
||||
<if test="brandId != null">
|
||||
brand_id,
|
||||
</if>
|
||||
<if test="merchantId != null">
|
||||
merchant_id,
|
||||
</if>
|
||||
|
||||
<if test="shopId != null">
|
||||
shop_id,
|
||||
</if>
|
||||
@@ -187,60 +124,34 @@
|
||||
<if test="lowPrice != null">
|
||||
low_price,
|
||||
</if>
|
||||
<if test="lowMemberPrice != null">
|
||||
low_member_price,
|
||||
</if>
|
||||
<if test="unitId != null">
|
||||
unit_id,
|
||||
</if>
|
||||
<if test="unitSnap != null">
|
||||
unit_snap,
|
||||
</if>
|
||||
|
||||
<if test="coverImg != null">
|
||||
cover_img,
|
||||
</if>
|
||||
<if test="shareImg != null">
|
||||
share_img,
|
||||
</if>
|
||||
<if test="videoCoverImg != null">
|
||||
video_cover_img,
|
||||
</if>
|
||||
|
||||
|
||||
<if test="sort != null">
|
||||
sort,
|
||||
</if>
|
||||
<if test="limitNumber != null">
|
||||
limit_number,
|
||||
</if>
|
||||
<if test="productScore != null">
|
||||
product_score,
|
||||
</if>
|
||||
|
||||
<if test="status != null">
|
||||
status,
|
||||
</if>
|
||||
<if test="failMsg != null">
|
||||
fail_msg,
|
||||
</if>
|
||||
<if test="isRecommend != null">
|
||||
is_recommend,
|
||||
</if>
|
||||
|
||||
<if test="isHot != null">
|
||||
is_hot,
|
||||
</if>
|
||||
<if test="isNew != null">
|
||||
is_new,
|
||||
</if>
|
||||
<if test="isOnSale != null">
|
||||
is_on_sale,
|
||||
</if>
|
||||
<if test="isShow != null">
|
||||
is_show,
|
||||
</if>
|
||||
|
||||
<if test="typeEnum != null">
|
||||
type_enum,
|
||||
</if>
|
||||
<if test="isDistribute != null">
|
||||
is_distribute,
|
||||
</if>
|
||||
|
||||
<if test="isDel != null">
|
||||
is_del,
|
||||
</if>
|
||||
@@ -250,96 +161,23 @@
|
||||
<if test="isPauseSale != null">
|
||||
is_pause_sale,
|
||||
</if>
|
||||
<if test="isFreeFreight != null">
|
||||
is_free_freight,
|
||||
</if>
|
||||
<if test="freightId != null">
|
||||
freight_id,
|
||||
</if>
|
||||
<if test="strategyType != null">
|
||||
strategy_type,
|
||||
</if>
|
||||
<if test="strategyId != null">
|
||||
strategy_id,
|
||||
</if>
|
||||
<if test="isVip != null">
|
||||
is_vip,
|
||||
</if>
|
||||
<if test="isDelete != null">
|
||||
is_delete,
|
||||
</if>
|
||||
|
||||
<if test="createdAt != null">
|
||||
created_at,
|
||||
</if>
|
||||
<if test="updatedAt != null">
|
||||
updated_at,
|
||||
</if>
|
||||
<if test="baseSalesNumber != null">
|
||||
base_sales_number,
|
||||
</if>
|
||||
|
||||
<if test="realSalesNumber != null">
|
||||
real_sales_number,
|
||||
</if>
|
||||
<if test="salesNumber != null">
|
||||
sales_number,
|
||||
</if>
|
||||
<if test="thumbCount != null">
|
||||
thumb_count,
|
||||
</if>
|
||||
<if test="storeCount != null">
|
||||
store_count,
|
||||
</if>
|
||||
<if test="furnishMeal != null">
|
||||
furnish_meal,
|
||||
</if>
|
||||
<if test="furnishExpress != null">
|
||||
furnish_express,
|
||||
</if>
|
||||
<if test="furnishDraw != null">
|
||||
furnish_draw,
|
||||
</if>
|
||||
<if test="furnishVir != null">
|
||||
furnish_vir,
|
||||
</if>
|
||||
<if test="isCombo != null">
|
||||
is_combo,
|
||||
</if>
|
||||
<if test="isShowCash != null">
|
||||
is_show_cash,
|
||||
</if>
|
||||
<if test="isShowMall != null">
|
||||
is_show_mall,
|
||||
</if>
|
||||
<if test="isNeedExamine != null">
|
||||
is_need_examine,
|
||||
</if>
|
||||
<if test="showOnMallStatus != null">
|
||||
show_on_mall_status,
|
||||
</if>
|
||||
<if test="showOnMallTime != null">
|
||||
show_on_mall_time,
|
||||
</if>
|
||||
<if test="showOnMallErrorMsg != null">
|
||||
show_on_mall_error_msg,
|
||||
</if>
|
||||
<if test="enableLabel != null">
|
||||
enable_label,
|
||||
</if>
|
||||
<if test="taxConfigId != null">
|
||||
tax_config_id,
|
||||
</if>
|
||||
<if test="specTableHeaders != null">
|
||||
spec_table_headers,
|
||||
</if>
|
||||
<if test="images != null">
|
||||
images,
|
||||
</if>
|
||||
<if test="video != null">
|
||||
video,
|
||||
</if>
|
||||
<if test="notice != null">
|
||||
notice,
|
||||
</if>
|
||||
<if test="groupSnap != null">
|
||||
group_snap,
|
||||
</if>
|
||||
@@ -366,15 +204,8 @@
|
||||
<if test="specId != null">
|
||||
#{specId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="sourcePath != null">
|
||||
#{sourcePath,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="brandId != null">
|
||||
#{brandId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="merchantId != null">
|
||||
#{merchantId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
||||
|
||||
<if test="shopId != null">
|
||||
#{shopId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -393,30 +224,19 @@
|
||||
<if test="lowPrice != null">
|
||||
#{lowPrice,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="lowMemberPrice != null">
|
||||
#{lowMemberPrice,jdbcType=DECIMAL},
|
||||
</if>
|
||||
|
||||
<if test="unitId != null">
|
||||
#{unitId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="unitSnap != null">
|
||||
#{unitSnap,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
||||
<if test="coverImg != null">
|
||||
#{coverImg,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="shareImg != null">
|
||||
#{shareImg,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="videoCoverImg != null">
|
||||
#{videoCoverImg,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
||||
<if test="sort != null">
|
||||
#{sort,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="limitNumber != null">
|
||||
#{limitNumber,jdbcType=INTEGER},
|
||||
</if>
|
||||
|
||||
<if test="productScore != null">
|
||||
#{productScore,jdbcType=INTEGER},
|
||||
</if>
|
||||
@@ -426,9 +246,7 @@
|
||||
<if test="failMsg != null">
|
||||
#{failMsg,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="isRecommend != null">
|
||||
#{isRecommend,jdbcType=TINYINT},
|
||||
</if>
|
||||
|
||||
<if test="isHot != null">
|
||||
#{isHot,jdbcType=TINYINT},
|
||||
</if>
|
||||
@@ -438,15 +256,11 @@
|
||||
<if test="isOnSale != null">
|
||||
#{isOnSale,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="isShow != null">
|
||||
#{isShow,jdbcType=TINYINT},
|
||||
</if>
|
||||
|
||||
<if test="typeEnum != null">
|
||||
#{typeEnum,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="isDistribute != null">
|
||||
#{isDistribute,jdbcType=TINYINT},
|
||||
</if>
|
||||
|
||||
<if test="isDel != null">
|
||||
#{isDel,jdbcType=TINYINT},
|
||||
</if>
|
||||
@@ -456,96 +270,28 @@
|
||||
<if test="isPauseSale != null">
|
||||
#{isPauseSale,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="isFreeFreight != null">
|
||||
#{isFreeFreight,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="freightId != null">
|
||||
#{freightId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="strategyType != null">
|
||||
#{strategyType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
||||
<if test="strategyId != null">
|
||||
#{strategyId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isVip != null">
|
||||
#{isVip,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="isDelete != null">
|
||||
#{isDelete,jdbcType=TINYINT},
|
||||
</if>
|
||||
|
||||
<if test="createdAt != null">
|
||||
#{createdAt,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="updatedAt != null">
|
||||
#{updatedAt,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="baseSalesNumber != null">
|
||||
#{baseSalesNumber,jdbcType=DOUBLE},
|
||||
</if>
|
||||
|
||||
<if test="realSalesNumber != null">
|
||||
#{realSalesNumber,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="salesNumber != null">
|
||||
#{salesNumber,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="thumbCount != null">
|
||||
#{thumbCount,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="storeCount != null">
|
||||
#{storeCount,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="furnishMeal != null">
|
||||
#{furnishMeal,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="furnishExpress != null">
|
||||
#{furnishExpress,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="furnishDraw != null">
|
||||
#{furnishDraw,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="furnishVir != null">
|
||||
#{furnishVir,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isCombo != null">
|
||||
#{isCombo,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="isShowCash != null">
|
||||
#{isShowCash,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="isShowMall != null">
|
||||
#{isShowMall,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="isNeedExamine != null">
|
||||
#{isNeedExamine,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="showOnMallStatus != null">
|
||||
#{showOnMallStatus,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="showOnMallTime != null">
|
||||
#{showOnMallTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="showOnMallErrorMsg != null">
|
||||
#{showOnMallErrorMsg,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="enableLabel != null">
|
||||
#{enableLabel,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="taxConfigId != null">
|
||||
#{taxConfigId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
||||
<if test="specTableHeaders != null">
|
||||
#{specTableHeaders,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="images != null">
|
||||
#{images,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="video != null">
|
||||
#{video,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="notice != null">
|
||||
#{notice,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="groupSnap != null">
|
||||
#{groupSnap,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
@@ -563,7 +309,7 @@
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs">
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProduct">
|
||||
update tb_product
|
||||
<set>
|
||||
<if test="categoryId != null">
|
||||
@@ -572,15 +318,7 @@
|
||||
<if test="specId != null">
|
||||
spec_id = #{specId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="sourcePath != null">
|
||||
source_path = #{sourcePath,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="brandId != null">
|
||||
brand_id = #{brandId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="merchantId != null">
|
||||
merchant_id = #{merchantId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
||||
<if test="shopId != null">
|
||||
shop_id = #{shopId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -599,60 +337,35 @@
|
||||
<if test="lowPrice != null">
|
||||
low_price = #{lowPrice,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="lowMemberPrice != null">
|
||||
low_member_price = #{lowMemberPrice,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="unitId != null">
|
||||
unit_id = #{unitId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="unitSnap != null">
|
||||
unit_snap = #{unitSnap,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
||||
<if test="coverImg != null">
|
||||
cover_img = #{coverImg,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="shareImg != null">
|
||||
share_img = #{shareImg,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="videoCoverImg != null">
|
||||
video_cover_img = #{videoCoverImg,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
||||
|
||||
<if test="sort != null">
|
||||
sort = #{sort,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="limitNumber != null">
|
||||
limit_number = #{limitNumber,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="productScore != null">
|
||||
product_score = #{productScore,jdbcType=INTEGER},
|
||||
</if>
|
||||
|
||||
<if test="status != null">
|
||||
status = #{status,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="failMsg != null">
|
||||
fail_msg = #{failMsg,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="isRecommend != null">
|
||||
is_recommend = #{isRecommend,jdbcType=TINYINT},
|
||||
</if>
|
||||
|
||||
<if test="isHot != null">
|
||||
is_hot = #{isHot,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="isNew != null">
|
||||
is_new = #{isNew,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="isOnSale != null">
|
||||
is_on_sale = #{isOnSale,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="isShow != null">
|
||||
is_show = #{isShow,jdbcType=TINYINT},
|
||||
</if>
|
||||
|
||||
|
||||
<if test="typeEnum != null">
|
||||
type_enum = #{typeEnum,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="isDistribute != null">
|
||||
is_distribute = #{isDistribute,jdbcType=TINYINT},
|
||||
</if>
|
||||
|
||||
<if test="isDel != null">
|
||||
is_del = #{isDel,jdbcType=TINYINT},
|
||||
</if>
|
||||
@@ -662,96 +375,24 @@
|
||||
<if test="isPauseSale != null">
|
||||
is_pause_sale = #{isPauseSale,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="isFreeFreight != null">
|
||||
is_free_freight = #{isFreeFreight,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="freightId != null">
|
||||
freight_id = #{freightId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="strategyType != null">
|
||||
strategy_type = #{strategyType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="strategyId != null">
|
||||
strategy_id = #{strategyId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isVip != null">
|
||||
is_vip = #{isVip,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="isDelete != null">
|
||||
is_delete = #{isDelete,jdbcType=TINYINT},
|
||||
</if>
|
||||
|
||||
<if test="createdAt != null">
|
||||
created_at = #{createdAt,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="updatedAt != null">
|
||||
updated_at = #{updatedAt,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="baseSalesNumber != null">
|
||||
base_sales_number = #{baseSalesNumber,jdbcType=DOUBLE},
|
||||
</if>
|
||||
|
||||
<if test="realSalesNumber != null">
|
||||
real_sales_number = #{realSalesNumber,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="salesNumber != null">
|
||||
sales_number = #{salesNumber,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="thumbCount != null">
|
||||
thumb_count = #{thumbCount,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="storeCount != null">
|
||||
store_count = #{storeCount,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="furnishMeal != null">
|
||||
furnish_meal = #{furnishMeal,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="furnishExpress != null">
|
||||
furnish_express = #{furnishExpress,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="furnishDraw != null">
|
||||
furnish_draw = #{furnishDraw,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="furnishVir != null">
|
||||
furnish_vir = #{furnishVir,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isCombo != null">
|
||||
is_combo = #{isCombo,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="isShowCash != null">
|
||||
is_show_cash = #{isShowCash,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="isShowMall != null">
|
||||
is_show_mall = #{isShowMall,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="isNeedExamine != null">
|
||||
is_need_examine = #{isNeedExamine,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="showOnMallStatus != null">
|
||||
show_on_mall_status = #{showOnMallStatus,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="showOnMallTime != null">
|
||||
show_on_mall_time = #{showOnMallTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="showOnMallErrorMsg != null">
|
||||
show_on_mall_error_msg = #{showOnMallErrorMsg,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="enableLabel != null">
|
||||
enable_label = #{enableLabel,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="taxConfigId != null">
|
||||
tax_config_id = #{taxConfigId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
||||
<if test="specTableHeaders != null">
|
||||
spec_table_headers = #{specTableHeaders,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="images != null">
|
||||
images = #{images,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="video != null">
|
||||
video = #{video,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="notice != null">
|
||||
notice = #{notice,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="groupSnap != null">
|
||||
group_snap = #{groupSnap,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
@@ -770,137 +411,60 @@
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs">
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProduct">
|
||||
update tb_product
|
||||
set category_id = #{categoryId,jdbcType=VARCHAR},
|
||||
spec_id = #{specId,jdbcType=INTEGER},
|
||||
source_path = #{sourcePath,jdbcType=VARCHAR},
|
||||
brand_id = #{brandId,jdbcType=INTEGER},
|
||||
merchant_id = #{merchantId,jdbcType=VARCHAR},
|
||||
shop_id = #{shopId,jdbcType=VARCHAR},
|
||||
name = #{name,jdbcType=VARCHAR},
|
||||
short_title = #{shortTitle,jdbcType=VARCHAR},
|
||||
type = #{type,jdbcType=VARCHAR},
|
||||
pack_fee = #{packFee,jdbcType=DECIMAL},
|
||||
low_price = #{lowPrice,jdbcType=DECIMAL},
|
||||
low_member_price = #{lowMemberPrice,jdbcType=DECIMAL},
|
||||
unit_id = #{unitId,jdbcType=VARCHAR},
|
||||
unit_snap = #{unitSnap,jdbcType=VARCHAR},
|
||||
cover_img = #{coverImg,jdbcType=VARCHAR},
|
||||
share_img = #{shareImg,jdbcType=VARCHAR},
|
||||
video_cover_img = #{videoCoverImg,jdbcType=VARCHAR},
|
||||
sort = #{sort,jdbcType=INTEGER},
|
||||
limit_number = #{limitNumber,jdbcType=INTEGER},
|
||||
product_score = #{productScore,jdbcType=INTEGER},
|
||||
status = #{status,jdbcType=TINYINT},
|
||||
fail_msg = #{failMsg,jdbcType=VARCHAR},
|
||||
is_recommend = #{isRecommend,jdbcType=TINYINT},
|
||||
is_hot = #{isHot,jdbcType=TINYINT},
|
||||
is_new = #{isNew,jdbcType=TINYINT},
|
||||
is_on_sale = #{isOnSale,jdbcType=TINYINT},
|
||||
is_show = #{isShow,jdbcType=TINYINT},
|
||||
type_enum = #{typeEnum,jdbcType=VARCHAR},
|
||||
is_distribute = #{isDistribute,jdbcType=TINYINT},
|
||||
is_del = #{isDel,jdbcType=TINYINT},
|
||||
is_stock = #{isStock,jdbcType=TINYINT},
|
||||
is_pause_sale = #{isPauseSale,jdbcType=TINYINT},
|
||||
is_free_freight = #{isFreeFreight,jdbcType=TINYINT},
|
||||
freight_id = #{freightId,jdbcType=BIGINT},
|
||||
strategy_type = #{strategyType,jdbcType=VARCHAR},
|
||||
strategy_id = #{strategyId,jdbcType=INTEGER},
|
||||
is_vip = #{isVip,jdbcType=TINYINT},
|
||||
is_delete = #{isDelete,jdbcType=TINYINT},
|
||||
created_at = #{createdAt,jdbcType=BIGINT},
|
||||
updated_at = #{updatedAt,jdbcType=BIGINT},
|
||||
base_sales_number = #{baseSalesNumber,jdbcType=DOUBLE},
|
||||
real_sales_number = #{realSalesNumber,jdbcType=INTEGER},
|
||||
sales_number = #{salesNumber,jdbcType=INTEGER},
|
||||
thumb_count = #{thumbCount,jdbcType=INTEGER},
|
||||
store_count = #{storeCount,jdbcType=INTEGER},
|
||||
furnish_meal = #{furnishMeal,jdbcType=INTEGER},
|
||||
furnish_express = #{furnishExpress,jdbcType=INTEGER},
|
||||
furnish_draw = #{furnishDraw,jdbcType=INTEGER},
|
||||
furnish_vir = #{furnishVir,jdbcType=INTEGER},
|
||||
is_combo = #{isCombo,jdbcType=TINYINT},
|
||||
is_show_cash = #{isShowCash,jdbcType=TINYINT},
|
||||
is_show_mall = #{isShowMall,jdbcType=TINYINT},
|
||||
is_need_examine = #{isNeedExamine,jdbcType=TINYINT},
|
||||
show_on_mall_status = #{showOnMallStatus,jdbcType=TINYINT},
|
||||
show_on_mall_time = #{showOnMallTime,jdbcType=BIGINT},
|
||||
show_on_mall_error_msg = #{showOnMallErrorMsg,jdbcType=VARCHAR},
|
||||
enable_label = #{enableLabel,jdbcType=TINYINT},
|
||||
tax_config_id = #{taxConfigId,jdbcType=VARCHAR},
|
||||
spec_table_headers = #{specTableHeaders,jdbcType=VARCHAR},
|
||||
images = #{images,jdbcType=LONGVARCHAR},
|
||||
video = #{video,jdbcType=LONGVARCHAR},
|
||||
notice = #{notice,jdbcType=LONGVARCHAR},
|
||||
group_snap = #{groupSnap,jdbcType=LONGVARCHAR},
|
||||
spec_info = #{specInfo,jdbcType=LONGVARCHAR},
|
||||
select_spec = #{selectSpec,jdbcType=LONGVARCHAR},
|
||||
stock_number = #{stockNumber,jdbcType=INTEGER},
|
||||
warn_line = #{warnLine,jdbcType=INTEGER}
|
||||
stock_number = #{stockNumber,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProduct">
|
||||
update tb_product
|
||||
set category_id = #{categoryId,jdbcType=VARCHAR},
|
||||
spec_id = #{specId,jdbcType=INTEGER},
|
||||
source_path = #{sourcePath,jdbcType=VARCHAR},
|
||||
brand_id = #{brandId,jdbcType=INTEGER},
|
||||
merchant_id = #{merchantId,jdbcType=VARCHAR},
|
||||
shop_id = #{shopId,jdbcType=VARCHAR},
|
||||
name = #{name,jdbcType=VARCHAR},
|
||||
short_title = #{shortTitle,jdbcType=VARCHAR},
|
||||
type = #{type,jdbcType=VARCHAR},
|
||||
pack_fee = #{packFee,jdbcType=DECIMAL},
|
||||
low_price = #{lowPrice,jdbcType=DECIMAL},
|
||||
low_member_price = #{lowMemberPrice,jdbcType=DECIMAL},
|
||||
unit_id = #{unitId,jdbcType=VARCHAR},
|
||||
unit_snap = #{unitSnap,jdbcType=VARCHAR},
|
||||
cover_img = #{coverImg,jdbcType=VARCHAR},
|
||||
share_img = #{shareImg,jdbcType=VARCHAR},
|
||||
video_cover_img = #{videoCoverImg,jdbcType=VARCHAR},
|
||||
sort = #{sort,jdbcType=INTEGER},
|
||||
limit_number = #{limitNumber,jdbcType=INTEGER},
|
||||
product_score = #{productScore,jdbcType=INTEGER},
|
||||
status = #{status,jdbcType=TINYINT},
|
||||
fail_msg = #{failMsg,jdbcType=VARCHAR},
|
||||
is_recommend = #{isRecommend,jdbcType=TINYINT},
|
||||
is_hot = #{isHot,jdbcType=TINYINT},
|
||||
is_new = #{isNew,jdbcType=TINYINT},
|
||||
is_on_sale = #{isOnSale,jdbcType=TINYINT},
|
||||
is_show = #{isShow,jdbcType=TINYINT},
|
||||
type_enum = #{typeEnum,jdbcType=VARCHAR},
|
||||
is_distribute = #{isDistribute,jdbcType=TINYINT},
|
||||
is_del = #{isDel,jdbcType=TINYINT},
|
||||
is_stock = #{isStock,jdbcType=TINYINT},
|
||||
is_pause_sale = #{isPauseSale,jdbcType=TINYINT},
|
||||
is_free_freight = #{isFreeFreight,jdbcType=TINYINT},
|
||||
freight_id = #{freightId,jdbcType=BIGINT},
|
||||
strategy_type = #{strategyType,jdbcType=VARCHAR},
|
||||
strategy_id = #{strategyId,jdbcType=INTEGER},
|
||||
is_vip = #{isVip,jdbcType=TINYINT},
|
||||
is_delete = #{isDelete,jdbcType=TINYINT},
|
||||
created_at = #{createdAt,jdbcType=BIGINT},
|
||||
updated_at = #{updatedAt,jdbcType=BIGINT},
|
||||
base_sales_number = #{baseSalesNumber,jdbcType=DOUBLE},
|
||||
real_sales_number = #{realSalesNumber,jdbcType=INTEGER},
|
||||
sales_number = #{salesNumber,jdbcType=INTEGER},
|
||||
thumb_count = #{thumbCount,jdbcType=INTEGER},
|
||||
store_count = #{storeCount,jdbcType=INTEGER},
|
||||
furnish_meal = #{furnishMeal,jdbcType=INTEGER},
|
||||
furnish_express = #{furnishExpress,jdbcType=INTEGER},
|
||||
furnish_draw = #{furnishDraw,jdbcType=INTEGER},
|
||||
furnish_vir = #{furnishVir,jdbcType=INTEGER},
|
||||
is_combo = #{isCombo,jdbcType=TINYINT},
|
||||
is_show_cash = #{isShowCash,jdbcType=TINYINT},
|
||||
is_show_mall = #{isShowMall,jdbcType=TINYINT},
|
||||
is_need_examine = #{isNeedExamine,jdbcType=TINYINT},
|
||||
show_on_mall_status = #{showOnMallStatus,jdbcType=TINYINT},
|
||||
show_on_mall_time = #{showOnMallTime,jdbcType=BIGINT},
|
||||
show_on_mall_error_msg = #{showOnMallErrorMsg,jdbcType=VARCHAR},
|
||||
enable_label = #{enableLabel,jdbcType=TINYINT},
|
||||
tax_config_id = #{taxConfigId,jdbcType=VARCHAR},
|
||||
spec_table_headers = #{specTableHeaders,jdbcType=VARCHAR},
|
||||
stock_number = #{stockNumber,jdbcType=INTEGER},
|
||||
warn_line = #{warnLine,jdbcType=INTEGER}
|
||||
@@ -908,7 +472,7 @@
|
||||
</update>
|
||||
|
||||
<select id="selectByShopId" resultMap="ResultMapWithBLOBs">
|
||||
select * from tb_product where shop_id=#{shopId} and status=1 and is_show_cash = 1 and type_enum in ('normal','sku','currentPrice','weight')
|
||||
select * from tb_product where shop_id=#{shopId} and status=1 and type_enum in ('normal','sku','currentPrice','weight')
|
||||
<if test="commdityName != null and commdityName!='' ">
|
||||
and name like CONCAT('%',#{commdityName},'%')
|
||||
</if>
|
||||
@@ -918,7 +482,7 @@
|
||||
<select id="selectByShopIdAndCheckGrounding" resultMap="ResultMapWithBLOBs">
|
||||
select a.* from tb_product as a
|
||||
left join tb_product_sku as b on a.id = b.product_id
|
||||
where a.shop_id=#{shopId} and a.status=1 and a.is_show_cash = 1 and a.type_enum in ('normal','sku','currentPrice','weight')
|
||||
where a.shop_id=#{shopId} and a.status=1 and a.type_enum in ('normal','sku','currentPrice','weight')
|
||||
<if test="commdityName != null and commdityName!='' ">
|
||||
and a.name like CONCAT('%',#{commdityName},'%')
|
||||
</if>
|
||||
@@ -929,7 +493,7 @@
|
||||
|
||||
<select id="selectByShopIdAndShopType" resultMap="ResultMapWithBLOBs">
|
||||
|
||||
select * from tb_product where shop_id=#{shopId} and status=1 and category_id=#{categoryId} and is_show_cash = 1 and type_enum in ('normal','sku','currentPrice','weight')
|
||||
select * from tb_product where shop_id=#{shopId} and status=1 and category_id=#{categoryId} and type_enum in ('normal','sku','currentPrice','weight')
|
||||
|
||||
<if test="commdityName != null and commdityName!='' ">
|
||||
and name like CONCAT('%',#{commdityName},'%')
|
||||
@@ -943,7 +507,7 @@
|
||||
|
||||
select a.* from tb_product as a
|
||||
left join tb_product_sku as b on a.id = b.product_id
|
||||
where a.shop_id=#{shopId} and a.status=1 and a.category_id=#{categoryId} and a.is_show_cash = 1 and a.type_enum in ('normal','sku','currentPrice','weight')
|
||||
where a.shop_id=#{shopId} and a.status=1 and a.category_id=#{categoryId} and a.type_enum in ('normal','sku','currentPrice','weight')
|
||||
|
||||
<if test="commdityName != null and commdityName!='' ">
|
||||
and a.name like CONCAT('%',#{commdityName},'%')
|
||||
@@ -955,7 +519,7 @@
|
||||
|
||||
select a.* from tb_product as a
|
||||
left join tb_product_sku as b on a.id = b.product_id
|
||||
where a.shop_id=#{shopId} and a.status=1 and a.is_show_cash = 1 and a.type_enum in ('normal','sku','currentPrice','weight')
|
||||
where a.shop_id=#{shopId} and a.status=1 and a.type_enum in ('normal','sku','currentPrice','weight')
|
||||
|
||||
<if test="commdityName != null and commdityName!='' ">
|
||||
and a.name like CONCAT('%',#{commdityName},'%')
|
||||
@@ -979,11 +543,13 @@
|
||||
group by shop_id,product_id
|
||||
</select>
|
||||
|
||||
<!--
|
||||
<update id="updateStockById">
|
||||
update tb_product
|
||||
set stock_number = stock_number - #{num,jdbcType=INTEGER}
|
||||
where id = #{productId}
|
||||
</update>
|
||||
-->
|
||||
|
||||
<select id="selectBySkuId" resultType="com.chaozhanggui.system.cashierservice.entity.po.ProConsSkuInfo">
|
||||
SELECT
|
||||
@@ -993,7 +559,6 @@
|
||||
i.id as con_id,
|
||||
i.con_code,
|
||||
i.con_name,
|
||||
i.surplus_stock,
|
||||
i.stock_number,
|
||||
p.id as product_id,
|
||||
p.`name` as product_name,
|
||||
|
||||
@@ -1,153 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbShopUnitMapper">
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chaozhanggui.system.cashierservice.mapper.MpShopUnitMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbShopUnit">
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="decimals_digits" jdbcType="INTEGER" property="decimalsDigits" />
|
||||
<result column="unit_type" jdbcType="VARCHAR" property="unitType" />
|
||||
<result column="is_system" jdbcType="TINYINT" property="isSystem" />
|
||||
<result column="status" jdbcType="TINYINT" property="status" />
|
||||
<result column="merchant_id" jdbcType="VARCHAR" property="merchantId" />
|
||||
<result column="shop_id" jdbcType="VARCHAR" property="shopId" />
|
||||
<result column="created_at" jdbcType="BIGINT" property="createdAt" />
|
||||
<result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="decimalsDigits" column="decimals_digits" jdbcType="INTEGER"/>
|
||||
<result property="unitType" column="unit_type" jdbcType="VARCHAR"/>
|
||||
<result property="isSystem" column="is_system" jdbcType="TINYINT"/>
|
||||
<result property="status" column="status" jdbcType="TINYINT"/>
|
||||
<result property="merchantId" column="merchant_id" jdbcType="VARCHAR"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="VARCHAR"/>
|
||||
<result property="createdAt" column="created_at" jdbcType="BIGINT"/>
|
||||
<result property="updatedAt" column="updated_at" jdbcType="BIGINT"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, name, decimals_digits, unit_type, is_system, status, merchant_id, shop_id, created_at,
|
||||
updated_at
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_shop_unit
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
delete from tb_shop_unit
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopUnit">
|
||||
insert into tb_shop_unit (id, name, decimals_digits,
|
||||
id,name,decimals_digits,
|
||||
unit_type,is_system,status,
|
||||
merchant_id,shop_id,created_at,
|
||||
updated_at)
|
||||
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{decimalsDigits,jdbcType=INTEGER},
|
||||
#{unitType,jdbcType=VARCHAR}, #{isSystem,jdbcType=TINYINT}, #{status,jdbcType=TINYINT},
|
||||
#{merchantId,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR}, #{createdAt,jdbcType=BIGINT},
|
||||
#{updatedAt,jdbcType=BIGINT})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopUnit">
|
||||
insert into tb_shop_unit
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="name != null">
|
||||
name,
|
||||
</if>
|
||||
<if test="decimalsDigits != null">
|
||||
decimals_digits,
|
||||
</if>
|
||||
<if test="unitType != null">
|
||||
unit_type,
|
||||
</if>
|
||||
<if test="isSystem != null">
|
||||
is_system,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status,
|
||||
</if>
|
||||
<if test="merchantId != null">
|
||||
merchant_id,
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
shop_id,
|
||||
</if>
|
||||
<if test="createdAt != null">
|
||||
created_at,
|
||||
</if>
|
||||
<if test="updatedAt != null">
|
||||
updated_at,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="decimalsDigits != null">
|
||||
#{decimalsDigits,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="unitType != null">
|
||||
#{unitType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="isSystem != null">
|
||||
#{isSystem,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="merchantId != null">
|
||||
#{merchantId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
#{shopId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createdAt != null">
|
||||
#{createdAt,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="updatedAt != null">
|
||||
#{updatedAt,jdbcType=BIGINT},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopUnit">
|
||||
update tb_shop_unit
|
||||
<set>
|
||||
<if test="name != null">
|
||||
name = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="decimalsDigits != null">
|
||||
decimals_digits = #{decimalsDigits,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="unitType != null">
|
||||
unit_type = #{unitType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="isSystem != null">
|
||||
is_system = #{isSystem,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status,jdbcType=TINYINT},
|
||||
</if>
|
||||
<if test="merchantId != null">
|
||||
merchant_id = #{merchantId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
shop_id = #{shopId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createdAt != null">
|
||||
created_at = #{createdAt,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="updatedAt != null">
|
||||
updated_at = #{updatedAt,jdbcType=BIGINT},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbShopUnit">
|
||||
update tb_shop_unit
|
||||
set name = #{name,jdbcType=VARCHAR},
|
||||
decimals_digits = #{decimalsDigits,jdbcType=INTEGER},
|
||||
unit_type = #{unitType,jdbcType=VARCHAR},
|
||||
is_system = #{isSystem,jdbcType=TINYINT},
|
||||
status = #{status,jdbcType=TINYINT},
|
||||
merchant_id = #{merchantId,jdbcType=VARCHAR},
|
||||
shop_id = #{shopId,jdbcType=VARCHAR},
|
||||
created_at = #{createdAt,jdbcType=BIGINT},
|
||||
updated_at = #{updatedAt,jdbcType=BIGINT}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
updated_at
|
||||
</sql>
|
||||
</mapper>
|
||||
26
src/main/resources/mapper/TbThirdPartyCouponRecordMapper.xml
Normal file
26
src/main/resources/mapper/TbThirdPartyCouponRecordMapper.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.chaozhanggui.system.cashierservice.mapper.TbThirdPartyCouponRecordMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbThirdPartyCouponRecord">
|
||||
<id property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="orderId" column="order_id" jdbcType="INTEGER"/>
|
||||
<result property="state" column="state" jdbcType="TINYINT"/>
|
||||
<result property="plat" column="plat" jdbcType="VARCHAR"/>
|
||||
<result property="code" column="code" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="checkTime" column="check_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
|
||||
<result property="num" column="num" jdbcType="INTEGER"/>
|
||||
<result property="cartIdList" column="cart_id_list" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,order_id,state,
|
||||
plat,code,create_time,
|
||||
check_time,shop_id,num,
|
||||
cart_id_list
|
||||
</sql>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user