Commit 80bd2f8b authored by tianyiming's avatar tianyiming

Merge branch 'develop_tzs_96333' into develop_tzs_ymt

parents 9f538f19 545f110a
......@@ -161,7 +161,7 @@ public class AlertCalledDto extends BaseDto {
// private String images;
@ApiModelProperty(value = "设备id")
private Long equipmentId;
private String equipmentId;
@ApiModelProperty(value = "现场照片")
private List<AttachmentDto> images;
......
package com.yeejoin.amos.boot.module.elevator.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.List;
/**
* @author keyong
* @title: BaseEnterpriseInfoDto
* <pre>
* @description: TODO
* </pre>
* @date 2023/7/28 11:07
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("tz_base_enterprise_info")
@ApiModel(value = "BaseEnterpriseInfoDto", description = "BaseEnterpriseInfoDto")
public class BaseEnterpriseInfoDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "统一社会信用代码")
@TableField("use_code")
private String socialCreditCode;
@ApiModelProperty(value = "维护保养单位名称")
@TableField("supervise_org_name")
private String unitName;
@ApiModelProperty(value = "省份")
@TableField("province")
private String province;
@ApiModelProperty(value = "地市")
@TableField("city")
private String city;
@ApiModelProperty(value = "区县")
@TableField("district")
private String district;
@ApiModelProperty(value = "区域代码")
@TableField("district")
private String regionCode;
@ApiModelProperty(value = "地址(详细地址,包括道路、门牌号码)")
@TableField("address")
private String address;
@ApiModelProperty(value = "经度")
@TableField("longitude")
private String longitude;
@ApiModelProperty(value = "纬度")
@TableField("latitude")
private String latitude;
// @ApiModelProperty(value = "法人id")
// private Long legalPersonId;
@ApiModelProperty(value = "法人")
@TableField("legal_person")
private String legalPerson;
@ApiModelProperty(value = "法人电话/注册电话")
@TableField("legal_phone")
private String legalPersonPhone;
// @ApiModelProperty(value = "企业资质等级")
// private String qualificationLevel;
//
// @ApiModelProperty(value = "信用级别")
// private Integer creditLevel;
// @ApiModelProperty(value = "许可证编号")
// private String licenseNum;
@ApiModelProperty(value = "值班电话")
@TableField("contact_phone")
private String dutyPhone;
// @ApiModelProperty(value = "紧急电话号码")
// private String emergencyPhone;
@ApiModelProperty(value = "主要负责人1")
@TableField("safety_one")
private String principalFirst;
@ApiModelProperty(value = "主要负责人1手机号码")
@TableField("safety_one_phone")
private String principalFirstPhone;
@ApiModelProperty(value = "主要负责人1id")
@TableField("safety_one_id")
private Long principalFirstId;
@ApiModelProperty(value = "主要负责人2")
@TableField("safety_two")
private String principalSecond;
@ApiModelProperty(value = "主要负责人2手机号码")
@TableField("safety_two_phone")
private String principalSecondPhone;
@ApiModelProperty(value = "主要负责人2id")
@TableField("safety_two_id")
private Long principalSecondId;
// @ApiModelProperty(value = "原始表id(来自历史数据库)")
// private String originalId;
@ApiModelProperty(value = "单位类型")
@TableField("unit_type")
private String unitType;
@ApiModelProperty(value = "人员信息")
@TableField(exist = false)
List<DutyPersonDto> dutyPersonList;
}
......@@ -120,7 +120,7 @@ public class ElevatorDto extends BaseDto {
private String useUnit;
@ApiModelProperty(value = "使用单位id")
private Long useUnitId;
private String useUnitId;
@ApiModelProperty(value = "制造单位名称")
private String manufacturerName;
......@@ -144,13 +144,13 @@ public class ElevatorDto extends BaseDto {
private String maintainUnit;
@ApiModelProperty(value = "维保单位id")
private Long maintainUnitId;
private String maintainUnitId;
@ApiModelProperty(value = "维保负责人")
private String maintainLeader;
@ApiModelProperty(value = "维保负责人id")
private Long maintainLeaderId;
private String maintainLeaderId;
@ApiModelProperty(value = "维保负责人手机")
private String maintainLeaderPhone;
......@@ -223,4 +223,6 @@ public class ElevatorDto extends BaseDto {
@ApiModelProperty(value = "保险信息")
private ElevatorInsureDto elevatorInsureDto;
List<String> ids;
}
package com.yeejoin.amos.boot.module.elevator.api.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Data
public class ElevatorDtoNew {
@ExcelProperty(value = "电梯应急救援识别码", index = 0)
private String rescueCode;
@ExcelProperty(value = "设备注册代码", index = 8)
private String registerCode;
@ExcelProperty(value = "所属区县", index = 3)
private String district;
@ExcelProperty(value = "安装地址", index = 1)
private String address;
@ExcelProperty(value = "内部编号", index = 2)
private String innerNum;
@ExcelProperty(value = "使用单位", index = 4)
private String useUnit;
@ExcelProperty(value = "维保单位", index = 7)
private String maintainUnit;
@ExcelProperty(value = "维保负责人", index = 5)
private String maintainLeader;
@ExcelProperty(value = "维保负责人手机", index = 6)
private String maintainLeaderPhone;
}
package com.yeejoin.amos.boot.module.elevator.api.dto;
import lombok.Data;
@Data
public class ElevatorMessageDto {
private String sequenceNbr;
private String address;
private Integer rescueCode;
private String registerCode;
private String useUnit;
private String useStatus;
private String useSiteCategory;
private String province;
private String city;
private String district;
private String regionCode;
private String street;
}
package com.yeejoin.amos.boot.module.elevator.api.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.List;
/**
* @author ky
* @date 2023-07-28
*/
@Data
public class EnterpriseInfoExportDto {
@ExcelProperty(value = "统一社会信用代码", index = 1)
private String socialCreditCode;
@ExcelProperty(value = "单位名称", index = 0)
private String unitName;
@ExcelProperty(value = "所属区域", index = 2)
private String district;
@ExcelProperty(value = "地址", index = 3)
private String address;
@ExcelProperty(value = "法人", index = 4)
private String legalPerson;
@ExcelProperty(value = "电话", index = 5)
private String legalPersonPhone;
@ExcelProperty(value = "值班电话", index = 6)
private String dutyPhone;
@ExcelProperty(value = "主要负责人1", index = 7)
private String principalFirst;
@ExcelProperty(value = "主要负责人1手机号码", index = 8)
private String principalFirstPhone;
@ExcelProperty(value = "主要负责人2", index = 9)
private String principalSecond;
@ExcelProperty(value = "主要负责人2手机号码", index = 10)
private String principalSecondPhone;
}
......@@ -225,7 +225,7 @@ public class AlertCalled extends BaseEntity {
@TableField("equipment_id")
@ApiModelProperty(value = "设备id")
private Long equipmentId;
private String equipmentId;
@TableField(exist=false)
......
......@@ -106,7 +106,7 @@ public class Elevator extends BaseEntity {
private String useUnit;
@ApiModelProperty(value = "使用单位id")
private Long useUnitId;
private String useUnitId;
@ApiModelProperty(value = "制造单位名称")
private String manufacturerName;
......@@ -124,7 +124,7 @@ public class Elevator extends BaseEntity {
private String maintainUnit;
@ApiModelProperty(value = "维保单位id")
private Long maintainUnitId;
private String maintainUnitId;
@ApiModelProperty(value = "维保负责人")
private String maintainLeader;
......
package com.yeejoin.amos.boot.module.elevator.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.List;
/**
* @author ky
* @date 2023-07-28
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("tz_base_enterprise_info")
@ApiModel(value = "BaseEnterpriseInfo对象", description = "BaseEnterpriseInfo对象")
public class EnterpriseInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "统一社会信用代码")
@TableField("use_code")
private String socialCreditCode;
@ApiModelProperty(value = "维护保养单位名称")
@TableField("use_unit")
private String unitName;
@ApiModelProperty(value = "省份")
@TableField("province")
private String province;
@ApiModelProperty(value = "地市")
@TableField("city")
private String city;
@ApiModelProperty(value = "区县")
@TableField("district")
private String district;
@ApiModelProperty(value = "区域代码")
@TableField("district")
private String regionCode;
@ApiModelProperty(value = "地址(详细地址,包括道路、门牌号码)")
@TableField("address")
private String address;
@ApiModelProperty(value = "经度")
@TableField("longitude")
private String longitude;
@ApiModelProperty(value = "纬度")
@TableField("latitude")
private String latitude;
@ApiModelProperty(value = "法人")
@TableField("legal_person")
private String legalPerson;
@ApiModelProperty(value = "法人电话/注册电话")
@TableField("legal_phone")
private String legalPersonPhone;
@ApiModelProperty(value = "值班电话")
@TableField("contact_phone")
private String dutyPhone;
@ApiModelProperty(value = "主要负责人1")
@TableField("safety_one")
private String principalFirst;
@ApiModelProperty(value = "主要负责人1手机号码")
@TableField("safety_one_phone")
private String principalFirstPhone;
@ApiModelProperty(value = "主要负责人1id")
@TableField("safety_one_id")
private Long principalFirstId;
@ApiModelProperty(value = "主要负责人2")
@TableField("safety_two")
private String principalSecond;
@ApiModelProperty(value = "主要负责人2手机号码")
@TableField("safety_two_phone")
private String principalSecondPhone;
@ApiModelProperty(value = "主要负责人2id")
@TableField("safety_two_id")
private Long principalSecondId;
@ApiModelProperty(value = "单位类型")
@TableField("unit_type")
private String unitType;
@TableField(exist = false)
private List<String> ids;
}
......@@ -21,7 +21,7 @@ public class EsElevator {
/** 主键 */
@Id
private Long sequenceNbr;
private String sequenceNbr;
/**
* 注册编码
......
package com.yeejoin.amos.boot.module.elevator.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.elevator.api.dto.ElevatorDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.ElevatorDtoNew;
import com.yeejoin.amos.boot.module.elevator.api.dto.ElevatorMessageDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.ElevatorWlInfoDto;
import com.yeejoin.amos.boot.module.elevator.api.entity.Elevator;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
/**
* Mapper 接口
......@@ -34,4 +38,30 @@ public interface ElevatorMapper extends BaseMapper<Elevator> {
List<ElevatorDto> selectExportData(@Param("ids") List<String> ids);
@Select("select * from tcb_elevator where address like concat('%',#{address},'%')")
List<ElevatorDto> getAddressList(String address);
List<ElevatorMessageDto> getAddressListNew(@Param("address") String address);
Page<Map<String, Object>> selectElevators(@Param("page") Page<Map<String, Object>> page, @Param("dto") ElevatorDto dto);
List<ElevatorDtoNew> selectExportDataNew(@Param("dto") ElevatorDto dto, @Param("ids")List<String> ids);
Map<String, Object> selectByRecord(@Param("record") String record);
Map<String, Object> selectFiles(@Param("record") String record);
Map<String, Object> selectRegisterFiles(@Param("record") String record);
Map<String, Object> selectMaintenanceInspectionFiles(@Param("record") String record);
Map<String,Object> selectElevatorList(@Param("elevator") Elevator elevator);
List<Map<String, Object>> selectElevatorEsList(int pageNum, int pageSize);
Integer selectUseInfoCount();
List<Map<String, Object>> selectMtByAlertId(String sequenceNbr);
Map<String, Object> selectUseUnitByAlertId(String sequenceNbr);
}
package com.yeejoin.amos.boot.module.elevator.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.elevator.api.entity.EnterpriseInfo;
/**
* @author keyong
* @title: EnterpriseInfoMapper
* <pre>
* @description: TODO
* </pre>
* @date 2023/7/28 14:20
*/
public interface EnterpriseInfoMapper extends BaseMapper<EnterpriseInfo> {
}
......@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.module.elevator.api.entity.MaintenanceUnit;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* Mapper 接口
......@@ -16,4 +17,6 @@ import java.util.List;
public interface MaintenanceUnitMapper extends BaseMapper<MaintenanceUnit> {
List<MaintenanceUnitDto> selectExportData(@Param("ids") List<String> ids);
Map<String, Object> selectMessage(@Param("record")String record);
}
......@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.module.elevator.api.entity.UseUnit;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* Mapper 接口
......@@ -16,4 +17,6 @@ import java.util.List;
public interface UseUnitMapper extends BaseMapper<UseUnit> {
List<UseUnitDto> selectExportData(@Param("ids") List<String> ids);
Map<String, Object> selectMessage(@Param("record") String record);
}
package com.yeejoin.amos.boot.module.elevator.api.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.elevator.api.dto.ElevatorDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.ElevatorDtoNew;
import com.yeejoin.amos.boot.module.elevator.api.entity.Elevator;
import com.yeejoin.amos.boot.module.elevator.api.entity.MaintenanceUnit;
import java.util.List;
import java.util.Map;
/**
* 服务类
......@@ -18,7 +22,7 @@ public interface IElevatorService extends IService<Elevator> {
* @param alertId
* @return
*/
Elevator selectByAlertId(Long alertId);
Map<String,Object> selectByAlertId(Long alertId);
/**
* 根据电梯id 生成电梯二维码
......@@ -28,4 +32,18 @@ public interface IElevatorService extends IService<Elevator> {
String saveElevatorQrCode(Long elevatorId);
List<ElevatorDto> selectExportData(String exportId);
Map<String,Object> selectElevatorList(Elevator elevator);
Page<Map<String, Object>> selectElevators(Page<Map<String, Object>>page, ElevatorDto dto);
List<ElevatorDtoNew> selectExportDataNew(ElevatorDto dto);
List<Map<String, Object>> selectElevatorEsList(int pageNum,int pageSize);
Integer selectUseInfoCount();
List<Map<String,Object>> selectMtByAlertId(String sequenceNbr);
Map<String, Object> selectUseUnitByAlertId(String sequenceNbr);
}
package com.yeejoin.amos.boot.module.elevator.api.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.elevator.api.entity.EnterpriseInfo;
/**
* @author keyong
* @title: IEnterpriseInfoService
* <pre>
* @description: TODO
* </pre>
* @date 2023/7/28 14:17
*/
public interface IEnterpriseInfoService extends IService<EnterpriseInfo> {
}
......@@ -5,6 +5,7 @@ import com.yeejoin.amos.boot.module.elevator.api.dto.MaintenanceUnitDto;
import com.yeejoin.amos.boot.module.elevator.api.entity.MaintenanceUnit;
import java.util.List;
import java.util.Map;
/**
* 服务类
......@@ -15,4 +16,6 @@ import java.util.List;
public interface IMaintenanceUnitService extends IService<MaintenanceUnit> {
List<MaintenanceUnitDto> selectExportData(String exportId);
Map<String, Object> selectMessage(String record);
}
......@@ -5,6 +5,7 @@ import com.yeejoin.amos.boot.module.elevator.api.dto.UseUnitDto;
import com.yeejoin.amos.boot.module.elevator.api.entity.UseUnit;
import java.util.List;
import java.util.Map;
/**
* 服务类
......@@ -15,4 +16,6 @@ import java.util.List;
public interface IUseUnitService extends IService<UseUnit> {
List<UseUnitDto> selectExportData(String exportId);
Map<String, Object> selectMessage(String record);
}
......@@ -185,8 +185,7 @@
a.call_time AS callTime,
a.emergency_call AS emergencyCall,
a.device_id AS deviceId,
e.address AS
elevatorAddress,
ibjui.ADDRESS AS elevatorAddress,
CONCAT(a.city,a.district) AS address,
a.alarm_type AS alertType,
a.alert_source AS alertSource,
......@@ -202,8 +201,8 @@
END AS alertStatus
FROM
tz_alert_called a
LEFT JOIN tcb_elevator e ON e.rescue_code =
a.device_id
LEFT JOIN idx_biz_jg_other_info ibjoi ON ibjoi.CODE96333 = a.device_id
LEFT JOIN idx_biz_jg_use_info ibjui ON ibjoi.RECORD = ibjui.RECORD
WHERE a.is_delete = 0
<if test="workOrderNumber != null and workOrderNumber != ''">
AND a.work_order_number like
......@@ -233,7 +232,7 @@
AND a.device_id like CONCAT(CONCAT('%',#{deviceId}),'%')
</if>
<if test="elevatorAddress != null and elevatorAddress != ''">
AND e.address like
AND ibjui.ADDRESS like
CONCAT(CONCAT('%',#{elevatorAddress}),'%')
</if>
<if test="district != null and district != ''">
......@@ -501,7 +500,6 @@
a.address
FROM
tz_alert_called a
LEFT JOIN tcb_elevator e ON e.sequence_nbr = a.equipment_id
WHERE 1=1
<if test="callTimeStart != null ">
and #{callTimeStart} <![CDATA[ <= ]]>
......@@ -533,19 +531,22 @@
SELECT
a.sequence_nbr AS alertId,
a.region_code AS regionCode,
e.rescue_code AS rescueCode,
ibjoi.CODE96333 AS rescueCode,
a.alarm_type_code AS alarmTypeCode,
a.alarm_type AS alarmType,
CONCAT(e.province ,e.city ,e.district) AS area,
CONCAT(ibjui.PROVINCE_NAME ,ibjui.CITY_NAME ,ibjui.COUNTY_NAME) AS area,
a.address AS address,
a.call_time AS callTime,
e.longitude AS longitude,
e.latitude AS latitude,
ifnull ( ibjui."LONGITUDE_LATITUDE"::json->> 'latitude', null ) AS latitude,
ifnull ( ibjui."LONGITUDE_LATITUDE"::json->> 'longitude', null ) AS longitude,
a.alert_stage AS alertStatus,
e.sequence_nbr AS elevatorId,
e.register_code AS elevatorCode
ibjui.RECORD AS elevatorId,
ibjri.SUPERVISORY_CODE AS elevatorCode
FROM tz_alert_called a
LEFT JOIN tcb_elevator e ON e.sequence_nbr = a.equipment_id
LEFT JOIN idx_biz_jg_other_info ibjoi ON ibjoi.RECORD = a.equipment_id
LEFT JOIN idx_biz_jg_use_info ibjui ON ibjui.RECORD = ibjoi.RECORD
LEFT JOIN idx_biz_jg_register_info ibjri ON ibjri.RECORD = ibjoi.RECORD
WHERE a.is_delete = 0
<choose>
<when test="isHistory == true">
......
......@@ -93,5 +93,429 @@
</if>
</select>
<select id="selectElevators" resultType="java.util.Map">
SELECT ifnull(joi.CODE96333, '') as rescueCode,
ifnull(jui.ADDRESS, '') as address,
ifnull(jui.USE_INNER_CODE, '') as innerNum,
ifnull(concat(jui.PROVINCE_NAME, jui.CITY_NAME, jui.COUNTY_NAME), '') as district,
ifnull(jui.USE_UNIT_NAME, '') as useUnit,
ifnull(jui.SAFETY_MANAGER, '') as maintainLeader,
ifnull(jui.PHONE, '') as maintainLeaderPhone,
(SELECT GROUP_CONCAT(ME_UNIT_NAME) FROM idx_biz_jg_maintenance_record_info WHERE RECORD = jui.RECORD
) as maintainUnit,
ifnull(joi.SUPERVISORY_CODE, '') as registerCode,
jui.RECORD as sequenceNbr
FROM idx_biz_jg_use_info jui
LEFT JOIN idx_biz_jg_other_info joi ON jui.RECORD = joi.RECORD
LEFT JOIN idx_biz_jg_register_info jri on jui.RECORD = jri.RECORD
LEFT JOIN idx_biz_jg_maintenance_record_info mri on jui.RECORD = mri.RECORD
<where>
jri.EQU_LIST = '3000'
<if test="dto.regionCode != null and dto.regionCode != ''">
and (jui.PROVINCE = #{dto.regionCode} or jui.CITY = #{dto.regionCode} or jui.COUNTY = #{dto.regionCode}
)
</if>
<if test="dto.rescueCode != null and dto.rescueCode != ''">
and joi.CODE96333 like concat('%',#{dto.rescueCode},'%')
</if>
<if test="dto.address != null and dto.address != ''">
and jui.ADDRESS like concat('%',#{dto.address},'%')
</if>
<if test="dto.maintainLeader != null and dto.maintainLeader != ''">
and jui.SAFETY_MANAGER like concat('%',#{dto.maintainLeader},'%')
</if>
<if test="dto.maintainLeaderPhone != null and dto.maintainLeaderPhone != ''">
and jui.PHONE like concat('%',#{dto.maintainLeaderPhone},'%')
</if>
<if test="dto.maintainUnit != null and dto.maintainUnit != ''">
and mri.ME_UNIT_NAME like concat('%',#{dto.maintainUnit},'%')
</if>
<if test="dto.useUnit != null and dto.useUnit != ''">
and jui.USE_UNIT_NAME like concat('%',#{dto.useUnit},'%')
</if>
</where>
</select>
<!-- <select id="selectExportDataNew" resultType="com.yeejoin.amos.boot.module.elevator.api.dto.ElevatorDtoNew">-->
<!-- SELECT joi.CODE96333 AS rescueCode,-->
<!-- jri.EQU_CODE AS registerCode,-->
<!-- jui.PROVINCE_NAME AS province,-->
<!-- jui.CITY_NAME AS city,-->
<!-- jui.COUNTY_NAME AS district,-->
<!-- concat(jui.PROVINCE, '#', jui.CITY, '#', jui.COUNTY) AS regionCode,-->
<!-- jui.ADDRESS AS address,-->
<!-- jui.USE_INNER_CODE AS innerNum,-->
<!-- jri.BRAND_NAME AS brand,-->
<!-- jfi.FACTORY_NUM AS factoryNum,-->
<!-- (SELECT GROUP_CONCAT(USC_UNIT_NAME)-->
<!-- FROM idx_biz_jg_construction_info-->
<!-- WHERE RECORD = jui.RECORD-->
<!-- and CONSTRUCTION_TYPE = '6030') AS installationUnit,-->
<!-- ifnull ( CAST(jfi.PRODUCE_DATE as VARCHAR ), '' ) AS factoryDate,-->
<!-- ifnull ((SELECT CAST(USC_DATE as VARCHAR )-->
<!-- FROM idx_biz_jg_construction_info-->
<!-- WHERE RECORD = jui.RECORD-->
<!-- and CONSTRUCTION_TYPE = '6031'-->
<!-- ORDER BY USC_DATE DESC LIMIT 1 ), '' ) AS overhaulDate,-->
<!-- ifnull ( CAST(jui.USE_DATE as VARCHAR ), '' ) AS startUseDate,-->
<!-- (SELECT name from tz_equipment_category WHERE code = jri.EQU_LIST) AS categoryName,-->
<!-- (SELECT name from cb_data_dictionary WHERE code = jui.USE_PLACE and type = 'ADDRESS' ) AS useSiteCategory,-->
<!-- jri.EQU_TYPE AS model,-->
<!-- tpe.STOREY AS floors,-->
<!-- tpe.STAND AS stations,-->
<!-- tpe.NUMBER_DOORS AS doors,-->
<!-- tpe.RATED_SPEED_UP AS ratedSpeed,-->
<!-- tpe.RATED_LOAD_CAPACITY AS ratedLoad,-->
<!-- '' AS maxPersonLoad,-->
<!-- tpe.LIFTING_HEIGHT AS raiseHeight,-->
<!-- tpe.CONTROL_MODE AS dragModeName,-->
<!-- case-->
<!-- WHEN jui.EQU_STATE = 0 then '未登记'-->
<!-- WHEN jui.EQU_STATE = 1 then '在用'-->
<!-- WHEN jui.EQU_STATE = 2 then '停用'-->
<!-- WHEN jui.EQU_STATE = 3 then '报废'-->
<!-- WHEN jui.EQU_STATE = 4 then '注销'-->
<!-- ELSE ''-->
<!-- END AS useStatus,-->
<!-- jui.USE_UNIT_NAME AS useUnit,-->
<!-- jfi.PRODUCE_UNIT_NAME AS manufacturerName,-->
<!-- jfi.PRODUCE_LICENSE_NUM AS manufacturingLicense,-->
<!-- '' AS maintainTypeName,-->
<!-- '' AS maintainLeaderPhone,-->
<!-- '' AS hostModel,-->
<!-- '' AS hostNum,-->
<!-- '' AS engineType,-->
<!-- '' AS engineNum,-->
<!-- '' AS panelModel,-->
<!-- '' AS panelNum,-->
<!-- '' AS cascadeModel,-->
<!-- '' AS cascadeLineModel,-->
<!-- '' AS handrailType,-->
<!-- '' AS handrailPanelModel,-->
<!-- '' AS handrailPanelBrand,-->
<!-- '' AS rollerMode,-->
<!-- '' AS tiltAngle,-->
<!-- '' AS horizontalSpan,-->
<!-- '' AS runningNoise,-->
<!-- '' AS runningMode,-->
<!-- '' AS runningVibration,-->
<!-- '' AS power,-->
<!-- ifnull ( jui."LONGITUDE_LATITUDE"::json->> 'latitude', '' ) AS latitude,-->
<!-- ifnull ( jui."LONGITUDE_LATITUDE"::json->> 'longitude', '' ) AS longitude,-->
<!-- (SELECT ME_CYCLE FROM idx_biz_jg_maintenance_record_info WHERE RECORD = jui.RECORD ORDER BY REC_DATE DESC limit-->
<!-- 1) as maintainPeriodName,-->
<!-- (SELECT ME_UNIT_NAME FROM idx_biz_jg_maintenance_record_info WHERE RECORD = jui.RECORD ORDER BY REC_DATE DESC-->
<!-- limit 1) as maintainUnit,-->
<!-- (SELECT ME_MASTER FROM idx_biz_jg_maintenance_record_info WHERE RECORD = jui.RECORD ORDER BY REC_DATE DESC limit-->
<!-- 1) as maintainLeader,-->
<!-- jui.RECORD AS sequenceNbr-->
<!-- FROM idx_biz_jg_register_info jri-->
<!-- LEFT JOIN idx_biz_jg_other_info joi ON jri.RECORD = joi.RECORD-->
<!-- LEFT JOIN idx_biz_jg_use_info jui ON jri.RECORD = jui.RECORD-->
<!-- LEFT JOIN idx_biz_jg_factory_info jfi ON jri.RECORD = jfi.RECORD-->
<!-- LEFT JOIN idx_biz_jg_tech_params_elevator tpe ON tpe.RECORD = jfi.RECORD-->
<!-- WHERE jri.EQU_LIST = '3000'-->
<!-- <if test="ids != null and ids.size() > 0">-->
<!-- and jui.RECORD in-->
<!-- <foreach item="item" collection="ids" separator="," open="(" close=")" index="">#{item}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- </select>-->
<select id="selectByRecord" resultType="java.util.Map">
SELECT joi.CODE96333 AS rescueCode,
jri.EQU_CODE AS registerCode,
jui.PROVINCE_NAME AS province,
jui.CITY_NAME AS city,
jui.COUNTY_NAME AS district,
concat(jui.PROVINCE, '#', jui.CITY, '#', jui.COUNTY) AS regionCode,
jui.ADDRESS AS address,
jui.USE_INNER_CODE AS innerNum,
jri.BRAND_NAME AS brand,
jfi.FACTORY_NUM AS factoryNum,
(SELECT GROUP_CONCAT(USC_UNIT_NAME)
FROM idx_biz_jg_construction_info
WHERE RECORD = jui.RECORD
and CONSTRUCTION_TYPE = '6030') AS installationUnit,
ifnull ( CAST(jfi.PRODUCE_DATE as VARCHAR ), null ) AS factoryDate,
ifnull ((SELECT CAST(USC_DATE as VARCHAR )
FROM idx_biz_jg_construction_info
WHERE RECORD = jui.RECORD
and CONSTRUCTION_TYPE = '6031'
ORDER BY USC_DATE DESC LIMIT 1 ), null ) AS overhaulDate,
ifnull ( CAST(jui.USE_DATE as VARCHAR ), null ) AS startUseDate,
(SELECT name from tz_equipment_category WHERE code = jri.EQU_LIST) AS categoryName,
(SELECT name from cb_data_dictionary WHERE code = jui.USE_PLACE and type = 'ADDRESS' ) AS useSiteCategory,
jri.EQU_TYPE AS model,
tpe.STOREY AS floors,
tpe.STAND AS stations,
tpe.NUMBER_DOORS AS doors,
tpe.RATED_SPEED_UP AS ratedSpeed,
tpe.RATED_LOAD_CAPACITY AS ratedLoad,
'' AS maxPersonLoad,
tpe.LIFTING_HEIGHT AS raiseHeight,
tpe.CONTROL_MODE AS dragModeName,
case
WHEN jui.EQU_STATE = 0 then '未登记'
WHEN jui.EQU_STATE = 1 then '在用'
WHEN jui.EQU_STATE = 2 then '停用'
WHEN jui.EQU_STATE = 3 then '报废'
WHEN jui.EQU_STATE = 4 then '注销'
ELSE ''
END AS useStatus,
jui.USE_UNIT_NAME AS useUnit,
jfi.PRODUCE_UNIT_NAME AS manufacturerName,
jfi.PRODUCE_LICENSE_NUM AS manufacturingLicense,
'' AS maintainTypeName,
'' AS maintainLeaderPhone,
'' AS hostModel,
'' AS hostNum,
'' AS engineType,
'' AS engineNum,
'' AS panelModel,
'' AS panelNum,
'' AS cascadeModel,
'' AS cascadeLineModel,
'' AS handrailType,
'' AS handrailPanelModel,
'' AS handrailPanelBrand,
'' AS rollerMode,
'' AS tiltAngle,
'' AS horizontalSpan,
'' AS runningNoise,
'' AS runningMode,
'' AS runningVibration,
'' AS power,
ifnull ( jui."LONGITUDE_LATITUDE"::json->> 'latitude', null ) AS latitude,
ifnull ( jui."LONGITUDE_LATITUDE"::json->> 'longitude', null ) AS longitude,
(SELECT ME_CYCLE FROM idx_biz_jg_maintenance_record_info WHERE RECORD = jui.RECORD ORDER BY REC_DATE DESC limit
1) as maintainPeriodName,
(SELECT ME_UNIT_NAME FROM idx_biz_jg_maintenance_record_info WHERE RECORD = jui.RECORD ORDER BY REC_DATE DESC
limit 1) as maintainUnit,
(SELECT ME_MASTER FROM idx_biz_jg_maintenance_record_info WHERE RECORD = jui.RECORD ORDER BY REC_DATE DESC limit
1) as maintainLeader,
jui.RECORD AS sequenceNbr
FROM idx_biz_jg_use_info jui
LEFT JOIN idx_biz_jg_other_info joi ON jui.RECORD = joi.RECORD
LEFT JOIN idx_biz_jg_register_info jri ON jri.RECORD = jui.RECORD
LEFT JOIN idx_biz_jg_factory_info jfi ON jui.RECORD = jfi.RECORD
LEFT JOIN idx_biz_jg_tech_params_elevator tpe ON tpe.RECORD = jui.RECORD
WHERE jui.RECORD = #{record}
</select>
<select id="selectFiles" resultType="java.util.Map">
SELECT jdi.DESIGN_DOC,
jdi.DESIGN_STANDARD ,
jfi.FACTORY_STANDARD,
jfi.PRODUCT_QUALITY_YIELD_PROVE,
jfi.INS_USE_MAINTAIN_EXPLAIN,
jfi.SUPERVISION_AGENCY_CREDENTIAL,
jfi.TYPE_TEST_CREDENTIAL
FROM idx_biz_jg_design_info jdi
LEFT JOIN idx_biz_jg_factory_info jfi on jdi.RECORD = jfi.RECORD
where jdi.RECORD = #{record}
</select>
<select id="selectElevatorList" resultType="java.util.Map">
SELECT
jui.RECORD AS sequenceNbr,
jui.USE_UNIT_NAME AS useUnit,
ifnull ( joi.CODE96333, null ) AS rescueCode,
ifnull ( joi.SUPERVISORY_CODE, null ) AS registerCode,
ifnull ( jui.USE_UNIT_NAME, null ) AS useUnit,
ifnull ( jui.EQU_STATE,'')AS useStatus,
ifnull ( ( SELECT NAME FROM cb_data_dictionary WHERE code = jui.USE_PLACE and type = 'ADDRESS' ), null ) AS useSiteCategory,
ifnull ( jui.ADDRESS, null ) AS address,
ifnull ( jui.PROVINCE_NAME, null ) AS province,
ifnull ( jui.CITY_NAME, null ) AS city,
ifnull ( jui.COUNTY_NAME, null ) AS district,
ifnull ( jui."LONGITUDE_LATITUDE"::json->> 'latitude', null ) AS latitude,
ifnull ( jui."LONGITUDE_LATITUDE"::json->> 'longitude', null ) AS longitude,
ifnull(jui.FACTORY_USE_SITE_STREET, '') AS street,
concat(jui.PROVINCE, '#',jui.CITY, '#',jui.COUNTY) AS regionCode
FROM
idx_biz_jg_use_info jui
LEFT JOIN idx_biz_jg_other_info joi ON jui.RECORD = joi.RECORD
LEFT JOIN idx_biz_jg_register_info jri ON jri.RECORD = jui.RECORD
WHERE
jri.EQU_LIST = '3000'
<if test="elevator.rescueCode!=null and elevator.rescueCode!='' ">
AND joi.CODE96333 = #{elevator.rescueCode}
</if>
<if test="elevator.registerCode!=null and elevator.registerCode!='' ">
AND joi.SUPERVISORY_CODE = #{elevator.registerCode}
</if>
<if test="elevator.originalId!=null and elevator.originalId!='' ">
AND jui.RECORD = #{elevator.originalId}
</if>
<if test="elevator.address!=null and elevator.address!='' ">
AND jui.ADDRESS = #{elevator.address}
</if>
limit 1
</select>
<select id="selectRegisterFiles" resultType="java.util.Map">
select USE_REGISTRATION_CERTIFICATE, USE_SIGN, PRODUCT_PHOTO
from idx_biz_jg_register_info
where record = #{record}
</select>
<select id="selectMaintenanceInspectionFiles" resultType="java.util.Map">
SELECT (select REPAIR_INFORM
from idx_biz_jg_maintenance_record_info
where record = #{record}
ORDER BY REC_DATE DESC LIMIT 1)as maintenanceFile,
(select INSPECT_REPORT
from idx_biz_jg_inspection_detection_info
where record = #{record}
ORDER BY REC_DATE DESC LIMIT 1) as inspectionFile
</select>
<select id="selectExportDataNew" resultType="com.yeejoin.amos.boot.module.elevator.api.dto.ElevatorDtoNew">
SELECT ifnull(joi.CODE96333, '') as rescueCode,
ifnull(jui.ADDRESS, '') as address,
ifnull(jui.USE_INNER_CODE, '') as innerNum,
ifnull(concat(jui.PROVINCE_NAME, jui.CITY_NAME, jui.COUNTY_NAME), '') as district,
ifnull(jui.USE_UNIT_NAME, '') as useUnit,
ifnull(jui.SAFETY_MANAGER, '') as maintainLeader,
ifnull(jui.PHONE, '') as maintainLeaderPhone,
(SELECT GROUP_CONCAT(ME_UNIT_NAME) FROM idx_biz_jg_maintenance_record_info WHERE RECORD = jui.RECORD
) as maintainUnit,
ifnull(joi.SUPERVISORY_CODE, '') as registerCode,
jui.RECORD as sequenceNbr
FROM idx_biz_jg_use_info jui
LEFT JOIN idx_biz_jg_other_info joi ON jui.RECORD = joi.RECORD
LEFT JOIN idx_biz_jg_register_info jri on jui.RECORD = jri.RECORD
LEFT JOIN idx_biz_jg_maintenance_record_info mri on jui.RECORD = mri.RECORD
<where>
jri.EQU_LIST = '3000'
<if test="dto.regionCode != null and dto.regionCode != ''">
and (jui.PROVINCE = #{dto.regionCode} or jui.CITY = #{dto.regionCode} or jui.COUNTY = #{dto.regionCode}
)
</if>
<if test="dto.rescueCode != null and dto.rescueCode != ''">
and joi.CODE96333 like concat('%',#{dto.rescueCode},'%')
</if>
<if test="dto.address != null and dto.address != ''">
and jui.ADDRESS like concat('%',#{dto.address},'%')
</if>
<if test="dto.maintainLeader != null and dto.maintainLeader != ''">
and jui.SAFETY_MANAGER like concat('%',#{dto.maintainLeader},'%')
</if>
<if test="dto.maintainLeaderPhone != null and dto.maintainLeaderPhone != ''">
and jui.PHONE like concat('%',#{dto.maintainLeaderPhone},'%')
</if>
<if test="dto.maintainUnit != null and dto.maintainUnit != ''">
and mri.ME_UNIT_NAME like concat('%',#{dto.maintainUnit},'%')
</if>
<if test="dto.useUnit != null and dto.useUnit != ''">
and jui.USE_UNIT_NAME like concat('%',#{dto.useUnit},'%')
</if>
<if test="ids != null and ids.size() > 0">
and jui.RECORD in
<foreach item="item" collection="ids" separator="," open="(" close=")" index="">#{item}
</foreach>
</if>
</where>
limit 10
</select>
<select id="selectElevatorEsList" resultType="java.util.Map">
SELECT
jui.RECORD AS sequenceNbr,
ifnull ( jui.USE_INNER_CODE, null ) AS innerNum,
ifnull ( joi.CODE96333, null ) AS rescueCode,
ifnull ( joi.SUPERVISORY_CODE, null ) AS registerCode,
ifnull ( jui.ADDRESS, null ) AS address,
ifnull ( jui.PROVINCE_NAME, null ) AS province,
ifnull ( jui.CITY_NAME, null ) AS city,
ifnull ( jui.COUNTY_NAME, null ) AS district,
ifnull ( jui."LONGITUDE_LATITUDE"::json->> 'latitude', null ) AS latitude,
ifnull ( jui."LONGITUDE_LATITUDE"::json->> 'longitude', null ) AS longitude,
concat(jui.PROVINCE, '#',jui.CITY, '#',jui.COUNTY) AS regionCode
FROM
idx_biz_jg_use_info jui
LEFT JOIN idx_biz_jg_other_info joi ON jui.RECORD = joi.RECORD
LEFT JOIN idx_biz_jg_register_info jri ON jri.RECORD = jui.RECORD
WHERE
jri.EQU_LIST = '3000'
AND joi.CLAIM_STATUS = '已认领'
AND jui.IS_NOT_ELEV is null
ORDER BY jui.REC_DATE
limit #{pageNum},#{pageSize}
</select>
<select id="selectUseInfoCount" resultType="java.lang.Integer">
select
count(*)
FROM idx_biz_jg_use_info jui
LEFT JOIN idx_biz_jg_other_info joi ON jui.RECORD = joi.RECORD
LEFT JOIN idx_biz_jg_register_info jri ON jri.RECORD = jui.RECORD
WHERE jri.EQU_LIST = '3000'
AND joi.CLAIM_STATUS = '已认领'
AND jui.IS_NOT_ELEV is null
</select>
<select id="selectMtByAlertId" resultType="java.util.Map">
SELECT
ME_MASTER AS userName,
EMERGENCYCALL AS phone,
tbei.address AS address,
tbei.use_unit AS unitName,
ibjui."USE_UNIT_CREDIT_CODE" AS useCode
FROM
idx_biz_jg_maintenance_record_info ibjmri
LEFT JOIN idx_biz_jg_use_info ibjui ON ibjmri."RECORD" = ibjui."RECORD"
LEFT JOIN tz_base_enterprise_info tbei ON ibjui."USE_UNIT_CREDIT_CODE" = tbei.use_code
where
ibjmri.RECORD = #{sequenceNbr}
order by ibjmri.REC_DATE
limit 2
</select>
<select id="selectUseUnitByAlertId" resultType="java.util.Map">
SELECT
ibjui.SAFETY_MANAGER AS manager,
ibjui.PHONE AS managerPhone,
ibjui.USE_UNIT_NAME as useUnitName,
tbei.address AS address
FROM
idx_biz_jg_use_info ibjui
LEFT JOIN tz_base_enterprise_info tbei ON ibjui.USE_UNIT_CREDIT_CODE = tbei.use_code
WHERE
RECORD = #{sequenceNbr}
</select>
<select id="getAddressListNew" resultType="com.yeejoin.amos.boot.module.elevator.api.dto.ElevatorMessageDto">
SELECT jui.RECORD AS sequenceNbr,
ifnull(joi.CODE96333, 0) AS rescueCode,
ifnull(joi.SUPERVISORY_CODE, '') AS registerCode,
ifnull(jui.USE_UNIT_NAME, '') AS useUnit,
ifnull(jui.EQU_STATE, '') AS useStatus,
ifnull((SELECT NAME FROM cb_data_dictionary WHERE code = jui.USE_PLACE and type = 'ADDRESS'),
'') AS useSiteCategory,
ifnull(jui.ADDRESS, '') AS address,
ifnull(jui.PROVINCE_NAME, '') AS province,
ifnull(jui.CITY_NAME, '') AS city,
ifnull(jui.COUNTY_NAME, '') AS district,
ifnull(jui.FACTORY_USE_SITE_STREET, '') AS street,
concat(jui.PROVINCE, '#', jui.CITY, '#', jui.COUNTY) AS regionCode
FROM idx_biz_jg_use_info jui
LEFT JOIN idx_biz_jg_other_info joi ON jui.RECORD = joi.RECORD
LEFT JOIN idx_biz_jg_register_info jri ON jri.RECORD = jui.RECORD
WHERE jri.EQU_LIST = '3000'
and jui.ADDRESS like concat('%', #{address}, '%') and joi.CODE96333 is not null
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.elevator.api.mapper.EnterpriseInfoMapper">
</mapper>
......@@ -12,5 +12,29 @@
</if>
</select>
<select id="selectMessage" resultType="java.util.Map">
SELECT address,
province,
city,
district,
use_unit as unitName,
use_code as socialCreditCode,
legal_person as legalPerson,
legal_phone as legalPersonPhone,
longitude,
latitude,
safety_one as principalFirst,
safety_one_id as principalFirstId,
safety_one_phone as principalFirstPhone,
safety_two as principalSecond,
safety_two_id as principalSecondId,
safety_two_phone as principalSecondPhone,
sequence_nbr as id
FROM tz_base_enterprise_info
WHERE use_code = (SELECT ME_UNIT_CREDIT_CODE
FROM idx_biz_jg_maintenance_record_info
WHERE record = #{record}
ORDER BY REC_DATE DESC LIMIT 1 )
</select>
</mapper>
......@@ -3,7 +3,7 @@
<mapper namespace="com.yeejoin.amos.boot.module.elevator.api.mapper.SuperviseInfoMapper">
<update id="updateRecordBatch">
UPDATE idx_biz_jg_use_info SET "IS_NOT_ES" = 1 WHERE "RECORD" IN
UPDATE idx_biz_jg_use_info SET "IS_NOT_ELEV" = 1 WHERE "RECORD" IN
<foreach collection="recordList" separator="," item="record" open="(" close=")">
#{record}
</foreach>
......
......@@ -29,5 +29,27 @@
</if>
</select>
<select id="selectMessage" resultType="java.util.Map">
SELECT address,
province,
city,
district,
use_unit as useUnitName,
use_code as socialCreditCode,
legal_person as manager,
legal_phone as managerPhone,
longitude,
latitude,
safety_one as principal,
safety_one_id as principalId,
safety_one_phone as principalPhone,
sequence_nbr as id
FROM tz_base_enterprise_info
WHERE use_code = (SELECT USE_UNIT_CREDIT_CODE FROM idx_biz_jg_use_info WHERE record = #{record})
</select>
</mapper>
......@@ -26,6 +26,7 @@ import com.yeejoin.amos.boot.module.elevator.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.slf4j.Logger;
......@@ -122,11 +123,13 @@ public class AlertCalledController extends BaseController {
if (ValidationUtil.isEmpty(alertCalledObjsDto)) {
throw new BadRequest("参数校验失败.");
}
LambdaQueryWrapper<Elevator> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Elevator::getRescueCode,alertCalledObjsDto.getAlertCalledDto().getDeviceId());
Elevator elevator = iElevatorService.getOne(queryWrapper);
if(elevator == null) {
//切换数据源
// LambdaQueryWrapper<Elevator> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(Elevator::getRescueCode,alertCalledObjsDto.getAlertCalledDto().getDeviceId());
Elevator elevator = new Elevator();
elevator.setRescueCode(Integer.valueOf(alertCalledObjsDto.getAlertCalledDto().getDeviceId()));
Map<String,Object> map = iElevatorService.selectElevatorList(elevator);
if(ObjectUtils.isEmpty(map)) {
throw new BadRequest("未找到相关电梯.");
}
......@@ -220,22 +223,26 @@ public class AlertCalledController extends BaseController {
alertPaperInfoDto.setAlertId(alertCalled.getSequenceNbr());
iAlertCalledService.selectAlertCalledByIdNew(alertPaperInfoDto);
// 数据源切换
// LambdaQueryWrapper<Elevator> queryWrapper1= new LambdaQueryWrapper<>();
// queryWrapper1.eq(Elevator::getSequenceNbr,alertCalled.getEquipmentId());
// Elevator elevator = elevatorService.getOne(queryWrapper1);
LambdaQueryWrapper<Elevator> queryWrapper1= new LambdaQueryWrapper<>();
queryWrapper1.eq(Elevator::getSequenceNbr,alertCalled.getEquipmentId());
Elevator elevator = elevatorService.getOne(queryWrapper1);
Elevator elevator = new Elevator();
elevator.setOriginalId(alertCalled.getEquipmentId());
Map<String,Object> map = iElevatorService.selectElevatorList(elevator);
alertPaperInfoDto.setArea(elevator.getProvince() + elevator.getCity() + elevator.getDistrict());
alertPaperInfoDto.setArea(map.get("province") + "" + map.get("city") + map.get("district"));
alertPaperInfoDto.setAddress(alertCalled.getAddress());
alertPaperInfoDto.setCallTime(alertCalled.getCallTime());
alertPaperInfoDto.setLatitude(elevator.getLatitude());
alertPaperInfoDto.setLongitude(elevator.getLongitude());
alertPaperInfoDto.setLatitude(String.valueOf(map.get("latitude")));
alertPaperInfoDto.setLongitude(String.valueOf(map.get("longitude")));
alertPaperInfoDto.setAlarmTypeCode(alertCalled.getAlarmTypeCode());
alertPaperInfoDto.setRegionCode(elevator.getRegionCode());
alertPaperInfoDto.setRescueCode(elevator.getRescueCode());
alertPaperInfoDto.setRegionCode(String.valueOf(map.get("regionCode")));
alertPaperInfoDto.setRescueCode(Integer.valueOf(String.valueOf(map.get("rescueCode"))));
alertPaperInfoDto.setAlertStatus(alertCalled.getAlertStage());
alertPaperInfoDto.setElevatorId(elevator.getSequenceNbr() +"");
alertPaperInfoDto.setElevatorCode(elevator.getRegisterCode());
alertPaperInfoDto.setElevatorId(String.valueOf(map.get("sequenceNbr")));
alertPaperInfoDto.setElevatorCode(String.valueOf(map.get("registerCode")));
DispatchPaper paper = dispatchPaperServiceImpl.getOne(new LambdaQueryWrapper<DispatchPaper>().eq(DispatchPaper::getIsDelete,false).eq(DispatchPaper::getAlertId,alertId));
if(paper != null) {
......
......@@ -7,19 +7,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
import com.yeejoin.amos.boot.biz.common.feign.AmosFeignService;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.elevator.api.dto.ElevatorBaseInfoDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.ElevatorDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.ElevatorInfoDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.ElevatorListDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.ElevatorMaintenanceInfoDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.ElevatorNewDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.ElevatorTestInfoDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.ElevatorWlInfoDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.EsElevatorDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.*;
import com.yeejoin.amos.boot.module.elevator.api.entity.Elevator;
import com.yeejoin.amos.boot.module.elevator.api.entity.MaintainInfo;
import com.yeejoin.amos.boot.module.elevator.api.entity.TestInfo;
......@@ -35,6 +28,7 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.slf4j.Logger;
......@@ -52,6 +46,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.util.*;
......@@ -155,6 +150,15 @@ public class ElevatorController extends BaseController {
return ResponseHelper.buildResponse(elevatorService.selectBySeq(sequenceNbr));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/ocp/{sequenceNbr}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public ResponseModel<Map<String, Object>> selectByRecord(@PathVariable String sequenceNbr) {
return ResponseHelper.buildResponse(elevatorService.selectByRecord(sequenceNbr));
}
/**
* 列表分页查询
*
......@@ -217,47 +221,50 @@ public class ElevatorController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/page/similar", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "相似电梯模糊查询", notes = "相似电梯模糊查询")
public ResponseModel<List<ElevatorDto>> similar(@RequestBody ElevatorNewDto elevatorNewDto) {
public ResponseModel<List<Map<String,Object>>> similar(@RequestBody ElevatorNewDto elevatorNewDto) {
Elevator elevator = BeanDtoVoUtils.convert(elevatorNewDto.getElevatorDto(), Elevator.class);
QueryWrapper<Elevator> elevatorQueryWrapper = new QueryWrapper<>();
Class<? extends Elevator> aClass = elevator.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(elevator);
if (o != null) {
String name = NameUtils.camel2Underline(field.getName());
if ("rescue_code".equalsIgnoreCase(name)) {
Integer fileValue = (Integer) o;
elevatorQueryWrapper.like(name, fileValue);
} else if ("city".equalsIgnoreCase(name) || "district".equalsIgnoreCase(name)) {
String fileValue = (String) o;
elevatorQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) o;
elevatorQueryWrapper.like(name, fileValue);
}
}
} catch (Exception e) {
logger.error(e.getMessage());
}
});
List<Elevator> elevators = iElevatorService.list(elevatorQueryWrapper);
List<ElevatorDto> elevatorDtoList = new ArrayList<>();
for (Elevator ele : elevators ) {
ElevatorDto eleDto = new ElevatorDto();
BeanUtils.copyProperties(ele,eleDto);
if(!ValidationUtil.isEmpty(eleDto.getUseSiteCategory())) {
LambdaQueryWrapper<DataDictionary> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(DataDictionary::getCode, eleDto.getUseSiteCategory());
DataDictionary dataDictionary = iDataDictionaryService.getOne(wrapper);
if (!ValidationUtil.isEmpty(dataDictionary)) {
eleDto.setUseSiteCategory(dataDictionary.getName());
}
}
elevatorDtoList.add(eleDto);
}
return ResponseHelper.buildResponse(elevatorDtoList);
// QueryWrapper<Elevator> elevatorQueryWrapper = new QueryWrapper<>();
// Class<? extends Elevator> aClass = elevator.getClass();
// Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
// try {
// field.setAccessible(true);
// Object o = field.get(elevator);
// if (o != null) {
// String name = NameUtils.camel2Underline(field.getName());
// if ("rescue_code".equalsIgnoreCase(name)) {
// Integer fileValue = (Integer) o;
// elevatorQueryWrapper.like(name, fileValue);
// } else if ("city".equalsIgnoreCase(name) || "district".equalsIgnoreCase(name)) {
// String fileValue = (String) o;
// elevatorQueryWrapper.eq(name, fileValue);
// } else {
// String fileValue = (String) o;
// elevatorQueryWrapper.like(name, fileValue);
// }
// }
// } catch (Exception e) {
// logger.error(e.getMessage());
// }
// });
// List<Elevator> elevators = iElevatorService.list(elevatorQueryWrapper);
Map<String,Object> map = iElevatorService.selectElevatorList(elevator);
// List<ElevatorDto> elevatorDtoList = new ArrayList<>();
// for (Elevator ele : elevators ) {
// ElevatorDto eleDto = new ElevatorDto();
// BeanUtils.copyProperties(ele,eleDto);
// if(!ValidationUtil.isEmpty(eleDto.getUseSiteCategory())) {
// LambdaQueryWrapper<DataDictionary> wrapper = new LambdaQueryWrapper<>();
// wrapper.eq(DataDictionary::getCode, eleDto.getUseSiteCategory());
// DataDictionary dataDictionary = iDataDictionaryService.getOne(wrapper);
// if (!ValidationUtil.isEmpty(dataDictionary)) {
// eleDto.setUseSiteCategory(dataDictionary.getName());
// }
// }
// elevatorDtoList.add(eleDto);
// }
List<Map<String,Object>> list = new ArrayList<>();
list.add(map);
return ResponseHelper.buildResponse(list);
}
/**
......@@ -309,6 +316,24 @@ public class ElevatorController extends BaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/ocp/query_elevator_list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "分页查询电梯信息(数据源切换)", notes = "分页查询电梯信息(数据源切换)")
public ResponseModel<Page<Map<String, Object>>> selectElevatorList(Long pageNum, Long pageSize,ElevatorDto dto) {
Page<Map<String, Object>> mapPage = new Page<>(pageNum, pageSize);
Page<Map<String, Object>> list = iElevatorService.selectElevators(mapPage, dto);
return ResponseHelper.buildResponse(list);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/ocp/exportData")
@ApiOperation(httpMethod = "GET", value = "设备信息导出", notes = "设备信息导出")
public void exportData(HttpServletResponse response, ElevatorDto dto) {
List<ElevatorDtoNew> equipExportData = iElevatorService.selectExportDataNew(dto);
ExcelUtil.createTemplate(response, "设备信息", "设备信息", equipExportData, ElevatorDtoNew.class, null, false);
}
/**
* 获取电梯使用单位
* @return
......@@ -402,28 +427,26 @@ public class ElevatorController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/init", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "电梯信息放入es", notes = "电梯信息放入es")
public void init(Integer num) {
IPage<Elevator> elevatorPage = new Page<>();
Integer count = elevatorService.count();
public void init(@RequestParam(value = "num",required = false) Integer num) {
Integer count = iElevatorService.selectUseInfoCount();
Integer times = 0;
if(ValidationUtil.isEmpty(num) && count != 0) {
times = count/500;
int last = count%500;
if(last > 0 ) {
times ++;
if (ValidationUtil.isEmpty(num) && count != 0) {
times = count / 1000;
int last = count % 1000;
if (last > 0) {
times++;
}
} else if(count != 0) {
} else if (count != 0) {
times = num;
}
for(int i = 0; i <= times ; i ++ ) {
elevatorPage.setCurrent(i);
elevatorPage.setSize(500);
elevatorPage = elevatorService.page(elevatorPage);
for (Elevator el:elevatorPage.getRecords()
) {
esElevatorService.saveEsElevatorToES(el);
}
List<Map<String,Object>> mapList = iElevatorService.selectElevatorEsList(1,1000);
esElevatorService.saveEsElevator2ES(mapList);
// for (Elevator el:elevatorPage.getRecords()
// ) {
// esElevatorService.saveEsElevatorToES(el);
// }
}
}
......@@ -561,19 +584,20 @@ public class ElevatorController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getAddressList",method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "获取电梯的安装地址", notes = "获取电梯的安装地址")
public ResponseModel<List<ElevatorDto>> getAddressList(@RequestBody ElevatorListDto elevatorListDto){
List<ElevatorDto> elevatorList = elevatorMapper.getAddressList(elevatorListDto.getElevatorAddress());
for(ElevatorDto elevatorDto : elevatorList){
if(!ValidationUtil.isEmpty(elevatorDto.getUseSiteCategory())) {
LambdaQueryWrapper<DataDictionary> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(DataDictionary::getCode, elevatorDto.getUseSiteCategory());
DataDictionary dataDictionary = iDataDictionaryService.getOne(wrapper);
if (!ValidationUtil.isEmpty(dataDictionary)) {
elevatorDto.setUseSiteCategory(dataDictionary.getName());
}
}
}
return ResponseHelper.buildResponse(elevatorList);
public ResponseModel<List<ElevatorMessageDto>> getAddressList(@RequestBody ElevatorListDto elevatorListDto){
// List<ElevatorDto> elevatorList = elevatorMapper.getAddressList(elevatorListDto.getElevatorAddress());
// for(ElevatorDto elevatorDto : elevatorList){
// if(!ValidationUtil.isEmpty(elevatorDto.getUseSiteCategory())) {
// LambdaQueryWrapper<DataDictionary> wrapper = new LambdaQueryWrapper<>();
// wrapper.eq(DataDictionary::getCode, elevatorDto.getUseSiteCategory());
// DataDictionary dataDictionary = iDataDictionaryService.getOne(wrapper);
// if (!ValidationUtil.isEmpty(dataDictionary)) {
// elevatorDto.setUseSiteCategory(dataDictionary.getName());
// }
// }
// }
List<ElevatorMessageDto> addressListNew = elevatorMapper.getAddressListNew(elevatorListDto.getElevatorAddress());
return ResponseHelper.buildResponse(addressListNew);
}
}
......
......@@ -4,26 +4,26 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.elevator.api.dto.DutyPersonDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.MaintenanceUnitDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.MaintenanceUnitNameDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.*;
import com.yeejoin.amos.boot.module.elevator.api.entity.Elevator;
import com.yeejoin.amos.boot.module.elevator.api.entity.EnterpriseInfo;
import com.yeejoin.amos.boot.module.elevator.api.entity.MaintenanceUnit;
import com.yeejoin.amos.boot.module.elevator.api.service.IEnterpriseInfoService;
import com.yeejoin.amos.boot.module.elevator.api.service.IMaintenanceUnitService;
import com.yeejoin.amos.boot.module.elevator.api.service.ITzBaseEnterpriseInfoService;
import com.yeejoin.amos.boot.module.elevator.biz.service.impl.ElevatorServiceImpl;
import com.yeejoin.amos.boot.module.elevator.biz.utils.BeanDtoVoUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
......@@ -31,9 +31,11 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
......@@ -52,6 +54,9 @@ public class MaintenanceUnitController extends BaseController {
IMaintenanceUnitService iMaintenanceUnitService;
@Autowired
IEnterpriseInfoService iEnterpriseInfoService;
@Autowired
ElevatorServiceImpl elevatorServiceImpl;
/**
......@@ -113,6 +118,13 @@ public class MaintenanceUnitController extends BaseController {
return ResponseHelper.buildResponse(maintenanceUnitDto);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/ocp/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public ResponseModel<Map<String, Object>> selectMessage(@PathVariable String id) {
Map<String, Object> objectMap = iMaintenanceUnitService.selectMessage(id);
return ResponseHelper.buildResponse(objectMap);
}
/**
* 列表分页查询
*
......@@ -216,6 +228,116 @@ public class MaintenanceUnitController extends BaseController {
}
/**
* 分页查询维保单位/使用单位信息
*
* @param pageNum 当前页
* @param pageSize 每页大小
* @return 返回结果
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/query_agency_unit_list/ocp/{unitType}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "分页查询维保单位/使用单位信息", notes = "分页查询维保单位/使用单位信息")
public ResponseModel<IPage<BaseEnterpriseInfoDto>> queryMaintenanceUnitList(String pageNum, String pageSize,
@PathVariable(required = false) String unitType,
EnterpriseInfo enterpriseInfoDto) {
enterpriseInfoDto.setUnitType(unitType);
EnterpriseInfo enterpriseInfo = BeanDtoVoUtils.convert(enterpriseInfoDto, EnterpriseInfo.class);
Page<EnterpriseInfo> pageBean;
QueryWrapper<EnterpriseInfo> enterpriseInfoQueryWrapper = new QueryWrapper<>();
Class<? extends EnterpriseInfo> aClass = enterpriseInfo.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(enterpriseInfo);
if (o != null) {
String name = NameUtils.camel2Underline(field.getName());
if ("city".equalsIgnoreCase(name) || "district".equalsIgnoreCase(name) || "qualification_level".equalsIgnoreCase(name)) {
String fileValue = (String) o;
enterpriseInfoQueryWrapper.eq(name, fileValue);
} else if ("credit_level".equalsIgnoreCase(name)) {
Integer fileValue = (Integer) o;
enterpriseInfoQueryWrapper.eq(name, fileValue);
} else if ("unit_type".equalsIgnoreCase(name)) {
// 1 维保单位,2 使用单位
String fileValue = (String) o;
if ("1".equals(fileValue)) {
// 此处由于写接口时表数据还未进行整理,所以此处先默认用文字做查询
enterpriseInfoQueryWrapper.like(name, "使用单位");
} else {
enterpriseInfoQueryWrapper.notLike(name, "使用单位");
}
} else {
String fileValue = (String) o;
enterpriseInfoQueryWrapper.like(name, fileValue);
}
}
} catch (Exception e) {
logger.error(e.getMessage());
}
});
IPage<EnterpriseInfo> page;
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
} else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
page = iEnterpriseInfoService.page(pageBean, enterpriseInfoQueryWrapper);
IPage<BaseEnterpriseInfoDto> enterpriseInfoDtoIPage = BeanDtoVoUtils.enterpriseInfoIPageDto(page);
return ResponseHelper.buildResponse(enterpriseInfoDtoIPage);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/ocp/exportData/{unitType}")
@ApiOperation(httpMethod = "GET", value = "维保、使用单位列表导出", notes = "维保、使用单位列表导出")
public void exportData(HttpServletResponse response, @PathVariable(required = false) String unitType,
EnterpriseInfo enterpriseInfoDto) {
enterpriseInfoDto.setUnitType(unitType);
EnterpriseInfo enterpriseInfo = BeanDtoVoUtils.convert(enterpriseInfoDto, EnterpriseInfo.class);
QueryWrapper<EnterpriseInfo> enterpriseInfoQueryWrapper = new QueryWrapper<>();
Class<? extends EnterpriseInfo> aClass = enterpriseInfo.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(enterpriseInfo);
if (o != null) {
String name = NameUtils.camel2Underline(field.getName());
if ("city".equalsIgnoreCase(name) || "district".equalsIgnoreCase(name) || "qualification_level".equalsIgnoreCase(name)) {
String fileValue = (String) o;
enterpriseInfoQueryWrapper.eq(name, fileValue);
} else if ("credit_level".equalsIgnoreCase(name)) {
Integer fileValue = (Integer) o;
enterpriseInfoQueryWrapper.eq(name, fileValue);
} else if ("unit_type".equalsIgnoreCase(name)) {
// 1 维保单位,2 使用单位
String fileValue = (String) o;
if ("1".equals(fileValue)) {
// 此处由于写接口时表数据还未进行整理,所以此处先默认用文字做查询
enterpriseInfoQueryWrapper.like(name, "使用单位");
} else {
enterpriseInfoQueryWrapper.notLike(name, "使用单位");
}
} else {
String fileValue = (String) o;
enterpriseInfoQueryWrapper.like(name, fileValue);
}
}
} catch (Exception e) {
logger.error(e.getMessage());
}
});
if (!ObjectUtils.isEmpty(enterpriseInfoDto.getIds())){
enterpriseInfoQueryWrapper.lambda().in(EnterpriseInfo :: getSequenceNbr, enterpriseInfo.getIds());
}
ArrayList<EnterpriseInfoExportDto> list = new ArrayList<>();
List<EnterpriseInfo> enterpriseInfos = iEnterpriseInfoService.getBaseMapper().selectList(enterpriseInfoQueryWrapper);
enterpriseInfos.forEach(item ->{
EnterpriseInfoExportDto dto = new EnterpriseInfoExportDto();
BeanUtils.copyProperties(item, dto);
list.add(dto);
});
ExcelUtil.createTemplate(response, "单位信息", "单位信息", list, EnterpriseInfoExportDto.class, null, false);
}
/**
* 根据名称查询维保单位列表
*
* @param unitName 维保单位名称
......@@ -246,28 +368,30 @@ public class MaintenanceUnitController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "根据警情id 查找设备维保单位信息", notes = "根据警情id 查找设备维保单位信息")
public ResponseModel<MaintenanceUnitDto> selectByAlertId(@PathVariable Long alertId) {
// 获取根据警情获取电梯信息
Elevator elevator = elevatorServiceImpl.selectByAlertId(alertId);
if (ValidationUtil.isEmpty(elevator)) {
Map<String,Object> map = elevatorServiceImpl.selectByAlertId(alertId);
if (ObjectUtils.isEmpty(map)) {
throw new BadRequest("设备未找到");
}
// 根据设备使用单位id 获取使用单位信息
MaintenanceUnit maintenanceUnit = iMaintenanceUnitService.getById(elevator.getMaintainUnitId());
if (ValidationUtil.isEmpty(maintenanceUnit)) {
// 根据设备使用id 获取维保单位信息
List<Map<String,Object>> list = elevatorServiceImpl.selectMtByAlertId(String.valueOf(map.get("sequenceNbr")));
if (ObjectUtils.isEmpty(list)) {
throw new BadRequest("维保单位未找到");
}
MaintenanceUnitDto maintenanceUnitVo = BeanDtoVoUtils.convert(maintenanceUnit, MaintenanceUnitDto.class);
MaintenanceUnitDto maintenanceUnitVo = new MaintenanceUnitDto();
maintenanceUnitVo.setUnitName(ObjectUtils.isEmpty(list.get(0).get("unitName")) ? null :String.valueOf(list.get(0).get("unitName")));
maintenanceUnitVo.setAddress(ObjectUtils.isEmpty(list.get(0).get("address")) ? null :String.valueOf(list.get(0).get("address")));
List<DutyPersonDto> dutyPersonList = new ArrayList<DutyPersonDto>();
DutyPersonDto principal = new DutyPersonDto();
principal.setDeptName("主要负责人1");
principal.setPhone(maintenanceUnitVo.getPrincipalFirstPhone());
principal.setUserId(maintenanceUnitVo.getPrincipalFirstId()+"");
principal.setUserName(maintenanceUnitVo.getPrincipalFirst());
principal.setPhone(String.valueOf(list.get(0).get("phone")));
principal.setUserId(null);
principal.setUserName(String.valueOf(list.get(0).get("userName")));
dutyPersonList.add(principal);
DutyPersonDto manager = new DutyPersonDto();
manager.setDeptName("主要负责人2");
manager.setPhone(maintenanceUnitVo.getPrincipalSecondPhone());
manager.setUserId(maintenanceUnitVo.getPrincipalSecondId()+"");
manager.setUserName(maintenanceUnitVo.getPrincipalSecond());
manager.setPhone(list.size() == 2 ? String.valueOf(list.get(0).get("phone")) : null);
manager.setUserId(null);
manager.setUserName(list.size() == 2 ? String.valueOf(list.get(0).get("userName")) : null);
dutyPersonList.add(manager);
maintenanceUnitVo.setDutyPersonList(dutyPersonList);
......
......@@ -32,10 +32,7 @@ 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.Arrays;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.*;
/**
......@@ -251,9 +248,9 @@ public class RescueStationController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "根据警情id和距离返回救援机构信息", notes = "根据警情id和距离返回救援机构信息")
public ResponseModel<Object> selectByAlertIdDistance(@PathVariable Long alertId, @PathVariable Integer distance) {
// 获取根据警情获取电梯信息
Elevator elevator = elevatorServiceImpl.selectByAlertId(alertId);
String longitude = elevator.getLongitude();
String latitude = elevator.getLatitude();
Map<String,Object> map = elevatorServiceImpl.selectByAlertId(alertId);
String longitude = String.valueOf(map.get("longitude"));
String latitude = String.valueOf(map.get("latitude"));
// 根据经纬度和距离返回救援机构信息
return ResponseHelper.buildResponse(iRescueStationService.getListByLatLonDistance(latitude,longitude,distance));
}
......@@ -268,9 +265,9 @@ public class RescueStationController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "根据警情id和距离返回5个救援机构信息", notes = "根据警情id和距离返回5个救援机构信息")
public ResponseModel<Object> selectByAlertIdDistance(@PathVariable Long alertId) {
// 获取根据警情获取电梯信息
Elevator elevator = elevatorServiceImpl.selectByAlertId(alertId);
String longitude = elevator.getLongitude();
String latitude = elevator.getLatitude();
Map<String,Object> map = elevatorServiceImpl.selectByAlertId(alertId);
String longitude = String.valueOf(map.get("longitude"));
String latitude = String.valueOf(map.get("latitude"));
// 根据经纬度和距离返回救援机构信息
List<RescueStationDto> rescueStationDtos = new LinkedList<>();
List<RescueStationDto> list = iRescueStationService.getListByLatLonDistance(latitude,longitude,1000);
......
......@@ -16,6 +16,7 @@ import com.yeejoin.amos.boot.module.elevator.biz.service.impl.ElevatorServiceImp
import com.yeejoin.amos.boot.module.elevator.biz.utils.BeanDtoVoUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -35,6 +36,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
//import com.yeejoin.amos.boot.module.elevator.api.service.EquipFeignService;
......@@ -132,6 +134,15 @@ public class UseUnitController extends BaseController {
return ResponseHelper.buildResponse(useUnitDto);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/ocp/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public ResponseModel< Map<String, Object>> selectMessage(@PathVariable String id) {
Map<String, Object> objectMap = iUseUnitService.selectMessage(id);
return ResponseHelper.buildResponse(objectMap);
}
/**
* 获取平台字典
*
......@@ -212,25 +223,27 @@ public class UseUnitController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "根据警情id 查找设备使用单位信息", notes = "根据警情id 查找设备使用单位信息")
public ResponseModel<UseUnitDto> selectByAlertId(@PathVariable Long alertId) {
// 获取根据警情获取电梯信息
Elevator elevator = elevatorServiceImpl.selectByAlertId(alertId);
// 根据设备使用单位id 获取使用单位信息
UseUnit useUnit = iUseUnitService.getById(elevator.getUseUnitId());
if (ValidationUtil.isEmpty(useUnit)) {
Map<String,Object> map = elevatorServiceImpl.selectByAlertId(alertId);
// 根据设备id 获取使用单位信息
Map<String,Object> useUnitMap = elevatorServiceImpl.selectUseUnitByAlertId(String.valueOf(map.get("sequenceNbr")));
if (ObjectUtils.isEmpty(useUnitMap)) {
throw new BadRequest("使用单位未找到");
}
UseUnitDto useUnitVo = BeanDtoVoUtils.convert(useUnit, UseUnitDto.class);
UseUnitDto useUnitVo = new UseUnitDto();
useUnitVo.setUseUnitName(ObjectUtils.isEmpty(useUnitMap.get("useUnitName")) ? null : String.valueOf(useUnitMap.get("useUnitName")));
useUnitVo.setAddress(ObjectUtils.isEmpty(useUnitMap.get("address")) ? null : String.valueOf(useUnitMap.get("address")));
List<DutyPersonDto> dutyPersonList = new ArrayList<DutyPersonDto>();
DutyPersonDto principal = new DutyPersonDto();
principal.setDeptName("主要负责人");
principal.setPhone(useUnitVo.getPrincipalPhone());
principal.setUserId(useUnitVo.getPrincipalId()+"");
principal.setUserName(useUnitVo.getPrincipal());
// todo 暂时置空
principal.setPhone(null);
principal.setUserId(null);
principal.setUserName(null);
dutyPersonList.add(principal);
DutyPersonDto manager = new DutyPersonDto();
manager.setDeptName("电梯安全管理员");
manager.setPhone(useUnitVo.getManagerPhone());
manager.setUserId(useUnitVo.getManagerId()+"");
manager.setUserName(useUnitVo.getManager());
manager.setPhone(String.valueOf(useUnitMap.get("managerPhone")));
manager.setUserName(String.valueOf(useUnitMap.get("manager")));
dutyPersonList.add(manager);
useUnitVo.setDutyPersonList(dutyPersonList);
return ResponseHelper.buildResponse(useUnitVo);
......
......@@ -27,6 +27,7 @@ import com.yeejoin.amos.boot.module.elevator.api.service.TzsAuthService;
import com.yeejoin.amos.boot.module.elevator.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.apache.commons.lang.text.StrBuilder;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.BeanUtils;
......@@ -131,20 +132,35 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
}
AlertCalledDto alertCalledDto = new AlertCalledDto();
BeanUtils.copyProperties(alertCalled,alertCalledDto);
LambdaQueryWrapper<Elevator> elevatorQueryWrapper = new LambdaQueryWrapper<>();
elevatorQueryWrapper.eq(Elevator::getRescueCode, alertCalled.getDeviceId());
elevatorQueryWrapper.eq(Elevator::getRegisterCode, alertCalled.getRegistrationCode());
Elevator elevator = iElevatorService.getOne(elevatorQueryWrapper);
if(null != elevator) {
alertCalledDto.setAddress(elevator.getAddress());
alertCalledDto.setProvince(elevator.getProvince());
alertCalledDto.setCity(elevator.getCity());
alertCalledDto.setDistrict(elevator.getDistrict());
alertCalledDto.setUseStatus(elevator.getUseStatus());
alertCalledDto.setUseSiteCategory(elevator.getUseSiteCategory());
alertCalledDto.setUseUnit(elevator.getUseUnit());
alertCalledDto.setRegionCode(elevator.getRegionCode());
Elevator elevator = new Elevator();
elevator.setRescueCode(Integer.valueOf(alertCalled.getDeviceId()));
elevator.setRegisterCode(alertCalled.getRegistrationCode());
Map<String,Object> map = iElevatorService.selectElevatorList(elevator);
if(!ObjectUtils.isEmpty(map)){
alertCalledDto.setAddress(String.valueOf(map.get("address")));
alertCalledDto.setProvince(String.valueOf(map.get("province")));
alertCalledDto.setCity(String.valueOf(map.get("city")));
alertCalledDto.setDistrict(String.valueOf(map.get("district")));
alertCalledDto.setUseStatus(Integer.valueOf(String.valueOf(map.get("useStatus"))));
alertCalledDto.setUseSiteCategory(String.valueOf(map.get("useSiteCategory")));
alertCalledDto.setUseUnit(String.valueOf(map.get("useUnit")));
alertCalledDto.setRegionCode(String.valueOf(map.get("regionCode")));
}
// 数据源切换
// LambdaQueryWrapper<Elevator> elevatorQueryWrapper = new LambdaQueryWrapper<>();
// elevatorQueryWrapper.eq(Elevator::getRescueCode, alertCalled.getDeviceId());
// elevatorQueryWrapper.eq(Elevator::getRegisterCode, alertCalled.getRegistrationCode());
// Elevator elevator = iElevatorService.getOne(elevatorQueryWrapper);
// if(null != elevator) {
// alertCalledDto.setAddress(elevator.getAddress());
// alertCalledDto.setProvince(elevator.getProvince());
// alertCalledDto.setCity(elevator.getCity());
// alertCalledDto.setDistrict(elevator.getDistrict());
// alertCalledDto.setUseStatus(elevator.getUseStatus());
// alertCalledDto.setUseSiteCategory(elevator.getUseSiteCategory());
// alertCalledDto.setUseUnit(elevator.getUseUnit());
// alertCalledDto.setRegionCode(elevator.getRegionCode());
// }
if(!ValidationUtil.isEmpty(alertCalledDto.getUseSiteCategory())) {
LambdaQueryWrapper<DataDictionary> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(DataDictionary::getCode, alertCalledDto.getUseSiteCategory());
......@@ -534,13 +550,17 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
alertCalled.setAlertStageCode(AlertStageEnums.JJ.getId());
alertCalled.setType(AlertStageEnums.JQCB.getValue());
alertCalled.setTypeCode(AlertStageEnums.JQCB.getId());
LambdaQueryWrapper<Elevator> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Elevator::getRescueCode,alertCalled.getDeviceId());
Elevator elevator = iElevatorService.getOne(queryWrapper);
alertCalled.setEquipmentId(elevator.getSequenceNbr());
alertCalled.setCity(elevator.getCity());
alertCalled.setDistrict(elevator.getDistrict());
alertCalled.setRegionCode(elevator.getRegionCode());
Elevator elevator = new Elevator();
elevator.setRescueCode(Integer.valueOf(alertCalledObjsDto.getAlertCalledDto().getDeviceId()));
Map<String,Object> map = iElevatorService.selectElevatorList(elevator);
if(!ObjectUtils.isEmpty(map)){
alertCalled.setEquipmentId(map.get("sequenceNbr").toString());
alertCalled.setCity(map.get("city").toString());
alertCalled.setDistrict(map.get("district").toString());
alertCalled.setRegionCode(map.get("regionCode").toString());
}
this.save(alertCalled);
// 动态表单
......
......@@ -24,9 +24,11 @@ import com.yeejoin.amos.boot.module.elevator.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.elevator.api.enums.DispatchPaperEnums;
import com.yeejoin.amos.boot.module.elevator.api.enums.TzsCommonParam;
import com.yeejoin.amos.boot.module.elevator.api.mapper.DispatchPaperMapper;
import com.yeejoin.amos.boot.module.elevator.api.mapper.ElevatorMapper;
import com.yeejoin.amos.boot.module.elevator.api.service.IDispatchPaperService;
import com.yeejoin.amos.boot.module.elevator.api.service.IMaintenanceUnitService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -60,6 +62,9 @@ public class DispatchPaperServiceImpl extends BaseService<DispatchPaperDto,Dispa
private ElevatorServiceImpl elevatorServiceImpl;
@Autowired
ElevatorMapper elevatorMapper;
@Autowired
private IMaintenanceUnitService iMaintenanceUnitService;
@Autowired
......@@ -173,10 +178,12 @@ public class DispatchPaperServiceImpl extends BaseService<DispatchPaperDto,Dispa
dispatchPaper.setSendUserName(sendUser.getRealName());
// 电梯维保单位统一信用代码
Elevator elevator = elevatorServiceImpl.selectByAlertId(alertId);
MaintenanceUnit maintenanceUnit = iMaintenanceUnitService.getById(elevator.getMaintainUnitId());
if(!ValidationUtil.isEmpty(maintenanceUnit)) {
dispatchPaper.setRepairOrgCreditCode(maintenanceUnit.getSocialCreditCode());
Map<String,Object> map = elevatorServiceImpl.selectByAlertId(alertId);
if(!ObjectUtils.isEmpty(map.get("sequenceNbr"))) {
List<Map<String,Object>> mapList = elevatorMapper.selectMtByAlertId(String.valueOf(map.get("sequenceNbr")));
if(ObjectUtils.isEmpty(mapList)){
dispatchPaper.setRepairOrgCreditCode(String.valueOf(mapList.get(0).get("useCode")));
}
}
this.save(dispatchPaper);
......
......@@ -182,16 +182,17 @@ public class DispatchTaskServiceImpl extends BaseService<DispatchTaskDto,Dispatc
String contactPhone = alertCalledDto.getContactPhone() == null ? "" : alertCalledDto.getContactPhone();
// 电梯数据
Elevator elevator = elevatorServiceImpl.selectByAlertId(alertId);
String address = elevator.getAddress() == null ? "" : elevator.getAddress();
// Elevator elevator = elevatorServiceImpl.selectByAlertId(alertId);
Map<String,Object> map = elevatorServiceImpl.selectByAlertId(alertId);
String address = map.get("address") == null ? "" : String.valueOf(map.get("address"));
String useSiteCategory = "";
if (!ValidationUtil.isEmpty(elevator.getUseSiteCategory())) {
String categoryCode = elevator.getUseSiteCategory();
if (!ValidationUtil.isEmpty(String.valueOf(map.get("useSiteCategory")))) {
String categoryCode = String.valueOf(map.get("useSiteCategory"));
DataDictionary categoryDict = iDataDictionaryService.getByCode(categoryCode, "USE_SITE_CATEGORY");
useSiteCategory = ValidationUtil.isEmpty(categoryDict) ? "" : categoryDict.getName();
}
String useUnit = elevator.getUseUnit();
content = content.replace("$call_time", createTime).replace("$address", address).replace("$rescue_code", rescueCode).replace("$use_site_category", useSiteCategory);
String useUnit = String.valueOf(map.get("useUnit"));
content = content.replace("$call_time",createTime).replace("$address",address).replace("$rescue_code",rescueCode).replace("$use_site_category",useSiteCategory);
String typeCode = "";
if(AlertStageEnums.KRJY.toString().equals(alertTypeCode)) {
typeCode = AlertStageEnums.KRJY.getId();
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.elevator.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.elevator.api.dto.ESAlertCalledDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.EsElevatorDto;
......@@ -12,8 +13,11 @@ import com.yeejoin.amos.boot.module.elevator.api.dto.SpecialEquipmentDto;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.elevator.api.entity.Elevator;
import com.yeejoin.amos.boot.module.elevator.api.entity.EsElevator;
import com.yeejoin.amos.boot.module.elevator.api.mapper.SuperviseInfoMapper;
import com.yeejoin.amos.boot.module.elevator.biz.dao.ESElavtorRepository;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.common.geo.GeoBoundingBox;
import org.elasticsearch.common.geo.GeoPoint;
......@@ -62,6 +66,7 @@ import java.util.stream.Collectors;
* @version 2021年9月26日
*/
@Service
@Slf4j
public class ESElevatorServiceImpl {
@Autowired
......@@ -79,45 +84,48 @@ public class ESElevatorServiceImpl {
@Autowired
ElevatorAlarmServiceImpl elevatorAlarmServiceImpl;
@Autowired
private SuperviseInfoMapper superviseInfoMapper;
@Value("${alertcall.es.synchrony.time}")
private Long time;
/**
*
* <pre>
* 电梯信息
* </pre>
*
* @param elevator 电梯信息
*/
public EsElevator saveEsElevatorToES(Elevator elevator)
{
EsElevator esElevator = new EsElevator();
if(StringUtils.isNotEmpty(elevator.getLongitude())) {
esElevator.setLongitude(Double.parseDouble(elevator.getLongitude()));
}
if(StringUtils.isNotEmpty(elevator.getLatitude())) {
esElevator.setLatitude(Double.parseDouble(elevator.getLatitude()));
}
esElevator.setAddress(elevator.getAddress());
esElevator.setCity(elevator.getCity());
esElevator.setDistrict(elevator.getDistrict());
esElevator.setProvince(elevator.getProvince());
esElevator.setRegionCode(elevator.getRegionCode());
esElevator.setRescueCode(elevator.getRescueCode().toString());
esElevator.setRegisterCode(elevator.getRegisterCode());
esElevator.setSequenceNbr(elevator.getSequenceNbr());
esElevator.setInnerNum(elevator.getInnerNum());
if(StringUtils.isNotBlank(elevator.getLatitude()) && StringUtils.isNotBlank(elevator.getLongitude())) {
Double lat = Double.parseDouble(elevator.getLatitude());
Double lon = Double.parseDouble(elevator.getLongitude());
esElevator.setLocation(new GeoPoint(lat,lon));
}
esElavtorRepository.save(esElevator);
return esElevator;
}
// 数据源切换
// /**
// *
// * <pre>
// * 电梯信息
// * </pre>
// *
// * @param elevator 电梯信息
// */
// public EsElevator saveEsElevatorToES(Elevator elevator)
// {
// EsElevator esElevator = new EsElevator();
// if(StringUtils.isNotEmpty(elevator.getLongitude())) {
// esElevator.setLongitude(Double.parseDouble(elevator.getLongitude()));
// }
// if(StringUtils.isNotEmpty(elevator.getLatitude())) {
// esElevator.setLatitude(Double.parseDouble(elevator.getLatitude()));
// }
// esElevator.setAddress(elevator.getAddress());
// esElevator.setCity(elevator.getCity());
// esElevator.setDistrict(elevator.getDistrict());
// esElevator.setProvince(elevator.getProvince());
// esElevator.setRegionCode(elevator.getRegionCode());
// esElevator.setRescueCode(elevator.getRescueCode().toString());
// esElevator.setRegisterCode(elevator.getRegisterCode());
// esElevator.setSequenceNbr(elevator.getSequenceNbr());
// esElevator.setInnerNum(elevator.getInnerNum());
// if(StringUtils.isNotBlank(elevator.getLatitude()) && StringUtils.isNotBlank(elevator.getLongitude())) {
// Double lat = Double.parseDouble(elevator.getLatitude());
// Double lon = Double.parseDouble(elevator.getLongitude());
// esElevator.setLocation(new GeoPoint(lat,lon));
// }
// esElavtorRepository.save(esElevator);
// return esElevator;
// }
/**
......@@ -160,12 +168,12 @@ public class ESElevatorServiceImpl {
queryWrapper.le(AlertCalled::getCallTime, DateUtils.stampToDate(DateUtils.dateAddDays(new Date(),1).getTime(),DateUtils.DATE_PATTERN));
}
alertCalleds = iAlertCalledService.list(queryWrapper);
List<Long> stringList = new ArrayList<>();
List<String> stringList = new ArrayList<>();
for (AlertCalled al: alertCalleds
) {
stringList.add(al.getEquipmentId());
}
List<Long> listL = stringList.stream().distinct().collect(Collectors.toList());
List<String> listL = stringList.stream().distinct().collect(Collectors.toList());
qb0.should(QueryBuilders.termsQuery("sequenceNbr", listL.toArray()));
boolMust.must(qb0);
}
......@@ -578,4 +586,47 @@ public class ESElevatorServiceImpl {
}
return result;
}
public void saveEsElevator2ES(List<Map<String, Object>> elevatorList) {
List<EsElevator> esElevatorList = new ArrayList<>();
List<String> recordList = new ArrayList<>();
for (Map<String, Object> map : elevatorList) {
EsElevator esElevator = new EsElevator();
if (!ObjectUtils.isEmpty(map.get("longitude"))) {
esElevator.setLongitude(Double.parseDouble(String.valueOf(map.get("longitude"))));
}
if (!ObjectUtils.isEmpty(map.get("latitude"))) {
esElevator.setLatitude(Double.parseDouble(String.valueOf(map.get("latitude"))));
}
esElevator.setAddress(String.valueOf(map.get("address")));
esElevator.setCity(String.valueOf(map.get("city")));
esElevator.setDistrict(String.valueOf(map.get("district")));
esElevator.setProvince(String.valueOf(map.get("province")));
esElevator.setRegionCode(String.valueOf(map.get("regionCode")));
esElevator.setRescueCode(String.valueOf(map.get("rescueCode")));
esElevator.setRegisterCode(String.valueOf(map.get("registerCode")));
esElevator.setSequenceNbr(String.valueOf(map.get("sequenceNbr")));
esElevator.setInnerNum(String.valueOf(map.get("latitude")));
if (!ObjectUtils.isEmpty(map.get("longitude")) && !ObjectUtils.isEmpty(map.get("latitude"))) {
Double lat = Double.parseDouble(String.valueOf(map.get("latitude")));
Double lon = Double.parseDouble(String.valueOf(map.get("latitude")));
esElevator.setLocation(new GeoPoint(lat, lon));
}
esElevatorList.add(esElevator);
recordList.add(String.valueOf(map.get("sequenceNbr")));
}
long start = System.currentTimeMillis();
esElavtorRepository.saveAll(esElevatorList);
long end = System.currentTimeMillis();
long cost = end - start;
System.out.println("批量存入es1000条数据耗时:" + cost);
log.info("批量存入es:【" + elevatorList.size() + "】条,耗时:" + (end - start) + " 毫秒");
long start1 = System.currentTimeMillis();
superviseInfoMapper.updateRecordBatch(recordList);
long end1 = System.currentTimeMillis();
long cost1 = end1 - start1;
log.info("批量更新:【" + elevatorList.size() + "】条业务数据,耗时:" + (end - start) + " 毫秒");
}
}
package com.yeejoin.amos.boot.module.elevator.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
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.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.QRCodeUtil;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.ElevatorDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.ElevatorInsureDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.ElevatorWlInfoDto;
import com.yeejoin.amos.boot.module.elevator.api.entity.Elevator;
import com.yeejoin.amos.boot.module.elevator.api.entity.ElevatorInsure;
import com.yeejoin.amos.boot.module.elevator.api.entity.ElevatorInsureRelation;
import com.yeejoin.amos.boot.module.elevator.api.entity.EquipmentCategory;
import com.yeejoin.amos.boot.module.elevator.api.dto.*;
import com.yeejoin.amos.boot.module.elevator.api.entity.*;
import com.yeejoin.amos.boot.module.elevator.api.enums.EquimentEnum;
import com.yeejoin.amos.boot.module.elevator.api.enums.TzsCommonParam;
import com.yeejoin.amos.boot.module.elevator.api.mapper.ElevatorMapper;
import com.yeejoin.amos.boot.module.elevator.api.service.IElevatorInsureRelationService;
......@@ -27,9 +25,11 @@ import com.yeejoin.amos.feign.systemctl.Systemctl;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
......@@ -62,6 +62,9 @@ public class ElevatorServiceImpl extends BaseService<ElevatorDto, Elevator, Elev
ElevatorMapper elevatorMapper;
@Autowired
private ElevatorServiceImpl iElevatorService;
@Autowired
EquipmentCategoryServiceImpl equipmentCategoryServiceImpl;
@Autowired
......@@ -72,6 +75,8 @@ public class ElevatorServiceImpl extends BaseService<ElevatorDto, Elevator, Elev
@Autowired
ElevatorInsureServiceImpl iElevatorInsureServiceImpl;
//一码通设备使用场所字典type
private static final String ADDRESS = "ADDRESS";
/**
* 保存电梯信息
......@@ -162,22 +167,66 @@ public class ElevatorServiceImpl extends BaseService<ElevatorDto, Elevator, Elev
return elevatorDto;
}
public Map<String, Object> selectByRecord(String sequenceNbr) {
Map<String, Object> map = baseMapper.selectByRecord(sequenceNbr);
Map<String, Object> designFiles = baseMapper.selectFiles(sequenceNbr);
ArrayList<Map<String, Object>> designFilesList = new ArrayList<>();
changeData(designFiles, "DESIGN_DOC", designFilesList);
changeData(designFiles, "DESIGN_STANDARD", designFilesList);
changeData(designFiles, "FACTORY_STANDARD", designFilesList);
changeData(designFiles, "TYPE_TEST_CREDENTIAL", designFilesList);
changeData(designFiles, "PRODUCT_QUALITY_YIELD_PROVE", designFilesList);
changeData(designFiles, "INS_USE_MAINTAIN_EXPLAIN", designFilesList);
changeData(designFiles, "SUPERVISION_AGENCY_CREDENTIAL", designFilesList);
map.put("designFiles", designFilesList);
Map<String, Object> registerFiles = baseMapper.selectRegisterFiles(sequenceNbr);
ArrayList<Map<String, Object>> registerFilesList = new ArrayList<>();
changeData(registerFiles, "USE_REGISTRATION_CERTIFICATE", registerFilesList);
changeData(registerFiles, "USE_SIGN", registerFilesList);
changeData(registerFiles, "PRODUCT_PHOTO", registerFilesList);
map.put("registerFiles", registerFilesList);
Map<String, Object> maintenanceInspectionFiles = baseMapper.selectMaintenanceInspectionFiles(sequenceNbr);
ArrayList<Map<String, Object>> maintenance = new ArrayList<>();
ArrayList<Map<String, Object>> inspection = new ArrayList<>();
changeData(maintenanceInspectionFiles, "maintenanceFile", maintenance);
map.put("maintenanceFile", maintenance);
changeData(maintenanceInspectionFiles, "inspectionFile", inspection);
map.put("inspectionFile", inspection);
return map;
}
private void changeData(Map<String, Object> data, String column, ArrayList<Map<String, Object>> maps) {
if (!ObjectUtils.isEmpty(data) && data.containsKey(column)) {
JSONArray list = JSON.parseArray(String.valueOf(data.get(column)));
for (Object o : list) {
Map<String, Object> objectMap = (Map<String, Object>) o;
maps.add(objectMap);
}
}
}
@Override
public Elevator selectByAlertId(Long alertId) {
public Map<String,Object> selectByAlertId(Long alertId) {
AlertCalledDto alertCalledDto = alertCalledServiceImpl.queryBySeq(alertId);
if (ValidationUtil.isEmpty(alertCalledDto)
|| ValidationUtil.isEmpty(alertCalledDto.getDeviceId()))
throw new BadRequest("警情不存在或者设备编码不存在");
// 设备类型 和 编码 确定设备的使用单位或者维保单位
String equipmentClassificationCode = alertCalledDto.getEquipmentClassificationCode();
Long deviceId = alertCalledDto.getEquipmentId();
String deviceId = alertCalledDto.getEquipmentId();
// 目前只有电梯类型
LambdaQueryWrapper<Elevator> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Elevator::getSequenceNbr, deviceId);
Elevator elevator = this.getOne(queryWrapper);
if (ValidationUtil.isEmpty(elevator))
Elevator elevator = new Elevator();
elevator.setOriginalId(deviceId);
Map<String,Object> map = iElevatorService.selectElevatorList(elevator);
// LambdaQueryWrapper<Elevator> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(Elevator::getSequenceNbr, deviceId);
// Elevator elevator = this.getOne(queryWrapper);
if (ValidationUtil.isEmpty(map))
throw new BadRequest("设备未找到");
return elevator;
return map;
}
@Override
......@@ -226,6 +275,42 @@ public class ElevatorServiceImpl extends BaseService<ElevatorDto, Elevator, Elev
}
@Override
public Map<String,Object> selectElevatorList(Elevator elevator) {
return elevatorMapper.selectElevatorList(elevator);
}
@Override
public List<Map<String, Object>> selectElevatorEsList(int pageNum,int pageSize) {
return elevatorMapper.selectElevatorEsList(pageNum,pageSize);
}
@Override
public Integer selectUseInfoCount() {
return elevatorMapper.selectUseInfoCount();
}
@Override
public List<Map<String,Object>> selectMtByAlertId(String sequenceNbr) {
return elevatorMapper.selectMtByAlertId(sequenceNbr);
}
@Override
public Map<String, Object> selectUseUnitByAlertId(String sequenceNbr) {
return elevatorMapper.selectUseUnitByAlertId(sequenceNbr);
}
@Override
public Page<Map<String, Object>> selectElevators(Page<Map<String, Object>> page, ElevatorDto dto) {
return elevatorMapper.selectElevators(page, dto);
}
@Override
public List<ElevatorDtoNew> selectExportDataNew(ElevatorDto dto) {
return baseMapper.selectExportDataNew(dto, dto.getIds());
}
public List<ElevatorWlInfoDto> queryElevatorList(ElevatorWlInfoDto esElevatorDto) {
return elevatorMapper.queryElevatorList(esElevatorDto.getAddress(),
esElevatorDto.getRegisterCode(),esElevatorDto.getRescueCode(),
......
package com.yeejoin.amos.boot.module.elevator.biz.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.boot.module.elevator.api.entity.EnterpriseInfo;
import com.yeejoin.amos.boot.module.elevator.api.mapper.EnterpriseInfoMapper;
import com.yeejoin.amos.boot.module.elevator.api.service.IEnterpriseInfoService;
import org.springframework.stereotype.Service;
/**
* @author keyong
* @title: EnterpriseInfoServiceImpl
* <pre>
* @description: TODO
* </pre>
* @date 2023/7/28 14:19
*/
@Service
public class EnterpriseInfoServiceImpl extends ServiceImpl<EnterpriseInfoMapper, EnterpriseInfo> implements IEnterpriseInfoService {
}
......@@ -10,6 +10,7 @@ import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 服务实现类
......@@ -29,4 +30,9 @@ public class MaintenanceUnitServiceImpl extends ServiceImpl<MaintenanceUnitMappe
}
return baseMapper.selectExportData(ids);
}
@Override
public Map<String, Object> selectMessage(String record) {
return baseMapper.selectMessage(record);
}
}
......@@ -10,6 +10,7 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 服务实现类return null;
......@@ -29,4 +30,9 @@ public class UseUnitServiceImpl extends BaseService<UseUnitDto, UseUnit, UseUnit
}
return baseMapper.selectExportData(ids);
}
@Override
public Map<String, Object> selectMessage(String record) {
return baseMapper.selectMessage(record);
}
}
......@@ -2,9 +2,11 @@ package com.yeejoin.amos.boot.module.elevator.biz.utils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.feign.AmosFeignService;
import com.yeejoin.amos.boot.module.elevator.api.dto.BaseEnterpriseInfoDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.ElevatorDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.MaintenanceUnitDto;
import com.yeejoin.amos.boot.module.elevator.api.entity.Elevator;
import com.yeejoin.amos.boot.module.elevator.api.entity.EnterpriseInfo;
import com.yeejoin.amos.boot.module.elevator.api.entity.MaintenanceUnit;
import com.yeejoin.amos.boot.module.elevator.flc.api.dto.CylinderInfoDto;
import com.yeejoin.amos.boot.module.elevator.flc.api.dto.EquipmentDto;
......@@ -251,6 +253,60 @@ public class BeanDtoVoUtils {
}
/**
* 将MaintenanceUnit转换为IPage<MaintenanceUnitVo>
*
* @param page 原分页对象
* @return 转换后的分页对象
*/
public static IPage<BaseEnterpriseInfoDto> enterpriseInfoIPageDto(IPage<EnterpriseInfo> page) {
try {
getMaintenanceUnitDictionaryByDictCode();
} catch (Exception e) {
return null;
}
return page.convert(item -> {
try {
return convertEnterpriseInfoToVo(item, true);
} catch (Exception e) {
return null;
}
});
}
/**
* 将MaintenanceUnit转换为Vo
*
* @param source 源对象
* @param isBatch 是否批量
* @return 转换后的Vo
*/
public static BaseEnterpriseInfoDto convertEnterpriseInfoToVo(EnterpriseInfo source, boolean isBatch) {
// 判断source是否为空
if (source == null) {
return null;
}
try {
// 创建新的对象实例
BaseEnterpriseInfoDto target = new BaseEnterpriseInfoDto();
// 把原对象数据拷贝到新对象
BeanUtils.copyProperties(source, target);
target.setDistrict(target.getCity() + target.getDistrict());
// 返回新对象
// 根据数据字典设置值
// if (!isBatch) {
// getMaintenanceUnitDictionaryByDictCode();
// }
// List<DictionarieValueModel> qualificationLevelValue =
// qualificationLevel.stream().filter(e -> e.getDictDataKey().equals(source.getQualificationLevel())).collect(Collectors.toList());
// target.setQualificationLevel(qualificationLevelValue.isEmpty() ? "" :
// qualificationLevelValue.get(0).getDictDataDesc());
return target;
} catch (Exception e) {
return null;
}
}
/**
* 将企业注册实体类转换为Vo
*
* @param page 原分页对象
......
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