海南版本提交

This commit is contained in:
hzj
2024-03-13 18:24:38 +08:00
parent 1192b87083
commit 6288e6902c
37 changed files with 1918 additions and 473 deletions

View File

@@ -9,11 +9,10 @@ import com.njcn.advance.pojo.carrycapacity.excel.CarryCapcityDataPEexcel;
import com.njcn.advance.pojo.carrycapacity.excel.CarryCapcityDataQEexcel;
import com.njcn.advance.pojo.carrycapacity.excel.CarryCapcityDataVEexcel;
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityCalParam;
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityEvaluateParam;
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityQueryDataParam;
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDResultVO;
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDataIVO;
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDataQVO;
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDataVO;
import com.njcn.advance.pojo.carrycapacity.param.ExcelDataParam;
import com.njcn.advance.pojo.carrycapacity.vo.*;
import com.njcn.advance.service.carrycapacity.CarryCapcityService;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
@@ -62,6 +61,16 @@ public class CarryCapacityController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, carryCapacityDataVO, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/modelTraining")
@ApiOperation("承载能力评估模型训练")
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
public HttpResult<CarryCapacityDataVO> modelTraining(@RequestBody @Validated CarryCapacityQueryDataParam queryParam) {
String methodDescribe = getMethodDescribe("modelTraining");
CarryCapacityDataVO carryCapacityDataVO = carryCapcityService.modelTraining(queryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, carryCapacityDataVO, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryCarryCapacityQData")
@ApiOperation("承载能力评估数据查询-无功功率")
@@ -102,7 +111,7 @@ public class CarryCapacityController extends BaseController {
}
@ResponseBody
@ApiOperation("导出设备模板")
@ApiOperation("导出数据集模板")
@GetMapping(value = "getExcelTemplate")
public HttpResult<String> getExcelTemplate(HttpServletResponse response) {
final List<Map<String, Object>> sheetsList = Lists.newArrayList();
@@ -116,7 +125,7 @@ public class CarryCapacityController extends BaseController {
sheetsList.add(exportMap);
Map<String, Object> exportMap2 = Maps.newHashMap();
final ExportParams exportParams2 = new ExportParams(null, "电压", ExcelType.HSSF);
final ExportParams exportParams2 = new ExportParams(null, "电压", ExcelType.XSSF);
// 以下3个参数为API中写死的参数名 分别是sheet配置/导出类(注解定义)/数据集
exportMap2.put("title", exportParams2);
exportMap2.put("entity", CarryCapcityDataVEexcel.class);
@@ -125,7 +134,7 @@ public class CarryCapacityController extends BaseController {
sheetsList.add(exportMap2);
Map<String, Object> exportMap3 = Maps.newHashMap();
final ExportParams exportParams3 = new ExportParams(null, "有功功率", ExcelType.HSSF);
final ExportParams exportParams3 = new ExportParams(null, "有功功率", ExcelType.XSSF);
// 以下3个参数为API中写死的参数名 分别是sheet配置/导出类(注解定义)/数据集
exportMap3.put("title", exportParams3);
exportMap3.put("entity", CarryCapcityDataPEexcel.class);
@@ -134,17 +143,17 @@ public class CarryCapacityController extends BaseController {
sheetsList.add(exportMap3);
Map<String, Object> exportMap4 = Maps.newHashMap();
final ExportParams exportParams4 = new ExportParams(null, "无功功率", ExcelType.HSSF);
final ExportParams exportParams4 = new ExportParams(null, "无功功率", ExcelType.XSSF);
// 以下3个参数为API中写死的参数名 分别是sheet配置/导出类(注解定义)/数据集
exportMap4.put("title", exportParams4);
exportMap4.put("entity", CarryCapcityDataQEexcel.class);
exportMap4.put("data", new ArrayList<>());
// 加入多sheet配置列表
sheetsList.add(exportMap4);
Workbook workbook = ExcelExportUtil.exportExcel(sheetsList, ExcelType.HSSF);
Workbook workbook = ExcelExportUtil.exportExcel(sheetsList, ExcelType.XSSF);
String fileName = "数据集.xls";
String fileName = "数据集.xlsx";
ExportParams exportExcel = new ExportParams("数据集", "数据集");
PoiUtil.exportFileByWorkbook(workbook, fileName, response);
@@ -153,5 +162,25 @@ public class CarryCapacityController extends BaseController {
return null;
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/uploadExcel")
@ApiOperation("上传数据集")
public HttpResult<Boolean> uploadExcel(@Validated ExcelDataParam excelDataParam) throws Exception {
String methodDescribe = getMethodDescribe("uploadExcel");
boolean flag = carryCapcityService.uploadExcel(excelDataParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/carryCapacityEvaluate")
@ApiOperation("承载能力评估_充电站、电加热负荷、电气化铁路承载能力评估")
@ApiImplicitParam(name = "calParam", value = "计算参数", required = true)
public HttpResult<CarryCapacityDResultVO> carryCapacityEvaluate(@RequestBody @Validated CarryCapacityEvaluateParam calParam) {
String methodDescribe = getMethodDescribe("carryCapacityEvaluate");
CarryCapacityDResultVO vo = carryCapcityService.carryCapacityEvaluate(calParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
}
}

View File

@@ -0,0 +1,51 @@
package com.njcn.advance.controller.carrycapacity;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityResultParam;
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDResultVO;
import com.njcn.advance.service.carrycapacity.CarryCapacityResultPOService;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author hongawen
* @version 1.0.0
* @date 2023年07月21日 10:06
*/
@RestController
@RequestMapping("result")
@Api(tags = "承载能力评估结果")
@RequiredArgsConstructor
public class CarryCapacityResultController extends BaseController {
private final CarryCapacityResultPOService carryCapacityResultPOService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryResultList")
@ApiOperation("承载能力评估列表查询")
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
public HttpResult<IPage<CarryCapacityDResultVO>> queryResultList(@RequestBody @Validated CarryCapacityResultParam.CarryCapacityResultPageParam queryParam) {
String methodDescribe = getMethodDescribe("queryResultList");
IPage<CarryCapacityDResultVO> vo = carryCapacityResultPOService.queryResultList(queryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
}
}

View File

@@ -74,6 +74,15 @@ public class CarryCapacityUserController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queyDetailUserById")
@ApiOperation("承载能力评估用户查询")
public HttpResult<CarryCapacityUserPO> queyDetailUserById(@RequestParam("userId") String userId) {
String methodDescribe = getMethodDescribe("queyDetailUserById");
CarryCapacityUserPO po = carryCapacityUserPOService.queyDetailUserById(userId);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
}

View File

@@ -1,6 +1,6 @@
package com.njcn.advance.mapper.carrycapacity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityDataPO;
/**
@@ -11,5 +11,5 @@ import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityDataPO;
* @author clam
* @version V1.0.0
*/
public interface CarryCapacityDataPOMapper extends BaseMapper<CarryCapacityDataPO> {
public interface CarryCapacityDataPOMapper extends MppBaseMapper<CarryCapacityDataPO> {
}

View File

@@ -4,9 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityResultPO;
/**
*
* Description:
* Date: 2024/3/1 15:38【需求编号】
* Date: 2024/3/8 16:23【需求编号】
*
* @author clam
* @version V1.0.0

View File

@@ -5,12 +5,17 @@
<!--@mbg.generated-->
<!--@Table carry_capacity_result-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="line_id" jdbcType="VARCHAR" property="lineId" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="start_time" jdbcType="DATE" property="startTime" />
<result column="end_time" jdbcType="DATE" property="endTime" />
<result column="u_t_level" jdbcType="INTEGER" property="uTLevel" />
<result column="pf_t_level" jdbcType="INTEGER" property="pfTLevel" />
<result column="b_t_level" jdbcType="INTEGER" property="bTLevel" />
<result column="i_level" jdbcType="INTEGER" property="iLevel" />
<result column="reslut_level" jdbcType="INTEGER" property="reslutLevel" />
<result column="evaluate_date" jdbcType="DATE" property="evaluateDate" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
@@ -18,7 +23,7 @@
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, u_t_level, pf_t_level, b_t_level, i_level, reslut_level, evaluate_date, create_by,
create_time, update_by, update_time
id, line_id, user_id, start_time, end_time, u_t_level, pf_t_level, b_t_level, i_level,
reslut_level, evaluate_date, `status`, create_by, create_time, update_by, update_time
</sql>
</mapper>

View File

@@ -1,7 +1,7 @@
package com.njcn.advance.service.carrycapacity;
import com.github.jeffreyning.mybatisplus.service.IMppService;
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityDataPO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
*
* Description:
@@ -10,7 +10,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
* @author clam
* @version V1.0.0
*/
public interface CarryCapacityDataPOService extends IService<CarryCapacityDataPO>{
public interface CarryCapacityDataPOService extends IMppService<CarryCapacityDataPO> {
}

View File

@@ -1,8 +1,12 @@
package com.njcn.advance.service.carrycapacity;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityResultParam;
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityResultPO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDResultVO;
/**
*
* Description:
* Date: 2024/3/1 15:38【需求编号】
@@ -13,4 +17,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
public interface CarryCapacityResultPOService extends IService<CarryCapacityResultPO>{
}
IPage<CarryCapacityDResultVO> queryResultList(CarryCapacityResultParam.CarryCapacityResultPageParam queryParam);
}

View File

@@ -20,4 +20,6 @@ public interface CarryCapacityUserPOService extends IService<CarryCapacityUserPO
Boolean updateUser(CarryCapacityUserParam.CarryCapacityUserUpdateParam userUpdateParam);
IPage<CarryCapacityUserPO> queyDetailUser(CarryCapacityUserParam.CarryCapacityUserPageParam pageParm);
CarryCapacityUserPO queyDetailUserById(String userId);
}

View File

@@ -1,11 +1,10 @@
package com.njcn.advance.service.carrycapacity;
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityCalParam;
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityEvaluateParam;
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityQueryDataParam;
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDResultVO;
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDataIVO;
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDataQVO;
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDataVO;
import com.njcn.advance.pojo.carrycapacity.param.ExcelDataParam;
import com.njcn.advance.pojo.carrycapacity.vo.*;
import com.njcn.device.pq.pojo.vo.TerminalTree;
import java.util.List;
@@ -29,4 +28,10 @@ public interface CarryCapcityService {
CarryCapacityDResultVO carryCapacityCal(CarryCapacityCalParam calParam);
List<TerminalTree> carryCapacityTree();
boolean uploadExcel(ExcelDataParam excelDataParam) throws Exception;
CarryCapacityDataVO modelTraining(CarryCapacityQueryDataParam queryParam);
CarryCapacityDResultVO carryCapacityEvaluate(CarryCapacityEvaluateParam calParam);
}

View File

@@ -1,12 +1,10 @@
package com.njcn.advance.service.carrycapacity.impl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityDataPO;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.advance.mapper.carrycapacity.CarryCapacityDataPOMapper;
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityDataPO;
import com.njcn.advance.service.carrycapacity.CarryCapacityDataPOService;
import org.springframework.stereotype.Service;
/**
*
* Description:
@@ -16,6 +14,6 @@ import com.njcn.advance.service.carrycapacity.CarryCapacityDataPOService;
* @version V1.0.0
*/
@Service
public class CarryCapacityDataPOServiceImpl extends ServiceImpl<CarryCapacityDataPOMapper, CarryCapacityDataPO> implements CarryCapacityDataPOService{
public class CarryCapacityDataPOServiceImpl extends MppServiceImpl<CarryCapacityDataPOMapper, CarryCapacityDataPO> implements CarryCapacityDataPOService{
}

View File

@@ -1,10 +1,25 @@
package com.njcn.advance.service.carrycapacity.impl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.advance.mapper.carrycapacity.CarryCapacityResultPOMapper;
import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityResultParam;
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityResultPO;
import com.njcn.advance.pojo.carrycapacity.po.CarryCapacityUserPO;
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityDResultVO;
import com.njcn.advance.service.carrycapacity.CarryCapacityResultPOService;
import com.njcn.advance.service.carrycapacity.CarryCapacityUserPOService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
*
* Description:
@@ -14,6 +29,36 @@ import com.njcn.advance.service.carrycapacity.CarryCapacityResultPOService;
* @version V1.0.0
*/
@Service
@RequiredArgsConstructor
public class CarryCapacityResultPOServiceImpl extends ServiceImpl<CarryCapacityResultPOMapper, CarryCapacityResultPO> implements CarryCapacityResultPOService{
private final CarryCapacityUserPOService carryCapacityUserPOService;
@Override
public IPage<CarryCapacityDResultVO> queryResultList(CarryCapacityResultParam.CarryCapacityResultPageParam queryParam) {
Page<CarryCapacityDResultVO> returnpage = new Page<> (queryParam.getPageNum ( ), queryParam.getPageSize ( ));
Page<CarryCapacityResultPO> temppage = new Page<> (queryParam.getPageNum ( ), queryParam.getPageSize ( ));
QueryWrapper<CarryCapacityResultPO> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(StringUtils.isNotBlank(queryParam.getEvaluateType()) ,CarryCapacityResultPO::getEvaluateType,queryParam.getEvaluateType())
.between(StringUtils.isNotBlank(queryParam.getStartTime()) && StringUtils.isNotBlank(queryParam.getEndTime()) ,CarryCapacityResultPO::getEvaluateDate,queryParam.getStartTime(),queryParam.getEndTime())
.orderByDesc(CarryCapacityResultPO::getEvaluateDate);
IPage<CarryCapacityResultPO> page = this.page(temppage, queryWrapper);
List<CarryCapacityDResultVO> collect = page.getRecords().stream().map(temp -> {
CarryCapacityDResultVO vo = new CarryCapacityDResultVO();
BeanUtils.copyProperties(temp, vo);
String[] split = temp.getUserId().split(",");
List<String> collect1 = Arrays.stream(split).sequential().map(userId -> {
CarryCapacityUserPO carryCapacityUserPO = carryCapacityUserPOService.queyDetailUserById(userId);
return carryCapacityUserPO.getUserName();
}).collect(Collectors.toList());
vo.setUserName(collect1.stream().collect(Collectors.joining(",")));
return vo;
}).collect(Collectors.toList());
returnpage.setRecords(collect);
returnpage.setTotal(page.getTotal());
return returnpage;
}
}

View File

@@ -61,9 +61,15 @@ public class CarryCapacityUserPOServiceImpl extends ServiceImpl<CarryCapacityUse
QueryWrapper<CarryCapacityUserPO> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(StringUtils.isNotBlank(pageParm.getUserId()) ,CarryCapacityUserPO::getUserId,pageParm.getUserId())
.eq(StringUtils.isNotBlank(pageParm.getUserType()) ,CarryCapacityUserPO::getUserType,pageParm.getUserType())
.between(StringUtils.isNotBlank(pageParm.getStartTime()) && StringUtils.isNotBlank(pageParm.getEndTime()) ,CarryCapacityUserPO::getCreateTime,pageParm.getStartTime(),pageParm.getEndTime());
.between(StringUtils.isNotBlank(pageParm.getStartTime()) && StringUtils.isNotBlank(pageParm.getEndTime()) ,CarryCapacityUserPO::getCreateTime,pageParm.getStartTime(),pageParm.getEndTime()).
orderByDesc(CarryCapacityUserPO::getCreateTime);
IPage<CarryCapacityUserPO> page = this.page (returnpage, queryWrapper);
return page;
}
@Override
public CarryCapacityUserPO queyDetailUserById(String userId) {
return this.lambdaQuery().eq(CarryCapacityUserPO::getUserId,userId).one();
}
}

View File

@@ -11,8 +11,8 @@ package com.njcn.advance.utils;
import cn.hutool.core.collection.CollectionUtil;
import java.lang.reflect.Field;
import java.time.Instant;
import java.time.LocalTime;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;
@@ -102,12 +102,27 @@ public class Utils {
}
return result;
}
// 辅助方法:检查时间是否在指定范围内
public static boolean isTimeInRange(Instant instant, LocalTime startTime, LocalTime endTime) {
LocalTime localTime = instant.atZone(Instant.now().atZone(java.time.ZoneId.systemDefault()).getZone()).toLocalTime();
return !localTime.isBefore(startTime) && !localTime.isAfter(endTime);
}
//辅助方法检查时间是否在指定范围内startTimeendTime
public static boolean isTimeInRange(Instant instant, LocalDate startTime, LocalDate endTime) {
// 将Instant对象转换为LocalDateTime对象
LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
// 检查LocalDateTime对象是否在startTime和endTime之间
boolean isInRange = !localDateTime.toLocalDate().isBefore(startTime) && !localDateTime.toLocalDate().isAfter(endTime.plus(1, ChronoUnit.DAYS));
// 返回结果
return isInRange;
}
public static <T> List<Double> getAttributeValueByPropertyName(List<T> list, String propertyName) {
List<Double> resultList = new ArrayList<>();
for (T item : list) {
@@ -121,15 +136,16 @@ public class Utils {
}
return resultList;
}
public static <T> Double getAttributeValueByPropertyName(T item, String propertyName) {
Double result = null;
try {
Field field = item.getClass().getDeclaredField(propertyName);
field.setAccessible(true);
result=(Double) field.get(item);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
try {
Field field = item.getClass().getDeclaredField(propertyName);
field.setAccessible(true);
result=(Double) field.get(item);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
return result;
}
}