Commit 034d3bf4 authored by duanruiming's avatar duanruiming

[add] 临时方案接口优化

parent 0771d199
...@@ -113,7 +113,7 @@ public interface FeignCommon { ...@@ -113,7 +113,7 @@ public interface FeignCommon {
// 临时方案 // 临时方案
@PostMapping("/tempScheme") @PostMapping("/tempScheme")
JsonViewObject tempScheme(@RequestParam String crossCode, @RequestParam Integer schemeNo); JsonViewObject tempScheme(Object obj);
@PostMapping("/control/findPlanId") @PostMapping("/control/findPlanId")
Integer findPlanId(@RequestParam Date datetime, @RequestParam String dateStr, @RequestParam String crossId); Integer findPlanId(@RequestParam Date datetime, @RequestParam String dateStr, @RequestParam String crossId);
......
...@@ -213,8 +213,8 @@ public class ControlCommandController { ...@@ -213,8 +213,8 @@ public class ControlCommandController {
@AspectLog(description = "临时方案", operationType = BaseEnum.OperationTypeEnum.UPDATE) @AspectLog(description = "临时方案", operationType = BaseEnum.OperationTypeEnum.UPDATE)
@ApiOperation(value = "临时方案", notes = "临时方案") @ApiOperation(value = "临时方案", notes = "临时方案")
@PostMapping("/tempScheme") @PostMapping("/tempScheme")
public JsonViewObject tempScheme(@RequestParam String crossCode, @RequestParam Integer schemeNo) throws Exception { public JsonViewObject tempScheme(@RequestBody @Validated Object obj) throws Exception {
return controlCommandStrategyService.tempScheme(crossCode, schemeNo); return controlCommandStrategyService.tempScheme(obj);
} }
/** /**
......
...@@ -59,7 +59,7 @@ public class StaticInfoController { ...@@ -59,7 +59,7 @@ public class StaticInfoController {
}) })
public JsonViewObject schemePhaseLights(@RequestBody @Validated SchemePhaseLightsDTO schemePhaseLightsDTO) throws Exception { public JsonViewObject schemePhaseLights(@RequestBody @Validated SchemePhaseLightsDTO schemePhaseLightsDTO) throws Exception {
// 更新数据库 // 更新数据库
staticInfoService.schemePhaseLights(schemePhaseLightsDTO); //staticInfoService.schemePhaseLights(schemePhaseLightsDTO);
// 构造返回值 // 构造返回值
SchemePhaseLightsVO schemePhaseLightsVO = staticInfoService.buildSchemePhaseLightsResponse(schemePhaseLightsDTO); SchemePhaseLightsVO schemePhaseLightsVO = staticInfoService.buildSchemePhaseLightsResponse(schemePhaseLightsDTO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance(); JsonViewObject jsonViewObject = JsonViewObject.newInstance();
......
...@@ -100,7 +100,7 @@ public interface ControlCommandService { ...@@ -100,7 +100,7 @@ public interface ControlCommandService {
JsonViewObject delBaseConfig(DelBaseConfigPO delBaseConfigPO) throws Exception; JsonViewObject delBaseConfig(DelBaseConfigPO delBaseConfigPO) throws Exception;
JsonViewObject timing(String crossCode, Date date) throws Exception; JsonViewObject timing(String crossCode, Date date) throws Exception;
JsonViewObject tempScheme(String crossCode, Integer schemeNo) throws Exception; JsonViewObject tempScheme(Object obj) throws Exception;
JsonViewObject tempSchemeDetail(TempSchemeSendVO tempSchemeSendVO) throws Exception; JsonViewObject tempSchemeDetail(TempSchemeSendVO tempSchemeSendVO) throws Exception;
JsonViewObject extendPhase(ExtendPhaseDTO extendPhase) throws Exception; JsonViewObject extendPhase(ExtendPhaseDTO extendPhase) throws Exception;
......
...@@ -109,12 +109,10 @@ public interface ControlCommandStrategyService { ...@@ -109,12 +109,10 @@ public interface ControlCommandStrategyService {
/** /**
* 临时方案 * 临时方案
* @param crossCode
* @param schemeNo
* @return * @return
* @throws Exception * @throws Exception
*/ */
JsonViewObject tempScheme(String crossCode, Integer schemeNo) throws Exception; JsonViewObject tempScheme(Object obj) throws Exception;
/** /**
* 临时方案详情 * 临时方案详情
......
...@@ -3,11 +3,10 @@ package net.wanji.utc.service.control.impl; ...@@ -3,11 +3,10 @@ package net.wanji.utc.service.control.impl;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.databus.dto.ExtendPhaseDTO;
import net.wanji.databus.dto.StepingPhaseDTO;
import net.wanji.databus.vo.TempSchemeSendVO;
import net.wanji.databus.dao.entity.*; import net.wanji.databus.dao.entity.*;
import net.wanji.databus.dao.mapper.*; import net.wanji.databus.dao.mapper.*;
import net.wanji.databus.dto.ExtendPhaseDTO;
import net.wanji.databus.dto.StepingPhaseDTO;
import net.wanji.databus.po.BaseCrossLightsPO; import net.wanji.databus.po.BaseCrossLightsPO;
import net.wanji.databus.po.CrossInfoPO; import net.wanji.databus.po.CrossInfoPO;
import net.wanji.databus.po.SaveToUtcPO; import net.wanji.databus.po.SaveToUtcPO;
...@@ -27,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -27,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.lang.reflect.Field;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -333,15 +333,30 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy ...@@ -333,15 +333,30 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
} }
@Override @Override
public JsonViewObject tempScheme(String crossCode, Integer schemeNo) throws Exception { public JsonViewObject tempScheme(Object obj) throws Exception {
String crossCode = getCrossCode(obj);
String manufacturerCode = crossInfoCache.getManufacturerCodeByCrossId(crossCode); String manufacturerCode = crossInfoCache.getManufacturerCodeByCrossId(crossCode);
JsonViewObject jsonViewObject = JsonViewObject.newInstance(); JsonViewObject jsonViewObject = wanJiControlCommandService.tempScheme(obj);
if (StringUtils.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerCode)) {
} else {
jsonViewObject = wanJiControlCommandService.tempScheme(crossCode, schemeNo);
}
return jsonViewObject; return jsonViewObject;
}
public static String getCrossCode(Object obj) throws NoSuchFieldException, IllegalAccessException {
// 获取对象的Class对象
Class<?> clazz = obj.getClass();
// 查找名为"crossCode"的字段(假设字段名是crossCode,且是public或可访问的)
Field crossCodeField = clazz.getDeclaredField("crossCode");
// 如果字段是私有的,则需要设置可访问性
crossCodeField.setAccessible(true);
// 获取字段的值
Object crossCodeValue = crossCodeField.get(obj);
// 将值转换为String类型(假设crossCode是String类型)
return (String) crossCodeValue;
} }
}
@Override @Override
public JsonViewObject tempSchemeDetail(TempSchemeSendVO tempSchemeSendVO) throws Exception { public JsonViewObject tempSchemeDetail(TempSchemeSendVO tempSchemeSendVO) throws Exception {
...@@ -413,7 +428,7 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy ...@@ -413,7 +428,7 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
} }
List<CrossSectionPO> sectionPOS = saveToUtcPO.getSectionPOS(); List<CrossSectionPO> sectionPOS = saveToUtcPO.getSectionPOS();
crossSectionMapper.deleteOne(crossId, null,null); crossSectionMapper.deleteOne(crossId, null, null);
if (!CollectionUtils.isEmpty(sectionPOS)) { if (!CollectionUtils.isEmpty(sectionPOS)) {
for (CrossSectionPO sectionPO : sectionPOS) { for (CrossSectionPO sectionPO : sectionPOS) {
CrossSectionPO crossSectionPO = new CrossSectionPO(); CrossSectionPO crossSectionPO = new CrossSectionPO();
......
...@@ -554,7 +554,7 @@ public class HKControlCommandServiceImpl implements ControlCommandService { ...@@ -554,7 +554,7 @@ public class HKControlCommandServiceImpl implements ControlCommandService {
} }
@Override @Override
public JsonViewObject tempScheme(String crossCode, Integer schemeNo) throws Exception { public JsonViewObject tempScheme(Object obj) throws Exception {
return null; return null;
} }
......
...@@ -174,9 +174,17 @@ public class WanJiControlCommandServiceImpl implements ControlCommandService { ...@@ -174,9 +174,17 @@ public class WanJiControlCommandServiceImpl implements ControlCommandService {
} }
@Override @Override
public JsonViewObject tempScheme(String crossCode, Integer schemeNo) throws Exception { public JsonViewObject tempScheme(Object obj) throws Exception {
String manufacturerIdCode = crossInfoCache.getManufacturerCodeByCrossId(crossCode); JsonViewObject jsonViewObject = JsonViewObject.newInstance();
JsonViewObject jsonViewObject = utcFeignClientCache.getUtcFeignClientService(manufacturerIdCode).tempScheme(crossCode, schemeNo); if (obj instanceof TempSchemeVO) {
TempSchemeVO tempSchemeVO = (TempSchemeVO) obj;
String manufacturerIdCode = crossInfoCache.getManufacturerCodeByCrossId(tempSchemeVO.getCrossCode());
jsonViewObject = utcFeignClientCache.getUtcFeignClientService(manufacturerIdCode).tempScheme(tempSchemeVO);
} else if (obj instanceof TempSchemeSendVO) {
TempSchemeSendVO tempSchemeSendVO = (TempSchemeSendVO) obj;
String manufacturerIdCode = crossInfoCache.getManufacturerCodeByCrossId(tempSchemeSendVO.getCrossCode());
jsonViewObject = utcFeignClientCache.getUtcFeignClientService(manufacturerIdCode).tempScheme(tempSchemeSendVO);
}
if (StringUtils.endsWithIgnoreCase("success", jsonViewObject.getStatus())) { if (StringUtils.endsWithIgnoreCase("success", jsonViewObject.getStatus())) {
return jsonViewObject.success("万集标准协议下发临时方案成功!"); return jsonViewObject.success("万集标准协议下发临时方案成功!");
} }
......
...@@ -5,18 +5,18 @@ spring: ...@@ -5,18 +5,18 @@ spring:
datasource: datasource:
master: master:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://37.12.182.29:3306/t_signal_utc_jinan?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true url: jdbc:mysql://10.102.1.182:3306/t_signal_utc_jinan?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
username: root username: root
password: Wanji300552 password: Wanji300552
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
slave: slave:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://37.12.182.29:3306/t_signal_utc_jinan?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true url: jdbc:mysql://10.102.1.182:3306/t_signal_utc_jinan?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
username: root username: root
password: Wanji300552 password: Wanji300552
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
redis: redis:
host: 37.12.182.29 host: 10.102.1.182
port: 6379 port: 6379
password: Wanji300552 password: Wanji300552
jedis: jedis:
...@@ -35,7 +35,7 @@ spring: ...@@ -35,7 +35,7 @@ spring:
application: application:
name: utc name: utc
kafka: kafka:
bootstrap-servers: 37.12.182.29:9092 bootstrap-servers: 10.102.1.182:9092
listener: listener:
missing-topics-fatal: false missing-topics-fatal: false
concurrency: 3 concurrency: 3
...@@ -44,6 +44,10 @@ spring: ...@@ -44,6 +44,10 @@ spring:
retries: 0 retries: 0
batch-size: 10000 batch-size: 10000
acks: 1 acks: 1
elasticsearch:
username: elastic
password: Wanji300552
uris: http://10.102.1.182:9200
server: server:
port: 32000 port: 32000
servlet: servlet:
......
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