Browse Source

feat(all): 修改仓库租用管理

dist.1.3.0
zhaoqiaobo 3 months ago
parent
commit
86b5b4db64
  1. 26
      blade-biz-common/src/main/java/org/springblade/common/jsonserializer/BigDecimalTwoDecimalSerializer.java
  2. 5
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/WarehouseLeasingEntity.java
  3. 15
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/WarehouseLeasingController.java
  4. 5
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/vo/WarehouseLeasingVO.java

26
blade-biz-common/src/main/java/org/springblade/common/jsonserializer/BigDecimalTwoDecimalSerializer.java

@ -0,0 +1,26 @@
package org.springblade.common.jsonserializer;
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;
/**
* BigDecimal 序列化器 保留2位小数 四舍五入
* @Author zqb
* @Date 2024/10/8
**/
public class BigDecimalTwoDecimalSerializer extends JsonSerializer<BigDecimal> {
@Override
public void serialize(BigDecimal value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
if (value != null) {
gen.writeNumber(value.setScale(2, RoundingMode.HALF_UP));
} else {
gen.writeNull();
}
}
}

5
blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/WarehouseLeasingEntity.java

@ -1,10 +1,12 @@
package com.logpm.basicdata.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.common.jsonserializer.BigDecimalTwoDecimalSerializer;
import org.springblade.core.tenant.mp.TenantEntity;
import java.math.BigDecimal;
@ -41,16 +43,19 @@ public class WarehouseLeasingEntity extends TenantEntity {
* 租用库位数
*/
@ApiModelProperty(value = "租用库位数")
@JsonSerialize(using = BigDecimalTwoDecimalSerializer.class)
private BigDecimal storageLocationCount;
/**
* 租用面积
*/
@ApiModelProperty(value = "租用面积")
@JsonSerialize(using = BigDecimalTwoDecimalSerializer.class)
private BigDecimal leasedArea;
/**
* 月租金
*/
@ApiModelProperty(value = "月租金")
@JsonSerialize(using = BigDecimalTwoDecimalSerializer.class)
private BigDecimal monthlyRent;
/**
* 租赁合同开始时间

15
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/WarehouseLeasingController.java

@ -16,6 +16,8 @@
*/
package com.logpm.basicdata.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -122,6 +124,19 @@ public class WarehouseLeasingController extends BladeController {
@ApiOperation(value = "分页", notes = "传入warehouseLeasing")
public R<IPage<WarehouseLeasingVO>> page(WarehouseLeasingVO warehouseLeasing, Query query) {
IPage<WarehouseLeasingVO> pages = warehouseLeasingService.selectWarehouseLeasingPage(Condition.getPage(query), warehouseLeasing);
if (ObjectUtil.isNotEmpty(pages)) {
List<WarehouseLeasingVO> records = pages.getRecords();
if (CollUtil.isNotEmpty(records)) {
for (WarehouseLeasingVO record : records) {
if (NumberUtil.equals(record.getType(), 1)) {
record.setTypeName("面积");
}
if (NumberUtil.equals(record.getType(), 2)) {
record.setTypeName("库位");
}
}
}
}
return R.data(pages);
}

5
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/vo/WarehouseLeasingVO.java

@ -37,6 +37,11 @@ public class WarehouseLeasingVO extends WarehouseLeasingEntity {
*/
@ApiModelProperty(value = "仓库名称")
private String warehouseName;
/**
* 租用类型名称
*/
@ApiModelProperty(value = "租用类型(名称)")
private String typeName;
/**
* 是否过期

Loading…
Cancel
Save