功能优化

This commit is contained in:
曹磊 2025-09-01 19:49:48 +08:00
parent 3a76ae5093
commit b609ba465e
12 changed files with 289 additions and 27 deletions

View File

@ -70,7 +70,7 @@ public class HomeApi {
//郊县数量郊县公司数量
LambdaQueryChainWrapper<Thermalcompany> qw3 = thermalcompanyService.lambdaQuery();
qw3.eq(Thermalcompany::getRegionType,"城区");
qw3.eq(Thermalcompany::getRegionType,"郊县");
qw3.eq(Thermalcompany::getDelFlag,"0");
qw3.orderByAsc(Thermalcompany::getId);
List<Thermalcompany> thermalcompanyList = qw3.list();

View File

@ -89,4 +89,14 @@ public class HeatanalysisHistoryController extends JeecgController<HeatanalysisH
return service.findHistoryList(heatanalysisHistory);
}
@GetMapping(value = "/getHistoryList")
public Result<?> getHistoryList(HeatanalysisHistory heatanalysisHistory, HttpServletRequest req) {
return service.getHistoryList(heatanalysisHistory);
}
@GetMapping(value = "/getJxHistoryList")
public Result<?> getJxHistoryList(HeatanalysisHistory heatanalysisHistory, HttpServletRequest req) {
return service.getJxHistoryList(heatanalysisHistory);
}
}

View File

@ -97,8 +97,10 @@ public class HeatsourcestationController extends JeecgController<Heatsourcestati
customeRuleMap.put("sourceId", QueryRuleEnum.EQ);
customeRuleMap.put("stationName", QueryRuleEnum.LIKE_WITH_OR);
QueryWrapper<Heatsourcestation> queryWrapper = QueryGenerator.initQueryWrapper(heatsourcestation, req.getParameterMap(),customeRuleMap);
queryWrapper.eq("del_flag","0");
queryWrapper.orderByAsc("company_id");
queryWrapper.orderByAsc("source_id");
queryWrapper.orderByAsc("id");
Page<Heatsourcestation> page = new Page<Heatsourcestation>(pageNo, pageSize);
IPage<Heatsourcestation> pageList = heatsourcestationService.page(page, queryWrapper);
return Result.OK(pageList);

View File

@ -54,8 +54,8 @@ public class Heatanalysis extends JeecgEntity {
private Integer view001; // 热力公司
private Integer view002; // 热源站
private String view003; // 热源所
private String view004; // 换热站
private Integer view003; // 热源所
private Integer view004; // 换热站
@Excel(name = "数据时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@TableField(updateStrategy = FieldStrategy.NEVER)

View File

@ -37,7 +37,7 @@ public class HeatanalysisHistory extends JeecgEntity {
private Integer view001; // 热力公司
private Integer view002; // 热源站
private String view003; // 热源所
private String view004; // 换热站
private Integer view004; // 换热站
@Excel(name = "数据时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@TableField(updateStrategy = FieldStrategy.NEVER)

View File

@ -62,19 +62,20 @@ public class FlowanalysisJob implements Job {
log.info("jsonObject:"+jsonObject);
String success = jsonObject.getStr("success");
if(StringUtils.equals(success,"true")){
QueryWrapper<Heatanalysis> heatanalysisQueryWrapper = new QueryWrapper<>();
heatanalysisQueryWrapper.eq("view031",sn);
heatanalysisQueryWrapper.last("limit 1");
Heatanalysis heatanalysis = heatanalysisService.getOne(heatanalysisQueryWrapper);
if(heatanalysis != null){
String view032_old = heatanalysis.getView032();
// QueryWrapper<Heatanalysis> heatanalysisQueryWrapper = new QueryWrapper<>();
// heatanalysisQueryWrapper.eq("view031",sn);
// heatanalysisQueryWrapper.last("limit 1");
// Heatanalysis heatanalysis = heatanalysisService.getOne(heatanalysisQueryWrapper);
Heatanalysis heatanalysis = new Heatanalysis();
// if(heatanalysis != null){
// String view032_old = heatanalysis.getView032();
String data = jsonObject.getStr("data");
JSONObject dataObject = new JSONObject(data);
String view032 = dataObject.getStr("logat");
if(StringUtils.equals(view032,view032_old)){
log.info("--------数据重复---------");
continue;
}
// if(StringUtils.equals(view032,view032_old)){
// log.info("--------数据重复---------");
// continue;
// }
String view033 = dataObject.getStr("ID");
String view034 = dataObject.getStr("valid");
String view035 = dataObject.getStr("gswd");
@ -129,7 +130,7 @@ public class FlowanalysisJob implements Job {
heatanalysis.setView047(view047);
heatanalysisService.exeWater(heatanalysis);
}
// }
}
} catch (Exception e) {

View File

@ -11,4 +11,5 @@ public interface HeatanalysisHistoryMapper extends BaseMapper<HeatanalysisHistor
Page<HeatanalysisHistory> findPage(Page<HeatanalysisHistory> page, @Param("params") HeatanalysisHistory heatanalysisHistory);
Page<HeatanalysisHistory> findJxPage(Page<HeatanalysisHistory> page, @Param("params") HeatanalysisHistory heatanalysisHistory);
List<HeatanalysisHistory> findHistoryList(HeatanalysisHistory heatanalysisHistory);
List<HeatanalysisHistory> getJxHistoryList(HeatanalysisHistory heatanalysisHistory);
}

View File

@ -38,17 +38,38 @@
a.view028 AS "view002Name",
a.view029 AS "view003Name",
a.view030 AS "view004Name",
a.from_flow AS "fromFlow",
a.view031 AS "view031",
a.view032 AS "view032",
a.view033 AS "view033",
a.view034 AS "view034",
a.view035 AS "view035",
a.view036 AS "view036",
a.view037 AS "view037",
a.view038 AS "view038",
a.view039 AS "view039",
a.view040 AS "view040",
a.view041 AS "view041",
a.view042 AS "view042",
a.view043 AS "view043",
a.view044 AS "view044",
a.view045 AS "view045",
a.view046 AS "view046",
a.view047 AS "view047",
a.sim AS "sim",
a.create_by AS "createBy.id",
a.create_date AS "createDate",
a.update_by AS "updateBy.id",
a.update_date AS "updateDate",
a.del_flag AS "delFlag",
a.report_type AS "reportType"
a.report_type AS "reportType",
a.region_type as "regionType"
FROM ${params.tableName} a
<where>
a.region_type = #{params.regionType}
And a.del_flag = '0'
<if test="params.regionType != null and params.regionType != ''">
AND a.region_type = #{params.regionType}
</if>
<if test="params.view001 != null and params.view001 != ''">
AND a.view001 = #{params.view001}
</if>
@ -78,7 +99,7 @@
</if>
</where>
) t
ORDER BY view001 asc ,view002 asc,view004 asc,DATATIME DESC
ORDER BY view001 asc ,view002 asc,view004 asc,datatime DESC
</select>
<select id="findJxPage" resultType="org.jeecg.modules.heating.entity.HeatanalysisHistory">
@ -141,11 +162,14 @@
a.update_by AS "updateBy.id",
a.update_date AS "updateDate",
a.del_flag AS "delFlag",
a.report_type AS "reportType"
a.report_type AS "reportType",
a.region_type as "regionType"
FROM ${params.tableName} a
<where>
a.region_type = #{params.regionType}
And a.del_flag = '0'
<if test="params.regionType != null and params.regionType != ''">
AND a.region_type = #{params.regionType}
</if>
<if test="params.view001 != null and params.view001 != ''">
AND a.view001 = #{params.view001}
</if>
@ -175,7 +199,7 @@
</if>
</where>
) t
ORDER BY view001 asc ,view002 asc,view004 asc,DATATIME DESC
ORDER BY view001 asc ,view002 asc,view004 asc,datatime DESC
</select>
<select id="findHistoryList" resultType="org.jeecg.modules.heating.entity.HeatanalysisHistory">
@ -214,25 +238,50 @@
a.view028 AS "view002Name",
a.view029 AS "view003Name",
a.view030 AS "view004Name",
a.from_flow AS "fromFlow",
a.view031 AS "view031",
a.view032 AS "view032",
a.view033 AS "view033",
a.view034 AS "view034",
a.view035 AS "view035",
a.view036 AS "view036",
a.view037 AS "view037",
a.view038 AS "view038",
a.view039 AS "view039",
a.view040 AS "view040",
a.view041 AS "view041",
a.view042 AS "view042",
a.view043 AS "view043",
a.view044 AS "view044",
a.view045 AS "view045",
a.view046 AS "view046",
a.view047 AS "view047",
a.sim AS "sim",
a.create_by AS "createBy.id",
a.create_date AS "createDate",
a.update_by AS "updateBy.id",
a.update_date AS "updateDate",
a.del_flag AS "delFlag",
a.report_type AS "reportType"
a.report_type AS "reportType",
a.region_type as "regionType"
FROM ${tableName} a
<where>
a.del_flag = '0'
<if test="regionType != null and regionType != ''">
AND a.region_type = #{regionType}
</if>
<if test="view001 != null and view001 != ''">
AND a.view001 = #{view001}
</if>
<if test="view002 != null and view002 != ''">
AND a.view002 = #{view002}
</if>
<if test="view004 != null and view004 != ''">
<if test="view004 != null and view004 != '' and view004 != -1">
AND a.view004 = #{view004}
</if>
<if test="view004 != null and view004 != '' and view004 == -1">
AND a.view004 is null
</if>
<if test="SDate != null">
AND a.datatime >= #{SDate}
</if>
@ -250,7 +299,107 @@
</if>
</where>
) t
ORDER BY t.datatime ASC
ORDER BY view001 asc ,view002 asc,view004 asc, datatime ASC
</select>
<select id="getJxHistoryList" resultType="org.jeecg.modules.heating.entity.HeatanalysisHistory">
select * from (
SELECT
a.id AS "id",
a.view001 AS "view001",
a.view002 AS "view002",
a.view003 AS "view003",
a.view004 AS "view004",
a.datatime AS "datatime",
a.caveat AS "caveat",
a.view005 AS "view005",
a.view006 AS "view006",
a.view007 AS "view007",
a.view008 AS "view008",
a.view009 AS "view009",
a.view010 AS "view010",
a.view011 AS "view011",
a.view012 AS "view012",
a.view013 AS "view013",
a.view014 AS "view014",
a.view015 AS "view015",
a.view016 AS "view016",
a.view017 AS "view017",
a.view018 AS "view018",
a.view019 AS "view019",
a.view020 AS "view020",
a.view021 AS "view021",
a.view022 AS "view022",
a.view023 AS "view023",
a.view024 AS "view024",
a.view025 AS "view025",
a.view026 AS "view026",
a.view027 AS "view001Name",
a.view028 AS "view002Name",
a.view029 AS "view003Name",
a.view030 AS "view004Name",
a.from_flow AS "fromFlow",
a.view031 AS "view031",
a.view032 AS "view032",
a.view033 AS "view033",
a.view034 AS "view034",
a.view035 AS "view035",
a.view036 AS "view036",
a.view037 AS "view037",
a.view038 AS "view038",
a.view039 AS "view039",
a.view040 AS "view040",
a.view041 AS "view041",
a.view042 AS "view042",
a.view043 AS "view043",
a.view044 AS "view044",
a.view045 AS "view045",
a.view046 AS "view046",
a.view047 AS "view047",
a.sim AS "sim",
a.create_by AS "createBy.id",
a.create_date AS "createDate",
a.update_by AS "updateBy.id",
a.update_date AS "updateDate",
a.del_flag AS "delFlag",
a.report_type AS "reportType",
a.region_type as "regionType"
FROM ${tableName} a
<where>
a.del_flag = '0'
<if test="regionType != null and regionType != ''">
AND a.region_type = #{regionType}
</if>
<if test="view001 != null and view001 != ''">
AND a.view001 = #{view001}
</if>
<if test="view002 != null and view002 != ''">
AND a.view002 = #{view002}
</if>
<if test="view004 != null and view004 != '' and view004 != -1">
AND a.view004 = #{view004}
</if>
<if test="view004 != null and view004 != '' and view004 == -1">
AND a.view004 is null
</if>
<if test="SDate != null">
AND a.view032 >= #{SDate}
</if>
<if test="EDate != null">
AND a.view032 &lt;= #{EDate}
</if>
<if test="caveat != null">
AND a.caveat = #{caveat}
</if>
<if test="reportType != null">
AND a.report_type = #{reportType}
</if>
<if test="sim != null and sim != ''">
AND a.sim = #{sim}
</if>
</where>
) t
ORDER BY view001 asc ,view002 asc,view004 asc, view032 ASC
</select>
</mapper>

View File

@ -208,6 +208,24 @@
a.view028 AS "view002Name",
a.view029 AS "view003Name",
a.view030 AS "view004Name",
a.from_flow AS "fromFlow",
a.view031 AS "view031",
a.view032 AS "view032",
a.view033 AS "view033",
a.view034 AS "view034",
a.view035 AS "view035",
a.view036 AS "view036",
a.view037 AS "view037",
a.view038 AS "view038",
a.view039 AS "view039",
a.view040 AS "view040",
a.view041 AS "view041",
a.view042 AS "view042",
a.view043 AS "view043",
a.view044 AS "view044",
a.view045 AS "view045",
a.view046 AS "view046",
a.view047 AS "view047",
a.sim AS "sim",
a.create_by AS "createBy.id",
a.create_date AS "createDate",
@ -216,6 +234,7 @@
a.del_flag AS "delFlag",
a.report_type AS "reportType",
a.is_extract AS "isExtract",
a.region_type as "regionType",
-- b.company_name AS "view001Name",
-- c.source_name AS "view002Name",
-- d.name AS "view003Name",
@ -268,10 +287,10 @@
count(distinct replace(e.station_name,SUBSTR(e.station_name,instr(e.station_name,'('),10),'')) as VIEW006
FROM BL_HEATANALYSIS a
LEFT JOIN BL_thermalcompany b ON b.id=a.view001
LEFT JOIN BL_heatsourcestation e ON e.id=a.view004 and e.id != 20
LEFT JOIN BL_heatsourcestation e ON e.id=a.view004
where a.del_flag = '0'
group by view001,view001Name
ORDER BY A.view001 DESC
ORDER BY A.view001 ASC
</select>
<select id="findSimulateList" resultType="org.jeecg.modules.heating.entity.Heatanalysis">

View File

@ -60,8 +60,10 @@
FROM BL_heatsource a
<include refid="heatsourceJoins"/>
<where>
a.region_type = #{regionType}
AND a.del_flag = '0'
<if test="regionType != null and regionType != ''">
AND a.region_type = #{regionType}
</if>
<if test="sourceName != null and sourceName != ''">
AND a.source_name LIKE concat('%',#{sourceName},'%')
</if>

View File

@ -11,4 +11,6 @@ public interface HeatanalysisHistoryService extends JeecgService<HeatanalysisHis
IPage<HeatanalysisHistory> findPage(Page<HeatanalysisHistory> page,HeatanalysisHistory heatanalysisHistory);
IPage<HeatanalysisHistory> findJxPage(Page<HeatanalysisHistory> page,HeatanalysisHistory heatanalysisHistory);
Result<?> findHistoryList(HeatanalysisHistory heatanalysisHistory);
Result<?> getHistoryList(HeatanalysisHistory heatanalysisHistory);
Result<?> getJxHistoryList(HeatanalysisHistory heatanalysisHistory);
}

View File

@ -115,4 +115,80 @@ public class HeatanalysisHistoryServiceImpl extends JeecgServiceImpl<Heatanalysi
return Result.ok(map);
}
public Result<?> getHistoryList(HeatanalysisHistory heatanalysisHistory){
Map<String,Object> map = new HashMap<>();
SimpleDateFormat dayFormat = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String startDate = heatanalysisHistory.getStartDate();
if(startDate==null||startDate.equals("")) {
startDate = dayFormat.format(new Date())+" 00:00:00";
}
try {
heatanalysisHistory.setSDate(timeFormat.parse(startDate));
}catch (ParseException e) {
e.printStackTrace();
}
String suffix1 = startDate.substring(2, 4)+startDate.substring(5, 7);
String tableName = "bl_heatanalysis_"+suffix1;
heatanalysisHistory.setTableName(tableName);
String endDate = heatanalysisHistory.getEndDate();
if(endDate==null||endDate.equals("")) {
endDate = dayFormat.format(new Date())+" 23:59:59";
}
try {
heatanalysisHistory.setEDate(timeFormat.parse(endDate));
}catch (ParseException e) {
e.printStackTrace();
}
String suffix2 = endDate.substring(2, 4)+endDate.substring(5, 7);
List<HeatanalysisHistory> list1 = baseMapper.findHistoryList(heatanalysisHistory);
if(!suffix1.equals(suffix2)){
tableName = "bl_heatanalysis_"+suffix2;
heatanalysisHistory.setTableName(tableName);
List<HeatanalysisHistory> list2 = baseMapper.findHistoryList(heatanalysisHistory);
list1.addAll(list2);
}
map.put("list",list1);
return Result.ok(map);
}
public Result<?> getJxHistoryList(HeatanalysisHistory heatanalysisHistory){
Map<String,Object> map = new HashMap<>();
SimpleDateFormat dayFormat = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String startDate = heatanalysisHistory.getStartDate();
if(startDate==null||startDate.equals("")) {
startDate = dayFormat.format(new Date())+" 00:00:00";
}
try {
heatanalysisHistory.setSDate(timeFormat.parse(startDate));
}catch (ParseException e) {
e.printStackTrace();
}
String suffix1 = startDate.substring(2, 4)+startDate.substring(5, 7);
String tableName = "bl_heatanalysis_"+suffix1;
heatanalysisHistory.setTableName(tableName);
String endDate = heatanalysisHistory.getEndDate();
if(endDate==null||endDate.equals("")) {
endDate = dayFormat.format(new Date())+" 23:59:59";
}
try {
heatanalysisHistory.setEDate(timeFormat.parse(endDate));
}catch (ParseException e) {
e.printStackTrace();
}
String suffix2 = endDate.substring(2, 4)+endDate.substring(5, 7);
List<HeatanalysisHistory> list1 = baseMapper.getJxHistoryList(heatanalysisHistory);
if(!suffix1.equals(suffix2)){
tableName = "bl_heatanalysis_"+suffix2;
heatanalysisHistory.setTableName(tableName);
List<HeatanalysisHistory> list2 = baseMapper.getJxHistoryList(heatanalysisHistory);
list1.addAll(list2);
}
map.put("list",list1);
return Result.ok(map);
}
}