Commit 855e4f08 authored by tianyiming's avatar tianyiming

气瓶充装信息存es修改

parent bdf62f66
...@@ -82,25 +82,25 @@ public class ESCylinderFillingRecordDto { ...@@ -82,25 +82,25 @@ public class ESCylinderFillingRecordDto {
//异常情况 //异常情况
@Field(type = FieldType.Integer) @Field(type = FieldType.Integer)
private Integer abnormal; private String abnormalStr;
//充装前检查人员姓名 //充装前检查人员姓名
@Field(type = FieldType.Text) @Field(type = FieldType.Text)
private String inspectorUserBefore; private String inspectorUser;
//充装前检查时间 //充装前检查时间
@Field(type = FieldType.Text) @Field(type = FieldType.Text)
private String inspectionDateBefore; private String inspectionDate;
//充装前检查结果 //充装前检查结果
@Field(type = FieldType.Text) @Field(type = FieldType.Text)
private String checkResultsBefore; private String fillingResult;
//重装后检查人员姓名 //重装后检查人员姓名
@Field(type = FieldType.Text) @Field(type = FieldType.Text)
private String inspectorAfter; private String inspector;
//重装后检查时间 //重装后检查时间
@Field(type = FieldType.Text) @Field(type = FieldType.Text)
...@@ -108,7 +108,7 @@ public class ESCylinderFillingRecordDto { ...@@ -108,7 +108,7 @@ public class ESCylinderFillingRecordDto {
//重装后检查结果 //重装后检查结果
@Field(type = FieldType.Text) @Field(type = FieldType.Text)
private String checkResultsAfter; private String checkResult;
//appid //appid
@Field(type = FieldType.Text) @Field(type = FieldType.Text)
......
...@@ -55,5 +55,5 @@ public interface CylinderFillingRecordMapper extends BaseMapper<CylinderFillingR ...@@ -55,5 +55,5 @@ public interface CylinderFillingRecordMapper extends BaseMapper<CylinderFillingR
Double getFillingSumByDate(@Param("appId") String appId,@Param("time") Date time); Double getFillingSumByDate(@Param("appId") String appId,@Param("time") Date time);
ESCylinderFillingRecordDto getCyinderFillingRecordInfo(String sequenceCode); ESCylinderFillingRecordDto getCyinderFillingRecordInfo(String appId, String sequenceCode);
} }
...@@ -148,6 +148,7 @@ ...@@ -148,6 +148,7 @@
<select id="getCyinderFillingRecord" resultType="com.yeejoin.amos.boot.module.tzs.api.entity.ESCylinderFillingRecordDto"> <select id="getCyinderFillingRecord" resultType="com.yeejoin.amos.boot.module.tzs.api.entity.ESCylinderFillingRecordDto">
SELECT SELECT
DISTINCT( r.filling_record_id),
r.sequence_nbr AS sequenceNbr, r.sequence_nbr AS sequenceNbr,
r.filling_startTime AS fillingStarttime, r.filling_startTime AS fillingStarttime,
r.filling_endTime AS fillingEndtime, r.filling_endTime AS fillingEndtime,
...@@ -156,28 +157,32 @@ ...@@ -156,28 +157,32 @@
r.temperature AS temperature, r.temperature AS temperature,
CASE CASE
r.abnormal r.abnormal
WHEN 0 THEN WHEN 3139 THEN
'有异常' '有异常'
WHEN 1 THEN WHEN 3140 THEN
'正常' ELSE'' '正常' ELSE''
END AS abnormalStr, END AS abnormalStr,
b.inspector_user AS inspectorUserBefore, b.inspector_user AS inspectorUser,
b.inspection_date AS inspectionDateBefore, b.inspection_date AS inspectionDate,
b.check_results AS checkResultsBefore, b.check_results AS fillingResult,
b.sequence_code AS sequenceCode, b.sequence_code AS sequenceCode,
b.app_id AS appId,
b.filling_unit_name AS fillingUnitName, b.filling_unit_name AS fillingUnitName,
af.inspector AS inspectorAfter, af.inspector AS inspector,
af.inspection_date AS inspectionDateAfter, af.inspection_date AS inspectionDateAfter,
af.check_results AS checkResultsAfter af.check_results AS checkResult
FROM FROM
tz_cylinder_filling_record r tz_cylinder_filling_record r
LEFT JOIN tz_cylinder_filling b ON b.filling_before_id = r.filling_before_id LEFT JOIN tz_cylinder_filling b ON b.filling_before_id = r.filling_before_id
AND date_format ( to_timestamp(b.inspection_date/1000)::date, '%Y-%m-%d' ) = date_format ( r.filling_startTime, '%Y-%m-%d' ) AND r.filling_before_id is NOT null
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 LEFT JOIN tz_cylinder_filling_check af ON af.filling_check_id = r.filling_check_id
AND date_format ( to_timestamp(af.inspection_date/1000)::date, '%Y-%m-%d' ) = date_format ( r.filling_startTime, '%Y-%m-%d' ) 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 LEFT JOIN tz_cylinder_info i ON b.sequence_code = i.sequence_code
WHERE WHERE
r.is_not_es IS NULL r.is_not_es IS NULL
AND b.inspection_date not like '16%'
ORDER BY r.filling_record_id
</select> </select>
<select id="getCyinderFillingRecordInfo" <select id="getCyinderFillingRecordInfo"
...@@ -201,5 +206,6 @@ ...@@ -201,5 +206,6 @@
LEFT JOIN tz_cylinder_unit AS tn ON ci.app_id = tn.app_id LEFT JOIN tz_cylinder_unit AS tn ON ci.app_id = tn.app_id
where where
ci.sequence_code = #{sequenceCode} ci.sequence_code = #{sequenceCode}
and ci.app_id = #{appId}
</select> </select>
</mapper> </mapper>
...@@ -25,7 +25,6 @@ import org.elasticsearch.client.RestHighLevelClient; ...@@ -25,7 +25,6 @@ import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
...@@ -145,7 +144,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -145,7 +144,7 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
if(!ObjectUtils.isEmpty(cylinderFillingRecordPage)){ if(!ObjectUtils.isEmpty(cylinderFillingRecordPage)){
cylinderFillingRecordPage.getRecords().stream().map(item->{ cylinderFillingRecordPage.getRecords().stream().map(item->{
if(!ObjectUtils.isEmpty(item.getSequenceCode())){ if(!ObjectUtils.isEmpty(item.getSequenceCode())){
ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getSequenceCode()); ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getAppId(),item.getSequenceCode());
item.setUnitName(cyinderFillingRecordInfo.getUnitName()); item.setUnitName(cyinderFillingRecordInfo.getUnitName());
item.setFactoryNum(cyinderFillingRecordInfo.getFactoryNum()); item.setFactoryNum(cyinderFillingRecordInfo.getFactoryNum());
item.setCylinderVariety(cyinderFillingRecordInfo.getCylinderVariety()); item.setCylinderVariety(cyinderFillingRecordInfo.getCylinderVariety());
...@@ -171,9 +170,10 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -171,9 +170,10 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
public Page<ESCylinderFillingRecordDto> getCyinderFillingRecord(Page<ESCylinderFillingRecordDto> cylinderFillingRecordDto) { public Page<ESCylinderFillingRecordDto> getCyinderFillingRecord(Page<ESCylinderFillingRecordDto> cylinderFillingRecordDto) {
Page<ESCylinderFillingRecordDto> cyinderFillingRecord = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordDto); Page<ESCylinderFillingRecordDto> cyinderFillingRecord = cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordDto);
if(!ObjectUtils.isEmpty(cyinderFillingRecord)){ if(!ObjectUtils.isEmpty(cyinderFillingRecord)){
cyinderFillingRecord.getRecords().stream().map(item->{ cyinderFillingRecord.getRecords().stream().map(item -> {
if(!ObjectUtils.isEmpty(item.getSequenceCode())){ if (!ObjectUtils.isEmpty(item.getSequenceCode())) {
ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getSequenceCode()); ESCylinderFillingRecordDto cyinderFillingRecordInfo = cylinderFillingRecordMapper.getCyinderFillingRecordInfo(item.getAppId(), item.getSequenceCode());
if (!ObjectUtils.isEmpty(cyinderFillingRecordInfo)) {
item.setUnitName(cyinderFillingRecordInfo.getUnitName()); item.setUnitName(cyinderFillingRecordInfo.getUnitName());
item.setFactoryNum(cyinderFillingRecordInfo.getFactoryNum()); item.setFactoryNum(cyinderFillingRecordInfo.getFactoryNum());
item.setCylinderVariety(cyinderFillingRecordInfo.getCylinderVariety()); item.setCylinderVariety(cyinderFillingRecordInfo.getCylinderVariety());
...@@ -185,10 +185,11 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -185,10 +185,11 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
item.setAppId(cyinderFillingRecordInfo.getAppId()); item.setAppId(cyinderFillingRecordInfo.getAppId());
item.setCreditCode(cyinderFillingRecordInfo.getCreditCode()); item.setCreditCode(cyinderFillingRecordInfo.getCreditCode());
} }
}
return item; return item;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
return cylinderFillingRecordMapper.getCyinderFillingRecord(cylinderFillingRecordDto); return cyinderFillingRecord;
} }
@Override @Override
...@@ -344,10 +345,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin ...@@ -344,10 +345,8 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
@Override @Override
public ESCylinderFillingRecordDto saveCylinderFillingRecordToES(ESCylinderFillingRecordDto ci) { public ESCylinderFillingRecordDto saveCylinderFillingRecordToES(ESCylinderFillingRecordDto ci) {
ESCylinderFillingRecordDto esCylinderFillingRecordDto = new ESCylinderFillingRecordDto();
BeanUtils.copyProperties(ci, esCylinderFillingRecordDto);
ESCylinderFillingRecordDto recordDto = esCylinderFillingRecordRepository.save(esCylinderFillingRecordDto); ESCylinderFillingRecordDto recordDto = esCylinderFillingRecordRepository.save(ci);
if (!ObjectUtils.isEmpty(recordDto)) { if (!ObjectUtils.isEmpty(recordDto)) {
//同步到es后修改 //同步到es后修改
CylinderFillingRecord cylinderFillingRecord = new CylinderFillingRecord(); CylinderFillingRecord cylinderFillingRecord = new CylinderFillingRecord();
......
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