Commit 82df05e8 authored by tianyiming's avatar tianyiming

气瓶基本信息和气瓶充装信息同步至es并添加查询逻辑

parent d4b3d7c4
package com.yeejoin.amos.boot.module.tzs.api.entity;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
@Data
@Accessors(chain = true)
@Document(indexName = "cylinder_filling", type = "tzs_cylinder_filling", shards = 1, replicas = 0)
public class ESCylinderFillingRecordDto {
@Id
private Long sequenceNbr;
//充装单位
@Field(type = FieldType.Text)
private String fillingUnitName;
//出厂编号
@Field(type = FieldType.Text)
private String factoryNum;
//气瓶品种code
@Field(type = FieldType.Integer)
private Integer cylinderVariety;
//气瓶品种名称
@Field(type = FieldType.Text)
private String cylinderVarietyName;
//二维码编号
@Field(type = FieldType.Text)
private String qrCode;
//电子标签编号
@Field(type = FieldType.Text)
private String electronicLabelCode;
//气瓶唯一标识
@Field(type = FieldType.Text)
private String sequenceCode;
//单位内部编号
@Field(type = FieldType.Text)
private String unitInnerCode;
//产权单位名称
@Field(type = FieldType.Text)
private String unitName;
//气瓶状态code
@Field(type = FieldType.Integer)
private Integer cylinderStatus;
//气瓶状态名称
@Field(type = FieldType.Text)
private String cylinderStatusStr;
//充装开始时间
@Field(type = FieldType.Text)
private String fillingStartTime;
//充装结束时间
@Field(type = FieldType.Text)
private String fillingEndTime;
//充装人员姓名
@Field(type = FieldType.Text)
private String fillingUser;
//充装量(Kg)
@Field(type = FieldType.Double)
private Double fillingQuantity;
//室温
@Field(type = FieldType.Double)
private Double temperature;
//异常情况
@Field(type = FieldType.Integer)
private Integer abnormal;
//充装前检查人员姓名
@Field(type = FieldType.Text)
private String inspectorUserBefore;
//充装前检查时间
@Field(type = FieldType.Text)
private String inspectionDateBefore;
//充装前检查结果
@Field(type = FieldType.Text)
private String checkResultsBefore;
//重装后检查人员姓名
@Field(type = FieldType.Text)
private String inspectorAfter;
//重装后检查时间
@Field(type = FieldType.Text)
private String inspectionDateAfter;
//重装后检查结果
@Field(type = FieldType.Text)
private String checkResultsAfter;
//appid
@Field(type = FieldType.Text)
private String appId;
//统一社会信用代码
@Field(type = FieldType.Text)
private String creditCode;
}
package com.yeejoin.amos.boot.module.tzs.api.entity;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
@Data
@Accessors(chain = true)
@Document(indexName = "cylinder_info", type = "tzs_cylinder_info", shards = 1, replicas = 0)
public class ESCylinderInfoDto {
@Id
private Long sequenceNbr;
//产权单位名称
@Field(type = FieldType.Text)
private String unitName;
//出厂编号
@Field(type = FieldType.Text)
private String factoryNum;
//气瓶品种code
@Field(type = FieldType.Integer)
private Integer cylinderVariety;
//气瓶品种名称
@Field(type = FieldType.Text)
private String cylinderVarietyName;
//二维码标签
@Field(type = FieldType.Text)
private String qrCode;
//电子标签编号
@Field(type = FieldType.Text)
private String electronicLabelCode;
//气瓶状态code
@Field(type = FieldType.Integer)
private Integer cylinderStatus;
//气瓶状态名称
@Field(type = FieldType.Text)
private String cylinderStatusStr;
//充装介质
@Field(type = FieldType.Text)
private String fillingMediaName;
//公称压力
@Field(type = FieldType.Double)
private Double nominalWorkPressure;
//容积
@Field(type = FieldType.Double)
private Double volume;
//制造日期
@Field(type = FieldType.Text)
private String manufacturingDate;
//制造单位
@Field(type = FieldType.Text)
private String manufacturingUnit;
//检验日期
@Field(type = FieldType.Text)
private String inspectionDate;
//气瓶唯一标识
@Field(type = FieldType.Text)
private String sequenceCode;
//单位内部编号
@Field(type = FieldType.Text)
private String unitInnerCode;
//appid
@Field(type = FieldType.Text)
private String appId;
//统一社会信用代码
@Field(type = FieldType.Text)
private String creditCode;
@Field(type = FieldType.Text)
private String regionCode;
}
package com.yeejoin.amos.boot.module.tzs.flc.api.dto;
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;
......@@ -9,7 +8,6 @@ import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 气瓶基本信息
......@@ -156,4 +154,7 @@ public class CylinderInfoDto extends BaseDto {
private String cylinderStatusStr;
private String SupervisionCode;
private String inspectionDateEnd;
private String inspectionDateStart;
}
package com.yeejoin.amos.boot.module.tzs.flc.api.dto;
import java.util.Date;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
......
package com.yeejoin.amos.boot.module.tzs.flc.api.entity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
import java.util.Date;
/**
* 液化气体气瓶充装信息-充装记录
*
......@@ -82,4 +79,7 @@ public class CylinderFillingRecord extends BaseEntity {
@ApiModelProperty(value = "充装信息审核ID")
private String fillingExamineId;
@ApiModelProperty(value = "是否保存到es(1标识已经保存过)")
private String isNotEs;
}
package com.yeejoin.amos.boot.module.tzs.flc.api.entity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity;
import java.util.Date;
/**
* 气瓶基本信息
*
......@@ -123,4 +120,7 @@ public class CylinderInfo extends BaseEntity {
@ApiModelProperty(value = "监管码")
private String SupervisionCode;
@ApiModelProperty(value = "是否保存到es(1标识已经保存过)")
private String isNotEs;
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tzs.flc.api.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.entity.ESCylinderFillingRecordDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderFillingRecordDto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderFillingRecord;
......@@ -45,9 +46,14 @@ public interface CylinderFillingRecordMapper extends BaseMapper<CylinderFillingR
@Param("appId") String appId
);
Page<ESCylinderFillingRecordDto> getCyinderFillingRecord(Page<ESCylinderFillingRecordDto> cylinderFillingRecordDto);
Double getFillingSumByMonth(@Param("appId") String appId,@Param("time") Date time);
Integer getFillingCountByMonth(@Param("appId") String appId,@Param("time") Date time);
Double getFillingSumByDate(@Param("appId") String appId,@Param("time") Date time);
ESCylinderFillingRecordDto getCyinderFillingRecordInfo(String sequenceCode);
}
package com.yeejoin.amos.boot.module.tzs.flc.api.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInfo;
import org.apache.ibatis.annotations.Param;
......@@ -82,5 +81,7 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> {
Page<CylinderInfoDto> cyinderInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort, List<String> appids);
Page<CylinderInfoDto> getCyinderInfoList(Page<CylinderInfoDto> page);
Page<CylinderInfoDto> cyinderOutInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort, List<String> appids);
}
package com.yeejoin.amos.boot.module.tzs.flc.api.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.entity.ESCylinderFillingRecordDto;
/**
* 液化气体气瓶充装信息-充装记录接口类
*
......@@ -9,4 +12,9 @@ package com.yeejoin.amos.boot.module.tzs.flc.api.service;
*/
public interface ICylinderFillingRecordService {
ESCylinderFillingRecordDto saveCylinderFillingRecordToES(ESCylinderFillingRecordDto ci);
Page<ESCylinderFillingRecordDto> getCyinderFillingRecord(Page<ESCylinderFillingRecordDto> cylinderFillingRecordDto);
Page<ESCylinderFillingRecordDto> queryByKeys(ESCylinderFillingRecordDto esCylinderFillingRecordDto, int pageNum, int pageSize);
}
package com.yeejoin.amos.boot.module.tzs.flc.api.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.entity.ESCylinderInfoDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto;
import java.util.Map;
/**
......@@ -39,4 +43,10 @@ public interface ICylinderInfoService {
void synUnitFillingCheckData();
void synFillingUnloadUnitData();
Page<CylinderInfoDto> getCyinderInfoList(Page<CylinderInfoDto> page);
ESCylinderInfoDto saveCylinderInfoToES(CylinderInfoDto ci);
Page<ESCylinderInfoDto> queryByKeys(CylinderInfoDto cylinderInfoDto, int pageNum, int pageSize);
}
......@@ -146,4 +146,60 @@
select count(1) from tz_cylinder_filling_record r where date_format(r.filling_endTime,'%Y-%m') = date_format(#{time},'%Y-%m') and app_id = #{appId}
</select>
<select id="getCyinderFillingRecord" resultType="com.yeejoin.amos.boot.module.tzs.api.entity.ESCylinderFillingRecordDto">
SELECT
r.sequence_nbr AS sequenceNbr,
r.filling_startTime AS fillingStarttime,
r.filling_endTime AS fillingEndtime,
r.filling_user AS fillingUser,
r.filling_quantity AS fillingQuantity,
r.temperature AS temperature,
CASE
r.abnormal
WHEN 0 THEN
'有异常'
WHEN 1 THEN
'正常' ELSE''
END AS abnormalStr,
b.inspector_user AS inspectorUserBefore,
b.inspection_date AS inspectionDateBefore,
b.check_results AS checkResultsBefore,
b.sequence_code AS sequenceCode,
b.filling_unit_name AS fillingUnitName,
af.inspector AS inspectorAfter,
af.inspection_date AS inspectionDateAfter,
af.check_results AS checkResultsAfter
FROM
tz_cylinder_filling_record r
LEFT JOIN tz_cylinder_filling b ON b.filling_before_id = r.filling_before_id
AND date_format ( b.inspection_date, '%Y-%m-%d' ) = date_format ( r.filling_startTime, '%Y-%m-%d' )
LEFT JOIN tz_cylinder_filling_check af ON af.filling_check_id = r.filling_check_id
AND date_format ( af.inspection_date, '%Y-%m-%d' ) = date_format ( r.filling_startTime, '%Y-%m-%d' )
LEFT JOIN tz_cylinder_info i ON b.sequence_code = i.sequence_code
WHERE
r.is_not_es IS NULL
</select>
<select id="getCyinderFillingRecordInfo"
resultType="com.yeejoin.amos.boot.module.tzs.api.entity.ESCylinderFillingRecordDto">
SELECT
ci.unit_name AS unit_name,
ci.factory_num AS factoryNum,
ci.cylinder_variety AS cylinder_variety,
d2.NAME AS cylinder_variety_name,
ci.unit_inner_code AS unit_inner_code,
ci.sequence_code AS sequence_code,
ct.qrCode,
ct.electronic_label_code,
ci.app_id,
ci.credit_code
FROM
tz_cylinder_info AS ci
LEFT JOIN cb_data_dictionary AS d1 ON d1.TYPE = 'CZJZMC' AND d1.code = ci.filling_media
LEFT JOIN cb_data_dictionary AS d2 ON d2.sequence_nbr = ci.cylinder_variety
LEFT JOIN tz_cylinder_tags AS ct ON ct.sequence_code = ci.sequence_code
LEFT JOIN tz_cylinder_unit AS tn ON ci.app_id = tn.app_id
where
ci.sequence_code = #{sequenceCode}
</select>
</mapper>
......@@ -243,4 +243,50 @@
</foreach>
</if>
</select>
<select id="getCyinderInfoList" resultType="com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto">
SELECT
ci.sequence_nbr AS sequence_nbr,
ci.unit_name AS unit_name,
ci.factory_num AS factory_num,
ci.cylinder_status AS cylinder_status,
ci.cylinder_variety AS cylinder_variety,
ci.volume AS volume,
ci.manufacturing_date AS manufacturing_date,
ci.manufacturing_unit AS manufacturing_unit,
ci.unit_inner_code AS unit_inner_code,
ci.sequence_code AS sequence_code,
ci.early_warning_level AS early_warning_level,
ci.early_warning_level_cal_date AS early_warning_level_cal_date,
ci.end_custom_code AS end_custom_code,
ci.rec_date AS rec_date,
ci.rec_user_id AS rec_user_id,
ci.sync_date AS sync_date,
ci.sync_state AS sync_state,
ci.app_id AS app_id,
ci.integrity AS integrity,
ci.longitude AS longitude,
ci.latitude AS latitude,
ci.credit_code AS credit_code,
ci.filling_media AS filling_media,
ci.product_name AS product_name,
ci.product_qualified AS product_qualified,
ci.proof_quality AS proof_quality,
ci.supervision_inspec AS supervision_inspec,
ci.type_experiments AS type_experiments,
ci.valve_manufactur_unit AS valve_manufactur_unit,
ci.nominal_work_pressure AS nominal_work_pressure,
d1.name AS filling_media_name,
d2.name AS cylinder_variety_name,
d3.name AS cylinder_status_str,
ct.qrCode,
ct.electronic_label_code
FROM
tz_cylinder_info AS ci
LEFT JOIN cb_data_dictionary AS d1 ON d1.type = 'CZJZMC' AND d1.code = ci.filling_media
LEFT JOIN cb_data_dictionary AS d2 ON d2.sequence_nbr = ci.cylinder_variety
LEFT JOIN cb_data_dictionary AS d3 ON d3.sequence_nbr = ci.cylinder_status
LEFT JOIN tz_cylinder_tags AS ct ON ct.sequence_code = ci.sequence_code
where ci.is_not_es IS NULL
</select>
</mapper>
package com.yeejoin.amos.boot.module.tzs.biz.dao;
import com.yeejoin.amos.boot.module.tzs.api.entity.ESCylinderFillingRecordDto;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface ESCylinderFillingRecordRepository extends PagingAndSortingRepository<ESCylinderFillingRecordDto, Long> {
}
package com.yeejoin.amos.boot.module.tzs.biz.dao;
import com.yeejoin.amos.boot.module.tzs.api.entity.ESCylinderInfoDto;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface ESCylinderInfoRepository extends PagingAndSortingRepository<ESCylinderInfoDto, Long> {
}
......@@ -143,5 +143,10 @@ rule.definition.load=false
rule.definition.default-agency=tzs
rule.definition.local-ip=172.16.10.210
#\u6C14\u74F6\u5145\u88C5\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es
tzs.cylinder.fill.cron=0 0 12 * * ?
#\u6C14\u74F6\u57FA\u672C\u4FE1\u606F\u5B9A\u65F6\u540C\u6B65\u81F3es
tzs.cylinder.info.cron=0 0 1 * * ?
# ??????????
minio.url.path=http://172.16.10.210:9000/
\ No newline at end of file
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