feat(material-task): 新增沥青改性剂上传接口
This commit is contained in:
@@ -21,7 +21,7 @@ public class DataDbMpGenerator {
|
|||||||
private static String password = "Xxs123456";
|
private static String password = "Xxs123456";
|
||||||
private static String schema = "material_manage";
|
private static String schema = "material_manage";
|
||||||
private static String[] tableList = {
|
private static String[] tableList = {
|
||||||
"LOCAL_MATERIAL",
|
"ASPHALT_MODIFIER",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -35,6 +35,8 @@ public class MaterialTaskType {
|
|||||||
public static final Integer LOCAL_FINE_AGGREGATE = 905; // 细料石
|
public static final Integer LOCAL_FINE_AGGREGATE = 905; // 细料石
|
||||||
public static final Integer LOCAL_COARSE_AGGREGATE = 906; // 粗料石
|
public static final Integer LOCAL_COARSE_AGGREGATE = 906; // 粗料石
|
||||||
public static final Integer LOCAL_CLAY = 907; // 粘土
|
public static final Integer LOCAL_CLAY = 907; // 粘土
|
||||||
|
// 辅材
|
||||||
|
public static final Integer ASPHALT_MODIFIER = 1001; // 改性剂
|
||||||
|
|
||||||
public static final List<Integer> list = List.of(
|
public static final List<Integer> list = List.of(
|
||||||
MY_STEEL_REBAR,
|
MY_STEEL_REBAR,
|
||||||
|
16
src/main/java/mjkf/xinke/main/dao/AsphaltModifierMapper.java
Normal file
16
src/main/java/mjkf/xinke/main/dao/AsphaltModifierMapper.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package mjkf.xinke.main.dao;
|
||||||
|
|
||||||
|
import mjkf.xinke.main.model.db.AsphaltModifier;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 沥青改性剂 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author han0
|
||||||
|
* @since 2023-12-14
|
||||||
|
*/
|
||||||
|
public interface AsphaltModifierMapper extends BaseMapper<AsphaltModifier> {
|
||||||
|
|
||||||
|
}
|
73
src/main/java/mjkf/xinke/main/model/db/AsphaltModifier.java
Normal file
73
src/main/java/mjkf/xinke/main/model/db/AsphaltModifier.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-12-14
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@TableName("ASPHALT_MODIFIER")
|
||||||
|
@ApiModel(value = "AsphaltModifier对象", description = "沥青改性剂")
|
||||||
|
public class AsphaltModifier extends Model<AsphaltModifier> {
|
||||||
|
|
||||||
|
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 AsphaltModifier() {}
|
||||||
|
|
||||||
|
public AsphaltModifier (Row row) {
|
||||||
|
this.setName(row.getCell(0).getStringCellValue());
|
||||||
|
this.setSpec("");
|
||||||
|
this.setPrice(BigDecimal.valueOf(row.getCell(1).getNumericCellValue()));
|
||||||
|
this.setDate(row.getCell(2).getLocalDateTimeCellValue().toLocalDate());
|
||||||
|
}
|
||||||
|
|
||||||
|
public AsphaltModifier update(AsphaltModifier item) {
|
||||||
|
this.setName(item.getName());
|
||||||
|
this.setSpec(item.getSpec());
|
||||||
|
this.setPrice(item.getPrice());
|
||||||
|
this.setDate(item.getDate());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,64 @@
|
|||||||
|
package mjkf.xinke.main.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import mjkf.xinke.main.model.db.AsphaltModifier;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class AsphaltModifierService extends DataService<BaseMapper<AsphaltModifier>, AsphaltModifier> {
|
||||||
|
public LambdaQueryWrapper<AsphaltModifier> indexQuery(AsphaltModifier data) {
|
||||||
|
LambdaQueryWrapper<AsphaltModifier> query = new LambdaQueryWrapper<>();
|
||||||
|
query.eq(AsphaltModifier::getName, data.getName());
|
||||||
|
query.eq(AsphaltModifier::getSpec, data.getSpec());
|
||||||
|
query.eq(AsphaltModifier::getDate, data.getDate());
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LambdaQueryWrapper<AsphaltModifier> trendQuery(Object obj, Integer year, Integer month) {
|
||||||
|
var data = (AsphaltModifier) obj;
|
||||||
|
LambdaQueryWrapper<AsphaltModifier> query = new LambdaQueryWrapper<>();
|
||||||
|
query.eq(AsphaltModifier::getName, data.getName());
|
||||||
|
var date = LocalDate.of(year, month, 1);
|
||||||
|
query.between(AsphaltModifier::getDate, date, date.minusMonths(1));
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LambdaQueryWrapper<AsphaltModifier> getQuery(String keyWord, Integer year, Integer month, String materialId, String name) {
|
||||||
|
LambdaQueryWrapper<AsphaltModifier> query = new LambdaQueryWrapper<>();
|
||||||
|
if (keyWord != null) {
|
||||||
|
query.and(e -> e
|
||||||
|
.like(AsphaltModifier::getName, keyWord)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (year != null) {
|
||||||
|
var date = LocalDate.of(year, month, 1);
|
||||||
|
query.between(AsphaltModifier::getDate, date, date.plusYears(1));
|
||||||
|
}
|
||||||
|
if (month != null) {
|
||||||
|
var date = LocalDate.of(year, month, 1);
|
||||||
|
query.between(AsphaltModifier::getDate, date, date.plusMonths(1));
|
||||||
|
}
|
||||||
|
if (name != null) {
|
||||||
|
query.like(AsphaltModifier::getName, name);
|
||||||
|
}
|
||||||
|
if (materialId != null) {
|
||||||
|
// query.eq(AsphaltModifier::getMaterialId, materialId);
|
||||||
|
}
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LambdaQueryWrapper<AsphaltModifier> filterQuery(LambdaQueryWrapper<AsphaltModifier> query) {
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AsphaltModifier getMapGroupingBy(Map item) {
|
||||||
|
var o = new AsphaltModifier();
|
||||||
|
o.setName(item.get("name").toString());
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@@ -50,6 +50,8 @@ public class MaterialTaskService extends ServiceImpl<BaseMapper<MaterialTask>, M
|
|||||||
FujianSurveyService fujianSurveyService;
|
FujianSurveyService fujianSurveyService;
|
||||||
@Resource
|
@Resource
|
||||||
LocalMaterialService localMaterialService;
|
LocalMaterialService localMaterialService;
|
||||||
|
@Resource
|
||||||
|
AsphaltModifierService asphaltModifierService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean save(MaterialTask data) {
|
public boolean save(MaterialTask data) {
|
||||||
@@ -108,6 +110,8 @@ public class MaterialTaskService extends ServiceImpl<BaseMapper<MaterialTask>, M
|
|||||||
list = fujianSurveyService.saveOrUpdateByIndexBatch(rows);
|
list = fujianSurveyService.saveOrUpdateByIndexBatch(rows);
|
||||||
} else if (MaterialTaskType.isLocalMaterial(data.getType())) {
|
} else if (MaterialTaskType.isLocalMaterial(data.getType())) {
|
||||||
list = localMaterialService.saveOrUpdateByIndexBatch(rows);
|
list = localMaterialService.saveOrUpdateByIndexBatch(rows);
|
||||||
|
} else if (data.getType().equals(MaterialTaskType.ASPHALT_MODIFIER)) {
|
||||||
|
list = asphaltModifierService.saveOrUpdateByIndexBatch(rows);
|
||||||
} else {
|
} else {
|
||||||
// todo 异常处理:未识别的类型
|
// todo 异常处理:未识别的类型
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user