风俗功率曲线
This commit is contained in:
parent
184b6e7394
commit
693908cc4f
@ -3,12 +3,12 @@ package com.das.modules.curve.controller;
|
|||||||
import cn.dev33.satoken.stp.StpUtil;
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import com.alibaba.excel.EasyExcel;
|
import com.alibaba.excel.EasyExcel;
|
||||||
import com.alibaba.excel.read.builder.ExcelReaderBuilder;
|
import com.alibaba.excel.read.builder.ExcelReaderBuilder;
|
||||||
import com.alibaba.excel.read.metadata.ReadSheet;
|
|
||||||
import com.das.common.constant.SysAuthorityIds;
|
import com.das.common.constant.SysAuthorityIds;
|
||||||
import com.das.common.result.R;
|
import com.das.common.result.R;
|
||||||
import com.das.common.utils.PageDataInfo;
|
import com.das.common.utils.PageDataInfo;
|
||||||
import com.das.common.utils.PageQuery;
|
import com.das.common.utils.PageQuery;
|
||||||
import com.das.modules.curve.domain.dto.TheoreticalPowerCurveDto;
|
import com.das.modules.curve.domain.dto.TheoreticalPowerCurveDto;
|
||||||
|
import com.das.modules.curve.domain.entity.CurveItemEntity;
|
||||||
import com.das.modules.curve.domain.entity.TheoreticalPowerCurveEntity;
|
import com.das.modules.curve.domain.entity.TheoreticalPowerCurveEntity;
|
||||||
import com.das.modules.curve.domain.excel.CurveItemExcel;
|
import com.das.modules.curve.domain.excel.CurveItemExcel;
|
||||||
import com.das.modules.curve.listener.CurveItemListener;
|
import com.das.modules.curve.listener.CurveItemListener;
|
||||||
@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.ParseException;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 风速功率曲线controller
|
* 风速功率曲线controller
|
||||||
@ -66,8 +66,7 @@ public class TheoreticalPowerCurveController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除设备类型
|
* 阐述制造商
|
||||||
* @return 所有的设备类型
|
|
||||||
*/
|
*/
|
||||||
@PostMapping("/delete")
|
@PostMapping("/delete")
|
||||||
public R<Void> deleteTheoreticalPowerCurve(@RequestBody TheoreticalPowerCurveDto theoreticalPowerCurveDto) {
|
public R<Void> deleteTheoreticalPowerCurve(@RequestBody TheoreticalPowerCurveDto theoreticalPowerCurveDto) {
|
||||||
@ -80,31 +79,37 @@ public class TheoreticalPowerCurveController {
|
|||||||
return R.success();
|
return R.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询制造商信息
|
||||||
|
* @param id 制造商id
|
||||||
|
* @return 制造商信息
|
||||||
|
*/
|
||||||
@GetMapping("/queryById")
|
@GetMapping("/queryById")
|
||||||
public R<TheoreticalPowerCurveEntity> queryTheoreticalPowerCurveById(String id) {
|
public R<TheoreticalPowerCurveEntity> queryTheoreticalPowerCurveById(String id) {
|
||||||
return R.success(theoreticalPowerCurveService.queryTheoreticalPowerCurveById(id));
|
return R.success(theoreticalPowerCurveService.queryTheoreticalPowerCurveById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备类型列表
|
* 查询所有制造商
|
||||||
* @return 所有的设备类型
|
* @return 所有制造商
|
||||||
*/
|
*/
|
||||||
@PostMapping("/query")
|
@PostMapping("/query")
|
||||||
public PageDataInfo<TheoreticalPowerCurveEntity> queryAllCurve(@RequestBody PageQuery pageQuery) {
|
public PageDataInfo<TheoreticalPowerCurveEntity> queryAllCurve(@RequestBody PageQuery pageQuery) {
|
||||||
return theoreticalPowerCurveService.getAllCurves(pageQuery);
|
return theoreticalPowerCurveService.getAllCurves(pageQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 速度功率曲线导出
|
||||||
|
*/
|
||||||
/** 设备导出 */
|
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void exportTheoreticalPowerCurve(@RequestBody TheoreticalPowerCurveDto theoreticalPowerCurveDto, HttpServletRequest request, HttpServletResponse response) {
|
public void exportTheoreticalPowerCurve(@RequestBody TheoreticalPowerCurveDto theoreticalPowerCurveDto, HttpServletRequest request, HttpServletResponse response) {
|
||||||
theoreticalPowerCurveService.exportTheoreticalPowerCurve(theoreticalPowerCurveDto,request, response);
|
theoreticalPowerCurveService.exportTheoreticalPowerCurve(theoreticalPowerCurveDto,request, response);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 设备导入 */
|
/**
|
||||||
|
* 速度功率曲线导入
|
||||||
|
*/
|
||||||
@PostMapping("/import")
|
@PostMapping("/import")
|
||||||
public R<Void> importSysIotModel(String id, @RequestParam("file") MultipartFile file) throws IOException {
|
public R<Void> importSysIotModel(String id, @RequestParam("file") MultipartFile file) throws IOException {
|
||||||
curveItemListener.setParent(Long.valueOf(id));
|
curveItemListener.setParent(Long.valueOf(id));
|
||||||
@ -112,4 +117,14 @@ public class TheoreticalPowerCurveController {
|
|||||||
read.sheet().doRead();
|
read.sheet().doRead();
|
||||||
return R.success("导入成功");
|
return R.success("导入成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据制造商id查询速度功率曲线
|
||||||
|
* @return 速度功率曲线
|
||||||
|
*/
|
||||||
|
@GetMapping("/queryItemByParent")
|
||||||
|
public R<List<CurveItemEntity>> queryAllCurve(String id) {
|
||||||
|
List<CurveItemEntity> curveItemEntityList = theoreticalPowerCurveService.queryCurveItemByParent(id);
|
||||||
|
return R.success(curveItemEntityList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,12 @@ package com.das.modules.curve.service;
|
|||||||
import com.das.common.utils.PageDataInfo;
|
import com.das.common.utils.PageDataInfo;
|
||||||
import com.das.common.utils.PageQuery;
|
import com.das.common.utils.PageQuery;
|
||||||
import com.das.modules.curve.domain.dto.TheoreticalPowerCurveDto;
|
import com.das.modules.curve.domain.dto.TheoreticalPowerCurveDto;
|
||||||
|
import com.das.modules.curve.domain.entity.CurveItemEntity;
|
||||||
import com.das.modules.curve.domain.entity.TheoreticalPowerCurveEntity;
|
import com.das.modules.curve.domain.entity.TheoreticalPowerCurveEntity;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface TheoreticalPowerCurveService {
|
public interface TheoreticalPowerCurveService {
|
||||||
PageDataInfo<TheoreticalPowerCurveEntity> getAllCurves(PageQuery pageQuery);
|
PageDataInfo<TheoreticalPowerCurveEntity> getAllCurves(PageQuery pageQuery);
|
||||||
@ -21,5 +23,7 @@ public interface TheoreticalPowerCurveService {
|
|||||||
|
|
||||||
void exportTheoreticalPowerCurve(TheoreticalPowerCurveDto theoreticalPowerCurveDto, HttpServletRequest request, HttpServletResponse response);
|
void exportTheoreticalPowerCurve(TheoreticalPowerCurveDto theoreticalPowerCurveDto, HttpServletRequest request, HttpServletResponse response);
|
||||||
|
|
||||||
|
List<CurveItemEntity> queryCurveItemByParent(String id);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,11 @@ public class TheoreticalPowerCurveServiceImpl implements TheoreticalPowerCurveSe
|
|||||||
if (theoreticalPowerCurveDto.getId() == null){
|
if (theoreticalPowerCurveDto.getId() == null){
|
||||||
throw new ServiceException("参数缺失");
|
throw new ServiceException("参数缺失");
|
||||||
}
|
}
|
||||||
|
|
||||||
//删除关联曲线数据
|
//删除关联曲线数据
|
||||||
|
QueryWrapper<CurveItemEntity> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("PARENT",theoreticalPowerCurveDto.getId());
|
||||||
|
curveItemMapper.delete(queryWrapper);
|
||||||
|
|
||||||
//删除制造商数据
|
//删除制造商数据
|
||||||
theoreticalPowerCurveMapper.deleteById(theoreticalPowerCurveDto.getId());
|
theoreticalPowerCurveMapper.deleteById(theoreticalPowerCurveDto.getId());
|
||||||
@ -121,6 +125,15 @@ public class TheoreticalPowerCurveServiceImpl implements TheoreticalPowerCurveSe
|
|||||||
HuExcelUtils.exportExcel(response, exportList, theoreticalPowerCurve.getMadeinfactory()+theoreticalPowerCurve.getModel()+"理论功率");
|
HuExcelUtils.exportExcel(response, exportList, theoreticalPowerCurve.getMadeinfactory()+theoreticalPowerCurve.getModel()+"理论功率");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CurveItemEntity> queryCurveItemByParent(String id) {
|
||||||
|
QueryWrapper<CurveItemEntity> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("PARENT",Long.valueOf(id));
|
||||||
|
queryWrapper.orderByAsc("SPEED");
|
||||||
|
List<CurveItemEntity> curveItemEntityList = curveItemMapper.selectList(queryWrapper);
|
||||||
|
return curveItemEntityList;
|
||||||
|
}
|
||||||
|
|
||||||
public void batchProcessing(List<CurveItemEntity> curveItemList, Long parent){
|
public void batchProcessing(List<CurveItemEntity> curveItemList, Long parent){
|
||||||
//先删除制造商数据
|
//先删除制造商数据
|
||||||
QueryWrapper<CurveItemEntity> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<CurveItemEntity> queryWrapper = new QueryWrapper<>();
|
||||||
@ -137,6 +150,5 @@ public class TheoreticalPowerCurveServiceImpl implements TheoreticalPowerCurveSe
|
|||||||
item.setRevision(1);
|
item.setRevision(1);
|
||||||
curveItemMapper.insert(item);
|
curveItemMapper.insert(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user