Commit e75d5d77 authored by 刘林's avatar 刘林

fix(cylinder):气瓶区域信息查询

parent f2d9eafe
......@@ -51,4 +51,7 @@ public class CylinderAreaDataDto extends BaseDto {
@ApiModelProperty(value = "纬度")
private String latitude;
@ApiModelProperty(value = "超期数量")
private Integer outOfDateNum;
}
......@@ -80,4 +80,10 @@ public class CylinderAreaData extends BaseEntity {
*/
@TableField("latitude")
private String latitude;
/**
* 超期数量
*/
@TableField("out_of_date_num")
private Integer outOfDateNum;
}
......@@ -55,6 +55,14 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> {
Integer getWarnNum(String code);
/**
* 查询超期数量
* @author LiuLin
* @param code 区域code
* @return
*/
Integer getOutOfDateNum(String code);
Integer getMonthInfoTotalUnit(@Param("appId") String appId);
......
......@@ -61,6 +61,11 @@
<select id="getWarnNum" resultType="java.lang.Integer">
select count(1) from view_cylider_outofdate v where v.app_id in (<include refid="selectAPPIdByRegionCode"/>)
</select>
<select id="getOutOfDateNum" resultType="java.lang.Integer">
select count(1) from view_cylider_outofdate v where v.app_id in (<include refid="selectAPPIdByRegionCode"/>)
and v.next_inspection_date <![CDATA[ > ]]> now()
</select>
<select id="getMonthInfoTotalUnit" resultType="java.lang.Integer">
select
......
......@@ -40,7 +40,7 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto
.regionCode(v.getRegionCode())
.longitude(v.getLongitude())
.latitude(v.getLatitude())
.isAlarm(v.getWarnNum() != 0)
.isAlarm(v.getOutOfDateNum() != 0)
.cylindersCount(v.getCylinderNum())
.stationCount(v.getUnitNum())
.build())
......
......@@ -214,6 +214,10 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
return baseMapper.getWarnNum(code);
}
public Integer getOutOfDateNum(String code) {
return baseMapper.getOutOfDateNum(code);
}
/**
* 按单位统计
*/
......@@ -250,7 +254,7 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
* 按区域统计
*/
@Transactional(rollbackFor = Exception.class)
@Scheduled(cron = "0 0 2 * * ?")
@Scheduled(cron = "0 0 4 * * ?")
@SchedulerLock(name = "synAreaDataTask", lockAtMostFor = "PT60M")
public void synAreaDataJob() {
this.synAreaData();
......@@ -284,6 +288,7 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
temp.setLevel(regionModel.getLevel().trim());
temp.setLatitude(regionModel.getLatitude());
temp.setLongitude(regionModel.getLongitude());
temp.setOutOfDateNum(this.getOutOfDateNum(code));
cylinderAreaDataServiceImpl.createWithModel(temp);
});
}
......
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