新增物料查询接口-按搜索关键字匹配度查询
This commit is contained in:
parent
d5ce236a0c
commit
788d9d0b28
|
|
@ -11,6 +11,8 @@ import com.google.common.collect.ImmutableList;
|
||||||
import com.nflg.product.base.core.api.BaseApi;
|
import com.nflg.product.base.core.api.BaseApi;
|
||||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||||
import com.nflg.product.bomnew.constant.ReportConstant;
|
import com.nflg.product.bomnew.constant.ReportConstant;
|
||||||
|
import com.nflg.product.bomnew.pojo.dto.MaterialQueryDTO;
|
||||||
|
import com.nflg.product.bomnew.pojo.dto.PdateLogDTO;
|
||||||
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
|
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
|
||||||
import com.nflg.product.bomnew.pojo.query.ChildBomReportQuery;
|
import com.nflg.product.bomnew.pojo.query.ChildBomReportQuery;
|
||||||
import com.nflg.product.bomnew.pojo.query.CompareReportQuery;
|
import com.nflg.product.bomnew.pojo.query.CompareReportQuery;
|
||||||
|
|
@ -20,6 +22,7 @@ import com.nflg.product.bomnew.service.CompareReportService;
|
||||||
import com.nflg.product.bomnew.service.ForwardReportService;
|
import com.nflg.product.bomnew.service.ForwardReportService;
|
||||||
import com.nflg.product.bomnew.service.MaterialMainService;
|
import com.nflg.product.bomnew.service.MaterialMainService;
|
||||||
import com.nflg.product.bomnew.service.ReverseReportService;
|
import com.nflg.product.bomnew.service.ReverseReportService;
|
||||||
|
import com.nflg.product.bomnew.util.CompareUtils;
|
||||||
import com.nflg.product.bomnew.util.EecExcelUtil;
|
import com.nflg.product.bomnew.util.EecExcelUtil;
|
||||||
import com.nflg.product.bomnew.util.VUtils;
|
import com.nflg.product.bomnew.util.VUtils;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|
@ -37,9 +40,9 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import javax.xml.transform.Result;
|
import javax.xml.transform.Result;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.stream.Collectors;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
@ -290,4 +293,31 @@ public class BomReportApi extends BaseApi {
|
||||||
}, datas);
|
}, datas);
|
||||||
EecExcelUtil.eecExcel(name, new ListSheet<>(exportList), response);
|
EecExcelUtil.eecExcel(name, new ListSheet<>(exportList), response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("queryMaterial")
|
||||||
|
@ApiOperation("物料查询")
|
||||||
|
public ResultVO<List<MaterialQueryResult>> materialQuery(@RequestBody MaterialQueryDTO queryParam){
|
||||||
|
List<MaterialQueryResult> result = materialMainService.getBaseMapper().queryMaterial(queryParam);
|
||||||
|
//排序
|
||||||
|
if(StrUtil.isNotBlank(queryParam.getMaterialNo())) {
|
||||||
|
result.forEach(u->{
|
||||||
|
u.setOrderNo(StrUtil.replace(u.getMaterialNo(),queryParam.getMaterialNo(),"0"));
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
if(StrUtil.isNotBlank(queryParam.getDrawingNo())) {
|
||||||
|
result.forEach(u->{
|
||||||
|
u.setOrderNo(StrUtil.replace(u.getDrawingNo(),queryParam.getDrawingNo(),"0"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(StrUtil.isNotBlank(queryParam.getMaterialDesc())) {
|
||||||
|
result.forEach(u->{
|
||||||
|
u.setOrderNo(StrUtil.replace(u.getMaterialDesc(),queryParam.getMaterialDesc(),"0"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
result= result.stream().sorted( Comparator.comparing(MaterialQueryResult::getOrderNo)).collect(Collectors.toList());
|
||||||
|
return ResultVO.success(result);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,9 @@ package com.nflg.product.bomnew.mapper.master;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.nflg.product.bomnew.pojo.dto.CategoryExcelDTO;
|
import com.nflg.product.bomnew.pojo.dto.CategoryExcelDTO;
|
||||||
|
import com.nflg.product.bomnew.pojo.dto.MaterialQueryDTO;
|
||||||
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
|
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
|
||||||
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
import com.nflg.product.bomnew.pojo.vo.*;
|
||||||
import com.nflg.product.bomnew.pojo.vo.MaterialMateVO;
|
|
||||||
import com.nflg.product.bomnew.pojo.vo.RolePostVo;
|
|
||||||
import com.nflg.product.bomnew.pojo.vo.UserInfoVO;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -62,4 +60,6 @@ public interface MaterialMainMapper extends BaseMapper<MaterialMainEntity> {
|
||||||
UserInfoVO getUserInfoByUserCode(@Param("userCode")String userCode);
|
UserInfoVO getUserInfoByUserCode(@Param("userCode")String userCode);
|
||||||
|
|
||||||
String getUserDepartmentDptCode(@Param("rowId") Long rowId);
|
String getUserDepartmentDptCode(@Param("rowId") Long rowId);
|
||||||
|
|
||||||
|
List<MaterialQueryResult> queryMaterial(@Param("query") MaterialQueryDTO query);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.nflg.product.bomnew.pojo.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料查询
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MaterialQueryDTO implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "物料分类")
|
||||||
|
private String materialCategoryCode;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "物料编码")
|
||||||
|
private String materialNo;
|
||||||
|
|
||||||
|
@ApiModelProperty("图号")
|
||||||
|
private String drawingNo;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "物料描述")
|
||||||
|
private String materialDesc;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.nflg.product.bomnew.pojo.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MaterialQueryResult {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料编码
|
||||||
|
*/
|
||||||
|
@TableField(value = "material_no")
|
||||||
|
@ApiModelProperty(value = "物料编码")
|
||||||
|
private String materialNo;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "图号")
|
||||||
|
private String drawingNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料名称
|
||||||
|
*/
|
||||||
|
@TableField(value = "material_name")
|
||||||
|
@ApiModelProperty(value = "物料名称")
|
||||||
|
private String materialName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料描述
|
||||||
|
*/
|
||||||
|
@TableField(value = "material_desc")
|
||||||
|
@ApiModelProperty(value = "物料描述")
|
||||||
|
private String materialDesc;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "基本计量单位")
|
||||||
|
private String materialUnit;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "物料状态 1:激活 2:禁止采购 3:售后专用 4:冻结 5:完全弃用")
|
||||||
|
private Integer materialState;
|
||||||
|
|
||||||
|
@ApiModelProperty("排序号")
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
|
|
||||||
|
private String materialStateName;
|
||||||
|
|
||||||
|
public String getMaterialStateName() {
|
||||||
|
ImmutableList<String> of = ImmutableList.of("", "激活", "禁止采购", "售后专用", "冻结", "完全弃用");
|
||||||
|
if(materialState!=null) {
|
||||||
|
return of.get(materialState);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -201,4 +201,20 @@
|
||||||
<select id="getUserDepartmentDptCode" resultType="java.lang.String">
|
<select id="getUserDepartmentDptCode" resultType="java.lang.String">
|
||||||
select dpt_code from t_authority_department where row_id=#{rowId}
|
select dpt_code from t_authority_department where row_id=#{rowId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="queryMaterial" resultType="com.nflg.product.bomnew.pojo.vo.MaterialQueryResult">
|
||||||
|
select material_no,drawing_no, material_name,material_desc,material_unit, material_state from t_material_main where 1=1
|
||||||
|
<if test="query.materialCategoryCode != null and query.materialCategoryCode != ''">
|
||||||
|
and material_category_code = #{query.materialCategoryCode}
|
||||||
|
</if>
|
||||||
|
<if test="query.materialNo != null and query.materialNo != ''">
|
||||||
|
and material_no like concat('%',#{query.materialNo},'%')
|
||||||
|
</if>
|
||||||
|
<if test="query.drawingNo != null and query.drawingNo != ''">
|
||||||
|
and drawing_no like concat('%',#{query.drawingNo},'%')
|
||||||
|
</if>
|
||||||
|
<if test="query.materialDesc != null and query.materialDesc != ''">
|
||||||
|
and material_desc like concat('%',#{query.materialDesc},'%')
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue