feat(material-task): 新增采集任务相关接口
This commit is contained in:
26
pom.xml
26
pom.xml
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-boot</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<version>1.0.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>material-manage-service</artifactId>
|
||||
@@ -39,12 +39,12 @@
|
||||
<version>${dep.xxs-common-core.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- test -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!--<!– test –>-->
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>org.springframework.boot</groupId>-->
|
||||
<!--<artifactId>spring-boot-starter-test</artifactId>-->
|
||||
<!--<scope>test</scope>-->
|
||||
<!--</dependency>-->
|
||||
|
||||
<!-- junit -->
|
||||
<dependency>
|
||||
@@ -102,12 +102,12 @@
|
||||
<!--<version>${mjkf-xinke.version}</version>-->
|
||||
<!--</dependency>-->
|
||||
|
||||
<!--<!– 移动端管理插件 –>-->
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>mjkf.xinke</groupId>-->
|
||||
<!--<artifactId>mjkf-xinke-plugin-mobile</artifactId>-->
|
||||
<!--<version>${mjkf-xinke.version}</version>-->
|
||||
<!--</dependency>-->
|
||||
<!-- 移动端管理插件 -->
|
||||
<dependency>
|
||||
<groupId>mjkf.xinke</groupId>
|
||||
<artifactId>mjkf-xinke-plugin-mobile</artifactId>
|
||||
<version>${mjkf-xinke.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 系统功能插件 -->
|
||||
<dependency>
|
||||
|
48
src/main/java/mjkf/xinke/main/common/api/DataToolApi.java
Normal file
48
src/main/java/mjkf/xinke/main/common/api/DataToolApi.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package mjkf.xinke.main.common.api;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.jgy.xxs.core.http.resp.NcHttpResponse;
|
||||
import okhttp3.MultipartBody;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface DataToolApi {
|
||||
|
||||
@GET("/data/by-task")
|
||||
Call<NcHttpResponse<List<JsonObject>>> listDataByTask(
|
||||
@Query("type") Integer type, @Query("id") String id,
|
||||
@Query("limit") Integer limit, @Query("page") Integer page
|
||||
);
|
||||
|
||||
// @POST("/split/remote-sensing-image/single/sync")
|
||||
// Call<ResponseBody> splitRemoteSensingImageSingleSync(@Body PointRangeMsg jsonObject);
|
||||
|
||||
@POST("/split/remote-sensing-image/multi/sync")
|
||||
Call<ResponseBody> splitRemoteSensingImageMultiSync(@Body JSONArray points);
|
||||
|
||||
@Multipart
|
||||
@POST("/tools/parse-point-range/kml")
|
||||
Call<JSONObject> toolsParsePointRangeKml(@Part() MultipartBody.Part files);
|
||||
|
||||
@Multipart
|
||||
@POST("/tools/convert")
|
||||
Call<ResponseBody> convert(@Part() MultipartBody.Part files, @Query("to_crs") String toCRS, @Query("format") String format);
|
||||
|
||||
@POST("/tools/create-shape/fe-data")
|
||||
Call<ResponseBody> createShapeByFeData(@Body JSONObject feData);
|
||||
|
||||
@Multipart
|
||||
@POST("/landuse/import-data/async")
|
||||
Call<JSONObject> importLanduseDataAsync(
|
||||
@Part() MultipartBody.Part files, @Query("cm") Double cm, @Query("project_id") Long projectId,
|
||||
@Query("project_no") String projectNo, @Query("project_name") String projectName,
|
||||
@Query("creator_id") String creatorId, @Query("creator_name") String creatorName,
|
||||
@Query("building_tolerance") Double buildingTolerance
|
||||
);
|
||||
}
|
@@ -21,17 +21,7 @@ public class DataDbMpGenerator {
|
||||
private static String password = "Xxs123456";
|
||||
private static String schema = "material_manage";
|
||||
private static String[] tableList = {
|
||||
"OIL",
|
||||
"CEMENT",
|
||||
"ASPHALT_DOMESTIC",
|
||||
"ASPHALT_IMPORTED",
|
||||
"STEEL_PLATE",
|
||||
"STEEL_REBAR",
|
||||
"STEEL_STRAND",
|
||||
"MATERIAL",
|
||||
"MATERIAL_TASK",
|
||||
"PRICE_PUBLISH",
|
||||
"PRICE_RESULT",
|
||||
"SANMING_STEEL",
|
||||
};
|
||||
|
||||
|
||||
|
@@ -0,0 +1,12 @@
|
||||
package mjkf.xinke.main.common.property;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Data
|
||||
@ConfigurationProperties(prefix = "api.host")
|
||||
@Component
|
||||
public class ApiHostProperty {
|
||||
private String dataTool;
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
package mjkf.xinke.main.common.serializer;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Deprecated
|
||||
public class DotTupleFieldSerializer extends JsonSerializer<String> {
|
||||
@Override
|
||||
public void serialize(String s, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
|
||||
if (s == null || ObjectUtil.isEmpty(s)) {
|
||||
jsonGenerator.writeNull();
|
||||
} else {
|
||||
String[] data = s.split(",");
|
||||
jsonGenerator.writeArray(data, 0, data.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,38 @@
|
||||
package mjkf.xinke.main.config;
|
||||
|
||||
import org.springframework.boot.context.properties.source.ConfigurationPropertySource;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.mitre.dsmiley.httpproxy.ProxyServlet;
|
||||
import org.springframework.boot.context.properties.bind.BindResult;
|
||||
import org.springframework.boot.context.properties.bind.Binder;
|
||||
import org.springframework.boot.context.properties.source.ConfigurationPropertySources;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.context.EnvironmentAware;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
@Configuration
|
||||
public class SolrProxyServletConfig implements EnvironmentAware {
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean servletRegistrationBean() {
|
||||
Properties properties = (Properties) bindResult.get();
|
||||
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new ProxyServlet(), properties.getProperty("servlet_url"));
|
||||
servletRegistrationBean.addInitParameter(ProxyServlet.P_TARGET_URI, properties.getProperty("target_url"));
|
||||
servletRegistrationBean.addInitParameter(ProxyServlet.P_LOG, properties.getProperty("logging_enabled", "false"));
|
||||
return servletRegistrationBean;
|
||||
}
|
||||
|
||||
private BindResult bindResult;
|
||||
|
||||
@Override
|
||||
public void setEnvironment(Environment environment) {
|
||||
Iterable<ConfigurationPropertySource> sources = ConfigurationPropertySources.get(environment);
|
||||
Binder binder = new Binder(sources);
|
||||
BindResult<Properties> bindResult = binder.bind("proxy.solr", Properties.class);
|
||||
this.bindResult = bindResult;
|
||||
}
|
||||
}
|
||||
|
@@ -3,30 +3,34 @@ package mjkf.xinke.main.constant;
|
||||
import java.util.List;
|
||||
|
||||
public class MaterialTaskType {
|
||||
public static final Integer MY_STEEL_REBAR = 101; // 钢筋网_钢筋
|
||||
// public static final Integer MY_STEEL_ = ""; // 钢筋网_钢绞线
|
||||
public static final Integer MY_STEEL_STRAND = 103; // 钢筋网_型钢
|
||||
public static final Integer MY_STEEL_PLATE = 104; // 钢筋网_中厚板
|
||||
|
||||
public static final Integer BAIINFO_ASPHALT_DOMESTIC = 201; // 百川网_国产沥青
|
||||
public static final Integer BAIINFO_ASPHALT_IMPORTED = 202; // 百川网_进口沥青
|
||||
public static final Integer BAIINFO_CEMENT = 203; // 百川网_水泥
|
||||
|
||||
public static final Integer SANMING_STEEL = 301; // 三明钢铁
|
||||
|
||||
// 钢筋网
|
||||
public static final Integer MY_STEEL_REBAR = 101; // 钢筋
|
||||
public static final Integer MY_STEEL_SECTION = 102; // 型钢
|
||||
public static final Integer MY_STEEL_STRAND = 103; // 钢绞线
|
||||
public static final Integer MY_STEEL_PLATE = 104; // 中厚板
|
||||
// 百川网
|
||||
public static final Integer BAIINFO_ASPHALT_DOMESTIC = 201; // 国产沥青
|
||||
public static final Integer BAIINFO_ASPHALT_IMPORTED = 202; // 进口沥青
|
||||
public static final Integer BAIINFO_CEMENT = 203; // 水泥
|
||||
// 三明钢铁
|
||||
public static final Integer SANMING_STEEL = 301;
|
||||
// 材料信息
|
||||
public static final Integer FUZHOU_TRANSPORTATION_BUREAU = 401; // 福州交通局
|
||||
public static final Integer FUZHOU_HIGHWAY_BUREAU = 402; // 福州公路局
|
||||
|
||||
public static final Integer FUJIAN_SURVEY = 501; // 福建省交通工程材料调查表
|
||||
|
||||
public static final Integer OTHER_ZHEJIANG = 601; // 其他省份_浙江
|
||||
public static final Integer OTHER_GIANLZHOU = 602; // 其他省份_广州
|
||||
public static final Integer OTHER_YUNNAN = 603; // 其他省份_云南
|
||||
|
||||
public static final Integer FUJIAN_DEPARTMENT = 701; // 住建厅
|
||||
// 福建省交通工程材料调查表
|
||||
public static final Integer FUJIAN_SURVEY = 501;
|
||||
// 其他省份
|
||||
public static final Integer OTHER_ZHEJIANG = 601; // 浙江
|
||||
public static final Integer OTHER_GIANLZHOU = 602; // 广州
|
||||
public static final Integer OTHER_YUNNAN = 603; // 云南
|
||||
// 住建厅
|
||||
public static final Integer FUJIAN_DEPARTMENT = 701;
|
||||
// 发改委
|
||||
public static final Integer OIL = 801; // 汽柴油
|
||||
|
||||
public static final List<Integer> list = List.of(
|
||||
MY_STEEL_REBAR,
|
||||
MY_STEEL_SECTION,
|
||||
MY_STEEL_STRAND,
|
||||
MY_STEEL_PLATE,
|
||||
BAIINFO_ASPHALT_DOMESTIC,
|
||||
@@ -39,7 +43,19 @@ public class MaterialTaskType {
|
||||
OTHER_ZHEJIANG,
|
||||
OTHER_GIANLZHOU,
|
||||
OTHER_YUNNAN,
|
||||
FUJIAN_DEPARTMENT
|
||||
FUJIAN_DEPARTMENT,
|
||||
OIL
|
||||
);
|
||||
|
||||
public static boolean isFromSpider(Integer type) {
|
||||
var dataFromSpiderTypes = List.of(
|
||||
OIL,
|
||||
OTHER_ZHEJIANG,
|
||||
OTHER_GIANLZHOU,
|
||||
OTHER_YUNNAN,
|
||||
FUJIAN_DEPARTMENT
|
||||
);
|
||||
return dataFromSpiderTypes.contains(type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2,8 +2,10 @@ package mjkf.xinke.main.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.jgy.xxs.core.http.exp.NcHttpException;
|
||||
import com.jgy.xxs.core.http.resp.HttpResponse;
|
||||
import com.jgy.xxs.core.http.resp.NcHttpResponse;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import mjkf.xinke.auth.core.util.StpLoginUserUtil;
|
||||
@@ -11,10 +13,12 @@ import mjkf.xinke.main.common.http.FuHttpResponse;
|
||||
import mjkf.xinke.main.constant.HttpErrorResponseEnum;
|
||||
import mjkf.xinke.main.model.db.MaterialTask;
|
||||
import mjkf.xinke.main.model.vo.MaterialTaskCreateRequest;
|
||||
import mjkf.xinke.main.service.DataToolService;
|
||||
import mjkf.xinke.main.service.MaterialTaskService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@@ -48,6 +52,7 @@ public class MaterialTaskController {
|
||||
query.like(MaterialTask::getName, keyWord);
|
||||
}
|
||||
var result = materialTaskService.page(new Page<>(page, limit), query);
|
||||
|
||||
return FuHttpResponse.Builder().pageResponse(result).build();
|
||||
}
|
||||
|
||||
@@ -62,44 +67,6 @@ public class MaterialTaskController {
|
||||
var data = new MaterialTask(params, user);
|
||||
materialTaskService.save(data);
|
||||
|
||||
// todo 解析
|
||||
// todo 写入数据
|
||||
// try (Workbook workbook = WorkbookFactory.create(file.getInputStream())) {
|
||||
// Sheet sheet = workbook.getSheetAt(0); // 假设文件中只有一个表格
|
||||
//
|
||||
// Iterator<Row> rowIterator = sheet.iterator();
|
||||
// rowIterator.next(); // 跳过标题行
|
||||
//
|
||||
// while (rowIterator.hasNext()) {
|
||||
// Row row = rowIterator.next();
|
||||
// // 从每一行中获取数据并调用 MyBatis-Plus 的方法写入数据库
|
||||
// yourService.saveData(row.getCell(0).getStringCellValue(), row.getCell(1).getNumericCellValue());
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
return FuHttpResponse.Builder().dataResponse(data).build();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("获取采集任务数据")
|
||||
@GetMapping("/{id}/data")
|
||||
public HttpResponse getData(
|
||||
@ApiParam("每页数量") @RequestParam(name = "limit", defaultValue = "10") Integer limit,
|
||||
@ApiParam("页码") @RequestParam(name = "page", defaultValue = "1") Integer page,
|
||||
@PathVariable String id
|
||||
) throws Exception {
|
||||
// 获取类型
|
||||
var data = materialTaskService.getById(id);
|
||||
if (data == null) {
|
||||
throw new NcHttpException(HttpErrorResponseEnum.MATERIAL_TASK_NOT_FOUND);
|
||||
}
|
||||
var type = data.getType();
|
||||
// todo 根据类型定位数据表
|
||||
// todo 按任务id作为过滤条件查找数据(分页)
|
||||
|
||||
return FuHttpResponse.Builder().dataResponse().build();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
73
src/main/java/mjkf/xinke/main/model/db/AsphaltDomestic.java
Normal file
73
src/main/java/mjkf/xinke/main/model/db/AsphaltDomestic.java
Normal file
@@ -0,0 +1,73 @@
|
||||
package mjkf.xinke.main.model.db;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 国产沥青
|
||||
* </p>
|
||||
*
|
||||
* @author han0
|
||||
* @since 2023-11-08
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("ASPHALT_DOMESTIC")
|
||||
@ApiModel(value = "AsphaltDomestic对象", description = "国产沥青")
|
||||
public class AsphaltDomestic extends Model<AsphaltDomestic> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "ID", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
@TableField("`NAME`")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("价格")
|
||||
@TableField("PRICE")
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty("日期")
|
||||
@TableField("`DATE`")
|
||||
private LocalDate date;
|
||||
|
||||
@ApiModelProperty("数据来源")
|
||||
@TableField("`FROM`")
|
||||
private String from;
|
||||
|
||||
@Override
|
||||
public Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public AsphaltDomestic () {}
|
||||
|
||||
public AsphaltDomestic (Row row) {
|
||||
this.setName(row.getCell(0).getStringCellValue());
|
||||
this.setPrice(BigDecimal.valueOf(row.getCell(1).getNumericCellValue()));
|
||||
this.setDate(row.getCell(2).getLocalDateTimeCellValue().toLocalDate());
|
||||
this.setFrom(row.getCell(3).getStringCellValue());
|
||||
}
|
||||
|
||||
public AsphaltDomestic update(AsphaltDomestic item) {
|
||||
this.setName(item.getName());
|
||||
this.setPrice(item.getPrice());
|
||||
this.setDate(item.getDate());
|
||||
this.setFrom(item.getFrom());
|
||||
return this;
|
||||
}
|
||||
}
|
67
src/main/java/mjkf/xinke/main/model/db/AsphaltImported.java
Normal file
67
src/main/java/mjkf/xinke/main/model/db/AsphaltImported.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package mjkf.xinke.main.model.db;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 进口沥青
|
||||
* </p>
|
||||
*
|
||||
* @author han0
|
||||
* @since 2023-11-08
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("ASPHALT_IMPORTED")
|
||||
@ApiModel(value = "AsphaltImported对象", description = "进口沥青")
|
||||
public class AsphaltImported extends Model<AsphaltImported> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "ID", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
@TableField("`NAME`")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("价格")
|
||||
@TableField("PRICE")
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty("日期")
|
||||
@TableField("`DATE`")
|
||||
private LocalDate date;
|
||||
|
||||
@Override
|
||||
public Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public AsphaltImported () {}
|
||||
|
||||
public AsphaltImported (Row row) {
|
||||
this.setName(row.getCell(0).getStringCellValue());
|
||||
this.setPrice(BigDecimal.valueOf(row.getCell(1).getNumericCellValue()));
|
||||
this.setDate(row.getCell(2).getLocalDateTimeCellValue().toLocalDate());
|
||||
}
|
||||
|
||||
public AsphaltImported update(AsphaltImported item) {
|
||||
this.setName(item.getName());
|
||||
this.setPrice(item.getPrice());
|
||||
this.setDate(item.getDate());
|
||||
return this;
|
||||
}
|
||||
}
|
91
src/main/java/mjkf/xinke/main/model/db/Cement.java
Normal file
91
src/main/java/mjkf/xinke/main/model/db/Cement.java
Normal file
@@ -0,0 +1,91 @@
|
||||
package mjkf.xinke.main.model.db;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 水泥
|
||||
* </p>
|
||||
*
|
||||
* @author han0
|
||||
* @since 2023-11-08
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("CEMENT")
|
||||
@ApiModel(value = "Cement对象", description = "水泥")
|
||||
public class Cement extends Model<Cement> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "ID", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
@TableField("`NAME`")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("规格")
|
||||
@TableField("SPEC")
|
||||
private String spec;
|
||||
|
||||
@ApiModelProperty("包装")
|
||||
@TableField("PACK")
|
||||
private String pack;
|
||||
|
||||
@ApiModelProperty("产地")
|
||||
@TableField("`SOURCE`")
|
||||
private String source;
|
||||
|
||||
@ApiModelProperty("价格")
|
||||
@TableField("PRICE")
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty("浮动")
|
||||
@TableField("FLUCTUATING")
|
||||
private BigDecimal fluctuating;
|
||||
|
||||
@ApiModelProperty("日期")
|
||||
@TableField("`DATE`")
|
||||
private LocalDate date;
|
||||
|
||||
@Override
|
||||
public Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public Cement () {}
|
||||
|
||||
public Cement (Row row) {
|
||||
this.setName(row.getCell(0).getStringCellValue());
|
||||
this.setSpec(row.getCell(1).getStringCellValue());
|
||||
this.setPack(row.getCell(2).getStringCellValue());
|
||||
this.setSource(row.getCell(3).getStringCellValue());
|
||||
this.setPrice(BigDecimal.valueOf(row.getCell(4).getNumericCellValue()));
|
||||
this.setFluctuating(BigDecimal.valueOf(row.getCell(5).getNumericCellValue()));
|
||||
this.setDate(row.getCell(6).getLocalDateTimeCellValue().toLocalDate());
|
||||
}
|
||||
|
||||
public Cement update(Cement item) {
|
||||
this.setName(item.getName());
|
||||
this.setSpec(item.getSpec());
|
||||
this.setPack(item.getPack());
|
||||
this.setSource(item.getSource());
|
||||
this.setPrice(item.getPrice());
|
||||
this.setFluctuating(item.getFluctuating());
|
||||
this.setDate(item.getDate());
|
||||
return this;
|
||||
}
|
||||
}
|
73
src/main/java/mjkf/xinke/main/model/db/FujianSurvey.java
Normal file
73
src/main/java/mjkf/xinke/main/model/db/FujianSurvey.java
Normal file
@@ -0,0 +1,73 @@
|
||||
package mjkf.xinke.main.model.db;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 福建省交通工程材料调查表
|
||||
* </p>
|
||||
*
|
||||
* @author han0
|
||||
* @since 2023-11-22
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("FUJIAN_SURVEY")
|
||||
@ApiModel(value = "FujianSurvey对象", description = "福建省交通工程材料调查表")
|
||||
public class FujianSurvey extends Model<FujianSurvey> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "ID", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
@TableField("`NAME`")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("规格")
|
||||
@TableField("SPEC")
|
||||
private String spec;
|
||||
|
||||
@ApiModelProperty("价格")
|
||||
@TableField("PRICE")
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty("日期")
|
||||
@TableField("`DATE`")
|
||||
private LocalDate date;
|
||||
|
||||
@Override
|
||||
public Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public FujianSurvey () {}
|
||||
|
||||
public FujianSurvey (Row row) {
|
||||
this.setName(row.getCell(0).getStringCellValue());
|
||||
this.setSpec(row.getCell(1).getStringCellValue());
|
||||
this.setPrice(BigDecimal.valueOf(row.getCell(2).getNumericCellValue()));
|
||||
this.setDate(row.getCell(3).getLocalDateTimeCellValue().toLocalDate());
|
||||
}
|
||||
|
||||
public FujianSurvey update(FujianSurvey item) {
|
||||
this.setName(item.getName());
|
||||
this.setSpec(item.getSpec());
|
||||
this.setPrice(item.getPrice());
|
||||
this.setDate(item.getDate());
|
||||
return this;
|
||||
}
|
||||
}
|
@@ -0,0 +1,73 @@
|
||||
package mjkf.xinke.main.model.db;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 福州公路局
|
||||
* </p>
|
||||
*
|
||||
* @author han0
|
||||
* @since 2023-11-22
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("FUZHOU_HIGHWAY_BUREAU")
|
||||
@ApiModel(value = "FuzhouHighwayBureau对象", description = "福州公路局")
|
||||
public class FuzhouHighwayBureau extends Model<FuzhouHighwayBureau> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "ID", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
@TableField("`NAME`")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("规格")
|
||||
@TableField("SPEC")
|
||||
private String spec;
|
||||
|
||||
@ApiModelProperty("价格")
|
||||
@TableField("PRICE")
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty("日期")
|
||||
@TableField("`DATE`")
|
||||
private LocalDate date;
|
||||
|
||||
@Override
|
||||
public Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public FuzhouHighwayBureau () {}
|
||||
|
||||
public FuzhouHighwayBureau (Row row) {
|
||||
this.setName(row.getCell(0).getStringCellValue());
|
||||
this.setSpec(row.getCell(1).getStringCellValue());
|
||||
this.setPrice(BigDecimal.valueOf(row.getCell(2).getNumericCellValue()));
|
||||
this.setDate(row.getCell(3).getLocalDateTimeCellValue().toLocalDate());
|
||||
}
|
||||
|
||||
public FuzhouHighwayBureau update(FuzhouHighwayBureau item) {
|
||||
this.setName(item.getName());
|
||||
this.setSpec(item.getSpec());
|
||||
this.setPrice(item.getPrice());
|
||||
this.setDate(item.getDate());
|
||||
return this;
|
||||
}
|
||||
}
|
@@ -0,0 +1,73 @@
|
||||
package mjkf.xinke.main.model.db;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 福州交通局
|
||||
* </p>
|
||||
*
|
||||
* @author han0
|
||||
* @since 2023-11-22
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("FUZHOU_TRANSPORTATION_BUREAU")
|
||||
@ApiModel(value = "FuzhouTransportationBureau对象", description = "福州交通局")
|
||||
public class FuzhouTransportationBureau extends Model<FuzhouTransportationBureau> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "ID", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
@TableField("`NAME`")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("规格")
|
||||
@TableField("SPEC")
|
||||
private String spec;
|
||||
|
||||
@ApiModelProperty("价格")
|
||||
@TableField("PRICE")
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty("日期")
|
||||
@TableField("`DATE`")
|
||||
private LocalDate date;
|
||||
|
||||
@Override
|
||||
public Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public FuzhouTransportationBureau () {}
|
||||
|
||||
public FuzhouTransportationBureau (Row row) {
|
||||
this.setName(row.getCell(0).getStringCellValue());
|
||||
this.setSpec(row.getCell(1).getStringCellValue());
|
||||
this.setPrice(BigDecimal.valueOf(row.getCell(2).getNumericCellValue()));
|
||||
this.setDate(row.getCell(3).getLocalDateTimeCellValue().toLocalDate());
|
||||
}
|
||||
|
||||
public FuzhouTransportationBureau update(FuzhouTransportationBureau item) {
|
||||
this.setName(item.getName());
|
||||
this.setSpec(item.getSpec());
|
||||
this.setPrice(item.getPrice());
|
||||
this.setDate(item.getDate());
|
||||
return this;
|
||||
}
|
||||
}
|
@@ -15,6 +15,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import mjkf.xinke.auth.core.pojo.SaBaseLoginUser;
|
||||
import mjkf.xinke.main.common.serializer.FastjsonArrayHandler;
|
||||
import mjkf.xinke.main.constant.MaterialTaskStatus;
|
||||
import mjkf.xinke.main.model.vo.MaterialTaskCreateRequest;
|
||||
|
||||
@@ -29,7 +30,7 @@ import mjkf.xinke.main.model.vo.MaterialTaskCreateRequest;
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
|
||||
@TableName("MATERIAL_TASK")
|
||||
@TableName(value="MATERIAL_TASK", autoResultMap=true)
|
||||
@ApiModel(value = "MaterialTask对象", description = "采集任务")
|
||||
public class MaterialTask extends Model<MaterialTask> {
|
||||
|
||||
@@ -90,10 +91,18 @@ public class MaterialTask extends Model<MaterialTask> {
|
||||
@TableField("`TYPE`")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty("采集年份")
|
||||
@TableField("`YEAR`")
|
||||
private Integer year;
|
||||
|
||||
@ApiModelProperty("采集月份")
|
||||
@TableField("`MONTH`")
|
||||
private Integer month;
|
||||
|
||||
@ApiModelProperty("数据")
|
||||
@TableField(value="`CONTENT`", typeHandler = FastjsonArrayHandler.class)
|
||||
private Object content;
|
||||
|
||||
@Override
|
||||
public Serializable pkVal() {
|
||||
return this.id;
|
||||
|
85
src/main/java/mjkf/xinke/main/model/db/SanmingSteel.java
Normal file
85
src/main/java/mjkf/xinke/main/model/db/SanmingSteel.java
Normal file
@@ -0,0 +1,85 @@
|
||||
package mjkf.xinke.main.model.db;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 三明钢铁
|
||||
* </p>
|
||||
*
|
||||
* @author han0
|
||||
* @since 2023-11-22
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("SANMING_STEEL")
|
||||
@ApiModel(value = "SanmingSteel对象", description = "三明钢铁")
|
||||
public class SanmingSteel extends Model<SanmingSteel> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "ID", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
@TableField("`NAME`")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("规格")
|
||||
@TableField("SPEC")
|
||||
private String spec;
|
||||
|
||||
@ApiModelProperty("材质")
|
||||
@TableField("MATERIAL")
|
||||
private String material;
|
||||
|
||||
@ApiModelProperty("价格")
|
||||
@TableField("PRICE")
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty("浮动")
|
||||
@TableField("FLUCTUATING")
|
||||
private BigDecimal fluctuating;
|
||||
|
||||
@ApiModelProperty("日期")
|
||||
@TableField("`DATE`")
|
||||
private LocalDate date;
|
||||
|
||||
@Override
|
||||
public Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public SanmingSteel () {}
|
||||
|
||||
public SanmingSteel (Row row) {
|
||||
this.setName(row.getCell(0).getStringCellValue());
|
||||
this.setSpec(row.getCell(1).getStringCellValue());
|
||||
this.setMaterial(row.getCell(2).getStringCellValue());
|
||||
this.setPrice(BigDecimal.valueOf(row.getCell(3).getNumericCellValue()));
|
||||
this.setFluctuating(BigDecimal.valueOf(row.getCell(4).getNumericCellValue()));
|
||||
this.setDate(row.getCell(5).getLocalDateTimeCellValue().toLocalDate());
|
||||
}
|
||||
|
||||
public SanmingSteel update(SanmingSteel item) {
|
||||
this.setName(item.getName());
|
||||
this.setSpec(item.getSpec());
|
||||
this.setMaterial(item.getMaterial());
|
||||
this.setPrice(item.getPrice());
|
||||
this.setFluctuating(item.getFluctuating());
|
||||
this.setDate(item.getDate());
|
||||
return this;
|
||||
}
|
||||
}
|
47
src/main/java/mjkf/xinke/main/model/db/SteelEntity.java
Normal file
47
src/main/java/mjkf/xinke/main/model/db/SteelEntity.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package mjkf.xinke.main.model.db;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import lombok.Data;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
public class SteelEntity<T extends Model<?>> extends Model<T> {
|
||||
private String name;
|
||||
private String spec;
|
||||
private String material;
|
||||
private String source;
|
||||
private BigDecimal price;
|
||||
private BigDecimal fluctuating;
|
||||
private LocalDate date;
|
||||
|
||||
public SteelEntity update(SteelEntity item) {
|
||||
this.setName(item.getName());
|
||||
this.setSpec(item.getSpec());
|
||||
this.setMaterial(item.getMaterial());
|
||||
this.setSource(item.getSource());
|
||||
this.setPrice(item.getPrice());
|
||||
this.setFluctuating(item.getFluctuating());
|
||||
this.setDate(item.getDate());
|
||||
return this;
|
||||
}
|
||||
|
||||
public void fromRow(Row row) {
|
||||
this.setName(row.getCell(0).getStringCellValue());
|
||||
this.setSpec(row.getCell(1).getStringCellValue());
|
||||
this.setMaterial(row.getCell(2).getStringCellValue());
|
||||
this.setSource(row.getCell(3).getStringCellValue());
|
||||
this.setPrice(BigDecimal.valueOf(row.getCell(4).getNumericCellValue()));
|
||||
this.setFluctuating(BigDecimal.valueOf(row.getCell(5).getNumericCellValue()));
|
||||
this.setDate(row.getCell(6).getLocalDateTimeCellValue().toLocalDate());
|
||||
}
|
||||
|
||||
public SteelEntity() {}
|
||||
|
||||
public SteelEntity(Row row) {
|
||||
this.fromRow(row);
|
||||
}
|
||||
}
|
74
src/main/java/mjkf/xinke/main/model/db/SteelPlate.java
Normal file
74
src/main/java/mjkf/xinke/main/model/db/SteelPlate.java
Normal file
@@ -0,0 +1,74 @@
|
||||
package mjkf.xinke.main.model.db;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 中厚板
|
||||
* </p>
|
||||
*
|
||||
* @author han0
|
||||
* @since 2023-11-08
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("STEEL_PLATE")
|
||||
@ApiModel(value = "SteelPlate对象", description = "中厚板")
|
||||
public class SteelPlate extends SteelEntity<SteelPlate> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "ID", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
@TableField("`NAME`")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("规格")
|
||||
@TableField("SPEC")
|
||||
private String spec;
|
||||
|
||||
@ApiModelProperty("材质")
|
||||
@TableField("MATERIAL")
|
||||
private String material;
|
||||
|
||||
@ApiModelProperty("产地")
|
||||
@TableField("`SOURCE`")
|
||||
private String source;
|
||||
|
||||
@ApiModelProperty("价格")
|
||||
@TableField("PRICE")
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty("浮动")
|
||||
@TableField("FLUCTUATING")
|
||||
private BigDecimal fluctuating;
|
||||
|
||||
@ApiModelProperty("日期")
|
||||
@TableField("`DATE`")
|
||||
private LocalDate date;
|
||||
|
||||
@Override
|
||||
public Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public SteelPlate() {}
|
||||
|
||||
public SteelPlate(Row row) {
|
||||
this.fromRow(row);
|
||||
}
|
||||
}
|
73
src/main/java/mjkf/xinke/main/model/db/SteelRebar.java
Normal file
73
src/main/java/mjkf/xinke/main/model/db/SteelRebar.java
Normal file
@@ -0,0 +1,73 @@
|
||||
package mjkf.xinke.main.model.db;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 钢筋
|
||||
* </p>
|
||||
*
|
||||
* @author han0
|
||||
* @since 2023-11-08
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("STEEL_REBAR")
|
||||
@ApiModel(value = "SteelRebar对象", description = "钢筋")
|
||||
public class SteelRebar extends SteelEntity<SteelRebar> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "ID", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
@TableField("`NAME`")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("规格")
|
||||
@TableField("SPEC")
|
||||
private String spec;
|
||||
|
||||
@ApiModelProperty("材质")
|
||||
@TableField("MATERIAL")
|
||||
private String material;
|
||||
|
||||
@ApiModelProperty("产地")
|
||||
@TableField("`SOURCE`")
|
||||
private String source;
|
||||
|
||||
@ApiModelProperty("价格")
|
||||
@TableField("PRICE")
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty("浮动")
|
||||
@TableField("FLUCTUATING")
|
||||
private BigDecimal fluctuating;
|
||||
|
||||
@ApiModelProperty("日期")
|
||||
@TableField("`DATE`")
|
||||
private LocalDate date;
|
||||
|
||||
@Override
|
||||
public Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public SteelRebar() {}
|
||||
|
||||
public SteelRebar(Row row) {
|
||||
this.fromRow(row);
|
||||
}
|
||||
}
|
73
src/main/java/mjkf/xinke/main/model/db/SteelSection.java
Normal file
73
src/main/java/mjkf/xinke/main/model/db/SteelSection.java
Normal file
@@ -0,0 +1,73 @@
|
||||
package mjkf.xinke.main.model.db;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 型钢
|
||||
* </p>
|
||||
*
|
||||
* @author han0
|
||||
* @since 2023-11-21
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("STEEL_SECTION")
|
||||
@ApiModel(value = "SteelSection对象", description = "型钢")
|
||||
public class SteelSection extends SteelEntity<SteelSection>{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "ID", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
@TableField("`NAME`")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("规格")
|
||||
@TableField("SPEC")
|
||||
private String spec;
|
||||
|
||||
@ApiModelProperty("材质")
|
||||
@TableField("MATERIAL")
|
||||
private String material;
|
||||
|
||||
@ApiModelProperty("产地")
|
||||
@TableField("`SOURCE`")
|
||||
private String source;
|
||||
|
||||
@ApiModelProperty("价格")
|
||||
@TableField("PRICE")
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty("浮动")
|
||||
@TableField("FLUCTUATING")
|
||||
private BigDecimal fluctuating;
|
||||
|
||||
@ApiModelProperty("日期")
|
||||
@TableField("`DATE`")
|
||||
private LocalDate date;
|
||||
|
||||
@Override
|
||||
public Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public SteelSection() {}
|
||||
|
||||
public SteelSection(Row row) {
|
||||
this.fromRow(row);
|
||||
}
|
||||
}
|
77
src/main/java/mjkf/xinke/main/service/ApiService.java
Normal file
77
src/main/java/mjkf/xinke/main/service/ApiService.java
Normal file
@@ -0,0 +1,77 @@
|
||||
package mjkf.xinke.main.service;
|
||||
|
||||
import com.jgy.xxs.core.http.exp.NcHttpException;
|
||||
import mjkf.xinke.main.constant.HttpErrorResponseEnum;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.logging.HttpLoggingInterceptor;
|
||||
import org.apache.http.HttpStatus;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public interface ApiService<V> {
|
||||
Integer timeout = 60;
|
||||
|
||||
default <T> Response<T> getResponse(Call<T> call) throws Exception {
|
||||
Response<T> response = call.execute();
|
||||
if (!response.isSuccessful()) {
|
||||
var isBodyEmpty = response.errorBody() == null;
|
||||
if (isBodyEmpty) {
|
||||
throw new NcHttpException(HttpErrorResponseEnum.SYSTEM_ERROR);
|
||||
}
|
||||
var isContentTypeJson = response.errorBody().contentType().toString().equals("application/json");
|
||||
if (isContentTypeJson) {
|
||||
throw new NcHttpException(response.errorBody().string(), 500, HttpStatus.SC_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
throw new NcHttpException(HttpErrorResponseEnum.SYSTEM_ERROR);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
default Map<String, RequestBody> buildRequestBodyParams(Map<String, Object> rawParams) {
|
||||
Map<String, RequestBody> params = new HashMap<>();
|
||||
params.put("f", RequestBody.create(null, "json"));
|
||||
rawParams.forEach((key, value) -> params.put(key, RequestBody.create(null, String.valueOf(value))));
|
||||
return params;
|
||||
}
|
||||
|
||||
default V initApi(String host) {
|
||||
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
|
||||
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BASIC);
|
||||
OkHttpClient client = new OkHttpClient.Builder()
|
||||
.connectTimeout(timeout, TimeUnit.MINUTES)
|
||||
.readTimeout(timeout, TimeUnit.MINUTES)
|
||||
.addInterceptor(loggingInterceptor)
|
||||
.build();
|
||||
return initApi(host, client);
|
||||
}
|
||||
|
||||
default V initApi(String host, Integer timeout) {
|
||||
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
|
||||
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
|
||||
OkHttpClient client = new OkHttpClient.Builder()
|
||||
.connectTimeout(timeout, TimeUnit.SECONDS)
|
||||
.readTimeout(timeout, TimeUnit.SECONDS)
|
||||
.addInterceptor(loggingInterceptor)
|
||||
.build();
|
||||
return initApi(host, client);
|
||||
}
|
||||
|
||||
default V initApi(String host, OkHttpClient client) {
|
||||
var apiClass = (Class<V>) ((ParameterizedType) this.getClass().getAnnotatedInterfaces()[0].getType()).getActualTypeArguments()[0];
|
||||
V retrofit = new Retrofit.Builder()
|
||||
.baseUrl(host)
|
||||
.client(client)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.build().create(apiClass);
|
||||
return retrofit;
|
||||
}
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
package mjkf.xinke.main.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import mjkf.xinke.main.model.db.AsphaltDomestic;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class AsphaltDomesticService extends ServiceImpl<BaseMapper<AsphaltDomestic>, AsphaltDomestic> {
|
||||
public boolean saveOrUpdateByIndex(AsphaltDomestic data) {
|
||||
var result = this.getOne(this.indexQuery(data));
|
||||
if (result == null) {
|
||||
return this.save(data);
|
||||
} else {
|
||||
result.update(data);
|
||||
return this.updateById(result);
|
||||
}
|
||||
}
|
||||
|
||||
public List<AsphaltDomestic> saveOrUpdateByIndexBatch(List<Row> rows) {
|
||||
var list = rows.stream().map(item -> new AsphaltDomestic(item)).collect(Collectors.toList());
|
||||
for (AsphaltDomestic item : list) {
|
||||
this.saveOrUpdateByIndex(item);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<AsphaltDomestic> indexQuery(AsphaltDomestic data) {
|
||||
LambdaQueryWrapper<AsphaltDomestic> query = new LambdaQueryWrapper<>();
|
||||
query.eq(AsphaltDomestic::getName, data.getName());
|
||||
query.eq(AsphaltDomestic::getDate, data.getDate());
|
||||
return query;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,40 @@
|
||||
package mjkf.xinke.main.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import mjkf.xinke.main.model.db.AsphaltImported;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class AsphaltImportedService extends ServiceImpl<BaseMapper<AsphaltImported>, AsphaltImported> {
|
||||
public boolean saveOrUpdateByIndex(AsphaltImported data) {
|
||||
var result = this.getOne(this.indexQuery(data));
|
||||
if (result == null) {
|
||||
return this.save(data);
|
||||
} else {
|
||||
result.update(data);
|
||||
return this.updateById(result);
|
||||
}
|
||||
}
|
||||
|
||||
public List<AsphaltImported> saveOrUpdateByIndexBatch(List<Row> rows) {
|
||||
var list = rows.stream().map(item -> new AsphaltImported(item)).collect(Collectors.toList());
|
||||
for (AsphaltImported item : list) {
|
||||
this.saveOrUpdateByIndex(item);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<AsphaltImported> indexQuery(AsphaltImported data) {
|
||||
LambdaQueryWrapper<AsphaltImported> query = new LambdaQueryWrapper<>();
|
||||
query.eq(AsphaltImported::getName, data.getName());
|
||||
query.eq(AsphaltImported::getDate, data.getDate());
|
||||
return query;
|
||||
}
|
||||
}
|
||||
|
43
src/main/java/mjkf/xinke/main/service/CementService.java
Normal file
43
src/main/java/mjkf/xinke/main/service/CementService.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package mjkf.xinke.main.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import mjkf.xinke.main.model.db.Cement;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class CementService extends ServiceImpl<BaseMapper<Cement>, Cement> {
|
||||
public boolean saveOrUpdateByIndex(Cement data) {
|
||||
var result = this.getOne(this.indexQuery(data));
|
||||
if (result == null) {
|
||||
return this.save(data);
|
||||
} else {
|
||||
result.update(data);
|
||||
return this.updateById(result);
|
||||
}
|
||||
}
|
||||
|
||||
public List<Cement> saveOrUpdateByIndexBatch(List<Row> rows) {
|
||||
var list = rows.stream().map(item -> new Cement(item)).collect(Collectors.toList());
|
||||
for (Cement item : list) {
|
||||
this.saveOrUpdateByIndex(item);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<Cement> indexQuery(Cement data) {
|
||||
LambdaQueryWrapper<Cement> query = new LambdaQueryWrapper<>();
|
||||
query.eq(Cement::getName, data.getName());
|
||||
query.eq(Cement::getSpec, data.getSpec());
|
||||
query.eq(Cement::getPack, data.getPack());
|
||||
query.eq(Cement::getSource, data.getSource());
|
||||
query.eq(Cement::getDate, data.getDate());
|
||||
return query;
|
||||
}
|
||||
}
|
||||
|
32
src/main/java/mjkf/xinke/main/service/DataToolService.java
Normal file
32
src/main/java/mjkf/xinke/main/service/DataToolService.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package mjkf.xinke.main.service;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.jgy.xxs.core.http.resp.NcHttpResponse;
|
||||
import mjkf.xinke.main.common.api.DataToolApi;
|
||||
import mjkf.xinke.main.common.property.ApiHostProperty;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class DataToolService implements ApiService<DataToolApi> {
|
||||
@Resource
|
||||
ApiHostProperty apiHostProperty;
|
||||
|
||||
private DataToolApi api;
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
this.api = this.initApi(apiHostProperty.getDataTool());
|
||||
}
|
||||
|
||||
public NcHttpResponse<List<JsonObject>> listDataByTask (Integer type, String id, Integer limit, Integer page) throws Exception {
|
||||
var call = this.api.listDataByTask(type, id, limit, page);
|
||||
var response = this.getResponse(call).body();
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,41 @@
|
||||
package mjkf.xinke.main.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import mjkf.xinke.main.model.db.FujianSurvey;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class FujianSurveyService extends ServiceImpl<BaseMapper<FujianSurvey>, FujianSurvey> {
|
||||
public boolean saveOrUpdateByIndex(FujianSurvey data) {
|
||||
var result = this.getOne(this.indexQuery(data));
|
||||
if (result == null) {
|
||||
return this.save(data);
|
||||
} else {
|
||||
result.update(data);
|
||||
return this.updateById(result);
|
||||
}
|
||||
}
|
||||
|
||||
public List<FujianSurvey> saveOrUpdateByIndexBatch(List<Row> rows) {
|
||||
var list = rows.stream().map(item -> new FujianSurvey(item)).collect(Collectors.toList());
|
||||
for (FujianSurvey item : list) {
|
||||
this.saveOrUpdateByIndex(item);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<FujianSurvey> indexQuery(FujianSurvey data) {
|
||||
LambdaQueryWrapper<FujianSurvey> query = new LambdaQueryWrapper<>();
|
||||
query.eq(FujianSurvey::getName, data.getName());
|
||||
query.eq(FujianSurvey::getSpec, data.getSpec());
|
||||
query.eq(FujianSurvey::getDate, data.getDate());
|
||||
return query;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,41 @@
|
||||
package mjkf.xinke.main.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import mjkf.xinke.main.model.db.FuzhouHighwayBureau;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class FuzhouHighwayBureauService extends ServiceImpl<BaseMapper<FuzhouHighwayBureau>, FuzhouHighwayBureau> {
|
||||
public boolean saveOrUpdateByIndex(FuzhouHighwayBureau data) {
|
||||
var result = this.getOne(this.indexQuery(data));
|
||||
if (result == null) {
|
||||
return this.save(data);
|
||||
} else {
|
||||
result.update(data);
|
||||
return this.updateById(result);
|
||||
}
|
||||
}
|
||||
|
||||
public List<FuzhouHighwayBureau> saveOrUpdateByIndexBatch(List<Row> rows) {
|
||||
var list = rows.stream().map(item -> new FuzhouHighwayBureau(item)).collect(Collectors.toList());
|
||||
for (FuzhouHighwayBureau item : list) {
|
||||
this.saveOrUpdateByIndex(item);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<FuzhouHighwayBureau> indexQuery(FuzhouHighwayBureau data) {
|
||||
LambdaQueryWrapper<FuzhouHighwayBureau> query = new LambdaQueryWrapper<>();
|
||||
query.eq(FuzhouHighwayBureau::getName, data.getName());
|
||||
query.eq(FuzhouHighwayBureau::getSpec, data.getSpec());
|
||||
query.eq(FuzhouHighwayBureau::getDate, data.getDate());
|
||||
return query;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,42 @@
|
||||
package mjkf.xinke.main.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import mjkf.xinke.main.model.db.FuzhouTransportationBureau;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class FuzhouTransportationBureauService extends ServiceImpl<BaseMapper<FuzhouTransportationBureau>, FuzhouTransportationBureau> {
|
||||
public boolean saveOrUpdateByIndex(FuzhouTransportationBureau data) {
|
||||
var result = this.getOne(this.indexQuery(data));
|
||||
if (result == null) {
|
||||
return this.save(data);
|
||||
} else {
|
||||
result.update(data);
|
||||
return this.updateById(result);
|
||||
}
|
||||
}
|
||||
|
||||
public List<FuzhouTransportationBureau> saveOrUpdateByIndexBatch(List<Row> rows) {
|
||||
var list = rows.stream().map(item -> new FuzhouTransportationBureau(item)).collect(Collectors.toList());
|
||||
for (FuzhouTransportationBureau item : list) {
|
||||
this.saveOrUpdateByIndex(item);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<FuzhouTransportationBureau> indexQuery(FuzhouTransportationBureau data) {
|
||||
LambdaQueryWrapper<FuzhouTransportationBureau> query = new LambdaQueryWrapper<>();
|
||||
query.eq(FuzhouTransportationBureau::getName, data.getName());
|
||||
query.eq(FuzhouTransportationBureau::getSpec, data.getSpec());
|
||||
query.eq(FuzhouTransportationBureau::getDate, data.getDate());
|
||||
return query;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,12 +1,139 @@
|
||||
package mjkf.xinke.main.service;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import mjkf.xinke.dev.modular.file.entity.DevFile;
|
||||
import mjkf.xinke.dev.modular.file.service.DevFileService;
|
||||
import mjkf.xinke.main.constant.MaterialTaskStatus;
|
||||
import mjkf.xinke.main.constant.MaterialTaskType;
|
||||
import mjkf.xinke.main.model.db.MaterialTask;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class MaterialTaskService extends ServiceImpl<BaseMapper<MaterialTask>, MaterialTask> {
|
||||
@Resource
|
||||
DevFileService devFileService;
|
||||
@Resource
|
||||
SteelRebarService steelRebarService;
|
||||
@Resource
|
||||
SteelSectionService steelSectionService;
|
||||
@Resource
|
||||
SteelStrandService steelStrandService;
|
||||
@Resource
|
||||
SteelPlateService steelPlateService;
|
||||
@Resource
|
||||
AsphaltDomesticService asphaltDomesticService;
|
||||
@Resource
|
||||
AsphaltImportedService asphaltImportedService;
|
||||
@Resource
|
||||
CementService cementService;
|
||||
@Resource
|
||||
SanmingSteelService sanmingSteelService;
|
||||
@Resource
|
||||
FuzhouTransportationBureauService fuzhouTransportationBureauService;
|
||||
@Resource
|
||||
FuzhouHighwayBureauService fuzhouHighwayBureauService;
|
||||
@Resource
|
||||
FujianSurveyService fujianSurveyService;
|
||||
|
||||
@Override
|
||||
public boolean save(MaterialTask data) {
|
||||
var result = super.save(data);
|
||||
try {
|
||||
// 根据类型判断
|
||||
if (MaterialTaskType.isFromSpider(data.getType())) {
|
||||
// 2.启动爬虫任务
|
||||
this.runSpider(data);
|
||||
data.setStatus(MaterialTaskStatus.DOING);
|
||||
super.updateById(data);
|
||||
} else {
|
||||
// 1.直接表格导入数据
|
||||
this.importData(data);
|
||||
data.setStatus(MaterialTaskStatus.DONE);
|
||||
super.updateById(data);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
data.setStatus(MaterialTaskStatus.FAILED);
|
||||
super.updateById(data);
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean importData(MaterialTask data) throws Exception {
|
||||
// 获取文件
|
||||
DevFile devFile = devFileService.queryEntity(data.getFile());
|
||||
File file = FileUtil.file(devFile.getStoragePath());
|
||||
// 解析
|
||||
List<Row> rows = this.getTableRows(file);
|
||||
// 导入
|
||||
List list;
|
||||
if (data.getType().equals(MaterialTaskType.MY_STEEL_REBAR)) {
|
||||
list = steelRebarService.saveOrUpdateByIndexBatch(rows);
|
||||
} else if (data.getType().equals(MaterialTaskType.MY_STEEL_SECTION)) {
|
||||
list = steelSectionService.saveOrUpdateByIndexBatch(rows);
|
||||
} else if (data.getType().equals(MaterialTaskType.MY_STEEL_STRAND)) {
|
||||
list = steelStrandService.saveOrUpdateByIndexBatch(rows);
|
||||
} else if (data.getType().equals(MaterialTaskType.MY_STEEL_PLATE)) {
|
||||
list = steelPlateService.saveOrUpdateByIndexBatch(rows);
|
||||
} else if (data.getType().equals(MaterialTaskType.BAIINFO_ASPHALT_DOMESTIC)) {
|
||||
list = asphaltDomesticService.saveOrUpdateByIndexBatch(rows);
|
||||
} else if (data.getType().equals(MaterialTaskType.BAIINFO_ASPHALT_IMPORTED)) {
|
||||
list = asphaltImportedService.saveOrUpdateByIndexBatch(rows);
|
||||
} else if (data.getType().equals(MaterialTaskType.BAIINFO_CEMENT)) {
|
||||
list = cementService.saveOrUpdateByIndexBatch(rows);
|
||||
} else if (data.getType().equals(MaterialTaskType.SANMING_STEEL)) {
|
||||
list = sanmingSteelService.saveOrUpdateByIndexBatch(rows);
|
||||
} else if (data.getType().equals(MaterialTaskType.FUZHOU_TRANSPORTATION_BUREAU)) {
|
||||
list = fuzhouTransportationBureauService.saveOrUpdateByIndexBatch(rows);
|
||||
} else if (data.getType().equals(MaterialTaskType.FUZHOU_HIGHWAY_BUREAU)) {
|
||||
list = fuzhouHighwayBureauService.saveOrUpdateByIndexBatch(rows);
|
||||
} else if (data.getType().equals(MaterialTaskType.FUJIAN_SURVEY)) {
|
||||
list = fujianSurveyService.saveOrUpdateByIndexBatch(rows);
|
||||
} else {
|
||||
// todo 异常处理:未识别的类型
|
||||
return false;
|
||||
}
|
||||
// 保存数据副本
|
||||
data.setContent(JSON.toJSON(list));
|
||||
super.updateById(data);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void runSpider(MaterialTask data) {
|
||||
// todo
|
||||
}
|
||||
|
||||
private List<Row> getTableRows(File file) throws IOException {
|
||||
List<Row> result = new ArrayList<>();
|
||||
try (Workbook workbook = WorkbookFactory.create(file)) {
|
||||
Sheet sheet = workbook.getSheetAt(0); // 假设文件中只有一个表格
|
||||
Iterator<Row> rowIterator = sheet.iterator();
|
||||
rowIterator.next( ); // 跳过标题行
|
||||
while (rowIterator.hasNext()) {
|
||||
Row row = rowIterator.next();
|
||||
result.add(row);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,43 @@
|
||||
package mjkf.xinke.main.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import mjkf.xinke.main.model.db.SanmingSteel;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class SanmingSteelService extends ServiceImpl<BaseMapper<SanmingSteel>, SanmingSteel> {
|
||||
public boolean saveOrUpdateByIndex(SanmingSteel data) {
|
||||
var result = this.getOne(this.indexQuery(data));
|
||||
if (result == null) {
|
||||
return this.save(data);
|
||||
} else {
|
||||
result.update(data);
|
||||
return this.updateById(result);
|
||||
}
|
||||
}
|
||||
|
||||
public List<SanmingSteel> saveOrUpdateByIndexBatch(List<Row> rows) {
|
||||
var list = rows.stream().map(item -> new SanmingSteel(item)).collect(Collectors.toList());
|
||||
for (SanmingSteel item : list) {
|
||||
this.saveOrUpdateByIndex(item);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SanmingSteel> indexQuery(SanmingSteel data) {
|
||||
LambdaQueryWrapper<SanmingSteel> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SanmingSteel::getName, data.getName());
|
||||
query.eq(SanmingSteel::getSpec, data.getSpec());
|
||||
query.eq(SanmingSteel::getMaterial, data.getMaterial());
|
||||
query.eq(SanmingSteel::getDate, data.getDate());
|
||||
return query;
|
||||
}
|
||||
|
||||
}
|
||||
|
44
src/main/java/mjkf/xinke/main/service/SteelPlateService.java
Normal file
44
src/main/java/mjkf/xinke/main/service/SteelPlateService.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package mjkf.xinke.main.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import mjkf.xinke.main.model.db.SteelPlate;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class SteelPlateService extends ServiceImpl<BaseMapper<SteelPlate>, SteelPlate> {
|
||||
public boolean saveOrUpdateByIndex(SteelPlate data) {
|
||||
var result = this.getOne(this.indexQuery(data));
|
||||
if (result == null) {
|
||||
return this.save(data);
|
||||
} else {
|
||||
result.update(data);
|
||||
return this.updateById(result);
|
||||
}
|
||||
}
|
||||
|
||||
public List<SteelPlate> saveOrUpdateByIndexBatch(List<Row> rows) {
|
||||
var list = rows.stream().map(item -> new SteelPlate(item)).collect(Collectors.toList());
|
||||
for (SteelPlate item : list) {
|
||||
this.saveOrUpdateByIndex(item);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SteelPlate> indexQuery(SteelPlate data) {
|
||||
LambdaQueryWrapper<SteelPlate> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SteelPlate::getName, data.getName());
|
||||
query.eq(SteelPlate::getSpec, data.getSpec());
|
||||
query.eq(SteelPlate::getMaterial, data.getMaterial());
|
||||
query.eq(SteelPlate::getSource, data.getSource());
|
||||
query.eq(SteelPlate::getDate, data.getDate());
|
||||
return query;
|
||||
}
|
||||
|
||||
}
|
||||
|
45
src/main/java/mjkf/xinke/main/service/SteelRebarService.java
Normal file
45
src/main/java/mjkf/xinke/main/service/SteelRebarService.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package mjkf.xinke.main.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import mjkf.xinke.main.model.db.SteelRebar;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class SteelRebarService extends ServiceImpl<BaseMapper<SteelRebar>, SteelRebar> {
|
||||
|
||||
public boolean saveOrUpdateByIndex(SteelRebar data) {
|
||||
var result = this.getOne(this.indexQuery(data));
|
||||
if (result == null) {
|
||||
return this.save(data);
|
||||
} else {
|
||||
result.update(data);
|
||||
return this.updateById(result);
|
||||
}
|
||||
}
|
||||
|
||||
public List<SteelRebar> saveOrUpdateByIndexBatch(List<Row> rows) {
|
||||
var list = rows.stream().map(item -> new SteelRebar(item)).collect(Collectors.toList());
|
||||
for (SteelRebar item : list) {
|
||||
this.saveOrUpdateByIndex(item);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SteelRebar> indexQuery(SteelRebar data) {
|
||||
LambdaQueryWrapper<SteelRebar> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SteelRebar::getName, data.getName());
|
||||
query.eq(SteelRebar::getSpec, data.getSpec());
|
||||
query.eq(SteelRebar::getMaterial, data.getMaterial());
|
||||
query.eq(SteelRebar::getSource, data.getSource());
|
||||
query.eq(SteelRebar::getDate, data.getDate());
|
||||
return query;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,43 @@
|
||||
package mjkf.xinke.main.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import mjkf.xinke.main.model.db.SteelSection;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class SteelSectionService extends ServiceImpl<BaseMapper<SteelSection>, SteelSection> {
|
||||
public boolean saveOrUpdateByIndex(SteelSection data) {
|
||||
var result = this.getOne(this.indexQuery(data));
|
||||
if (result == null) {
|
||||
return this.save(data);
|
||||
} else {
|
||||
result.update(data);
|
||||
return this.updateById(result);
|
||||
}
|
||||
}
|
||||
|
||||
public List<SteelSection> saveOrUpdateByIndexBatch(List<Row> rows) {
|
||||
var list = rows.stream().map(item -> new SteelSection(item)).collect(Collectors.toList());
|
||||
for (SteelSection item : list) {
|
||||
this.saveOrUpdateByIndex(item);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SteelSection> indexQuery(SteelSection data) {
|
||||
LambdaQueryWrapper<SteelSection> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SteelSection::getName, data.getName());
|
||||
query.eq(SteelSection::getSpec, data.getSpec());
|
||||
query.eq(SteelSection::getMaterial, data.getMaterial());
|
||||
query.eq(SteelSection::getSource, data.getSource());
|
||||
query.eq(SteelSection::getDate, data.getDate());
|
||||
return query;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,44 @@
|
||||
package mjkf.xinke.main.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import mjkf.xinke.main.model.db.SteelStrand;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class SteelStrandService extends ServiceImpl<BaseMapper<SteelStrand>, SteelStrand> {
|
||||
public boolean saveOrUpdateByIndex(SteelStrand data) {
|
||||
var result = this.getOne(this.indexQuery(data));
|
||||
if (result == null) {
|
||||
return this.save(data);
|
||||
} else {
|
||||
result.update(data);
|
||||
return this.updateById(result);
|
||||
}
|
||||
}
|
||||
|
||||
public List<SteelStrand> saveOrUpdateByIndexBatch(List<Row> rows) {
|
||||
var list = rows.stream().map(item -> new SteelStrand(item)).collect(Collectors.toList());
|
||||
for (SteelStrand item : list) {
|
||||
this.saveOrUpdateByIndex(item);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SteelStrand> indexQuery(SteelStrand data) {
|
||||
LambdaQueryWrapper<SteelStrand> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SteelStrand::getName, data.getName());
|
||||
query.eq(SteelStrand::getSpec, data.getSpec());
|
||||
query.eq(SteelStrand::getMaterial, data.getMaterial());
|
||||
query.eq(SteelStrand::getSource, data.getSource());
|
||||
query.eq(SteelStrand::getDate, data.getDate());
|
||||
return query;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -16,3 +16,7 @@ spring:
|
||||
main:
|
||||
supervise:
|
||||
dispatcher-role-id: 1677946127227682818,0
|
||||
|
||||
api:
|
||||
host:
|
||||
data-tool: http://localhost:50000
|
@@ -1,23 +1,23 @@
|
||||
|
||||
package mjkf.xinke;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* 主测试类
|
||||
*
|
||||
*
|
||||
* @date 2022/9/17 17:09
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = Application.class)
|
||||
public class MainTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
}
|
||||
}
|
||||
//
|
||||
//package mjkf.xinke;
|
||||
//
|
||||
//import org.junit.Test;
|
||||
//import org.junit.runner.RunWith;
|
||||
//import org.springframework.boot.test.context.SpringBootTest;
|
||||
//import org.springframework.test.context.junit4.SpringRunner;
|
||||
//
|
||||
///**
|
||||
// * 主测试类
|
||||
// *
|
||||
// *
|
||||
// * @date 2022/9/17 17:09
|
||||
// */
|
||||
//@RunWith(SpringRunner.class)
|
||||
//@SpringBootTest(classes = Application.class)
|
||||
//public class MainTest {
|
||||
//
|
||||
// @Test
|
||||
// public void test() {
|
||||
//
|
||||
// }
|
||||
//}
|
||||
|
Reference in New Issue
Block a user