feat: 新增接壤城市展示接口
This commit is contained in:
@@ -4,12 +4,18 @@ import com.jgy.xxs.core.http.resp.HttpResponse;
|
|||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import io.swagger.annotations.ApiParam;
|
import io.swagger.annotations.ApiParam;
|
||||||
import mjkf.xinke.main.common.http.FuHttpResponse;
|
import mjkf.xinke.main.common.http.FuHttpResponse;
|
||||||
|
import mjkf.xinke.main.constant.PricePublishType;
|
||||||
|
import mjkf.xinke.main.model.db.DataAdjacent;
|
||||||
import mjkf.xinke.main.model.db.LocalMaterial;
|
import mjkf.xinke.main.model.db.LocalMaterial;
|
||||||
|
import mjkf.xinke.main.model.db.PricePublish;
|
||||||
|
import mjkf.xinke.main.service.DataAdjacentService;
|
||||||
import mjkf.xinke.main.service.LocalMaterialService;
|
import mjkf.xinke.main.service.LocalMaterialService;
|
||||||
|
import mjkf.xinke.main.service.PricePublishService;
|
||||||
import mjkf.xinke.main.service.PriceResultService;
|
import mjkf.xinke.main.service.PriceResultService;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -22,6 +28,12 @@ public class DataShowingController {
|
|||||||
@Resource
|
@Resource
|
||||||
LocalMaterialService localMaterialService;
|
LocalMaterialService localMaterialService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
PricePublishService pricePublishService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
DataAdjacentService dataAdjacentService;
|
||||||
|
|
||||||
@ApiOperation("钢材")
|
@ApiOperation("钢材")
|
||||||
@GetMapping("/steel")
|
@GetMapping("/steel")
|
||||||
public HttpResponse steel (
|
public HttpResponse steel (
|
||||||
@@ -90,4 +102,20 @@ public class DataShowingController {
|
|||||||
var result = localMaterialService.list(query);
|
var result = localMaterialService.list(query);
|
||||||
return FuHttpResponse.Builder().dataResponse(result).build();
|
return FuHttpResponse.Builder().dataResponse(result).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("接壤城市")
|
||||||
|
@GetMapping("/adjacent")
|
||||||
|
public HttpResponse<List<PricePublish>> adjacent(
|
||||||
|
@ApiParam(value = "年") @RequestParam(value="year") Integer year,
|
||||||
|
@ApiParam(value = "月") @RequestParam(value="month") Integer month
|
||||||
|
) throws Exception {
|
||||||
|
var query = pricePublishService.getQuery( year, month,null,null, null, PricePublishType.CURRENT);
|
||||||
|
var result = pricePublishService.list(query);
|
||||||
|
for (var item : result) {
|
||||||
|
var queryAdjacent = dataAdjacentService.getQuery(null, year, month, item.getMaterialId(), null, null);
|
||||||
|
var adjacent = dataAdjacentService.getOne(queryAdjacent, false);
|
||||||
|
item.setAdjacent((DataAdjacent)adjacent);
|
||||||
|
}
|
||||||
|
return FuHttpResponse.Builder().dataResponse(result).build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -11,6 +11,8 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@@ -191,6 +193,11 @@ public class PricePublish extends Model<PricePublish> {
|
|||||||
@ExcelProperty(value={"单位"}, index=3)
|
@ExcelProperty(value={"单位"}, index=3)
|
||||||
private String unit;
|
private String unit;
|
||||||
|
|
||||||
|
@ApiModelProperty("接壤城市数据")
|
||||||
|
@ExcelIgnore
|
||||||
|
@TableField(exist = false)
|
||||||
|
private DataAdjacent adjacent;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Serializable pkVal() {
|
public Serializable pkVal() {
|
||||||
return this.id;
|
return this.id;
|
||||||
|
Reference in New Issue
Block a user