update:
1.change category attribution
This commit is contained in:
@@ -7,7 +7,6 @@ CREATE TABLE `kiosk_category`
|
||||
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '产品名称',
|
||||
`image_url` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '目录图片地址',
|
||||
`photo_limit` int NULL DEFAULT 1 COMMENT '照片数量',
|
||||
`shape` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '形状',
|
||||
`create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
|
||||
`create_dept` bigint NULL DEFAULT NULL COMMENT '创建部门',
|
||||
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||
@@ -26,11 +25,22 @@ CREATE TABLE `kiosk_price_list`
|
||||
`id` bigint AUTO_INCREMENT NOT NULL COMMENT '主键',
|
||||
`tenant_id` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '000000' COMMENT '租户ID',
|
||||
`category_id` bigint NOT NULL COMMENT 'cid',
|
||||
`shape` int NOT NULL DEFAULT 0 COMMENT '形状',
|
||||
`material` int NOT NULL DEFAULT 0 COMMENT '材质',
|
||||
`size` int NOT NULL DEFAULT 0 COMMENT '尺寸',
|
||||
`currency` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '货币',
|
||||
`price` decimal(10, 2) NOT NULL DEFAULT 0 COMMENT '单价',
|
||||
`shape` int NULL DEFAULT 0 COMMENT '形状',
|
||||
`material` int NULL DEFAULT 0 COMMENT '材质',
|
||||
`size` int NULL DEFAULT 0 COMMENT '尺寸',
|
||||
`size_description` varchar(255) NULL DEFAULT '' COMMENT '尺寸描述',
|
||||
`style` int NULL DEFAULT 0 COMMENT '风格',
|
||||
`currency` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '货币',
|
||||
`original_price` decimal(10, 2) NOT NULL DEFAULT 0 COMMENT '原价',
|
||||
`actual_price` decimal(10, 2) NULL DEFAULT 0 COMMENT '售价',
|
||||
`back_print` int NULL DEFAULT 1 COMMENT '背面打印',
|
||||
`back_print_price` decimal(10, 2) NULL DEFAULT 0 COMMENT '背面打印价格',
|
||||
`size_upgrade` int NULL DEFAULT 1 COMMENT '尺寸升级',
|
||||
`size_upgrade_price` decimal(10, 2) NULL DEFAULT 0 COMMENT '尺寸升级价格',
|
||||
`stand` int NULL DEFAULT 1 COMMENT '支架',
|
||||
`stand_price` decimal(10, 2) NULL DEFAULT 0 COMMENT '支架价格',
|
||||
`material_upgrade` int NULL DEFAULT 1 COMMENT '材料升级',
|
||||
`material_upgrade_price` decimal(10, 2) NULL DEFAULT 0 COMMENT '材料升级价格',
|
||||
`dept_id` bigint NULL DEFAULT NULL COMMENT '目标部门',
|
||||
`create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
|
||||
`create_dept` bigint NULL DEFAULT NULL COMMENT '创建部门',
|
||||
|
||||
@@ -97,6 +97,18 @@ public class KioskApiController {
|
||||
return R.data(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 风格目录查询
|
||||
*
|
||||
* @return List<DictBizApiVO>
|
||||
*/
|
||||
@GetMapping("/style-list")
|
||||
@Operation(summary = "风格目录")
|
||||
public R<List<DictBizApiVO>> styleList() {
|
||||
List<DictBizApiVO> list = kioskApiService.styleList();
|
||||
return R.data(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成上传地址
|
||||
*
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
<if test="priceList.csize !=null">
|
||||
and kpl.size = #{csize}
|
||||
</if>
|
||||
order by kpl.price, kc.type
|
||||
order by kpl.original_price, kc.type
|
||||
</select>
|
||||
|
||||
<select id="selectPriceList" resultType="org.springblade.modules.kiosk.pojo.vo.PriceListVO">
|
||||
@@ -74,14 +74,16 @@
|
||||
<if test="csize !=null">
|
||||
and kpl.size = #{csize}
|
||||
</if>
|
||||
order by kpl.price, kc.type
|
||||
<if test="style !=null">
|
||||
and kpl.style = #{style}
|
||||
</if>
|
||||
order by kpl.original_price, kc.type
|
||||
</select>
|
||||
|
||||
<insert id="initWallByCrossJoin">
|
||||
INSERT INTO kiosk_price_list (category_id, shape, material, size, dept_id, tenant_id, create_user, create_dept,
|
||||
INSERT INTO kiosk_price_list (category_id, material, size, dept_id, tenant_id, create_user, create_dept,
|
||||
create_time, update_user, update_time)
|
||||
SELECT c.id AS category_id,
|
||||
c.shape AS shape,
|
||||
CAST(m.dict_key AS SIGNED) AS material,
|
||||
CAST(s.dict_key AS SIGNED) AS size,
|
||||
#{targetDept} AS dept_id,
|
||||
|
||||
@@ -23,8 +23,8 @@ public class OrderApiRequest implements Serializable {
|
||||
@Data
|
||||
public static class Item {
|
||||
|
||||
@NotNull(message = "category is missing")
|
||||
private Long category;
|
||||
@NotNull(message = "priceList is missing")
|
||||
private Long priceList;
|
||||
|
||||
@NotEmpty(message = "snapshot is missing")
|
||||
private Long snapshot;
|
||||
@@ -32,15 +32,14 @@ public class OrderApiRequest implements Serializable {
|
||||
@NotEmpty(message = "photos is missing")
|
||||
private List<Photo> photos = List.of();
|
||||
|
||||
@NotNull(message = "size is missing")
|
||||
private Integer size;
|
||||
private Text printBack;
|
||||
|
||||
@NotNull(message = "material is missing")
|
||||
private Integer material;
|
||||
private Boolean extraStand;
|
||||
|
||||
private Integer shape;
|
||||
private Boolean sizeUp;
|
||||
|
||||
private Boolean materialUp;
|
||||
|
||||
private List<Long> accessories = List.of();
|
||||
}
|
||||
|
||||
@Data
|
||||
@@ -49,6 +48,12 @@ public class OrderApiRequest implements Serializable {
|
||||
private String content;
|
||||
|
||||
private String font;
|
||||
|
||||
private Integer size;
|
||||
|
||||
private Boolean bold;
|
||||
|
||||
private Boolean italic;
|
||||
}
|
||||
|
||||
@Data
|
||||
|
||||
@@ -68,10 +68,5 @@ public class CategoryEntity extends TenantEntity {
|
||||
*/
|
||||
@Schema(description = "照片数量")
|
||||
private Integer photoLimit;
|
||||
/**
|
||||
* 形状
|
||||
*/
|
||||
@Schema(description = "形状")
|
||||
private String shape;
|
||||
|
||||
}
|
||||
|
||||
@@ -77,15 +77,70 @@ public class PriceListEntity extends TenantEntity {
|
||||
@Schema(description = "尺寸")
|
||||
private Integer size;
|
||||
/**
|
||||
* 单价
|
||||
* 尺寸描述
|
||||
*/
|
||||
@Schema(description = "单价")
|
||||
@Schema(description = "尺寸描述")
|
||||
private String sizeDescription;
|
||||
/**
|
||||
* 风格
|
||||
*/
|
||||
@Schema(description = "风格")
|
||||
private Integer style;
|
||||
/**
|
||||
* 货币单位
|
||||
*/
|
||||
@Schema(description = "货币单位")
|
||||
private String currency;
|
||||
/**
|
||||
* 单价
|
||||
* 原价
|
||||
*/
|
||||
@Schema(description = "单价")
|
||||
private BigDecimal price;
|
||||
@Schema(description = "原价")
|
||||
private BigDecimal originalPrice;
|
||||
/**
|
||||
* 售价
|
||||
*/
|
||||
@Schema(description = "售价")
|
||||
private BigDecimal actualPrice;
|
||||
/**
|
||||
* 背面打印
|
||||
*/
|
||||
@Schema(description = "背面打印")
|
||||
private Integer backPrint;
|
||||
/**
|
||||
* 背面打印价格
|
||||
*/
|
||||
@Schema(description = "背面打印价格")
|
||||
private BigDecimal backPrintPrice;
|
||||
/**
|
||||
* 尺寸升级
|
||||
*/
|
||||
@Schema(description = "尺寸升级")
|
||||
private Integer sizeUpgrade;
|
||||
/**
|
||||
* 尺寸升级价格
|
||||
*/
|
||||
@Schema(description = "尺寸升级价格")
|
||||
private BigDecimal sizeUpgradePrice;
|
||||
/**
|
||||
* 材质升级
|
||||
*/
|
||||
@Schema(description = "材质升级")
|
||||
private Integer materialUpgrade;
|
||||
/**
|
||||
* 材质升级价格
|
||||
*/
|
||||
@Schema(description = "材质升级价格")
|
||||
private BigDecimal materialUpgradePrice;
|
||||
/**
|
||||
* 支架
|
||||
*/
|
||||
@Schema(description = "支架")
|
||||
private Integer stand;
|
||||
/**
|
||||
* 支架价格
|
||||
*/
|
||||
@Schema(description = "支架价格")
|
||||
private BigDecimal standPrice;
|
||||
/**
|
||||
* 目标部门
|
||||
*/
|
||||
|
||||
@@ -44,14 +44,38 @@ public class PriceListApiVO implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private Integer shape;
|
||||
|
||||
private Integer size;
|
||||
|
||||
private String sizeDescription;
|
||||
|
||||
private Integer material;
|
||||
|
||||
private Integer style;
|
||||
|
||||
private String currency;
|
||||
|
||||
private BigDecimal price;
|
||||
private BigDecimal originalPrice;
|
||||
|
||||
private BigDecimal actualPrice;
|
||||
|
||||
private Integer backPrint;
|
||||
|
||||
private BigDecimal backPrintPrice;
|
||||
|
||||
private Integer sizeUpgrade;
|
||||
|
||||
private BigDecimal sizeUpgradePrice;
|
||||
|
||||
private Integer materialUpgrade;
|
||||
|
||||
private BigDecimal materialUpgradePrice;
|
||||
|
||||
private Integer stand;
|
||||
|
||||
private BigDecimal standPrice;
|
||||
|
||||
}
|
||||
|
||||
@@ -74,15 +74,70 @@ public class PriceListVO extends TenantEntity {
|
||||
@Schema(description = "尺寸")
|
||||
private Integer csize;
|
||||
/**
|
||||
* 单价
|
||||
* 尺寸描述
|
||||
*/
|
||||
@Schema(description = "单价")
|
||||
@Schema(description = "尺寸描述")
|
||||
private String sizeDescription;
|
||||
/**
|
||||
* 风格
|
||||
*/
|
||||
@Schema(description = "风格")
|
||||
private Integer style;
|
||||
/**
|
||||
* 货币单位
|
||||
*/
|
||||
@Schema(description = "货币单位")
|
||||
private String currency;
|
||||
/**
|
||||
* 单价
|
||||
* 原价
|
||||
*/
|
||||
@Schema(description = "单价")
|
||||
private BigDecimal price;
|
||||
@Schema(description = "原价")
|
||||
private BigDecimal originalPrice;
|
||||
/**
|
||||
* 售价
|
||||
*/
|
||||
@Schema(description = "售价")
|
||||
private BigDecimal actualPrice;
|
||||
/**
|
||||
* 背面打印
|
||||
*/
|
||||
@Schema(description = "背面打印")
|
||||
private Integer printBack;
|
||||
/**
|
||||
* 背面打印价格
|
||||
*/
|
||||
@Schema(description = "背面打印价格")
|
||||
private BigDecimal printBackPrice;
|
||||
/**
|
||||
* 尺寸升级
|
||||
*/
|
||||
@Schema(description = "尺寸升级")
|
||||
private Integer sizeUpgrade;
|
||||
/**
|
||||
* 尺寸升级价格
|
||||
*/
|
||||
@Schema(description = "尺寸升级价格")
|
||||
private BigDecimal sizeUpgradePrice;
|
||||
/**
|
||||
* 材质升级
|
||||
*/
|
||||
@Schema(description = "材质升级")
|
||||
private Integer materialUpgrade;
|
||||
/**
|
||||
* 材质升级价格
|
||||
*/
|
||||
@Schema(description = "材质升级价格")
|
||||
private BigDecimal materialUpgradePrice;
|
||||
/**
|
||||
* 支架
|
||||
*/
|
||||
@Schema(description = "支架")
|
||||
private Integer stand;
|
||||
/**
|
||||
* 支架价格
|
||||
*/
|
||||
@Schema(description = "支架价格")
|
||||
private BigDecimal standPrice;
|
||||
/**
|
||||
* 目标部门
|
||||
*/
|
||||
|
||||
@@ -29,6 +29,8 @@ public interface IKioskApiService {
|
||||
|
||||
List<DictBizApiVO> shapeList();
|
||||
|
||||
List<DictBizApiVO> styleList();
|
||||
|
||||
Long upload(String fileName, InputStream stream);
|
||||
|
||||
List<PriceListApiVO> priceList(Long id);
|
||||
|
||||
@@ -69,6 +69,8 @@ public class KioskServiceImpl implements IKioskApiService {
|
||||
|
||||
private static final String materialType = "material_type";
|
||||
|
||||
private static final String styleType = "style_type";
|
||||
|
||||
private static final String categoryType = "category_type";
|
||||
|
||||
private static final String autoCleanKey = "kiosk.default.autoCleanSeconds";
|
||||
@@ -187,31 +189,33 @@ public class KioskServiceImpl implements IKioskApiService {
|
||||
OrderDetailEntity orderDetail = new OrderDetailEntity();
|
||||
orderDetail.setOrderId(order.getId());
|
||||
|
||||
CategoryEntity category = categoryService.getById(item.getCategory());
|
||||
PriceListEntity priceList = priceListService.getById(item.getPriceList());
|
||||
if (priceList == null) {
|
||||
throw new ServiceException("Invalid price.");
|
||||
}
|
||||
|
||||
CategoryEntity category = categoryService.getById(priceList.getCategoryId());
|
||||
if (category == null) {
|
||||
throw new ServiceException("Invalid category.");
|
||||
}
|
||||
if (category.getType() == 1 && item.getShape() == null) {
|
||||
throw new ServiceException("Invalid shape.");
|
||||
}
|
||||
orderDetail.setCategoryId(item.getCategory());
|
||||
|
||||
orderDetail.setCategoryId(priceList.getCategoryId());
|
||||
orderDetail.setCategoryType(category.getType());
|
||||
orderDetail.setCategoryName(category.getName());
|
||||
|
||||
String materialTypeValue = dictService.getValue(materialType, String.valueOf(item.getMaterial()));
|
||||
String materialTypeValue = dictService.getValue(materialType, String.valueOf(priceList.getMaterial()));
|
||||
if (StringUtil.isBlank(materialTypeValue)) {
|
||||
throw new ServiceException("Invalid material.");
|
||||
}
|
||||
orderDetail.setMaterial(materialTypeValue);
|
||||
|
||||
String sizeTypeValue = dictService.getValue(sizeType, String.valueOf(item.getSize()));
|
||||
String sizeTypeValue = dictService.getValue(sizeType, String.valueOf(priceList.getSize()));
|
||||
if (StringUtil.isBlank(sizeTypeValue)) {
|
||||
throw new ServiceException("Invalid size.");
|
||||
}
|
||||
orderDetail.setSize(sizeTypeValue);
|
||||
|
||||
String shapeTypeKey = category.getType() == 1 ? String.valueOf(item.getShape()) : category.getShape();
|
||||
String shapeTypeValue = dictService.getValue(shapeType, shapeTypeKey);
|
||||
String shapeTypeValue = dictService.getValue(shapeType, String.valueOf(priceList.getShape()));
|
||||
if (StringUtil.isBlank(shapeTypeValue)) {
|
||||
throw new ServiceException("Invalid shape.");
|
||||
}
|
||||
@@ -223,17 +227,9 @@ public class KioskServiceImpl implements IKioskApiService {
|
||||
}
|
||||
orderDetail.setSnapshotLink(snapshotPhoto.getLink());
|
||||
|
||||
PriceListEntity price = priceListService.getOne(Wrappers.<PriceListEntity>lambdaQuery()
|
||||
.eq(PriceListEntity::getCategoryId, category.getId())
|
||||
.eq(PriceListEntity::getShape, Integer.valueOf(shapeTypeKey))
|
||||
.eq(PriceListEntity::getSize, item.getSize())
|
||||
.eq(PriceListEntity::getMaterial, item.getMaterial())
|
||||
);
|
||||
if (price == null) {
|
||||
throw new ServiceException("Invalid price.");
|
||||
}
|
||||
orderDetail.setTotalAmount(price.getPrice());
|
||||
totalAmount.add(price.getPrice());
|
||||
|
||||
orderDetail.setTotalAmount(priceList.getActualPrice());
|
||||
totalAmount.add(priceList.getActualPrice());
|
||||
orderDetailService.save(orderDetail);
|
||||
|
||||
item.getPhotos().forEach(photo -> photoAttachmentService.createPhotoDetail(photo, orderDetail.getId()));
|
||||
@@ -289,6 +285,16 @@ public class KioskServiceImpl implements IKioskApiService {
|
||||
}).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictBizApiVO> styleList() {
|
||||
return dictService.getList(styleType).stream().map(dictBiz -> {
|
||||
DictBizApiVO vo = new DictBizApiVO();
|
||||
vo.setKey(dictBiz.getDictKey());
|
||||
vo.setValue(dictBiz.getDictValue());
|
||||
return vo;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long upload(String fileName, InputStream stream) {
|
||||
BladeUser user = AuthUtil.getUser();
|
||||
@@ -320,9 +326,19 @@ public class KioskServiceImpl implements IKioskApiService {
|
||||
PriceListApiVO vo = new PriceListApiVO();
|
||||
vo.setShape(p.getShape());
|
||||
vo.setSize(p.getSize());
|
||||
vo.setSizeDescription(p.getSizeDescription());
|
||||
vo.setMaterial(p.getMaterial());
|
||||
vo.setCurrency(p.getCurrency());
|
||||
vo.setPrice(p.getPrice());
|
||||
vo.setOriginalPrice(p.getOriginalPrice());
|
||||
vo.setActualPrice(p.getActualPrice());
|
||||
vo.setBackPrint(p.getBackPrint());
|
||||
vo.setBackPrintPrice(p.getBackPrintPrice());
|
||||
vo.setSizeUpgrade(p.getSizeUpgrade());
|
||||
vo.setSizeUpgradePrice(p.getSizeUpgradePrice());
|
||||
vo.setMaterialUpgrade(p.getMaterialUpgrade());
|
||||
vo.setMaterialUpgradePrice(p.getMaterialUpgradePrice());
|
||||
vo.setStand(p.getStand());
|
||||
vo.setStandPrice(p.getStandPrice());
|
||||
return vo;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user