feat: 新增材料计算位数显示
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package mjkf.xinke.main.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.jgy.xxs.core.http.exp.NcHttpException;
|
||||
import com.jgy.xxs.core.http.resp.HttpResponse;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -12,6 +13,7 @@ import mjkf.xinke.main.constant.HttpErrorResponseEnum;
|
||||
import mjkf.xinke.main.constant.PricePublishStatus;
|
||||
import mjkf.xinke.main.model.db.PricePublish;
|
||||
import mjkf.xinke.main.model.vo.PricePublishEditRequest;
|
||||
import mjkf.xinke.main.service.MaterialService;
|
||||
import mjkf.xinke.main.service.PricePublishService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -32,6 +34,8 @@ public class PricePublishController {
|
||||
|
||||
@Resource
|
||||
PricePublishService pricePublishService;
|
||||
@Resource
|
||||
MaterialService materialService;
|
||||
|
||||
@ApiOperation("获取发布价格数据列表")
|
||||
@GetMapping("/")
|
||||
@@ -52,9 +56,15 @@ public class PricePublishController {
|
||||
year = date.getYear();
|
||||
month = date.getMonthValue();
|
||||
}
|
||||
|
||||
var query = pricePublishService.getQuery(year, month, materialId, name, spec, type);
|
||||
var materialMap = materialService.mapCode();
|
||||
var result = pricePublishService.list(query);
|
||||
for (var item: result) {
|
||||
var meterial = materialMap.get(item.getMaterialId());
|
||||
if (ObjectUtil.isNotEmpty(meterial)) {
|
||||
item.setRoundBit(meterial.getRoundBit());
|
||||
}
|
||||
}
|
||||
|
||||
return FuHttpResponse.Builder().dataResponse(result).build();
|
||||
}
|
||||
|
@@ -196,6 +196,10 @@ public class PricePublish extends Model<PricePublish> {
|
||||
@TableField("DISPLAY_DIGIT")
|
||||
private Integer displayDigit;
|
||||
|
||||
@ApiModelProperty("计算小数位数")
|
||||
@TableField(exist = false)
|
||||
private Integer roundBit;
|
||||
|
||||
@Override
|
||||
public Serializable pkVal() {
|
||||
return this.id;
|
||||
|
@@ -6,6 +6,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class MaterialService extends ServiceImpl<BaseMapper<Material>, Material> {
|
||||
@Deprecated
|
||||
@@ -49,5 +52,11 @@ public class MaterialService extends ServiceImpl<BaseMapper<Material>, Material>
|
||||
query.eq(Material::getCode, code);
|
||||
return this.getOne(query, false);
|
||||
}
|
||||
|
||||
public Map<String, Material> mapCode() {
|
||||
var list = this.list();
|
||||
var result = list.stream().collect(Collectors.toMap(i->i.getCode(), i->i));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user