Commit e9cb1da1 authored by 刘林's avatar 刘林

fix(openapi):榆林接口对接

parent 6543eb62
......@@ -17,6 +17,8 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 特种设备监管controller
......@@ -46,4 +48,45 @@ public class YuLinDataDockController {
PageParam pageParam) {
return ResponseHelper.buildResponse(jgServiceFeignClient.getElevatorInfo(equCode, startTime, endTime, pageParam));
}
/**
* 根据时间范围查询液化石油气瓶档案
* @param equCode 设备代码
* @param startTime 开始时间
* @param endTime 结束时间
* @param pageParam 分页参数
* @return 石油气瓶档案
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getCylinderInfo")
@ApiOperation(httpMethod = "GET", value = "根据时间范围查询液化石油气瓶档案", notes = "根据时间范围查询液化石油气瓶档案")
public ResponseModel<IPage<ElevatorModel>> getCylinderInfo(@RequestParam(value = "equCode", required = false) String equCode,
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime,
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime,
PageParam pageParam) {
return ResponseHelper.buildResponse(jgServiceFeignClient.getCylinderInfo(equCode, startTime, endTime, pageParam));
}
/**
* 车用气气瓶档案
* @param useCode 气站统一信用代码
* @return 车用气气瓶档案
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getVehicleCylinderInfo")
@ApiOperation(httpMethod = "GET", value = "车用气气瓶档案", notes = "车用气气瓶档案")
public ResponseModel<List<Map<String, Object>>> getVehicleCylinderInfo(@RequestParam(value = "useCode") String useCode) {
return ResponseHelper.buildResponse(jgServiceFeignClient.getVehicleCylinderInfo(useCode));
}
/**
* 查询气站信息
* @return 气站信息
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getCylinderStationInfo")
@ApiOperation(httpMethod = "GET", value = "查询气站信息", notes = "查询气站信息")
public ResponseModel<List<Map<String, Object>>> getCylinderStationInfo() {
return ResponseHelper.buildResponse(jgServiceFeignClient.getCylinderStationInfo());
}
}
......@@ -12,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Date;
import java.util.List;
import java.util.Map;
@FeignClient(name = "TZS-JG", path = "/jg",url = "172.16.3.70:11007", configuration = {FeignConfiguration.class})
public interface TzsJgServiceFeignClient {
......@@ -46,4 +48,27 @@ public interface TzsJgServiceFeignClient {
@RequestParam("startTime") Date startTime,
@RequestParam("startTime") Date endTime,
PageParam pageParam);
/**
* 根据时间范围查询液化石油气瓶档案
* @param equCode 设备代码
* @param startTime 开始时间
* @param endTime 结束时间
* @return 电梯数据
*/
@RequestMapping(value = "/equipment-register/getCylinderInfo", method = RequestMethod.GET)
IPage<ElevatorModel> getCylinderInfo(@RequestParam("equCode") String equCode,
@RequestParam("startTime") Date startTime,
@RequestParam("startTime") Date endTime,
PageParam pageParam);
/**
* 查询气站信息
* @return
*/
@RequestMapping(value = "/equipment-register/getCylinderStationInfo", method = RequestMethod.GET)
List<Map<String, Object>> getCylinderStationInfo();
@RequestMapping(value = "/equipment-register/getVehicleCylinderInfo", method = RequestMethod.GET)
List<Map<String, Object>> getVehicleCylinderInfo(String useCode);
}
......@@ -30,6 +30,10 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
Map<String,Object> getEnterpriseInfo(String useCode);
List<Map<String,Object>> getCylinderStationInfo(String orgCode);
List<Map<String, Object>> getVehicleCylinderInfo(String useCode);
List<Map<String,Object>> getEnterpriseEmployee(String unitCode);
String getOrgCodeByCompanyCode(String companyCode);
......
......@@ -91,5 +91,7 @@ public interface JgUseRegistrationMapper extends BaseMapper<JgUseRegistration> {
Integer getUseRegisterCount(@Param("dpFilterParamDto") DPFilterParamDto dpFilterParamDto);
List<ElevatorModelVo> getElevatorModeList(@Param("equIds") List<String> equIds);
List<Map<String, Object>> getElevatorModeList(@Param("equIds") List<String> equIds);
List<Map<String, Object>> getCylinderInfoList(@Param("records") List<String> records);
}
......@@ -2182,4 +2182,37 @@
</if>
</select>
<select id="getCylinderStationInfo" resultType="java.util.Map">
SELECT tbei.sequence_nbr as id,
tbei.use_unit as name,
tbei.address as address,
tbei.use_code as useCode
FROM tz_base_enterprise_info tbei
WHERE tbei.org_code like concat(#{orgCode}, '%')
AND tbei.is_delete = '0'
AND tbei.unit_type = '充装单位'
</select>
<select id="getVehicleCylinderInfo" resultType="java.util.Map">
SELECT
tjvi.use_registration_code as registerNo,
tjvi.reg_date as registerDate,
tjvi.reg_date as registerDate,
tjvi.use_unit_address as address,
tjvi.use_unit_address as address,
'23T0' as type,
tjvi.volume as volume,
tjvi.filling_medium as medium,
tjvi.filling_medium as medium,
tjvi.car_number as carNo,
tjvi.vehicle_attribute as carType,
tjvi.audit_pass_date as certificateDate,
tjvi.vehicle_attribute as state,
tjvi.next_inspection_date as nextDate,
tjvi.use_unit_name as ownCompany,
tjvi.rec_date as updateDate
FROM tzs_jg_vehicle_information tjvi
WHERE tjvi."USE_UNIT_CREDIT_CODE" = #{useCode}
AND tjvi.is_delete = '0'
</select>
</mapper>
......@@ -729,30 +729,86 @@
C.equ_category
</select>
<select id="getElevatorModeList" resultType="com.yeejoin.amos.boot.module.jg.api.vo.ElevatorModelVo">
<select id="getElevatorModeList" resultType="java.util.Map">
SELECT
ri."USE_ORG_CODE" useCertNumber,
ri."EQU_CODE" deviceNumber,
ri."ORGANIZATION_NAME" registerOrg,
ri."ORGANIZATION_NAME" certIssueOrg,
(select tec.name from amos_tzs_biz.tz_equipment_category tec WHERE ri."EQU_CATEGORY"::text = tec.code::text) AS deviceCategory,
ri."PRODUCT_NAME" deviceName,
ui.ADDRESS deviceAddress,
ui."USE_INNER_CODE" innerCode,
ui."USE_UNIT_NAME" useCompanyName,
ui."ESTATE_UNIT_CREDIT_CODE" ownerCode,
ui."ESTATE_UNIT_NAME" ownerName,
ui.SAFETY_MANAGE_DT safetyDept,
ui.SAFETY_MANAGER safetyAdmin,
ui.PHONE safetyAdminPhone
ui.USE_UNIT_CREDIT_CODE, ui.USE_UNIT_NAME, ui.ESTATE_UNIT_CREDIT_CODE, ui.ESTATE_UNIT_NAME, ui.USE_STATE_CHANGE_DATE, ui.CHANGES, ui.USE_INNER_CODE, ui.USE_DATE, ui.AGENT, ui.PROVINCE, ui.CITY, ui.COUNTY, ui.FACTORY_USE_SITE_STREET, ui.ADDRESS, ui.LONGITUDE_LATITUDE, ui.USE_PLACE, ui.EQU_MANAGE_DT, ui.SAFETY_MANAGE_DT, ui.SAFETY_MANAGER, ui.PHONE, ui.EQU_STATE, ui.PROVINCE_NAME, ui.CITY_NAME, ui.COUNTY_NAME,
si.ORG_BRANCH_CODE, si.COMPANY_ORG_BRANCH_CODE, si.ORG_BRANCH_NAME, si.KEY_MONITORING_EQU, si.DENSELY_POPULATED_AREAS, si.IMPORTANT_PLACES,
ri.ORGANIZATION_CODE, ri.ORGANIZATION_NAME, ri.USE_ORG_CODE, ri.REGISTER_STATE, ri.EQU_CODE, ri.EQU_LIST, ri.EQU_CATEGORY, ri.EQU_DEFINE, ri.PRODUCT_NAME, ri.BRAND_NAME, ri.EQU_TYPE, ri.EQU_PRICE, ri.USE_REGISTRATION_CERTIFICATE, ri.USE_SIGN, ri.PRODUCT_PHOTO, ri.CAR_NUMBER, ri.FRAME_NUMBER, ri.ENGINE_NUMBER, ri.MOTOR_NUMBER,
DI.DESIGN_UNIT_CREDIT_CODE, DI.DESIGN_UNIT_NAME, DI.DESIGN_LICENSE_NUM, DI.DESIGN_USE_DATE, DI.DESIGN_DATE, DI.DRAWING_DO, DI.DESIGN_DOC, DI.APPRAISAL_UNIT, DI.APPRAISAL_DATE, DI.DESIGN_STANDARD,
fi.PRODUCE_UNIT_CREDIT_CODE, fi.PRODUCE_UNIT_NAME, fi.PRODUCE_LICENSE_NUM, fi.FACTORY_NUM, fi.PRODUCE_DATE, fi.IMPORTED, fi.PRODUCE_COUNTRY, fi.FACTORY_STANDARD, fi.PRODUCT_QUALITY_YIELD_PROVE, fi.INS_USE_MAINTAIN_EXPLAIN, fi.SUPERVISION_AGENCY_CREDENTIAL, fi.TYPE_TEST_CREDENTIAL,
TPE.RATED_SPEED_UP, TPE.RATED_SPEED_DOWN, TPE.RATED_LOAD_CAPACITY, TPE.CAR_SIZE, TPE.LIFTING_HEIGHT, TPE.STOREY, TPE.STAND, TPE.NUMBER_DOORS, TPE.CONTROL_MODE, TPE.NUMBER_CYLINDERS, TPE.JACKING_TYPE, TPE.RATED_PRESSURE, TPE.EXPLOSIONPROOF_TYPE, TPE.EXPLOSIONPROOF_GRADE, TPE.EXPLOSIVE_SUBSTANCE, TPE.EXPLOSIONPROOF_SIGN_COMPLETE, TPE.QDZJ_RATED_POWER, TPE.QDZJ_RATED_SPEED, TPE.QDZJ_REDUCTION_RATIO, TPE.YABZ_FULLLOAD_PRESSURE, TPE.XGXL_MEDIA_TYPE, TPE.XGXL_MEDIA_NUMBER, TPE.XGXL_MEDIA_MODEL, TPE.XGXL_MEDIA_SPECIFICATION, TPE.QDZJ_MODEL, TPE.QDZJ_PRODUCT_NO, TPE.QDZJ_MANUFACTURER, TPE.KZG_MODEL, TPE.KZG_PRODUCT_NO, TPE.KZG_MANUFACTURER, TPE.XSQ_MODEL, TPE.XSQ_PRODUCT_NO, TPE.XSQ_MANUFACTURER, TPE.AQQ_MODEL, TPE.AQQ_PRODUCT_NO, TPE.AQQ_MANUFACTURER, TPE.JXHCQ_MODEL, TPE.JXHCQ_PRODUCT_NO, TPE.JXHCQ_MANUFACTURER, TPE.DCHCQ_MODEL, TPE.DCHCQ_PRODUCT_NO, TPE.DCHCQ_MANUFACTURER, TPE.CMMSZZ_MODEL, TPE.CMMSZZ_PRODUCT_NO, TPE.CMMSZZ_MANUFACTURER, TPE.JMMSZZ_MODEL, TPE.JMMSZZ_PRODUCT_NO, TPE.JMMSZZ_MANUFACTURER, TPE.SXCSBHZZ_MODEL, TPE.SXCSBHZZ_PRODUCT_NO, TPE.SXCSBHZZ_MANUFACTURER, TPE.JXYWYDBHZZ_MODEL, TPE.JXYWYDBHZZ_PRODUCT_NO, TPE.JXYWYDBHZZ_MANUFACTURER, TPE.YYBZ_MODEL, TPE.YYBZ_PRODUCT_NO, TPE.YYBZ_MANUFACTURER, TPE.XSQDF_MODEL, TPE.XSQDF_PRODUCT_NO, TPE.XSQDF_MANUFACTURER, TPE.NOMINAL_SPEED, TPE.ANGLE_ROLL, TPE.NOMINAL_WIDTH, TPE.USE_SECTION_LENGTH, TPE.CONVEYING_CAPACITY, TPE.WORK_TYPE, TPE.WORK_ENVIRONMENT, TPE.KZG_OPERATION_MODE,
joi.INSURANCE_ORG, joi.EXPIRY_DATE, joi.IOT_ORG, joi.IOT_SIGN, joi.IS_MONITOR, joi.CODE96333, joi.SUPERVISORY_CODE,
(select legal_person from tz_base_enterprise_info ei Where ei.use_code = ui.use_unit_credit_code) AS SAFETY_MANAGER,
(select legal_phone from tz_base_enterprise_info ei Where ei.use_code = ui.use_unit_credit_code) AS SAFETY_MANAGER_PHONE,
(select address from tz_base_enterprise_info ei Where ei.use_code = ui.use_unit_credit_code) AS ADDRESS,
ibjci.CONSTRUCTION_TYPE, ibjci.USC_UNIT_CREDIT_CODE, ibjci.USC_UNIT_NAME, ibjci.USC_DATE,
mri.ME_UNIT_CREDIT_CODE, mri.ME_UNIT_NAME, mri.REPAIR_INFORM, mri.INFORM_START, mri.INFORM_END, mri.ME_MASTER, mri.ME_MASTER_ID, mri.EMERGENCYCALL, mri.ME_CYCLE, mri.OVERHAUL_CYCLE, mri.ME24_TELEPHONE,
tec2.name AS EQU_CATEGORY_NAME,
tec1.name AS EQU_LIST_NAME,
tec.name AS EQU_DEFINE_NAME,
to_char((select INSPECT_DATE from idx_biz_jg_inspection_detection_info where "RECORD" = ui."RECORD" ORDER BY INSPECT_DATE limit 1), 'YYYY-MM-DD') inspectDate,
to_char((select NEXT_INSPECT_DATE from idx_biz_jg_inspection_detection_info where "RECORD" = ui."RECORD" ORDER BY INSPECT_DATE limit 1), 'YYYY-MM-DD') nextInspectDate
FROM idx_biz_jg_use_info ui
LEFT JOIN idx_biz_jg_supervision_info si ON ui."RECORD" = si."RECORD"
LEFT JOIN idx_biz_jg_register_info ri ON ri."RECORD" = ui."RECORD"
LEFT JOIN idx_biz_jg_design_info di ON di."RECORD" = ui."RECORD"
LEFT JOIN idx_biz_jg_factory_info fi ON fi."RECORD" = ui."RECORD"
LEFT JOIN idx_biz_jg_other_info joi ON joi."RECORD" = ui."RECORD"
LEFT JOIN idx_biz_jg_tech_params_elevator tpe ON tpe."RECORD" = ui."RECORD"
LEFT JOIN idx_biz_jg_construction_info ibjci on ibjci.record = ui."RECORD"
LEFT JOIN idx_biz_jg_maintenance_record_info mri on ui."RECORD" = mri.RECORD
LEFT JOIN tz_equipment_category tec ON ri."EQU_CATEGORY"::text = tec.code::text
LEFT JOIN tz_equipment_category tec1 ON ri."EQU_LIST"::text = tec1.code::text
LEFT JOIN tz_equipment_category tec2 ON ri."EQU_DEFINE"::text = tec2.code::text
WHERE ui."RECORD" in
<foreach collection="equIds" separator="," item="record" open="(" close=")">
#{record}
</foreach>
</select>
<select id="getCylinderInfoList" resultType="java.util.Map">
<include refid="list-cylinder"/>
WHERE ri."EQU_CATEGORY" = '2300' and ui."DATA_SOURCE" like 'jg%' and (ri.whether_vehicle_cylinder is null or ri.whether_vehicle_cylinder != 1)
and ui.record in
<foreach collection="records" item="record" open="(" close=")" separator=",">
#{record}
</foreach>
ORDER BY ui.REC_DATE DESC
</select>
<sql id="list-cylinder">
SELECT
fi.FACTORY_NUM useCode,
(select name from cb_data_dictionary where code = pv."CHARGING_MEDIUM" and type = 'FILLING_MEDIUM') mediumName,
fi.PRODUCE_UNIT_NAME as makeUnit,
fi.PRODUCE_DATE as makeDate,
(select INSPECT_ORG_NAME from idx_biz_jg_inspection_detection_info where "RECORD" = ri.RECORD ORDER BY INSPECT_DATE limit 1), 'YYYY-MM-DD' as lastCheckCompany,
(select INSPECT_CONCLUSION from idx_biz_jg_inspection_detection_info where "RECORD" = ri.RECORD ORDER BY INSPECT_DATE limit 1), 'YYYY-MM-DD' as checkResult,
to_char((select NEXT_INSPECT_DATE from idx_biz_jg_inspection_detection_info where "RECORD" = ri.RECORD ORDER BY INSPECT_DATE limit 1), 'YYYY-MM-DD') nextCheckDate,
(select name from tz_equipment_category tec3 where tec3.code = ri."EQU_DEFINE") AS cylinderClass,
pv."CHARGING_MEDIUM" chargingMedium,
pv."NOMINAL_WORKING_PRESSURE" workPress,
pv."SINGLE_BOTTLE_VOLUME" volume,
pv."WALL_THICKNESS" thickness,
ri."USE_ORG_CODE" qualityCert,
pv."SELF_WEIGHT" initWeight,
pv."MAX_FILL" maxProduce,
ui."USE_UNIT_NAME" useUnitName,
ui."USE_UNIT_CREDIT_CODE" useUnitCreditCode,
to_char(ui."USE_DATE", 'YYYY-MM') useDate,
(SELECT "PRODUCE_UNIT_NAME" from idx_biz_jg_factory_info where "RECORD" = ui."RECORD") produceUnitName,
to_char((SELECT "PRODUCE_DATE" from idx_biz_jg_factory_info where "RECORD" = ui."RECORD"), 'YYYY-MM') produceDate,
(select name from tz_equipment_category where code = ri."EQU_LIST") equListName,
ri."EQU_CATEGORY" equCategory,
(select name from tz_equipment_category where code = ri."EQU_CATEGORY") equCategoryName,
ri."EQU_DEFINE" equDefine,
(select name from tz_equipment_category where code = ri."EQU_DEFINE") equDefineName,
ri."PRODUCT_NAME" productName,
ri."EQU_TYPE" equType,
ri."EQU_CODE_TYPE" equCodeType
FROM
idx_biz_jg_use_info ui
LEFT JOIN idx_biz_jg_register_info ri on ri."RECORD" = ui."RECORD"
LEFT JOIN idx_biz_jg_factory_info fi on ri."RECORD" = fi."RECORD"
LEFT JOIN idx_biz_jg_tech_params_vessel pv ON pv."RECORD" = ui."RECORD"
</sql>
</mapper>
......@@ -268,11 +268,51 @@ public class IdxBizJqEquipmentRegisterController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getElevatorInfo")
@ApiOperation(httpMethod = "GET", value = "查询电梯信息列表", notes = "查询电梯信息列表")
public ResponseModel<IPage<ElevatorModelVo>> getElevatorInfo(@RequestParam(value = "equCode",required = false) String equCode,
public ResponseModel<IPage<Map<String, Object>>> getElevatorInfo(@RequestParam(value = "equCode",required = false) String equCode,
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime,
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime,
PageParam pageParam) {
return ResponseHelper.buildResponse(idxBizJgRegisterInfoService.getElevatorInfo(equCode, startTime, endTime, pageParam));
}
/**
* 查询气站信息
* @return 查询气站信息
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getCylinderStationInfo")
@ApiOperation(httpMethod = "GET", value = "查询气站信息", notes = "查询气站信息")
public ResponseModel<List<Map<String, Object>>> getCylinderStationInfo() {
return ResponseHelper.buildResponse(idxBizJgRegisterInfoService.getCylinderStationInfo());
}
/**
* 车用气气瓶档案
* @return 车用气气瓶档案
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getVehicleCylinderInfo")
@ApiOperation(httpMethod = "GET", value = "车用气气瓶档案", notes = "车用气气瓶档案")
public ResponseModel<List<Map<String, Object>>> getVehicleCylinderInfo(@RequestParam(value = "useCode") String useCode){
return ResponseHelper.buildResponse(idxBizJgRegisterInfoService.getVehicleCylinderInfo(useCode));
}
/**
* 根据时间范围查询液化石油气瓶档案
* @param equCode 设备代码
* @param startTime 开始时间
* @param endTime 结束时间
* @return 电梯数据
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getCylinderInfo")
@ApiOperation(httpMethod = "GET", value = "根据时间范围查询液化石油气瓶档案", notes = "根据时间范围查询液化石油气瓶档案")
public ResponseModel<IPage<Map<String, Object>>> getCylinderInfo(@RequestParam(value = "equCode",required = false) String equCode,
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime,
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime,
PageParam pageParam) {
return ResponseHelper.buildResponse(idxBizJgRegisterInfoService.getCylinderInfo(equCode, startTime, endTime, pageParam));
}
}
package com.yeejoin.amos.boot.module.jg.biz.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.jg.api.vo.ElevatorModelVo;
import com.yeejoin.amos.boot.module.ymt.api.entity.PageParam;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import org.springframework.web.multipart.MultipartFile;
......@@ -60,5 +60,11 @@ public interface IIdxBizJgRegisterInfoService {
*/
List<Map<String, Object>> getProjectContraptionList(String useUnitCreditCode);
Page<ElevatorModelVo> getElevatorInfo(String equCode, Date startTime, Date endTime, PageParam pageParam);
Page<Map<String, Object>> getElevatorInfo(String equCode, Date startTime, Date endTime, PageParam pageParam);
List<Map<String, Object>> getCylinderStationInfo();
List<Map<String, Object>> getVehicleCylinderInfo(String useCode);
IPage<Map<String, Object>> getCylinderInfo(String equCode, Date startTime, Date endTime, PageParam pageParam);
}
......@@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -32,7 +33,6 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.SafetyProblemTracingMapper;
import com.yeejoin.amos.boot.module.jg.api.vo.ElevatorModelVo;
import com.yeejoin.amos.boot.module.jg.biz.config.PressureVesselListener;
import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
......@@ -3224,8 +3224,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
@Override
public Page<ElevatorModelVo> getElevatorInfo(String equCode, Date startTime, Date endTime, PageParam pageParam) {
Page<ElevatorModelVo> result = new Page<>(pageParam.getCurrent(), pageParam.getSize());
public Page<Map<String, Object>> getElevatorInfo(String equCode, Date startTime, Date endTime, PageParam pageParam) {
Page<Map<String, Object>> result = new Page<>(pageParam.getCurrent(), pageParam.getSize());
SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all");
SearchSourceBuilder builder = new SearchSourceBuilder();
......@@ -3259,7 +3259,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
builder.from((pageParam.getCurrent() - 1) * pageParam.getSize());
builder.size(pageParam.getSize());
request.source(builder);
List<ElevatorModelVo> elevatorModelVoList = Collections.emptyList();
List<Map<String, Object>> elevatorModelVoList = Collections.emptyList();
try {
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
List<String> equIds = Arrays.stream(response.getHits().getHits())
......@@ -3273,7 +3273,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
if (!equIds.isEmpty()) {
elevatorModelVoList = jgUseRegistrationMapper.getElevatorModeList(equIds);
}
result.setRecords(elevatorModelVoList);
result.setRecords(convertKeysToCamelCase(elevatorModelVoList));
result.setTotal(response.getHits().getTotalHits().value);
} catch (IOException e) {
throw new RuntimeException(e);
......@@ -3281,6 +3281,131 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
return result;
}
@Override
public List<Map<String, Object>> getCylinderStationInfo() {
return commonMapper.getCylinderStationInfo(this.getAndSetOrgCode("610581"));
}
@Override
public List<Map<String, Object>> getVehicleCylinderInfo(String useCode) {
return commonMapper.getVehicleCylinderInfo(useCode);
}
@Override
public IPage<Map<String, Object>> getCylinderInfo(String equCode, Date startTime, Date endTime, PageParam pageParam) {
Page<Map<String, Object>> result = new Page<>(pageParam.getCurrent(), pageParam.getSize());
SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all");
SearchSourceBuilder builder = new SearchSourceBuilder();
builder.trackTotalHits(true);
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
//榆林市审批局
String orgCode = this.getAndSetOrgCode("610581");
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*"));
//默认查询电梯
BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchPhraseQuery("EQU_CATEGORY_CODE", QueryParser.escape("2300")));
boolMust.must(query);
BoolQueryBuilder pBuilder = QueryBuilders.boolQuery();
String param = QueryParser.escape("true");
pBuilder.must(QueryBuilders.matchQuery(IS_INTO_MANAGEMENT, param));
boolMust.must(pBuilder);
boolMust.must(QueryBuilders.rangeQuery("REC_DATE").gte(startTime.getTime()).lte(endTime.getTime()));
if (!ObjectUtils.isEmpty(equCode)) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
String test = QueryParser.escape(equCode);
meBuilder.must(QueryBuilders.matchPhraseQuery("EQU_CODE", "*" + test + "*"));
boolMust.must(meBuilder);
}
builder.query(boolMust);
builder.sort("REC_DATE", SortOrder.DESC);
builder.from((pageParam.getCurrent() - 1) * pageParam.getSize());
builder.size(pageParam.getSize());
request.source(builder);
List<Map<String, Object>> cylinderInfoList = Collections.emptyList();
try {
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
List<String> equIds = Arrays.stream(response.getHits().getHits())
.map(hit -> {
JSONObject dto2 = ((JSONObject) JSONObject.toJSON(hit)).getJSONObject("sourceAsMap");
dto2.put("record", dto2.getString(SEQUENCE_NBR));
return dto2.getString(SEQUENCE_NBR);
})
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (!equIds.isEmpty()) {
// 查询设备信息
cylinderInfoList = jgUseRegistrationMapper.getCylinderInfoList(equIds);
Map<String, Object> fillingMediumMap = Systemctl.dictionarieClient.dictValues("FILLING_MEDIUM")
.getResult()
.stream()
.collect(Collectors.toMap(DictionarieValueModel::getDictDataKey, DictionarieValueModel::getDictDataValue));
cylinderInfoList.forEach(i ->i.computeIfPresent("chargingMedium", (key, value) -> fillingMediumMap.get(value)));
}
result.setRecords(convertKeysToCamelCase(cylinderInfoList));
result.setTotal(response.getHits().getTotalHits().value);
} catch (IOException e) {
throw new RuntimeException(e);
}
return result;
}
/**
* 将List<Map<String, Object>>中的字段名从大写转换为驼峰格式
* @param originalList 源List<Map<String, Object>>对象
* @return 转换后的List<Map<String, Object>>对象
*/
public static List<Map<String, Object>> convertKeysToCamelCase(List<Map<String, Object>> originalList) {
List<Map<String, Object>> camelCaseList = new ArrayList<>();
for (Map<String, Object> originalMap : originalList) {
Map<String, Object> camelCaseMap = new HashMap<>();
for (Map.Entry<String, Object> entry : originalMap.entrySet()) {
String camelCaseKey = toCamelCase(entry.getKey());
camelCaseMap.put(camelCaseKey, entry.getValue());
}
camelCaseList.add(camelCaseMap);
}
return camelCaseList;
}
/**
* 将大写加下划线的字符串转换为驼峰命名法
* @param input 需要转换的字符串
* @return 驼峰格式的字符串
*/
public static String toCamelCase(String input) {
if (input == null || input.isEmpty()) {
return input;
}
StringBuilder result = new StringBuilder();
boolean toUpperCase = false;
for (int i = 0; i < input.length(); i++) {
char c = input.charAt(i);
if (c == '_') {
toUpperCase = true;
} else if (toUpperCase) {
result.append(Character.toUpperCase(c));
toUpperCase = false;
} else {
result.append(Character.toLowerCase(c));
}
}
return result.toString();
}
public String getAndSetOrgCode(String cityCode) {
String orgCode = regionCodeOrgCodeMap.get(cityCode);
......
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