数据抽取规则表

This commit is contained in:
曹磊 2024-12-06 17:37:52 +08:00
parent 5ad23519b1
commit b3496bf0a5
9 changed files with 383 additions and 4 deletions

View File

@ -0,0 +1,153 @@
package org.jeecg.modules.heating.controller;
import java.util.Arrays;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.heating.entity.DataExtractConfig;
import org.jeecg.modules.heating.service.DataExtractConfigService;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
* @Description: 数据抽取配置
* @Author: jeecg-boot
* @Date: 2024-12-06
* @Version: V1.0
*/
@Api(tags="数据抽取配置")
@RestController
@RequestMapping("/heating/dataExtractConfig")
@Slf4j
public class DataExtractConfigController extends JeecgController<DataExtractConfig, DataExtractConfigService> {
@Autowired
private DataExtractConfigService dataExtractConfigService;
/**
* 分页列表查询
*
* @param dataExtractConfig
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "数据抽取配置-分页列表查询")
@ApiOperation(value="数据抽取配置-分页列表查询", notes="数据抽取配置-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<DataExtractConfig>> queryPageList(DataExtractConfig dataExtractConfig,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Page<DataExtractConfig> page = new Page<DataExtractConfig>(pageNo, pageSize);
IPage<DataExtractConfig> pageList = dataExtractConfigService.findPage(page, dataExtractConfig);
return Result.OK(pageList);
}
/**
* 添加
*
* @param dataExtractConfig
* @return
*/
@AutoLog(value = "数据抽取配置-添加")
@ApiOperation(value="数据抽取配置-添加", notes="数据抽取配置-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody DataExtractConfig dataExtractConfig) {
dataExtractConfigService.save(dataExtractConfig);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param dataExtractConfig
* @return
*/
@AutoLog(value = "数据抽取配置-编辑")
@ApiOperation(value="数据抽取配置-编辑", notes="数据抽取配置-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody DataExtractConfig dataExtractConfig) {
dataExtractConfigService.updateById(dataExtractConfig);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "数据抽取配置-通过id删除")
@ApiOperation(value="数据抽取配置-通过id删除", notes="数据抽取配置-通过id删除")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
dataExtractConfigService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "数据抽取配置-批量删除")
@ApiOperation(value="数据抽取配置-批量删除", notes="数据抽取配置-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.dataExtractConfigService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "数据抽取配置-通过id查询")
@ApiOperation(value="数据抽取配置-通过id查询", notes="数据抽取配置-通过id查询")
@GetMapping(value = "/queryById")
public Result<DataExtractConfig> queryById(@RequestParam(name="id",required=true) String id) {
DataExtractConfig dataExtractConfig = dataExtractConfigService.getById(id);
if(dataExtractConfig==null) {
return Result.error("未找到对应数据");
}
return Result.OK(dataExtractConfig);
}
/**
* 导出excel
*
* @param request
* @param dataExtractConfig
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, DataExtractConfig dataExtractConfig) {
return super.exportXls(request, dataExtractConfig, DataExtractConfig.class, "数据抽取配置");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, DataExtractConfig.class);
}
}

View File

@ -0,0 +1,68 @@
package org.jeecg.modules.heating.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import org.jeecg.common.system.base.entity.JeecgEntity;
import java.io.Serializable;
/**
* <p>Class :数据抽取配置Entity
* <p>功能描述:功能描述
*/
@Data
@TableName("bl_data_extract_config")
public class DataExtractConfig implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(type = IdType.AUTO)
private Long id;
private String sim; //手机号
private String onePipeSim; //一次网抽取sim卡号
private String onePipeType; //一次网抽取类型 0无 1一次网 2二次网
private String twoPipeSim; //二次网抽取sim卡号
private String twoPipeType; //二次网抽取类型 0无 1一次网 2二次网
private String flag; //是否生效 0失效 1生效
@TableField(exist = false)
private Integer companyId;//热力公司
@TableField(exist = false)
private String company;
@TableField(exist = false)
private Integer sourceId;//热源站
@TableField(exist = false)
private String source;
@TableField(exist = false)
private Integer stationId;//换热站
@TableField(exist = false)
private String station;
@TableField(exist = false)
private Integer oneCompanyId;//一次网热力公司
@TableField(exist = false)
private String oneCompany;
@TableField(exist = false)
private Integer oneSourceId;//一次网热源站
@TableField(exist = false)
private String oneSource;
@TableField(exist = false)
private Integer oneStationId;//一次网换热站
@TableField(exist = false)
private String oneStation;
@TableField(exist = false)
private Integer twoCompanyId;//二次网热力公司
@TableField(exist = false)
private String twoCompany;
@TableField(exist = false)
private Integer twoSourceId;//二次网热源站
@TableField(exist = false)
private String twoSource;
@TableField(exist = false)
private Integer twoStationId;//二次网换热站
@TableField(exist = false)
private String twoStation;
}

View File

@ -77,6 +77,7 @@ public class Heatanalysis extends JeecgEntity {
private String view030; // view030
private String sim; // sim
private String code; // code
private Integer reportType;//上报类型
@TableField(exist = false)
private String SDate;//开始时间

View File

@ -0,0 +1,17 @@
package org.jeecg.modules.heating.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.heating.entity.DataExtractConfig;
/**
* @Description: 数据抽取配置
* @Author: jeecg-boot
* @Date: 2024-12-06
* @Version: V1.0
*/
public interface DataExtractConfigMapper extends BaseMapper<DataExtractConfig> {
Page<DataExtractConfig> findPage(Page<DataExtractConfig> page, @Param("params") DataExtractConfig dataExtractConfig);
}

View File

@ -0,0 +1,97 @@
<?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="org.jeecg.modules.heating.mapper.DataExtractConfigMapper">
<select id="findPage" resultType="org.jeecg.modules.heating.entity.DataExtractConfig">
SELECT
a.id,
a.sim,
a.one_pipe_sim,
a.one_pipe_type,
a.two_pipe_sim,
a.two_pipe_type,
a.flag,
b.company_company_id as companyId,
tc.company_name as company,
b.source_source_id as sourceId,
hs.source_name as source,
b.station_station_id as stationId,
hss.station_name as station,
t2.companyId as oneCompanyId,
t2.company as oneCompany,
t2.sourceId as oneSourceId,
t2.source as oneSource,
t2.stationId as oneStationId,
t2.station as oneStation,
t3.companyId as twoCompanyId,
t3.company as twoCompany,
t3.sourceId as twoSourceId,
t3.source as twoSource,
t3.stationId as twoStationId,
t3.station as twoStation
FROM bl_data_extract_config a
left join simconfig b on a.sim = b.sim
left join thermalcompany tc on tc.id = b.company_company_id
left join heatsource hs on hs.id = b.source_source_id
left join heatsourcestation hss on hss.id = b.station_station_id
left join (
select
b.sim,
b.company_company_id as companyId,
tc.company_name as company,
b.source_source_id as sourceId,
hs.source_name as source,
b.station_station_id as stationId,
hss.station_name as station
from simconfig b
left join thermalcompany tc on tc.id = b.company_company_id
left join heatsource hs on hs.id = b.source_source_id
left join heatsourcestation hss on hss.id = b.station_station_id
) t2 on a.one_pipe_sim = t2.sim
left join (
select
b.sim,
b.company_company_id as companyId,
tc.company_name as company,
b.source_source_id as sourceId,
hs.source_name as source,
b.station_station_id as stationId,
hss.station_name as station
from simconfig b
left join thermalcompany tc on tc.id = b.company_company_id
left join heatsource hs on hs.id = b.source_source_id
left join heatsourcestation hss on hss.id = b.station_station_id
) t3 on a.two_pipe_sim = t3.sim
<where>
<if test="params.sim != null and params.sim != ''">
AND a.sim = #{params.sim}
</if>
<if test="params.companyId != null and params.companyId != ''">
AND b.company_company_id = #{params.companyId}
</if>
<if test="params.sourceId != null and params.sourceId != ''">
AND b.source_source_id = #{params.sourceId}
</if>
<if test="params.stationId != null and params.stationId != ''">
AND b.station_station_id = #{params.stationId}
</if>
<if test="params.onePipeSim != null and params.onePipeSim != ''">
AND a.one_pipe_sim = #{params.onePipeSim}
</if>
<if test="params.onePipeType != null and params.onePipeType != ''">
AND a.one_pipe_type = #{params.onePipeType}
</if>
<if test="params.twoPipeSim != null and params.twoPipeSim != ''">
AND a.two_pipe_sim = #{params.twoPipeSim}
</if>
<if test="params.twoPipeType != null and params.twoPipeType != ''">
AND a.two_pipe_type = #{params.twoPipeType}
</if>
<if test="params.flag != null and params.flag != ''">
AND a.flag = #{params.flag}
</if>
</where>
ORDER BY b.company_company_id,b.source_source_id,b.station_station_id
</select>
</mapper>

View File

@ -194,11 +194,11 @@
SELECT *
FROM HEATANALYSIS a
where a.del_flag = #{DEL_FLAG_NORMAL}
and a.create_by = '-1'
and a.report_type = 2
</select>
<insert id="exeProc">
CALL P_Q_D_HEATANALYSIS_SIMULATE(#{code}, #{sim}, #{datatime}, #{view005}, #{view006}, #{view007}, #{view008}, #{view009}, #{view010}, #{view011}, #{view012})
CALL P_Q_D_HEATANALYSIS_SIMULATE_NEW(#{code}, #{sim}, #{datatime}, #{view005}, #{view006}, #{view007}, #{view008}, #{view009}, #{view010}, #{view011}, #{view012})
</insert>
<select id="lowest" resultType="org.jeecg.modules.heating.entity.Heatanalysis">

View File

@ -0,0 +1,16 @@
package org.jeecg.modules.heating.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.heating.entity.DataExtractConfig;
/**
* @Description: 数据抽取配置
* @Author: jeecg-boot
* @Date: 2024-12-06
* @Version: V1.0
*/
public interface DataExtractConfigService extends IService<DataExtractConfig> {
IPage<DataExtractConfig> findPage(Page<DataExtractConfig> page, DataExtractConfig dataExtractConfig);
}

View File

@ -0,0 +1,27 @@
package org.jeecg.modules.heating.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.heating.entity.DataExtractConfig;
import org.jeecg.modules.heating.mapper.DataExtractConfigMapper;
import org.jeecg.modules.heating.service.DataExtractConfigService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 数据抽取配置
* @Author: jeecg-boot
* @Date: 2024-12-06
* @Version: V1.0
*/
@Service
@DS("multi-datasource1")
public class DataExtractConfigServiceImpl extends ServiceImpl<DataExtractConfigMapper, DataExtractConfig> implements DataExtractConfigService {
public IPage<DataExtractConfig> findPage(Page<DataExtractConfig> page, DataExtractConfig dataExtractConfig){
return baseMapper.findPage(page,dataExtractConfig);
}
}

View File

@ -21,7 +21,7 @@
FROM
${tableName}
WHERE
code = '868065074569587'
code = '867896071477072'
ORDER BY
report_time DESC
LIMIT 1
@ -34,7 +34,7 @@
concat(DATE_FORMAT(now(), '%Y-%m-%d %H'),':00') reportTime
FROM ${tableName}
<where>
code = '868065074569587'
code = '867896071477072'
<if test="SDate != null and SDate != ''">
AND report_time >= #{SDate}
</if>