feat:硬件登录

This commit is contained in:
dzc committed 2025-01-10 14:16:09 +08:00
1 parent 92b8cc1a14
commit 3f8f24c1ed
9 files changed
+43 -25

No files matched your search

@@ -11,7 +11,7 @@ public class HardBindDto {
@NotNull(message = "设备ID")
private Long id;
@Schema(description = "mac地址", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "mac地址")
@Schema(description = "android唯一标识", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "android唯一标识")
private String uniqueCode;
}
@@ -8,6 +8,10 @@ import lombok.Data;
@Data
public class HardManagerVo extends HardManagerEntity implements BaseDeptInterface, BaseMchInterface {
/**
* android重点使用
*/
private Long merchantDeptId;
private String deptName;
@@ -44,7 +44,7 @@ public class HardApiController {
@GetMapping("/get")
@Operation(summary = "获取硬件配置信息")
public R<HardManagerVo> get(@RequestParam Long id) {
return R.ok(BeanUtils.toBean(hardManagerService.getById(id), HardManagerVo.class));
return R.ok(hardManagerService.getById(id));
}
@GetMapping("/get-by-order-id")
@@ -16,4 +16,6 @@ public interface HardManagerService extends IService<HardManagerEntity> {
void edit(HardManagerDto dto);
HardManagerVo bind(HardBindDto dto);
HardManagerVo getById(Long hardId);
}
@@ -109,7 +109,15 @@ public class HardManagerServiceImpl extends ServiceImpl<HardManagerMapper, HardM
}
HardManagerEntity updateObj = HardManagerEntity.builder().id(detail.getId()).uniqueCode(dto.getUniqueCode()).build();
baseMapper.updateById(updateObj);
return BeanUtils.toBean(baseMapper.selectById(dto.getId()), HardManagerVo.class);
return getById(dto.getId());
}
@Override
public HardManagerVo getById(Long hardId) {
HardManagerEntity hard = baseMapper.selectById(hardId);
HardManagerVo vo = BeanUtils.toBean(hard, HardManagerVo.class);
vo.setMerchantDeptId(hard.getDeptId());
return vo;
}
private String createMqConfigByAction(Long deptId, Long hardId, Integer action) {
@@ -141,7 +141,7 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
List<SupermarketUnitWithSpuVo> supList = supermarketUnitSkuService.getSupermarketUnits(productIds).getData();
for (HardCreateCarDto v : list) {
supList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getProductId())).findFirst().ifPresent(spu -> {
int itemTotalPrice = v.getProductCount() * spu.getRetailPrice();
int itemTotalPrice = v.getProductCount() * spu.getPromotionPrice();
supermarketTotalPrice.addAndGet(itemTotalPrice);
});
}
@@ -192,10 +192,10 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
for (HardCreateCarDto v : productList) {
HardCarEntity item = HardCarEntity.builder().parentCarId(parentCarId).build();
supList.stream().filter(i -> ObjectUtil.equals(i.getId(), v.getProductId())).findFirst().ifPresent(spu -> {
int totalPrice = v.getProductCount() * spu.getRetailPrice();
int totalPrice = v.getProductCount() * spu.getPromotionPrice();
item.setProductId(spu.getId());
item.setProductName(spu.getProductName());
item.setProductPrice(spu.getRetailPrice());
item.setProductPrice(spu.getPromotionPrice());
item.setProductPic(spu.getPicUrl());
item.setTotalPrice((long) totalPrice);
item.setProductCount(v.getProductCount());
@@ -16,40 +16,39 @@ public class SupermarketUnitWithSpuVo {
/**
* 货号
*/
@Schema(description="货号")
@Schema(description = "货号")
private String productCode;
/**
* 自编码/条码
*/
@Schema(description="自编码/条码")
@Schema(description = "自编码/条码")
private String barcode;
/**
* 商品封面图
*/
@Schema(description="商品封面图")
@Schema(description = "商品封面图")
private String picUrl;
/**
* 商品名称
*/
@Schema(description="商品名称")
@Schema(description = "商品名称")
private String productName;
/**
* 商品分类编号
*/
@Schema(description="商品分类编号")
@Schema(description = "商品分类编号")
private Long categoryId;
/**
* 品牌id
*/
@Schema(description="品牌id")
@Schema(description = "品牌id")
private Long brandId;
@@ -60,43 +59,43 @@ public class SupermarketUnitWithSpuVo {
* 包装单位id
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="包装单位id")
@Schema(description = "包装单位id")
private Long id;
/**
* 条码
*/
@Schema(description="条码")
@Schema(description = "条码")
private String barCode;
/**
* 规格
*/
@Schema(description="规格")
@Schema(description = "规格")
private String spec;
/**
* 单位
*/
@Schema(description="单位")
@Schema(description = "单位")
private String unit;
/**
* 状态(0正常,1停销)
*/
@Schema(description="状态(0正常,1停销)")
@Schema(description = "状态(0正常,1停销)")
private Integer status;
/**
* 内装数量
*/
@Schema(description="内装数量")
@Schema(description = "内装数量")
private Integer packageNum;
/**
* 进价/单位分
*/
@Schema(description="进价")
@Schema(description = "进价")
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
private Integer purchasePrice;
@@ -104,17 +103,21 @@ public class SupermarketUnitWithSpuVo {
/**
* 零售价/单位分
*/
@Schema(description="零售价")
@Schema(description = "零售价")
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
private Integer retailPrice;
/**
* 促销价
*/
private Integer promotionPrice;
/**
* spuID
*/
@Schema(description="spuID")
@Schema(description = "spuID")
private Long spuId;
}
@@ -38,6 +38,7 @@
<result property="packageNum" column="package_num" />
<result property="purchasePrice" column="purchase_price" />
<result property="retailPrice" column="retail_price" />
<result property="promotionPrice" column="promotion_price" />
<result property="spuId" column="spu_id" />
</resultMap>
<select id="getSupermarketUnitsWithSpu" resultMap="SupermarketUnitWithSpuVoMap">
@@ -55,6 +56,7 @@
u.package_num,
u.purchase_price,
u.retail_price,
u.promotion_price,
u.spu_id
FROM supermarket_unit u
LEFT JOIN supermarket_spu s
@@ -6,7 +6,6 @@ import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.util.BeanUtils;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.common.security.annotation.Inner;