update:
1.change category attribution
This commit is contained in:
@@ -123,24 +123,33 @@ CREATE TABLE `kiosk_order`
|
|||||||
DROP TABLE IF EXISTS `kiosk_order_detail`;
|
DROP TABLE IF EXISTS `kiosk_order_detail`;
|
||||||
CREATE TABLE `kiosk_order_detail`
|
CREATE TABLE `kiosk_order_detail`
|
||||||
(
|
(
|
||||||
`id` bigint NOT NULL COMMENT '主键',
|
`id` bigint NOT NULL COMMENT '主键',
|
||||||
`tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户ID',
|
`tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户ID',
|
||||||
`order_id` bigint NOT NULL COMMENT 'oid',
|
`order_id` bigint NOT NULL COMMENT 'oid',
|
||||||
`category_id` bigint NOT NULL COMMENT 'cid',
|
`category_id` bigint NOT NULL COMMENT 'cid',
|
||||||
`category_type` int NOT NULL DEFAULT 1 COMMENT '产品类型 1:单张 2:组合',
|
`category_type` int NOT NULL DEFAULT 1 COMMENT '产品类型 1:单张 2:组合',
|
||||||
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品名称',
|
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品名称',
|
||||||
`material` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '材质',
|
`material` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '材质',
|
||||||
`size` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '尺寸',
|
`size` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '尺寸',
|
||||||
`shape` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '形状',
|
`shape` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '形状',
|
||||||
`snapshot_link` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '快照地址',
|
`style` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '风格',
|
||||||
`total_amount` decimal(10, 2) NOT NULL DEFAULT 0 COMMENT '总金额',
|
`snapshot_link` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '快照地址',
|
||||||
`create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
|
`back_print` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '背面打印',
|
||||||
`create_dept` bigint NULL DEFAULT NULL COMMENT '创建部门',
|
`back_print_font` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '背面打印字体',
|
||||||
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
`back_print_size` int NULL DEFAULT 0 COMMENT '背面打印尺寸',
|
||||||
`update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
|
`back_print_bold` int NULL DEFAULT 2 COMMENT '背面打印加粗',
|
||||||
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
|
`back_print_italic` int NULL DEFAULT 2 COMMENT '背面打印加粗斜体',
|
||||||
`status` int NULL DEFAULT 1 COMMENT '状态 1:待制作 2:已完成',
|
`size_upgrade` int NULL DEFAULT 2 COMMENT '尺寸升级',
|
||||||
`is_deleted` int NULL DEFAULT 0 COMMENT '是否已删除',
|
`material_upgrade` int NULL DEFAULT 2 COMMENT '材料升级',
|
||||||
|
`stand` int NULL DEFAULT 2 COMMENT '支架',
|
||||||
|
`total_amount` decimal(10, 2) NOT NULL DEFAULT 0 COMMENT '总金额',
|
||||||
|
`create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
|
||||||
|
`create_dept` bigint NULL DEFAULT NULL COMMENT '创建部门',
|
||||||
|
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
|
||||||
|
`update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
|
||||||
|
`status` int NULL DEFAULT 1 COMMENT '状态 1:待制作 2:已完成',
|
||||||
|
`is_deleted` int NULL DEFAULT 0 COMMENT '是否已删除',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE = InnoDB
|
) ENGINE = InnoDB
|
||||||
CHARACTER SET = utf8mb4
|
CHARACTER SET = utf8mb4
|
||||||
|
|||||||
@@ -28,10 +28,13 @@ package org.springblade.modules.kiosk.pojo.entity;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import org.springblade.core.tenant.mp.TenantEntity;
|
import org.springblade.core.tenant.mp.TenantEntity;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,11 +87,56 @@ public class OrderDetailEntity extends TenantEntity {
|
|||||||
*/
|
*/
|
||||||
@Schema(description = "形状")
|
@Schema(description = "形状")
|
||||||
private String shape;
|
private String shape;
|
||||||
|
/**
|
||||||
|
* 风格
|
||||||
|
*/
|
||||||
|
@Schema(description = "风格")
|
||||||
|
private String style;
|
||||||
/**
|
/**
|
||||||
* 快照地址
|
* 快照地址
|
||||||
*/
|
*/
|
||||||
@Schema(description = "快照地址")
|
@Schema(description = "快照地址")
|
||||||
private String snapshotLink;
|
private String snapshotLink;
|
||||||
|
/**
|
||||||
|
* 背面打印
|
||||||
|
*/
|
||||||
|
@Schema(description = "背面打印")
|
||||||
|
private String backPrint;
|
||||||
|
/**
|
||||||
|
* 背面打印字体
|
||||||
|
*/
|
||||||
|
@Schema(description = "背面打印字体")
|
||||||
|
private String backPrintFont;
|
||||||
|
/**
|
||||||
|
* 背面打印尺寸
|
||||||
|
*/
|
||||||
|
@Schema(description = "背面打印尺寸")
|
||||||
|
private Integer backPrintSize;
|
||||||
|
/**
|
||||||
|
* 背面打印粗体
|
||||||
|
*/
|
||||||
|
@Schema(description = "背面打印粗体")
|
||||||
|
private Integer backPrintBold;
|
||||||
|
/**
|
||||||
|
* 背面打印斜体
|
||||||
|
*/
|
||||||
|
@Schema(description = "背面打印斜体")
|
||||||
|
private Integer backPrintItalic;
|
||||||
|
/**
|
||||||
|
* 尺寸升级
|
||||||
|
*/
|
||||||
|
@Schema(description = "尺寸升级")
|
||||||
|
private Integer sizeUpgrade;
|
||||||
|
/**
|
||||||
|
* 材质升级
|
||||||
|
*/
|
||||||
|
@Schema(description = "材质升级")
|
||||||
|
private Integer materialUpgrade;
|
||||||
|
/**
|
||||||
|
* 支架
|
||||||
|
*/
|
||||||
|
@Schema(description = "支架")
|
||||||
|
private Integer stand;
|
||||||
/**
|
/**
|
||||||
* 总金额
|
* 总金额
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -62,19 +62,19 @@ public class PriceListApiVO implements Serializable {
|
|||||||
|
|
||||||
private BigDecimal actualPrice;
|
private BigDecimal actualPrice;
|
||||||
|
|
||||||
private Integer backPrint;
|
private Boolean backPrint;
|
||||||
|
|
||||||
private BigDecimal backPrintPrice;
|
private BigDecimal backPrintPrice;
|
||||||
|
|
||||||
private Integer sizeUpgrade;
|
private Boolean sizeUpgrade;
|
||||||
|
|
||||||
private BigDecimal sizeUpgradePrice;
|
private BigDecimal sizeUpgradePrice;
|
||||||
|
|
||||||
private Integer materialUpgrade;
|
private Boolean materialUpgrade;
|
||||||
|
|
||||||
private BigDecimal materialUpgradePrice;
|
private BigDecimal materialUpgradePrice;
|
||||||
|
|
||||||
private Integer stand;
|
private Boolean stand;
|
||||||
|
|
||||||
private BigDecimal standPrice;
|
private BigDecimal standPrice;
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import org.springblade.modules.system.service.IUserService;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import org.thymeleaf.ITemplateEngine;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -76,6 +77,7 @@ public class KioskServiceImpl implements IKioskApiService {
|
|||||||
private static final String autoCleanKey = "kiosk.default.autoCleanSeconds";
|
private static final String autoCleanKey = "kiosk.default.autoCleanSeconds";
|
||||||
|
|
||||||
private static final Integer taxPercent = 15;
|
private static final Integer taxPercent = 15;
|
||||||
|
private final ITemplateEngine iTemplateEngine;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DictBizApiVO> categoryType() {
|
public List<DictBizApiVO> categoryType() {
|
||||||
@@ -184,8 +186,10 @@ public class KioskServiceImpl implements IKioskApiService {
|
|||||||
order.setRemarks(request.getRemarks());
|
order.setRemarks(request.getRemarks());
|
||||||
orderService.save(order);
|
orderService.save(order);
|
||||||
|
|
||||||
List<BigDecimal> totalAmount = new ArrayList<>();
|
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||||
request.getData().forEach(item -> {
|
for (OrderApiRequest.Item item : request.getData()) {
|
||||||
|
BigDecimal detailAmount = BigDecimal.ZERO;
|
||||||
|
|
||||||
OrderDetailEntity orderDetail = new OrderDetailEntity();
|
OrderDetailEntity orderDetail = new OrderDetailEntity();
|
||||||
orderDetail.setOrderId(order.getId());
|
orderDetail.setOrderId(order.getId());
|
||||||
|
|
||||||
@@ -221,6 +225,36 @@ public class KioskServiceImpl implements IKioskApiService {
|
|||||||
}
|
}
|
||||||
orderDetail.setShape(shapeTypeValue);
|
orderDetail.setShape(shapeTypeValue);
|
||||||
|
|
||||||
|
String styleTypeValue = dictService.getValue(styleType, String.valueOf(priceList.getStyle()));
|
||||||
|
if (StringUtil.isBlank(styleTypeValue)) {
|
||||||
|
throw new ServiceException("Invalid shape.");
|
||||||
|
}
|
||||||
|
orderDetail.setStyle(styleTypeValue);
|
||||||
|
|
||||||
|
if (item.getPrintBack() != null && StringUtil.isNotBlank(item.getPrintBack().getContent())) {
|
||||||
|
orderDetail.setBackPrint(item.getPrintBack().getContent());
|
||||||
|
orderDetail.setBackPrintFont(item.getPrintBack().getFont());
|
||||||
|
orderDetail.setBackPrintSize(item.getPrintBack().getSize());
|
||||||
|
orderDetail.setBackPrintBold(item.getPrintBack().getBold() ? 1 : 2);
|
||||||
|
orderDetail.setBackPrintItalic(item.getPrintBack().getItalic() ? 1 : 2);
|
||||||
|
detailAmount = detailAmount.add(priceList.getBackPrintPrice());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.getSizeUp()) {
|
||||||
|
orderDetail.setSizeUpgrade(1);
|
||||||
|
detailAmount = detailAmount.add(priceList.getSizeUpgradePrice());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.getMaterialUp()) {
|
||||||
|
orderDetail.setMaterialUpgrade(1);
|
||||||
|
detailAmount = detailAmount.add(priceList.getMaterialUpgradePrice());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.getExtraStand()) {
|
||||||
|
orderDetail.setStand(1);
|
||||||
|
detailAmount = detailAmount.add(priceList.getStandPrice());
|
||||||
|
}
|
||||||
|
|
||||||
PhotoAttachmentEntity snapshotPhoto = photoAttachmentService.getById(item.getSnapshot());
|
PhotoAttachmentEntity snapshotPhoto = photoAttachmentService.getById(item.getSnapshot());
|
||||||
if (snapshotPhoto == null) {
|
if (snapshotPhoto == null) {
|
||||||
throw new ServiceException("Invalid snapshot.");
|
throw new ServiceException("Invalid snapshot.");
|
||||||
@@ -228,13 +262,13 @@ public class KioskServiceImpl implements IKioskApiService {
|
|||||||
orderDetail.setSnapshotLink(snapshotPhoto.getLink());
|
orderDetail.setSnapshotLink(snapshotPhoto.getLink());
|
||||||
|
|
||||||
|
|
||||||
orderDetail.setTotalAmount(priceList.getActualPrice());
|
orderDetail.setTotalAmount(detailAmount.add(priceList.getActualPrice()));
|
||||||
totalAmount.add(priceList.getActualPrice());
|
totalAmount = totalAmount.add(priceList.getActualPrice());
|
||||||
orderDetailService.save(orderDetail);
|
orderDetailService.save(orderDetail);
|
||||||
|
|
||||||
item.getPhotos().forEach(photo -> photoAttachmentService.createPhotoDetail(photo, orderDetail.getId()));
|
item.getPhotos().forEach(photo -> photoAttachmentService.createPhotoDetail(photo, orderDetail.getId()));
|
||||||
});
|
}
|
||||||
order.setSubAmount(totalAmount.stream().reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP));
|
order.setSubAmount(totalAmount);
|
||||||
order.setTaxPercent(BigDecimal.valueOf(taxPercent).setScale(2, RoundingMode.HALF_UP));
|
order.setTaxPercent(BigDecimal.valueOf(taxPercent).setScale(2, RoundingMode.HALF_UP));
|
||||||
order.setTaxAmount(order.getSubAmount().multiply(BigDecimal.valueOf(taxPercent).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP)).setScale(2, RoundingMode.HALF_UP));
|
order.setTaxAmount(order.getSubAmount().multiply(BigDecimal.valueOf(taxPercent).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP)).setScale(2, RoundingMode.HALF_UP));
|
||||||
order.setTotalAmount(order.getSubAmount().add(order.getTaxAmount()).setScale(2, RoundingMode.HALF_UP));
|
order.setTotalAmount(order.getSubAmount().add(order.getTaxAmount()).setScale(2, RoundingMode.HALF_UP));
|
||||||
@@ -333,13 +367,13 @@ public class KioskServiceImpl implements IKioskApiService {
|
|||||||
vo.setCurrency(p.getCurrency());
|
vo.setCurrency(p.getCurrency());
|
||||||
vo.setOriginalPrice(p.getOriginalPrice());
|
vo.setOriginalPrice(p.getOriginalPrice());
|
||||||
vo.setActualPrice(p.getActualPrice());
|
vo.setActualPrice(p.getActualPrice());
|
||||||
vo.setBackPrint(p.getBackPrint());
|
vo.setBackPrint(p.getBackPrint() == 1 ? Boolean.TRUE : Boolean.FALSE);
|
||||||
vo.setBackPrintPrice(p.getBackPrintPrice());
|
vo.setBackPrintPrice(p.getBackPrintPrice());
|
||||||
vo.setSizeUpgrade(p.getSizeUpgrade());
|
vo.setSizeUpgrade(p.getSizeUpgrade() == 1 ? Boolean.TRUE : Boolean.FALSE);
|
||||||
vo.setSizeUpgradePrice(p.getSizeUpgradePrice());
|
vo.setSizeUpgradePrice(p.getSizeUpgradePrice());
|
||||||
vo.setMaterialUpgrade(p.getMaterialUpgrade());
|
vo.setMaterialUpgrade(p.getMaterialUpgrade() == 1 ? Boolean.TRUE : Boolean.FALSE);
|
||||||
vo.setMaterialUpgradePrice(p.getMaterialUpgradePrice());
|
vo.setMaterialUpgradePrice(p.getMaterialUpgradePrice());
|
||||||
vo.setStand(p.getStand());
|
vo.setStand(p.getStand() == 1 ? Boolean.TRUE : Boolean.FALSE);
|
||||||
vo.setStandPrice(p.getStandPrice());
|
vo.setStandPrice(p.getStandPrice());
|
||||||
return vo;
|
return vo;
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|||||||
Reference in New Issue
Block a user