Browse Source

2024-02-07 IOT的生产数据统计接口,新增HUtool-poi依赖

develop
zhousq 8 months ago
parent
commit
b636dbf59e
  1. 31
      lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiHisReportController.java
  2. 10
      lzbi-module/src/main/java/com/lzbi/bi/domain/LogTimeThreeQueryParamVo.java
  3. 6
      lzbi-module/src/main/java/com/lzbi/bi/mapper/LogTimeScaleThreeMapper.java
  4. 10
      lzbi-module/src/main/java/com/lzbi/code/service/LogTimesacleHistoryThreeService.java
  5. 14
      lzbi-module/src/main/resources/mapper/LogTimeScaleThreeMapper.xml

31
lzbi-module/src/main/java/com/lzbi/bi/controller/DcBusiHisReportController.java

@ -52,8 +52,8 @@ public class DcBusiHisReportController extends BaseController {
* *
* @return 分页数据 * @return 分页数据
*/ */
@GetMapping("/listReport") @PostMapping("/listReport")
public AjaxResult list(@NotNull @RequestBody LogTimeThreeQueryParamVo queryVo) { public AjaxResult list(@RequestBody LogTimeThreeQueryParamVo queryVo) {
String error = validatorator(queryVo); String error = validatorator(queryVo);
if (error != null) { if (error != null) {
return AjaxResult.error(error); return AjaxResult.error(error);
@ -170,13 +170,13 @@ public class DcBusiHisReportController extends BaseController {
} }
} }
private String validatorator(LogTimeThreeQueryParamVo queryVo) { private String validatorator(LogTimeThreeQueryParamVo queryVo) {
if (StringUtils.isEmpty(queryVo.getBeginTime())) { if (StringUtils.isNull(queryVo.getBeginTime())||StringUtils.isEmpty(queryVo.getBeginTime())) {
return "查询失败,开始时间不能为空!"; return "查询失败,开始时间不能为空!";
} }
if (StringUtils.isEmpty(queryVo.getEndTime())) { if (StringUtils.isNull(queryVo.getEndTime())||StringUtils.isEmpty(queryVo.getEndTime())) {
return "查询失败,结束时间不能为空!"; return "查询失败,结束时间不能为空!";
} }
if (StringUtils.isEmpty(queryVo.getQueryParamClass())) { if (StringUtils.isNull(queryVo.getQueryParamClass())||StringUtils.isEmpty(queryVo.getQueryParamClass())) {
return "查询失败,参数类型不能为空!"; return "查询失败,参数类型不能为空!";
} }
return null; return null;
@ -280,8 +280,9 @@ public class DcBusiHisReportController extends BaseController {
} }
private void toExcel(HttpServletResponse response,List<Map<String, Object>> mapList) throws IOException { private void toExcel(HttpServletResponse response,List<Map<String, Object>> mapList) throws IOException {
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); String fileName ="report"+DateUtil.now() + ".xls";
response.setCharacterEncoding("utf-8"); //response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
//response.setCharacterEncoding("utf-8");
ExcelWriter writer = ExcelUtil.getWriter(); ExcelWriter writer = ExcelUtil.getWriter();
// 一次性写出内容,使用默认样式,强制输出标题 // 一次性写出内容,使用默认样式,强制输出标题
//writer.write(mapList, true); //writer.write(mapList, true);
@ -294,7 +295,7 @@ public class DcBusiHisReportController extends BaseController {
//response为HttpServletResponse对象 //response为HttpServletResponse对象
response.setContentType("application/vnd.ms-excel;charset=utf-8"); response.setContentType("application/vnd.ms-excel;charset=utf-8");
//test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码 //test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码
response.setHeader("Content-Disposition", "attachment;filename=换热站数据明细表.xls"); response.setHeader("Content-Disposition", "attachment;filename="+fileName);
ServletOutputStream out = response.getOutputStream(); ServletOutputStream out = response.getOutputStream();
writer.flush(out, true); writer.flush(out, true);
// 关闭writer,释放内存 // 关闭writer,释放内存
@ -302,5 +303,17 @@ public class DcBusiHisReportController extends BaseController {
//此处记得关闭输出Servlet流 //此处记得关闭输出Servlet流
IoUtil.close(out); IoUtil.close(out);
} }
@ApiOperation("获取生产IOT系统参数模版列表")
@GetMapping("/getParamClass")
public AjaxResult getParamClass(){
return AjaxResult.success(logTimesacleHistoryThreeService.selectParamModels()) ;
}
@ApiOperation("获取生产IOT系统设备列表")
@GetMapping("/getDevicie/{orgCode}")
public AjaxResult selectDevices(@PathVariable Long orgCode) {
if(orgCode==0){
return AjaxResult.success(logTimesacleHistoryThreeService.selectDevices(null)) ;
}
return AjaxResult.success(logTimesacleHistoryThreeService.selectDevices(orgCode)) ;
}
} }

10
lzbi-module/src/main/java/com/lzbi/bi/domain/LogTimeThreeQueryParamVo.java

@ -26,11 +26,19 @@ public class LogTimeThreeQueryParamVo {
private String endTime; private String endTime;
/** 中台设备UUID */ /** 中台设备UUID */
@ApiModelProperty(name = "中台设备UUID",notes = "") @ApiModelProperty(name = "中台设备UUID",notes = "")
private List deviceUuids ; private List<String> deviceUuids ;
/** 参数列表 */ /** 参数列表 */
@ApiModelProperty(name = "参数列表",notes = "") @ApiModelProperty(name = "参数列表",notes = "")
private List<String> queryParamCodes ; private List<String> queryParamCodes ;
/** 参数模版列表 */ /** 参数模版列表 */
@ApiModelProperty(name = "参数模版列表",notes = "") @ApiModelProperty(name = "参数模版列表",notes = "")
private List<String> queryParamClass ; private List<String> queryParamClass ;
private Integer pageNum;
private Integer pageSize;
public String getBeginTime() {
return beginTime+" 00:00:00";
}
public String getEndTime() {
return endTime+" 23:59:59";
}
} }

6
lzbi-module/src/main/java/com/lzbi/bi/mapper/LogTimeScaleThreeMapper.java

@ -5,9 +5,11 @@ import com.lzbi.bi.domain.DcDymicHeaderQueryVo;
import com.lzbi.bi.domain.DcDymicReportHeaderVo; import com.lzbi.bi.domain.DcDymicReportHeaderVo;
import com.lzbi.bi.domain.LogTimeThreeQueryParamVo; import com.lzbi.bi.domain.LogTimeThreeQueryParamVo;
import com.lzbi.bi.domain.LogTimescaleHistoryThreeVo; import com.lzbi.bi.domain.LogTimescaleHistoryThreeVo;
import org.apache.ibatis.annotations.MapKey;
import java.util.List; import java.util.List;
import java.util.Map;
@InterceptorIgnore(tenantLine = "true") @InterceptorIgnore(tenantLine = "true")
@ -18,6 +20,10 @@ public interface LogTimeScaleThreeMapper extends BaseMapper<LogTimescaleHistoryT
//List<DeviceHistoryResponseVo> selectVo(DeviceHistoryQueryVo queryVo); //List<DeviceHistoryResponseVo> selectVo(DeviceHistoryQueryVo queryVo);
List<LogTimescaleHistoryThreeVo> selectDetailByQuery(LogTimeThreeQueryParamVo queryVo); List<LogTimescaleHistoryThreeVo> selectDetailByQuery(LogTimeThreeQueryParamVo queryVo);
List<DcDymicReportHeaderVo> selectHeaderInfo(DcDymicHeaderQueryVo queryVo); List<DcDymicReportHeaderVo> selectHeaderInfo(DcDymicHeaderQueryVo queryVo);
@MapKey("code")
List<Map<String,String>> selectParamModels();
@MapKey("code")
List<Map<String,String>> selectDevices(Long orgCode);
} }

10
lzbi-module/src/main/java/com/lzbi/code/service/LogTimesacleHistoryThreeService.java

@ -10,9 +10,12 @@ import com.lzbi.bi.domain.LogTimeThreeQueryParamVo;
import com.lzbi.bi.domain.LogTimescaleHistoryThreeVo; import com.lzbi.bi.domain.LogTimescaleHistoryThreeVo;
import com.lzbi.bi.mapper.LogTimeScaleThreeMapper; import com.lzbi.bi.mapper.LogTimeScaleThreeMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.MapKey;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Map;
@DS("workDB") @DS("workDB")
@Slf4j @Slf4j
@Service @Service
@ -30,4 +33,11 @@ public class LogTimesacleHistoryThreeService extends ServiceImpl<LogTimeScaleThr
public List<DcDymicReportHeaderVo> selectHeaderInfo(DcDymicHeaderQueryVo queryVo){ public List<DcDymicReportHeaderVo> selectHeaderInfo(DcDymicHeaderQueryVo queryVo){
return baseMapper.selectHeaderInfo(queryVo); return baseMapper.selectHeaderInfo(queryVo);
} }
public List<Map<String,String>> selectParamModels(){
return baseMapper.selectParamModels();
}
public List<Map<String,String>> selectDevices(Long orgCode){
return baseMapper.selectDevices(orgCode);
}
} }

14
lzbi-module/src/main/resources/mapper/LogTimeScaleThreeMapper.xml

@ -85,4 +85,18 @@
</if> </if>
ORDER BY a.center_device_code,b.param_code,b.partion ORDER BY a.center_device_code,b.param_code,b.partion
</select> </select>
<select id="selectParamModels" resultType="map">
SELECT param_class_code as code,param_class_name as name from dc_model_paramclass where delete_by is null ORDER BY param_class_code asc
</select>
<select id="selectDevices" resultType="map">
SELECT center_device_code as code,device_name as name
from dc_base_deviceinfo
where delete_by is null
and enabled_flag=true
<if test="orgCode!= null">
and org_code =#{orgCode}
</if>
ORDER BY center_device_code asc
</select>
</mapper> </mapper>
Loading…
Cancel
Save