Commit de0b467f authored by zhoushiguang's avatar zhoushiguang

Merge remote-tracking branch 'origin/master'

parents 72a746a6 3e539f29
......@@ -12,9 +12,8 @@ import java.util.Objects;
@Getter
@AllArgsConstructor
public enum OptStatusEnum {
ZERO(0, "未优化"),
ONE(1, "优化中"),
TWO(2, "优化完");
ZERO(0, "正常"),
ONE(1, "优化中");
private Integer code;
private String desc;
......
......@@ -130,25 +130,30 @@ public class CrossIndexServiceImpl implements CrossIndexService {
aiOptResultVO.setId(resultEntity.getCrossId());
aiOptResultVO.setName(resultEntity.getCrossName());
Integer currentAlgo = resultEntity.getCurrentAlgo();
aiOptResultVO.setStrategy(currentAlgo);
// 失衡 均衡调控,其他效率提升
aiOptResultVO.setOptMethod(Objects.equals(1, currentAlgo) ? StrategyControlEnum.ONE.getMethod() : StrategyControlEnum.TWO.getMethod());
// 失衡 优化中,15分钟内,优化中,其他,优化完
aiOptResultVO.setOptStatus(OptStatusEnum.TWO.getCode());
if (Objects.equals(1, currentAlgo)) {
if (Objects.nonNull(currentAlgo)) {
aiOptResultVO.setStrategy(currentAlgo);
// 失衡 均衡调控,其他效率提升
aiOptResultVO.setOptMethod(Objects.equals(1, currentAlgo) ? StrategyControlEnum.ONE.getMethod() : StrategyControlEnum.TWO.getMethod());
// 失衡 优化中,15分钟内,优化中,其他,优化完
aiOptResultVO.setOptStatus(OptStatusEnum.ZERO.getCode());
Date issueTimeDate = resultEntity.getIssueTime();
//Date issueTimeDate = DateUtils.parseDate(issueTime);
Integer countDown = Objects.isNull(resultEntity.getCountDown()) ? 0 : resultEntity.getCountDown();
long optTime = issueTimeDate.getTime();
long currentTimeMillis = System.currentTimeMillis();
long offset = currentTimeMillis - optTime;
if (offset <= 15 * 60 * 1000) {
aiOptResultVO.setOptStatus(OptStatusEnum.ONE.getCode());
long offset = (currentTimeMillis - optTime) / 1000;
if (Objects.equals(1, currentAlgo)) {
if (offset <= 15 * 60 * 1000) {
aiOptResultVO.setOptStatus(OptStatusEnum.ONE.getCode());
}
} else {
if (offset <= countDown ) {
aiOptResultVO.setOptStatus(OptStatusEnum.ONE.getCode());
}
}
}
aiOptResultVO.setOptStatusName(Objects.equals(1, currentAlgo) ? OptStatusEnum.ONE.getDesc() : OptStatusEnum.TWO.getDesc());
if (Objects.isNull(currentAlgo)) {
aiOptResultVO.setOptStatus(-1);
aiOptResultVO.setOptStatusName(OptStatusEnum.ZERO.getDesc());
aiOptResultVO.setOptStatusName(OptStatusEnum.getDesc(aiOptResultVO.getOptStatus()));
} else {
aiOptResultVO.setOptStatus(OptStatusEnum.ZERO.getCode());
aiOptResultVO.setOptStatusName(OptStatusEnum.getDesc(aiOptResultVO.getOptStatus()));
}
results.add(aiOptResultVO);
}
......
......@@ -15,6 +15,8 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.ws.rs.core.MediaType;
import java.util.Arrays;
import java.util.List;
/**
* @author duanruiming
......@@ -182,6 +184,19 @@ public class StrategyControlController {
@ApiResponse(code = 200, message = "OK", response = StrategyFactoryEntity.class),
})
public JsonViewObject strategyFactoryDel(@Param("id") Integer id) throws Exception {
return strategyControlService.strategyFactoryDel(id);
return strategyControlService.strategyFactoryDel(Arrays.asList(id));
}
@ApiOperation(value = "策略管理计划批量删除", notes = "策略管理计划批量删除",
response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/strategyFactoryDelList")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = StrategyFactoryEntity.class),
})
public JsonViewObject strategyFactoryDelList(@RequestBody List<Integer> ids) throws Exception {
return strategyControlService.strategyFactoryDel(ids);
}
}
......@@ -3,10 +3,11 @@ package net.wanji.opt.synthesis.service;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.synthesis.pojo.StrategyControlDataEntity;
import net.wanji.opt.synthesis.pojo.StrategyControlDetailList;
import net.wanji.opt.synthesis.pojo.vo.StrategyControlVO;
import net.wanji.opt.synthesis.pojo.StrategyFactoryEntity;
import net.wanji.opt.synthesis.pojo.vo.StrategyControlVO;
import net.wanji.opt.synthesis.pojo.vo.StrategyFactoryQueryVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author duanruiming
......@@ -16,15 +17,24 @@ public interface StrategyControlService {
JsonViewObject strategyInfoOperation(StrategyControlVO strategyControlVO) throws Exception;
JsonViewObject strategyInfoPageList(StrategyControlDataEntity entity) throws Exception;
JsonViewObject crossStrategyInfoList(Integer type) throws Exception;
JsonViewObject strategyOptTimes() throws Exception;
JsonViewObject crossStrategyHistList(Integer strategyType, Integer groupType, Integer resultType) throws Exception;
JsonViewObject crossOptInfoList(Integer type) throws Exception;
JsonViewObject strategyPlanDetail(String crossId) throws Exception;
JsonViewObject strategyPush(StrategyControlDetailList list) throws Exception;
JsonViewObject strategyPlanSave(StrategyControlDetailList list) throws Exception;
JsonViewObject strategyFactoryList(StrategyFactoryQueryVO vo) throws Exception;
JsonViewObject strategyFactorySave(StrategyFactoryEntity entity) throws Exception;
JsonViewObject strategyFactoryDel(Integer id) throws Exception;
JsonViewObject strategyFactoryDel(List<Integer> ids) throws Exception;
}
......@@ -913,12 +913,12 @@ public class StrategyControlServiceImpl implements StrategyControlService {
}
@Override
public JsonViewObject strategyFactoryDel(Integer id) throws Exception {
public JsonViewObject strategyFactoryDel(List<Integer> ids) throws Exception {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
StrategyFactoryEntity strategyFactoryEntity = new StrategyFactoryEntity();
strategyFactoryEntity.setId(id);
strategyFactoryMapper.deleteById(strategyFactoryEntity);
if (!CollectionUtils.isEmpty(ids)) {
strategyFactoryMapper.deleteBatchIds(ids);
}
} catch (Exception e) {
log.error("策略库策略删除失败:{}", e);
jsonViewObject.success("策略库策略删除失败");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment