Browse Source

#大模型发电量

zhongwei
yang_shj 8 months ago
parent
commit
b8ad77fa36
  1. 2
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java
  2. 3
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java
  3. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmParamMapper.java
  4. 1
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java
  5. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/controller/GenerateController.java
  6. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/feign/GenerateClient.java
  7. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/GenerateService.java
  8. 28
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java

2
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java

@ -175,5 +175,5 @@ public interface IEmInfoClient {
R<List<EmInfoEntity>> emInfoList(EmInfoEntity req); R<List<EmInfoEntity>> emInfoList(EmInfoEntity req);
@GetMapping(RIDE_DEVICES) @GetMapping(RIDE_DEVICES)
List<RideDeviceVo> rideDevices(List<Long> longs); List<RideDeviceVo> rideDevices(@RequestParam("deptIds") List<Long> deptIds);
} }

3
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java

@ -157,7 +157,8 @@ public class EmInfoClient implements IEmInfoClient {
} }
@Override @Override
public List<RideDeviceVo> rideDevices(List<Long> deptIds) { @GetMapping(RIDE_DEVICES)
public List<RideDeviceVo> rideDevices(@RequestParam("deptIds") List<Long> deptIds) {
return service.rideDevices(deptIds); return service.rideDevices(deptIds);
} }

2
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmParamMapper.java

@ -19,5 +19,5 @@ public interface EmParamMapper extends UserDataScopeBaseMapper<EmParamEntity> {
List<EmParamEntity> selectRideCountGroupEmIdByDepts(@Param("list") List<Long> list); List<EmParamEntity> selectRideCountGroupEmIdByDepts(@Param("list") List<Long> list);
List<EmParamEntity> rides(List<Long> deviceIds); List<EmParamEntity> rides(@Param("deviceIds") List<Long> deviceIds);
} }

1
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java

@ -347,7 +347,6 @@ public class InteractiveServiceImpl implements IInteractiveService {
if(CollectionUtil.isEmpty(devices)){ if(CollectionUtil.isEmpty(devices)){
return fill; return fill;
} }
// 步骤4.遍历设备查询发电量 // 步骤4.遍历设备查询发电量
// 监控线程执行完后返回结果 // 监控线程执行完后返回结果
CountDownLatch countDownLatch = new CountDownLatch(devices.size()); CountDownLatch countDownLatch = new CountDownLatch(devices.size());

9
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/controller/GenerateController.java

@ -80,4 +80,13 @@ public class GenerateController extends BladeController {
return service.pageCondition(filter, query); return service.pageCondition(filter, query);
} }
/**
* 新增
*/
@PostMapping("/test")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "测试发电量保存", notes = "传入InsertPowerEntity对象")
public R test(@RequestBody GenerateEntity entity) {
return R.status(service.test(entity));
}
} }

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/feign/GenerateClient.java

@ -7,6 +7,7 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
@ -24,11 +25,13 @@ public class GenerateClient implements IGenerateClient {
@Override @Override
@GetMapping(STATION_GENERATE_BY_TIME) @GetMapping(STATION_GENERATE_BY_TIME)
public Double stationGenerateByTime(String stationId, String startTime, String endTime) { public Double stationGenerateByTime(@RequestParam("stationId") String stationId,
@RequestParam("startTime") String startTime,
@RequestParam("endTime") String endTime) {
List<GenerateEntity> generates = generateService.list(Wrappers.<GenerateEntity>lambdaQuery() List<GenerateEntity> generates = generateService.list(Wrappers.<GenerateEntity>lambdaQuery()
.eq(GenerateEntity::getStationCode,stationId) .eq(GenerateEntity::getStationCode,stationId)
.ge(GenerateEntity::getFillDate,startTime) .ge(GenerateEntity::getFillDate,startTime)
.le(GenerateEntity::getGenerate,endTime) .le(GenerateEntity::getFillDate,endTime)
); );
if(CollectionUtil.isEmpty(generates)){ if(CollectionUtil.isEmpty(generates)){
return 0.0; return 0.0;

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/GenerateService.java

@ -37,4 +37,6 @@ public interface GenerateService extends BaseService<GenerateEntity> {
List<PowerMonthVo> generateThreeYear(String start, String end, String station); List<PowerMonthVo> generateThreeYear(String start, String end, String station);
List<PowerMonthVo> fillPowerMon(String code); List<PowerMonthVo> fillPowerMon(String code);
boolean test(GenerateEntity entity);
} }

28
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java

@ -26,10 +26,7 @@ import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.*;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -246,6 +243,29 @@ public class GenerateServiceImpl extends BaseServiceImpl<GenerateMapper, Generat
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
@Override
public boolean test(GenerateEntity entity) {
Calendar calendar = Calendar.getInstance();
Date end = calendar.getTime();
calendar.add(Calendar.MONTH,-calendar.get(Calendar.MONTH));
calendar.add(Calendar.MONTH,-calendar.get(Calendar.MONTH));
calendar.add(Calendar.DAY_OF_MONTH,-calendar.get(Calendar.DAY_OF_MONTH));
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND));
Random random = new Random();
Date start = calendar.getTime();
while (end.compareTo(start) > 0){
entity.setId(null);
entity.setFillDate(DateUtil.format(start,DateUtil.PATTERN_DATE));
entity.setGenerate((random.nextDouble() * 10000) + 50000);
this.save(entity);
calendar.add(Calendar.DAY_OF_MONTH,1);
start = calendar.getTime();
}
return true;
}
/** /**
* 获取近年月份集合 * 获取近年月份集合

Loading…
Cancel
Save