Commit 3bf9fc65 authored by zhouleilei's avatar zhouleilei

Merge remote-tracking branch 'origin/master'

parents e1876760 b5a033ef
...@@ -10,7 +10,8 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; ...@@ -10,7 +10,8 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
/** /**
* @author * @author
*/ */
@SpringBootApplication(scanBasePackages = {"net.wanji.opt", "net.wanji.databus", "net.wanji.common"}) @SpringBootApplication(scanBasePackages = {"net.wanji.opt", "net.wanji.databus", "net.wanji.common",
"net.wanji.opt.controller","net.wanji.opt.synthesis.controller"})
@MapperScan(basePackages = {"net.wanji.opt.dao.mapper", "net.wanji.databus.dao.mapper"}) @MapperScan(basePackages = {"net.wanji.opt.dao.mapper", "net.wanji.databus.dao.mapper"})
@EnableTransactionManagement @EnableTransactionManagement
@EnableScheduling @EnableScheduling
......
package net.wanji.opt.config; package net.wanji.opt.config;
import com.google.common.base.Predicates;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.ApiInfoBuilder;
...@@ -21,7 +22,8 @@ public class Swagger2 { ...@@ -21,7 +22,8 @@ public class Swagger2 {
.apiInfo(apiInfo()) .apiInfo(apiInfo())
.select() .select()
//为当前包路径 //为当前包路径
.apis(RequestHandlerSelectors.basePackage("net.wanji.opt.controller")) .apis(Predicates.or(RequestHandlerSelectors.basePackage("net.wanji.opt.controller"),
RequestHandlerSelectors.basePackage("net.wanji.opt.synthesis.controller")))
.paths(PathSelectors.any()) .paths(PathSelectors.any())
.build(); .build();
} }
......
package net.wanji.opt.dao.mapper; package net.wanji.opt.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.wanji.opt.po.StrategyControlDataEntity; import net.wanji.opt.synthesis.pojo.StrategyControlDataEntity;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
......
package net.wanji.opt.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.wanji.opt.synthesis.pojo.StrategyDailyPlanInfoEntity;
/**
* @author duanruiming
* @date 2024/11/08 10:15
*/
public interface StrategyDailyPlanInfoMapper extends BaseMapper<StrategyDailyPlanInfoEntity> {
}
package net.wanji.opt.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.wanji.opt.synthesis.pojo.StrategyPlanInfoEntity;
/**
* @author duanruiming
* @date 2024/11/08 10:14
*/
public interface StrategyPlanInfoMapper extends BaseMapper<StrategyPlanInfoEntity> {
}
...@@ -6,13 +6,12 @@ import io.swagger.annotations.ApiResponse; ...@@ -6,13 +6,12 @@ import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponses;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.dao.mapper.SynthesisOptimizeLogInfoMapper; import net.wanji.opt.dao.mapper.SynthesisOptimizeLogInfoMapper;
import net.wanji.opt.po.StrategyControlDataEntity; import net.wanji.opt.synthesis.pojo.StrategyControlDataEntity;
import net.wanji.opt.synthesis.pojo.StrategyControlDetailList;
import net.wanji.opt.synthesis.pojo.StrategyControlVO; import net.wanji.opt.synthesis.pojo.StrategyControlVO;
import net.wanji.opt.synthesis.service.StrategyControlService; import net.wanji.opt.synthesis.service.StrategyControlService;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
...@@ -56,4 +55,37 @@ public class StrategyControlController { ...@@ -56,4 +55,37 @@ public class StrategyControlController {
return strategyControlService.strategyInfoPageList(entity); return strategyControlService.strategyInfoPageList(entity);
} }
@ApiOperation(value = "策略控制查询列表", notes = "策略控制查询列表",
response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/crossStrategyInfoList")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = StrategyControlDataEntity.class),
})
public JsonViewObject crossStrategyInfoList(@RequestParam Integer type) throws Exception {
return strategyControlService.crossStrategyInfoList(type);
}
@ApiOperation(value = "策略管理计划详情查询", notes = "策略管理计划详情查询",
response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/strategyPlanDetail")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = StrategyControlDetailList.class),
})
public JsonViewObject strategyPlanDetail(@RequestParam String crossId) throws Exception {
return strategyControlService.strategyPlanDetail(crossId);
}
@ApiOperation(value = "策略管理计划保存", notes = "策略管理计划列表查询",
response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/strategyPlanSave",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = StrategyControlDetailList.class),
})
public JsonViewObject strategyPlanSave(@RequestBody @Validated StrategyControlDetailList list) throws Exception {
return strategyControlService.strategyPlanSave(list);
}
} }
package net.wanji.opt.po; package net.wanji.opt.synthesis.pojo;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
......
...@@ -35,6 +35,8 @@ public class StrategyControlDataVO { ...@@ -35,6 +35,8 @@ public class StrategyControlDataVO {
private Integer status; private Integer status;
@ApiModelProperty(value = "操作(insert=新增,update=更新,delete=删除)") @ApiModelProperty(value = "操作(insert=新增,update=更新,delete=删除)")
private String action; private String action;
@ApiModelProperty(value = "模式1定时任务 2自适应")
private Integer model;
@Data @Data
@NoArgsConstructor @NoArgsConstructor
......
package net.wanji.opt.synthesis.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.util.Date;
import java.util.List;
/**
* @author duanruiming
* @date 2024/11/08 0:24
*/
@Data
public class StrategyControlDetailList {
private String crossId;
@NotEmpty
private List<ExecutePlan> plans;
@NotEmpty
private List<DailyPlan> dailyPlans;
@Data
public static class ExecutePlan {
private String crossId;
private Integer type;
private Integer planId;
private String company;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date endTime;
private List<PlanDetail> planDetails;
@Data
public static class PlanDetail {
private Integer dailyPlanId;
private List<Integer> weeks;
}
}
@Data
public static class DailyPlan {
private String crossId;
private Integer dailyPlanId;
private List<DailyPlanDetail> dailyPlanDetails;
@Data
public static class DailyPlanDetail {
private Integer strategy;
private List<String> times;
}
}
}
package net.wanji.opt.synthesis.pojo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author duanruiming
* @date 2024/11/08 10:10
*/
@TableName("t_strategy_daily_plan_info")
@ApiModel(value = "StrategyDailyPlanInfoEntity", description = "策略管理日计划管理实体")
@Data
public class StrategyDailyPlanInfoEntity {
@ApiModelProperty("id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty("dailyPlanId")
@TableField("daily_plan_id")
private Integer dailyPlanId;
@ApiModelProperty("crossId")
@TableField("cross_id")
private String crossId;
@ApiModelProperty("dailyPlanDetails")
@TableField("daily_plan_details")
private String dailyPlanDetails;
}
package net.wanji.opt.synthesis.pojo;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author duanruiming
* @date 2024/11/08 13:12
*/
@Data
public class StrategyPlanDTO {
private String crossId;
private Integer planId;
private Integer dailyPlanId;
private Integer strategy;
private List<String> times;
private List<Integer> weeks;
private Date startTime;
private Date endTime;
}
package net.wanji.opt.synthesis.pojo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author duanruiming
* @date 2024/11/08 10:02
* @description 策略管理运行计划管理实体
*/
@TableName("t_strategy_plan_info")
@ApiModel(value = "StrategyPlanInfoEntity", description = "策略管理运行计划管理实体")
@Data
public class StrategyPlanInfoEntity {
@ApiModelProperty("id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty("planId")
@TableField("plan_id")
private Integer planId;
@ApiModelProperty("crossId")
@TableField("cross_id")
private String crossId;
@ApiModelProperty("type")
@TableField("type")
private Integer type;
@ApiModelProperty("startTime")
@TableField("start_time")
private Date startTime;
@ApiModelProperty("endTime")
@TableField("end_time")
private Date endTime;
private String company;
@ApiModelProperty("planDetails")
@TableField("plan_details")
private String planDetails;
}
package net.wanji.opt.synthesis.service; package net.wanji.opt.synthesis.service;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.po.StrategyControlDataEntity; import net.wanji.opt.synthesis.pojo.StrategyControlDataEntity;
import net.wanji.opt.synthesis.pojo.StrategyControlDetailList;
import net.wanji.opt.synthesis.pojo.StrategyControlVO; import net.wanji.opt.synthesis.pojo.StrategyControlVO;
/** /**
...@@ -12,4 +13,8 @@ public interface StrategyControlService { ...@@ -12,4 +13,8 @@ public interface StrategyControlService {
JsonViewObject strategyInfoOperation(StrategyControlVO strategyControlVO) throws Exception; JsonViewObject strategyInfoOperation(StrategyControlVO strategyControlVO) throws Exception;
JsonViewObject strategyInfoPageList(StrategyControlDataEntity entity) throws Exception; JsonViewObject strategyInfoPageList(StrategyControlDataEntity entity) throws Exception;
JsonViewObject crossStrategyInfoList(Integer type) throws Exception;
JsonViewObject strategyPlanDetail(String crossId) throws Exception;
JsonViewObject strategyPlanSave(StrategyControlDetailList list) throws Exception;
} }
package net.wanji.opt.synthesis.service.impl; package net.wanji.opt.synthesis.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.wanji.common.enums.DateStyle; import net.wanji.common.enums.DateStyle;
import net.wanji.common.framework.Constants; import net.wanji.common.framework.Constants;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.utils.tool.JacksonUtils; import net.wanji.common.utils.tool.JacksonUtils;
import net.wanji.opt.dao.mapper.StrategyControlInfoMapper; import net.wanji.opt.dao.mapper.StrategyControlInfoMapper;
import net.wanji.opt.po.StrategyControlDataEntity; import net.wanji.opt.dao.mapper.StrategyDailyPlanInfoMapper;
import net.wanji.opt.dao.mapper.StrategyPlanInfoMapper;
import net.wanji.opt.synthesis.pojo.*; import net.wanji.opt.synthesis.pojo.*;
import net.wanji.opt.synthesis.service.PushStrategyControlService; import net.wanji.opt.synthesis.service.PushStrategyControlService;
import net.wanji.opt.synthesis.service.StrategyControlService; import net.wanji.opt.synthesis.service.StrategyControlService;
...@@ -22,6 +26,7 @@ import org.springframework.util.CollectionUtils; ...@@ -22,6 +26,7 @@ import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
...@@ -37,6 +42,10 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -37,6 +42,10 @@ public class StrategyControlServiceImpl implements StrategyControlService {
private PushStrategyControlService pushStrategyControlService; private PushStrategyControlService pushStrategyControlService;
@Resource @Resource
private StrategyControlInfoMapper strategyControlInfoMapper; private StrategyControlInfoMapper strategyControlInfoMapper;
@Resource
private StrategyPlanInfoMapper strategyPlanInfoMapper;
@Resource
private StrategyDailyPlanInfoMapper strategyDailyPlanInfoMapper;
@Override @Override
public JsonViewObject strategyInfoOperation(StrategyControlVO strategyControlVO) throws Exception { public JsonViewObject strategyInfoOperation(StrategyControlVO strategyControlVO) throws Exception {
...@@ -135,4 +144,198 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -135,4 +144,198 @@ public class StrategyControlServiceImpl implements StrategyControlService {
Page<StrategyControlDataEntity> pageInfo = strategyControlInfoMapper.selectPage(page, queryWrapper); Page<StrategyControlDataEntity> pageInfo = strategyControlInfoMapper.selectPage(page, queryWrapper);
return JsonViewObject.newInstance().success(pageInfo.getRecords()); return JsonViewObject.newInstance().success(pageInfo.getRecords());
} }
@Override
public JsonViewObject crossStrategyInfoList(Integer type) throws Exception {
ObjectMapper instance = JacksonUtils.getInstance();
LambdaQueryWrapper<StrategyControlDataEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StrategyControlDataEntity::getBizType, type);
List<StrategyControlDataEntity> entities = strategyControlInfoMapper.selectList(queryWrapper);
List<StrategyControlDataEntity> results = new ArrayList<>(entities.size());
Date current = new Date();
for (StrategyControlDataEntity entity : entities) {
StrategyControlDataEntity result = new StrategyControlDataEntity();
BeanUtils.copyProperties(result, entity);
Date start = entity.getScheduleStart();
Date end = entity.getScheduleEnd();
if (current.before(start) || current.after(end)) {
result.setTime("");
} else {
String time = entity.getTime();
List<StrategyControlDataVO.TimeTable> timeTables = instance.readValue(time, new TypeReference<List<StrategyControlDataVO.TimeTable>>() {});
for (StrategyControlDataVO.TimeTable timeTable : timeTables) {
int currentWeek = DateUtil.thisDayOfWeek();
if (currentWeek != timeTable.getWeek()) {
result.setTime("");
} else {
String[] timeList = timeTable.getTimeList();
for (String s : timeList) {
String[] hours = s.split(",");
for (String hour : hours) {
String[] currentHour = hour.split("-");
String startHour = currentHour[0];
String entHour = currentHour[1];
String format = DateUtil.format(current, "HH:mm");
DateTime currentTime = DateUtil.parse(format, "HH:mm");
DateTime startHourDate = DateUtil.parse(startHour, "HH:mm");
DateTime endHourDate = DateUtil.parse(entHour, "HH:mm");
if (currentTime.before(startHourDate) || currentTime.after(endHourDate)) {
result.setTime(hour);
}
}
}
}
results.add(result);
}
}
}
return JsonViewObject.newInstance().success(results);
}
@Override
public JsonViewObject strategyPlanDetail(String crossId) throws Exception {
try {
ObjectMapper instance = JacksonUtils.getInstance();
StrategyControlDetailList result = new StrategyControlDetailList();
LambdaQueryWrapper<StrategyPlanInfoEntity> planQueryWrapper = new LambdaQueryWrapper<>();
planQueryWrapper.eq(StrategyPlanInfoEntity::getCrossId, crossId);
List<StrategyPlanInfoEntity> planInfoEntities = strategyPlanInfoMapper.selectList(planQueryWrapper);
List<StrategyControlDetailList.ExecutePlan> executePlans = new ArrayList<>();
for (StrategyPlanInfoEntity planInfoEntity : planInfoEntities) {
StrategyControlDetailList.ExecutePlan executePlan = new StrategyControlDetailList.ExecutePlan();
executePlan.setCompany(planInfoEntity.getCompany());
executePlan.setCrossId(planInfoEntity.getCrossId());
executePlan.setType(planInfoEntity.getType());
executePlan.setPlanId(planInfoEntity.getPlanId());
executePlan.setStartTime(planInfoEntity.getStartTime());
executePlan.setEndTime(planInfoEntity.getEndTime());
String planDetailsStr = planInfoEntity.getPlanDetails();
List<StrategyControlDetailList.ExecutePlan.PlanDetail> planDetails = instance.readValue(planDetailsStr, new TypeReference<List<StrategyControlDetailList.ExecutePlan.PlanDetail>>() {});
executePlan.setPlanDetails(planDetails);
executePlans.add(executePlan);
}
result.setPlans(executePlans);
LambdaQueryWrapper<StrategyDailyPlanInfoEntity> dailyPlanQueryWrapper = new LambdaQueryWrapper<>();
dailyPlanQueryWrapper.eq(StrategyDailyPlanInfoEntity::getCrossId, crossId);
List<StrategyDailyPlanInfoEntity> dailyPlanInfoEntities = strategyDailyPlanInfoMapper.selectList(dailyPlanQueryWrapper);
List<StrategyControlDetailList.DailyPlan> dailyPlans = new ArrayList<>();
for (StrategyDailyPlanInfoEntity dailyPlanInfoEntity : dailyPlanInfoEntities) {
StrategyControlDetailList.DailyPlan dailyPlan = new StrategyControlDetailList.DailyPlan();
dailyPlan.setCrossId(dailyPlanInfoEntity.getCrossId());
dailyPlan.setDailyPlanId(dailyPlanInfoEntity.getDailyPlanId());
String dailyPlanDetailsStr = dailyPlanInfoEntity.getDailyPlanDetails();
List<StrategyControlDetailList.DailyPlan.DailyPlanDetail> dailyPlanDetails = instance.readValue(dailyPlanDetailsStr, new TypeReference<List<StrategyControlDetailList.DailyPlan.DailyPlanDetail>>() {});
dailyPlan.setDailyPlanDetails(dailyPlanDetails);
dailyPlans.add(dailyPlan);
}
result.setDailyPlans(dailyPlans);
return JsonViewObject.newInstance().success(result);
} catch (Exception e) {
log.error("策略管理查询失败:{}", e);
throw new Exception(e);
}
}
@Override
public JsonViewObject strategyPlanSave(StrategyControlDetailList list) throws Exception {
try {
if (Objects.nonNull(list)) {
ObjectMapper mapper = JacksonUtils.getInstance();
List<StrategyControlDetailList.ExecutePlan> plans = list.getPlans();
if (!CollectionUtils.isEmpty(plans)) {
for (StrategyControlDetailList.ExecutePlan plan : plans) {
StrategyPlanInfoEntity planInfoEntity = new StrategyPlanInfoEntity();
planInfoEntity.setPlanId(plan.getPlanId());
planInfoEntity.setCrossId(plan.getCrossId());
planInfoEntity.setType(plan.getType());
planInfoEntity.setStartTime(plan.getStartTime());
planInfoEntity.setEndTime(plan.getEndTime());
planInfoEntity.setCompany(plan.getCompany());
planInfoEntity.setPlanDetails(mapper.writeValueAsString(plan.getPlanDetails()));
strategyPlanInfoMapper.insert(planInfoEntity);
}
}
List<StrategyControlDetailList.DailyPlan> dailyPlans = list.getDailyPlans();
for (StrategyControlDetailList.DailyPlan dailyPlan : dailyPlans) {
Integer dailyPlanId = dailyPlan.getDailyPlanId();
String crossId = dailyPlan.getCrossId();
List<StrategyControlDetailList.DailyPlan.DailyPlanDetail> dailyPlanDetails = dailyPlan.getDailyPlanDetails();
StrategyDailyPlanInfoEntity dailyPlanInfoEntity = new StrategyDailyPlanInfoEntity();
dailyPlanInfoEntity.setCrossId(crossId);
dailyPlanInfoEntity.setDailyPlanId(dailyPlanId);
dailyPlanInfoEntity.setDailyPlanDetails(mapper.writeValueAsString(dailyPlanDetails));
strategyDailyPlanInfoMapper.insert(dailyPlanInfoEntity);
}
}
convertDataList(list);
return JsonViewObject.newInstance().success();
} catch (Exception e) {
log.error("策略管理数据保存失败,:{}", e);
throw new Exception(e);
}
}
/**
* 页面管理数据转化神思数据
*
* @param list
*/
public void convertDataList(StrategyControlDetailList list) throws Exception {
try {
if (Objects.nonNull(list)) {
List<StrategyControlDetailList.DailyPlan> dailyPlans = list.getDailyPlans();
List<StrategyPlanDTO> strategyPlanDTOS = new ArrayList<>();
if (!CollectionUtils.isEmpty(dailyPlans)) {
for (StrategyControlDetailList.DailyPlan dailyPlan : dailyPlans) {
Integer dailyPlanId = dailyPlan.getDailyPlanId();
List<StrategyControlDetailList.DailyPlan.DailyPlanDetail> dailyPlanDetails = dailyPlan.getDailyPlanDetails();
for (StrategyControlDetailList.DailyPlan.DailyPlanDetail dailyPlanDetail : dailyPlanDetails) {
StrategyPlanDTO strategyPlanDTO = new StrategyPlanDTO();
strategyPlanDTO.setStrategy(dailyPlanDetail.getStrategy());
strategyPlanDTO.setTimes(dailyPlanDetail.getTimes());
strategyPlanDTO.setDailyPlanId(dailyPlanId);
strategyPlanDTOS.add(strategyPlanDTO);
}
}
}
List<StrategyPlanDTO> resultList = new ArrayList<>();
List<StrategyControlDetailList.ExecutePlan> plans = list.getPlans();
if (!CollectionUtils.isEmpty(plans) && !CollectionUtils.isEmpty(dailyPlans)) {
for (StrategyControlDetailList.ExecutePlan plan : plans) {
Integer planId = plan.getPlanId();
Date startTime = plan.getStartTime();
Date endTime = plan.getEndTime();
List<StrategyControlDetailList.ExecutePlan.PlanDetail> planDetails = plan.getPlanDetails();
if (!CollectionUtils.isEmpty(planDetails)) {
for (StrategyControlDetailList.ExecutePlan.PlanDetail planDetail : planDetails) {
Integer dailyPlanId = planDetail.getDailyPlanId();
List<Integer> weeks = planDetail.getWeeks();
for (StrategyPlanDTO strategyPlanDTO : strategyPlanDTOS) {
if (dailyPlanId == strategyPlanDTO.getDailyPlanId()) {
strategyPlanDTO.setPlanId(planId);
strategyPlanDTO.setStartTime(startTime);
strategyPlanDTO.setEndTime(endTime);
strategyPlanDTO.setWeeks(weeks);
resultList.add(strategyPlanDTO);
}
}
}
}
}
}
for (StrategyPlanDTO strategyPlanDTO : strategyPlanDTOS) {
System.err.println(strategyPlanDTO);
}
log.error("神思数据:{}", JacksonUtils.getInstance().writeValueAsString(strategyPlanDTOS));
}
} catch (Exception e) {
log.error("数据转化神思数据结构异常:{}", e);
throw new Exception(e);
}
}
} }
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<mapper namespace="net.wanji.opt.dao.mapper.StrategyControlInfoMapper"> <mapper namespace="net.wanji.opt.dao.mapper.StrategyControlInfoMapper">
<insert id="insertBatch" parameterType="net.wanji.opt.po.StrategyControlDataEntity"> <insert id="insertBatch" parameterType="net.wanji.opt.synthesis.pojo.StrategyControlDataEntity">
INSERT INTO t_strategy_control_info ( INSERT INTO t_strategy_control_info (
biz_id, biz_id,
biz_type, biz_type,
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.StrategyDailyPlanInfoMapper">
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.StrategyPlanInfoMapper">
</mapper>
\ No newline at end of file
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