Merge branch 'master' of https://codeup.aliyun.com/bsdtec/biz-api-cloud
This commit is contained in:
commit
f922ddf09b
8 files changed
+283
-1
No files matched your search
+11
@@ -29,6 +29,9 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zjf
|
||||
* @date 2018/6/22
|
||||
@@ -54,4 +57,12 @@ public interface RemoteCanteenSpuService {
|
||||
@PostMapping("/canteenSpu/ad/updateSkuStock")
|
||||
R getAllSimple(@RequestBody CanteenSpuUpdateStockReqDTO updateStockReqDTO);
|
||||
|
||||
|
||||
/**
|
||||
* 根据ids查询菜品
|
||||
* @return ids
|
||||
*/
|
||||
@PostMapping("/canteenSpu/ad/getSpuListByIds")
|
||||
R getSpuListByIds(@RequestBody List<Long> ids);
|
||||
|
||||
}
|
||||
+14
@@ -24,6 +24,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -152,4 +153,17 @@ public class CanteenSpuController {
|
||||
public R updateSkuStock(@RequestBody CanteenSpuUpdateStockReqDTO updateStockReqDTO) {
|
||||
return canteenSpuService.updateSkuStock(updateStockReqDTO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过ids查询菜品spu
|
||||
* @param ids ids
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过ids查询" , description = "通过ids查询" )
|
||||
@PostMapping("/ad/getSpuListByIds" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenSpu_view')" )
|
||||
public R getByIds(@RequestBody List<Long> ids) {
|
||||
return R.ok( canteenSpuService.list(new LambdaQueryWrapper<CanteenSpuEntity>().in(CanteenSpuEntity::getId,ids)));
|
||||
}
|
||||
}
|
||||
+6
@@ -2,6 +2,10 @@ package com.bsd.pjcloud.canteen.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.bsd.pjcloud.common.core.util.MoneyDeserializer;
|
||||
import com.bsd.pjcloud.common.core.util.MoneySerializer;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -89,6 +93,8 @@ public class CanteenSpuEntity extends Model<CanteenSpuEntity> {
|
||||
* 商品价格,单位使用:分
|
||||
*/
|
||||
@Schema(description="商品价格,单位使用:分")
|
||||
@JsonSerialize(using = MoneySerializer.class) // 分 -> 元
|
||||
@JsonDeserialize(using = MoneyDeserializer.class) // 元 -> 分
|
||||
private Integer price;
|
||||
|
||||
/**
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.bsd.pjcloud.common.core.util;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class MoneyDeserializer extends JsonDeserializer<Integer> {
|
||||
@Override
|
||||
public Integer deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
||||
String text = p.getText();
|
||||
if (text == null || text.isEmpty()) {
|
||||
return 0; // 默认值
|
||||
}
|
||||
BigDecimal yuan = new BigDecimal(text);
|
||||
return yuan.multiply(new BigDecimal(100)).intValue();
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.bsd.pjcloud.common.core.util;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
public class MoneySerializer extends JsonSerializer<Integer> {
|
||||
@Override
|
||||
public void serialize(Integer value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
|
||||
if (value == null) {
|
||||
gen.writeString("0.00"); // 默认值
|
||||
return;
|
||||
}
|
||||
BigDecimal yuan = new BigDecimal(value).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
|
||||
gen.writeString(yuan.toString());
|
||||
}
|
||||
}
|
||||
+202
@@ -0,0 +1,202 @@
|
||||
package com.bsd.pjcloud.supermarket.vo;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SupermarketSpuVo {
|
||||
|
||||
/**
|
||||
* 商品 SPU 编号,自增
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description="商品 SPU 编号,自增")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 货号
|
||||
*/
|
||||
@Schema(description="货号")
|
||||
private String productCode;
|
||||
|
||||
/**
|
||||
* 自编码/条码
|
||||
*/
|
||||
@Schema(description="自编码/条码")
|
||||
private String barcode;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@Schema(description="商品名称")
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@Schema(description="单位")
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 商品简介
|
||||
*/
|
||||
@Schema(description="商品简介")
|
||||
private String introduction;
|
||||
|
||||
/**
|
||||
* 商品详情
|
||||
*/
|
||||
@Schema(description="商品详情")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 商品分类编号
|
||||
*/
|
||||
@Schema(description="商品分类编号")
|
||||
private Long categoryId;
|
||||
|
||||
/**
|
||||
* 商品封面图
|
||||
*/
|
||||
@Schema(description="商品封面图")
|
||||
private String picUrl;
|
||||
|
||||
/**
|
||||
* 商品轮播图地址
|
||||
数组,以逗号分隔
|
||||
最多上传15张
|
||||
*/
|
||||
@Schema(description="商品轮播图地址")
|
||||
private String sliderPicUrls;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 成本单价,单位: 分
|
||||
*/
|
||||
@Schema(description="成本单价,单位: 分")
|
||||
private Integer costPrice;
|
||||
|
||||
/**
|
||||
* 库存
|
||||
*/
|
||||
@Schema(description="库存")
|
||||
private Integer stock;
|
||||
|
||||
/**
|
||||
* 赠送积分
|
||||
*/
|
||||
@Schema(description="赠送积分")
|
||||
private Integer giveIntegral;
|
||||
|
||||
/**
|
||||
* 商户编号
|
||||
*/
|
||||
@Schema(description="商户编号")
|
||||
private Long merchantId;
|
||||
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
@Schema(description="规格")
|
||||
private String specification;
|
||||
|
||||
/**
|
||||
* 产地
|
||||
*/
|
||||
@Schema(description="产地")
|
||||
private String origin;
|
||||
|
||||
/**
|
||||
* 装数
|
||||
*/
|
||||
@Schema(description="装数")
|
||||
private Integer packingQuantity;
|
||||
|
||||
/**
|
||||
* 进价(分为单位)
|
||||
*/
|
||||
@Schema(description="进价(分为单位)")
|
||||
private Integer purchasePrice;
|
||||
|
||||
/**
|
||||
* 零售价(分为单位)
|
||||
*/
|
||||
@Schema(description="零售价(分为单位)")
|
||||
private Integer retailPrice;
|
||||
|
||||
|
||||
/**
|
||||
* 促销价(分为单位)
|
||||
*/
|
||||
@Schema(description="促销价(分为单位)")
|
||||
private Integer promotionPrice;
|
||||
|
||||
/**
|
||||
* 商品性质(字典)
|
||||
*/
|
||||
@Schema(description="商品性质(字典)")
|
||||
private String productNature;
|
||||
|
||||
/**
|
||||
* 签名上锁
|
||||
*/
|
||||
@Schema(description="签名上锁")
|
||||
private String archiverSignature;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 品牌id
|
||||
*/
|
||||
@Schema(description="品牌id")
|
||||
private Long brandId;
|
||||
|
||||
/**
|
||||
* 货商id
|
||||
*/
|
||||
@Schema(description="货商id")
|
||||
private Long supplierId;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description="创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@Schema(description="更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
@Schema(description = "销量")
|
||||
private Integer salesCount;
|
||||
|
||||
|
||||
|
||||
}
|
||||
+5
-1
@@ -138,6 +138,10 @@ public class SupermarketSpuController {
|
||||
return supermarketSpuService.list(Wrappers.lambdaQuery(supermarketSpu).in(ArrayUtil.isNotEmpty(ids), SupermarketSpuEntity::getId, ids));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// --------APP-----------------
|
||||
|
||||
@PostMapping("/ad/updateSpuStock")
|
||||
@SysLog("更新商品库存")
|
||||
public R updateSkuStock(@RequestBody SupermarketSpuUpdateStockReqDTO updateStockReqDTO){
|
||||
@@ -151,7 +155,7 @@ public class SupermarketSpuController {
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "条件查询所有" , description = "条件查询所有" )
|
||||
@GetMapping("/selectListAll" )
|
||||
@GetMapping("/ad/selectListAll" )
|
||||
@PreAuthorize("@pms.hasPermission('supermarket_supermarketSpu_view')" )
|
||||
public R getSupermarketSpuPage(@ParameterObject SupermarketSpuEntity supermarketSpu) {
|
||||
return R.ok(supermarketSpuService.selectListAllScope(supermarketSpu));
|
||||
|
||||
+2
@@ -136,6 +136,8 @@ public class SupermarketSpuServiceImpl extends ServiceImpl<SupermarketSpuMapper,
|
||||
@Override
|
||||
public Object selectListAllScope(SupermarketSpuEntity supermarketSpu) {
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user