Commit 7b65b85e authored by chenzhao's avatar chenzhao

增加接口

parent 3b0a1f5f
......@@ -1241,6 +1241,21 @@ public class PointController extends AbstractBaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "关联巡检点分页列表", notes = "关联巡检点分页列表")
@GetMapping(value = "/listNew", produces = "application/json;charset=UTF-8")
public CommonResponse queryPointList4RouteNew(
@ApiParam(value = "区域") @RequestParam(value = "riskSourceId", required = false) Long riskSourceId,
@ApiParam(value = "点编号") @RequestParam(value = "pointNo", required = false) String pointNo,
@ApiParam(value = "点名称") @RequestParam(value = "name", required = false) String name,
@RequestParam(value = "current", defaultValue = "1") int current,
@RequestParam(value = "size", defaultValue = "10") int size) {
ReginParams reginParams = getSelectedOrgInfo();
String companyBizOrgCode = reginParams.getPersonIdentity().getCompanyBizOrgCode();
return CommonResponseUtil.success(iPointService.queryPointList4RouteNew(companyBizOrgCode,riskSourceId, pointNo, name, current, size));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "新*查询巡检点列表", notes = "新*查询巡检点列表")
@GetMapping(value = "/route-list-new", produces = "application/json;charset=UTF-8")
public CommonResponse queryPointListByRouteId(
......
......@@ -135,9 +135,15 @@ public interface PointMapper extends BaseMapper {
int queryPointCount4Route(@Param(value = "structureIdList") List<Long> structureIdList, @Param(value = "pointNo") String pointNo, @Param(value = "name") String name, @Param(value = "nullRiskSourceId") boolean nullRiskSourceId);
int queryPointCount4RouteNew(@Param(value = "bizOrgCode") String bizOrgCode,@Param(value = "structureIdList") List<Long> structureIdList, @Param(value = "pointNo") String pointNo, @Param(value = "name") String name, @Param(value = "nullRiskSourceId") boolean nullRiskSourceId);
List<Map<String, Object>> queryPointList4Route(@Param(value = "structureIdList") List<Long> structureIdList, @Param(value = "pointNo") String pointNo, @Param(value = "name") String name,
@Param(value = "offset") int offset, @Param(value = "size") int size, @Param(value = "nullRiskSourceId") boolean nullRiskSourceId);
List<Map<String, Object>> queryPointList4RouteNew(@Param(value = "bizOrgCode") String bizOrgCode,@Param(value = "structureIdList") List<Long> structureIdList, @Param(value = "pointNo") String pointNo, @Param(value = "name") String name,
@Param(value = "offset") int offset, @Param(value = "size") int size, @Param(value = "nullRiskSourceId") boolean nullRiskSourceId);
List<Map<String, Object>> queryPointListByRouteId(@Param(value = "routeId") Long routeId);
......
......@@ -1604,6 +1604,39 @@ public class PointServiceImpl implements IPointService {
return new PageImpl(list, PageRequest.of(current - 1, size), total);
}
@Override
public Page queryPointList4RouteNew(String bizOrgCode,Long riskSourceId, String pointNo, String name, int current, int size) {
if (current < 1 || size < 0) {
throw new RuntimeException("查询条件有误");
}
List<Long> structureIdList = null;
List<Map<String, Object>> list = Collections.EMPTY_LIST;
// 传入riskSourceId为-2请求的是巡检点区域为空
if (riskSourceId != null && riskSourceId != -2) {
LinkedHashMap<String,Object> o = equipFeign.getBuildingTree();
if(o==null||!"200".equals(o.get("status").toString())) {
throw new YeeException("获取建筑树出错");
}
List<Map<String, Object>> buildingTree = (List<Map<String, Object>>) o.get("result");
Map<String, Object> node = getAllNodes(buildingTree).stream().filter(map -> riskSourceId.toString().equals(map.get("id"))).findFirst().orElse(null);
if (node != null) {
structureIdList = findBuildChildrenIds(node);
}
}
boolean nullRiskSourceId = false;
if (riskSourceId != null && riskSourceId == -2) {
nullRiskSourceId = true;
}
int total = pointMapper.queryPointCount4RouteNew(bizOrgCode,structureIdList, pointNo, name, nullRiskSourceId);
int offset = (current - 1) * size;
if (total > offset) {
list = pointMapper.queryPointList4RouteNew(bizOrgCode,structureIdList, pointNo, name, offset, size, nullRiskSourceId);
}
return new PageImpl(list, PageRequest.of(current - 1, size), total);
}
private List<Map<String, Object>> getAllNodes(List<Map<String, Object>> buildingTree) {
List<Map<String, Object>> res = new LinkedList<>();
if (buildingTree != null && !buildingTree.isEmpty()) {
......
......@@ -357,6 +357,8 @@ public interface IPointService {
Page queryPointList4Route(Long riskSourceId, String pointNo, String name, int current, int size);
Page queryPointList4RouteNew(String bizOrgCode,Long riskSourceId, String pointNo, String name, int current, int size);
List queryPointListByRouteId(Long routeId);
List queryEquipListByPointId(Long pointId);
......
......@@ -1078,6 +1078,36 @@
</where>
</select>
<select id="queryPointCount4RouteNew" parameterType="long" resultType="int">
SELECT
count(1)
FROM
p_point pp
LEFT JOIN wl_warehouse_structure wws
ON pp.risk_source_id = wws.source_id
<where>
<if test="structureIdList != null and structureIdList.size > 0">
AND pp.risk_source_id in
<foreach collection="structureIdList" open="(" close=")" separator="," item="sid">
#{sid}
</foreach>
</if>
<if test="name != null and name.length > 0">
AND pp.name LIKE concat("%", #{name}, "%")
</if>
<if test="pointNo != null and pointNo.length > 0">
AND pp.point_no LIKE concat("%", #{pointNo}, "%")
</if>
<if test="nullRiskSourceId == true">
AND ( pp.risk_source_id is NULL OR trim(pp.risk_source_id)='')
</if>
<if test="bizOrgCode != null and bizOrgCode != '' ">
AND PP.biz_org_code LIKE CONCAT (#{bizOrgCode},'%')
</if>
AND pp.is_delete = 0
</where>
</select>
<select id="queryPointList4Route" parameterType="long" resultType="map">
SELECT
pp.id pointId
......@@ -1086,6 +1116,7 @@
, wws.name area
, pp.address pointAddress
, wws.full_name position
, pp.biz_org_name bizOrgName
FROM
p_point pp
LEFT JOIN wl_warehouse_structure wws
......@@ -1111,6 +1142,43 @@
LIMIT #{offset}, #{size}
</select>
<select id="queryPointList4RouteNew" parameterType="long" resultType="map">
SELECT
pp.id pointId
, pp.name pointName
, pp.point_no pointNo
, wws.name area
, pp.address pointAddress
, wws.full_name position
, pp.biz_org_name bizOrgName
FROM
p_point pp
LEFT JOIN wl_warehouse_structure wws
ON pp.risk_source_id = wws.source_id
<where>
<if test="structureIdList != null and structureIdList.size > 0">
AND pp.risk_source_id in
<foreach collection="structureIdList" open="(" close=")" separator="," item="sid">
#{sid}
</foreach>
</if>
<if test="name != null and name.length > 0">
AND pp.name LIKE concat("%", #{name}, "%")
</if>
<if test="pointNo != null and pointNo.length > 0">
AND pp.point_no LIKE concat("%", #{pointNo}, "%")
</if>
<if test="nullRiskSourceId == true">
AND ( pp.risk_source_id is NULL OR trim(pp.risk_source_id)='' )
</if>
<if test="bizOrgCode != null and bizOrgCode != '' ">
AND PP.biz_org_code LIKE CONCAT (#{bizOrgCode},'%')
</if>
AND pp.is_delete = 0
</where>
LIMIT #{offset}, #{size}
</select>
<select id="queryPointListByRouteId" parameterType="long" resultType="map">
SELECT
pp.id pointId
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment