diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java index ea08887..8635e66 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java @@ -19,6 +19,7 @@ import org.nl.acs.opc.DeviceAppServiceImpl; import org.nl.system.service.param.ISysParamService; import org.nl.common.utils.CodeUtil; import org.nl.config.SpringContextHolder; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import java.util.HashMap; @@ -27,6 +28,7 @@ import java.util.Map; @Slf4j @Service @RequiredArgsConstructor +@Lazy public class NDCAgvServiceImpl implements NDCAgvService { private final DeviceAppService deviceAppService; diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java index 1c6c92b..b623d6e 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java @@ -19,6 +19,7 @@ import org.nl.system.service.param.ISysParamService; import org.nl.config.SpringContextHolder; import org.nl.system.service.param.impl.SysParamServiceImpl; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; import java.io.DataInputStream; @@ -33,6 +34,7 @@ import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString; @Slf4j @Component +@Lazy public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { Socket s; diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index e473525..363640a 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -24,11 +24,13 @@ import org.nl.acs.task.service.dto.TaskDto; import org.nl.system.service.param.ISysParamService; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; @Service @RequiredArgsConstructor @Slf4j +@Lazy public class AcsToWmsServiceImpl implements AcsToWmsService { @Autowired ISysParamService paramService; diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/domain/Instruction.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/domain/Instruction.java index e3a908c..55b4ae9 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/domain/Instruction.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/domain/Instruction.java @@ -12,9 +12,9 @@ import cn.hutool.core.bean.copier.CopyOptions; import java.io.Serializable; /** -* @author jiaolm -* @date 2023-05-09 -*/ + * @author jiaolm + * @date 2023-05-09 + */ @Data @Builder @Accessors(chain = true) @@ -26,6 +26,10 @@ public class Instruction extends InstructionDto implements Serializable { public Instruction() { } + public Instruction(InstructionDto instructionDto) { + BeanUtil.copyProperties(instructionDto,this, CopyOptions.create().setIgnoreNullValue(true)); + } + public void copyFrom(Instruction source){ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index c2309e2..92ffc43 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -5,7 +5,6 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpResponse; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -18,8 +17,6 @@ import org.apache.commons.lang3.ObjectUtils; import org.nl.acs.AcsConfig; import org.nl.acs.agv.server.MagicAgvService; import org.nl.acs.agv.server.NDCAgvService; -import org.nl.acs.agv.server.XianGongAgvService; -import org.nl.acs.agv.server.ZheDaAgvService; import org.nl.acs.auto.initial.ApplicationAutoInitial; import org.nl.acs.device.domain.Device; import org.nl.acs.device.service.DeviceService; @@ -112,7 +109,7 @@ public class InstructionServiceImpl extends CommonServiceImpl queryAll(InstructionQueryParam query) { + public List queryAll(InstructionQueryParam query){ return ConvertUtil.convertList(instructionMapper.selectList(QueryHelpMybatisPlus.getPredicate(query)), InstructionDto.class); } @@ -129,7 +126,7 @@ public class InstructionServiceImpl extends CommonServiceImpl ids) { + public int removeByIds(Set ids){ // delCaches(ids); return instructionMapper.deleteBatchIds(ids); } @Override @Transactional(rollbackFor = Exception.class) - public int removeById(String id) { + public int removeById(String id){ Set set = new HashSet<>(1); set.add(id); return this.removeByIds(set); @@ -177,7 +174,7 @@ public class InstructionServiceImpl extends CommonServiceImpl(ConvertUtil.convertList(list, Instruction.class)); + this.instructions = new CopyOnWriteArrayList<>(ConvertUtil.convertList(list,Instruction.class)); } @Override @@ -193,20 +190,20 @@ public class InstructionServiceImpl extends CommonServiceImpl queryPage = PageUtil.toMybatisPage(page); LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); // wrapper.eq(InstructionMybatis::getIs_delete,0); - wrapper.and(StringUtils.isNotBlank(code), instructionMybatis -> instructionMybatis.like(InstructionMybatis::getInstruction_code, code).or().like(InstructionMybatis::getTask_code, code)); - wrapper.like(StringUtils.isNotBlank(vehicle_code), InstructionMybatis::getVehicle_code, vehicle_code); - wrapper.eq(StringUtils.isNotBlank(material_type), InstructionMybatis::getMaterial, material_type); - wrapper.eq(StringUtils.isNotBlank(status), InstructionMybatis::getInstruction_status, status); - wrapper.and(StringUtils.isNotBlank(point_code), instructionMybatis -> instructionMybatis.like(InstructionMybatis::getStart_point_code, point_code).or().like(InstructionMybatis::getNext_point_code, point_code)); - wrapper.eq(StringUtils.isNotBlank(instruction_type), InstructionMybatis::getInstruction_type, instruction_type); + wrapper.and(StringUtils.isNotBlank(code), instructionMybatis -> instructionMybatis.like(InstructionMybatis::getInstruction_code,code).or().like(InstructionMybatis::getTask_code,code)); + wrapper.like(StringUtils.isNotBlank(vehicle_code),InstructionMybatis::getVehicle_code,vehicle_code); + wrapper.eq(StringUtils.isNotBlank(material_type),InstructionMybatis::getMaterial,material_type); + wrapper.eq(StringUtils.isNotBlank(status),InstructionMybatis::getInstruction_status,status); + wrapper.and(StringUtils.isNotBlank(point_code),instructionMybatis -> instructionMybatis.like(InstructionMybatis::getStart_point_code,point_code).or().like(InstructionMybatis::getNext_point_code,point_code)); + wrapper.eq(StringUtils.isNotBlank(instruction_type),InstructionMybatis::getInstruction_type,instruction_type); if (!StrUtil.isEmpty(is_over)) { - if (StrUtil.equals(is_over, "1")) { - wrapper.ge(InstructionMybatis::getInstruction_status, 2); - } else { - wrapper.lt(InstructionMybatis::getInstruction_status, 2); + if (StrUtil.equals(is_over,"1")){ + wrapper.ge(InstructionMybatis::getInstruction_status,2); + }else{ + wrapper.lt(InstructionMybatis::getInstruction_status,2); } } - IPage insPage = instructionMapper.selectPage(queryPage, wrapper); + IPage insPage = instructionMapper.selectPage(queryPage,wrapper); final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(insPage, InstructionDto.class)); return json; } @@ -225,31 +222,32 @@ public class InstructionServiceImpl extends CommonServiceImpl wrapper = new LambdaQueryWrapper<>(); // wrapper.eq(InstructionMybatis::getIs_delete,"0"); if (!StrUtil.isEmpty(code)) { - wrapper.and(instructionMybatis -> instructionMybatis.like(InstructionMybatis::getInstruction_code, code).or().like(InstructionMybatis::getTask_code, code)); + wrapper.and(instructionMybatis -> instructionMybatis.like(InstructionMybatis::getInstruction_code,code).or().like(InstructionMybatis::getTask_code,code)); } if (!StrUtil.isEmpty(vehicle_code)) { - wrapper.like(InstructionMybatis::getVehicle_code, vehicle_code); + wrapper.like(InstructionMybatis::getVehicle_code,vehicle_code); } if (!StrUtil.isEmpty(material_type)) { - wrapper.eq(InstructionMybatis::getMaterial, material_type); + wrapper.eq(InstructionMybatis::getMaterial,material_type); } if (!StrUtil.isEmpty(status)) { - wrapper.eq(InstructionMybatis::getInstruction_status, status); + wrapper.eq(InstructionMybatis::getInstruction_status,status); } if (!StrUtil.isEmpty(point_code)) { - wrapper.and(instructionMybatis -> instructionMybatis.like(InstructionMybatis::getStart_point_code, point_code).or().like(InstructionMybatis::getNext_point_code, point_code)); + wrapper.and(instructionMybatis -> instructionMybatis.like(InstructionMybatis::getStart_point_code,point_code).or().like(InstructionMybatis::getNext_point_code,point_code)); } if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) { - wrapper.between(InstructionMybatis::getCreate_time, create_time, end_time); + wrapper.between(InstructionMybatis::getCreate_time,create_time,end_time); } - IPage insPage = instructionMapper.selectPage(queryPage, wrapper); + wrapper.orderByDesc(InstructionMybatis::getCreate_time); + IPage insPage = instructionMapper.selectPage(queryPage,wrapper); final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(insPage, InstructionDto.class)); return json; } @Override public Map getByTaskId(String id) { - List insList = new LambdaQueryChainWrapper<>(instructionMapper) + List insList= new LambdaQueryChainWrapper<>(instructionMapper) .eq(InstructionMybatis::getTask_id, id) .list(); JSONObject jsonObject = new JSONObject(); @@ -275,9 +273,9 @@ public class InstructionServiceImpl extends CommonServiceImpl queryAll(Map whereJson) { - List insList = new LambdaQueryChainWrapper<>(instructionMapper) + List insList= new LambdaQueryChainWrapper<>(instructionMapper) .list(); - return ConvertUtil.convertList(insList, Instruction.class); + return ConvertUtil.convertList(insList,Instruction.class); } @Override @@ -285,10 +283,10 @@ public class InstructionServiceImpl extends CommonServiceImpl list = arr.toJavaList(Instruction.class); - List insList = new LambdaQueryChainWrapper<>(instructionMapper) + List insList= new LambdaQueryChainWrapper<>(instructionMapper) .lt(InstructionMybatis::getInstruction_status, "2") .list(); - return ConvertUtil.convertList(insList, Instruction.class); + return ConvertUtil.convertList(insList,Instruction.class); } @@ -302,13 +300,13 @@ public class InstructionServiceImpl extends CommonServiceImpl(instructionMapper) + InstructionMybatis ins= new LambdaQueryChainWrapper<>(instructionMapper) .eq(InstructionMybatis::getInstruction_code, code) .one(); - if (ObjectUtil.isEmpty(ins)) { + if(ObjectUtil.isEmpty(ins)){ return null; } - return ConvertUtil.convert(ins, Instruction.class); + return ConvertUtil.convert(ins,Instruction.class); } @Override @@ -317,13 +315,13 @@ public class InstructionServiceImpl extends CommonServiceImpl(instructionMapper) + InstructionMybatis ins= new LambdaQueryChainWrapper<>(instructionMapper) .eq(InstructionMybatis::getTask_code, code) .one(); - if (ObjectUtil.isEmpty(ins)) { + if(ObjectUtil.isEmpty(ins)){ return null; } - return ConvertUtil.convert(ins, Instruction.class); + return ConvertUtil.convert(ins,Instruction.class); } @Override @@ -352,11 +350,11 @@ public class InstructionServiceImpl extends CommonServiceImpl wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(InstructionMybatis::getTask_id, id); - wrapper.apply(StringUtils.isNotBlank(wherecaluse), wherecaluse); + wrapper.eq(InstructionMybatis::getTask_id,id); + wrapper.apply(StringUtils.isNotBlank(wherecaluse),wherecaluse); InstructionMybatis ins = instructionMapper.selectOne(wrapper); if (ObjectUtil.isNotEmpty(ins)) { - return ConvertUtil.convert(ins, Instruction.class); + return ConvertUtil.convert(ins,Instruction.class); } return null; } @@ -412,8 +410,8 @@ public class InstructionServiceImpl extends CommonServiceImpl(instructionMapper) + InstructionMybatis ins= new LambdaQueryChainWrapper<>(instructionMapper) .lt(InstructionMybatis::getInstruction_status, 3) - .eq(InstructionMybatis::getNext_point_code, dto.getNext_point_code()) - .eq(InstructionMybatis::getStart_point_code, dto.getStart_point_code()) - .eq(InstructionMybatis::getTask_id, dto.getTask_id()) + .eq(InstructionMybatis::getNext_point_code,dto.getNext_point_code()) + .eq(InstructionMybatis::getStart_point_code,dto.getStart_point_code()) + .eq(InstructionMybatis::getTask_id,dto.getTask_id()) .one(); @@ -818,14 +801,14 @@ public class InstructionServiceImpl extends CommonServiceImpl(taskMapper) - .eq(Task::getTask_id, insttaskid) + .eq(Task::getTask_id,insttaskid) .one(); // =0 则不用再次请求 if (StrUtil.equals(task.getRequest_again(), "0")) { if (StrUtil.equals(task.getNext_device_code(), instnextdevice)) { taskService.finish(task.getTask_id()); } else { - finishAndCreateNextInst((Instruction) entity); + finishAndCreateNextInst(new Instruction(entity)); } } @@ -853,7 +836,7 @@ public class InstructionServiceImpl extends CommonServiceImpl(taskMapper) - .eq(Task::getTask_id, insttaskid) + .eq(Task::getTask_id,insttaskid) .one(); // =0 则不用再次请求 if (StrUtil.equals(task.getRequest_again(), "0")) { @@ -907,7 +890,7 @@ public class InstructionServiceImpl extends CommonServiceImpl(taskMapper) - .eq(Task::getTask_id, dto.getTask_id()) + .eq(Task::getTask_id,dto.getTask_id()) .one(); RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineServiceImpl.class); @@ -995,23 +978,26 @@ public class InstructionServiceImpl extends CommonServiceImpl{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value, sb}); // this.businessLogger.setResource(itemDto.getDevice_code(), itemDto.getDevice_name()).log("信号{}变更从{}->{};信号快照:{}", new Object[]{itemId, his, value, sb}); } else { - log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value}); + if(his instanceof int[]){ + if(!Arrays.equals((long[]) his, (long[]) value)){ + log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value}); + } + } else if(his instanceof String){ + if(!StrUtil.equals((CharSequence) his, (CharSequence) value)){ + log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value}); + } + } else { + log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value}); + } // this.businessLogger.setResource(itemDto.getDevice_code(), itemDto.getDevice_name()).log("信号{}变更从{}->{}", new Object[]{itemId, his, value}); } } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcSynchronizeAutoRun.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcSynchronizeAutoRun.java index c598a7b..26a91f0 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcSynchronizeAutoRun.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceOpcSynchronizeAutoRun.java @@ -1,83 +1,313 @@ package org.nl.acs.opc; -import cn.hutool.core.util.ObjectUtil; +import lombok.extern.slf4j.Slf4j; +import org.apache.lucene.util.NamedThreadFactory; import org.nl.acs.auto.run.AbstractAutoRunnable; import org.nl.acs.opc.service.dto.OpcServerManageDto; +import org.nl.acs.udw.UnifiedDataAccessor; +import org.nl.acs.udw.UnifiedDataAccessorFactory; +import org.nl.acs.udw.UnifiedDataAppService; +import org.nl.config.SpringContextHolder; +import org.nl.system.service.param.ISysParamService; +import org.openscada.opc.lib.da.Group; +import org.openscada.opc.lib.da.Item; +import org.openscada.opc.lib.da.ItemState; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.*; +import java.util.regex.Pattern; /** * OPC设备同步启动 */ @Component +@Slf4j public class DeviceOpcSynchronizeAutoRun extends AbstractAutoRunnable { - - public static boolean isRun = false; - ExecutorService executorService = Executors.newCachedThreadPool(); + static boolean isRun = true; @Autowired private DeviceAppService deviceAppService; @Autowired private OpcServerManageService opcServerManageService; +// @Autowired +// LuceneExecuteLogService lucene; + + static ExecutorService executorService; + public static Map opcServersConfig; + public static Map itemCodeOpcItemDtoMapping = new ConcurrentHashMap(); + + static boolean canRefreshOpcEntity = true; + private long lastRefreshOpcEntityTime; + static UnifiedDataAccessor udw; + private static Map canReadOpcValues; + private static volatile Map opcCodeOpcEntityMapping; + + public DeviceOpcSynchronizeAutoRun() { + this.lastRefreshOpcEntityTime = 0L; + } - @Override public String getCode() { return DeviceOpcSynchronizeAutoRun.class.getSimpleName(); } - @Override public String getName() { return "opc设备同步器"; } - @Override - public void autoRun() throws Exception { - { - isRun = true; + static Group getGroup(String opcCode) throws Exception { + OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerService.class); + return opcServerService.getServer(opcCode); + } - Map servers = this.opcServerManageService.queryAllServerMap(); - Map>> pros; - do{ - Thread.sleep(1000L); - pros = this.deviceAppService.findAllFormatProtocolFromDriver(); - }while (ObjectUtil.isEmpty(pros)); - Set keys = pros.keySet(); - Iterator var4 = keys.iterator(); - //代码执行一次 - while (var4.hasNext()) { - String key = (String) var4.next(); - List> list = (List) pros.get(key); - OpcServerManageDto opcServer = (OpcServerManageDto) servers.get(key); - Iterator var8 = list.iterator(); - while (var8.hasNext()) { - List groupProtols = (List) var8.next(); - DeviceOpcProtocolRunable runable = new DeviceOpcProtocolRunable(); - runable.setProtocols(groupProtols); - runable.setOpcServer(opcServer); - this.executorService.submit(runable); - } + static void submitTimeLimitTask(Runnable runnable, String opcCode) { + CompletableFuture future = CompletableFuture.runAsync(runnable, executorService); + +// try { +// future.get(10L, TimeUnit.SECONDS); +// } catch (InterruptedException var9) { +// Thread.currentThread().interrupt(); +// } catch (ExecutionException var10) { +// var10.printStackTrace(); +// } catch (TimeoutException var11) { +// itemCodeOpcItemDtoMapping.keySet().forEach((key) -> { +// udw.setValue(key, (Object) null); +// }); +// canReadOpcValues = new ConcurrentHashMap<>(); +// System.out.println("opc设备同步器 任务执行超时,取消任务..."); +// future.cancel(true); +// } finally { +// canRefreshOpcEntity = true; +// if (opcCode != null) { +// canReadOpcValues.put(opcCode, true); +// } +// +// } + } + + private ExecutorService createThreadPool() { + ThreadPoolExecutor executor = new ThreadPoolExecutor(32, 32, 10L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new NamedThreadFactory("opc-sync")); + executor.allowCoreThreadTimeOut(true); + return executor; + } + + public void autoRun() { + OpcStartTag.is_run = true; + opcServersConfig = this.opcServerManageService.queryAllServerMap(); + executorService = this.createThreadPool(); + opcCodeOpcEntityMapping = new ConcurrentHashMap(); + itemCodeOpcItemDtoMapping.keySet().forEach((key) -> { + udw.setValue(key, (Object) null); + }); + canRefreshOpcEntity = true; + canReadOpcValues.clear(); + + while (true) { + this.refreshOpcEntity(); + Iterator var1 = opcServersConfig.keySet().iterator(); + + while (var1.hasNext()) { + String opcCode = (String) var1.next(); + submitTimeLimitTask(() -> { + boolean in = false; + try { + if (canReadOpcValues.computeIfAbsent(opcCode, (key) -> true)) { + in = true; + canReadOpcValues.put(opcCode, false); + this.readOpcValues(opcCode); + } + } catch (Exception var3) { + var3.printStackTrace(); + } finally { + canRefreshOpcEntity = true; + if (opcCode != null && in) { + canReadOpcValues.put(opcCode, true); + } + } + }, opcCode); } - // 同步无光电设备信号 - //Map>> pros1 = this.deviceAppService.findAllFormatProtocolFromDriver(); - //List opcDrivers = this.deviceAppService.findDeviceDriver(DeviceDriver.class); + ThreadUtl.sleep((long) OpcConfig.synchronized_millisecond); + } + } - while (true) { - Thread.sleep(3000L); + private void readOpcValues(String opcCode) throws Exception { + synchronized (opcCode.intern()) { + OpcEntity opcEntity = (OpcEntity) opcCodeOpcEntityMapping.get(opcCode); + if (opcEntity != null) { + if (opcEntity.getItems().size() != 0) { + long begin = System.currentTimeMillis(); + if (log.isTraceEnabled()) { + log.trace("opc {} 开始计时{}", opcCode, begin); + } + + new HashMap(); + + Map itemStatus; + try { + itemStatus = opcEntity.readAll(); + } catch (Exception var15) { + itemStatus = opcEntity.readDividually(); + } + + long end = System.currentTimeMillis(); + long duration = end - begin; + if (log.isTraceEnabled()) { + log.trace("opc {} 读取耗时:{}", opcCode, duration); + } + + if (duration > 1000L) { + log.warn("opc {} 读取超时 : {}", opcCode, duration); + } + +// boolean allNull = itemStatus.entrySet().stream().map((map) -> { +// return OpcUtl.getValue((Item)map.getKey(), (ItemState)map.getValue()); +// }).allMatch(Objects::isNull); +// if (allNull) { +// opcEntity.getItems().clear(); +// } + + UnifiedDataAccessor udw = opcEntity.getUdw(); + + + Set items = itemStatus.keySet(); + Iterator var18 = items.iterator(); + + while (var18.hasNext()) { + Item item = (Item) var18.next(); + ItemState itemState = (ItemState) itemStatus.get(item); + Object nowValue = OpcUtl.getValue(item, itemState); + String itemId = item.getId(); + Object historyValue = udw.getValue(itemId); + if (!ObjectUtl.isEquals(itemState.getQuality(), QualityTypeValue.OPC_QUALITY_GOOD) && historyValue != null) { + log.warn("opc 值不健康 item: {}, 状态: {}", itemId, itemState.getQuality()); + } + if (!UnifiedDataAppService.isEquals(nowValue, historyValue)) { + OpcItemDto itemDto = (OpcItemDto) itemCodeOpcItemDtoMapping.get(itemId); + if (true) { + this.logItemChanged(itemId, udw, nowValue, itemDto); + } + udw.setValue(itemId, nowValue); + } + + } + + } } } } - @Override + private void refreshOpcEntity() { + if (canRefreshOpcEntity) { + canRefreshOpcEntity = false; + long now = System.currentTimeMillis(); + if (now - this.lastRefreshOpcEntityTime >= 20000L) { + this.lastRefreshOpcEntityTime = now; + submitTimeLimitTask(() -> { + try { + Map>> protocol = this.deviceAppService.findAllFormatProtocolFromDriver(); + Iterator var2 = protocol.entrySet().iterator(); + + while (var2.hasNext()) { + Entry>> stringListEntry = (Entry) var2.next(); + String opcCode = (String) stringListEntry.getKey(); + List> opcItemDtos = (List) stringListEntry.getValue(); + ((OpcEntity) opcCodeOpcEntityMapping.computeIfAbsent(opcCode, OpcEntity::new)).reload(opcItemDtos); + } + } catch (Exception var6) { + var6.printStackTrace(); + } finally { + canRefreshOpcEntity = true; + } + + }, (String) null); + } + } + } + + private void logMessage(String errorMessage) { + try { +// issueLogger.setResource(OpcConfig.resource_code, OpcConfig.resource_name).setError(StringUtl.getString(100), "设备同步通信异常").log(errorMessage, new Object[0]); +// businessLogger.setResource(OpcConfig.resource_code, OpcConfig.resource_name).setError(StringUtl.getString(100), "设备同步通信异常").log(errorMessage, new Object[0]); + } catch (Exception var5) { + var5.printStackTrace(); + } + + } + public void after() { - isRun = false; - this.executorService.shutdownNow(); - this.executorService = Executors.newCachedThreadPool(); + OpcStartTag.is_run = false; + opcCodeOpcEntityMapping.values().forEach((opcEntity) -> { + opcEntity.cleanUdwCache(); + OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerService.class); + opcServerService.cleanGroups(opcEntity.getOpcCode()); + }); + opcCodeOpcEntityMapping = new ConcurrentHashMap(); + itemCodeOpcItemDtoMapping = new ConcurrentHashMap(); + executorService.shutdownNow(); + } + + private void logItemChanged(String itemId, UnifiedDataAccessor accessor_value, Object value, OpcItemDto itemDto) { + ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class); + Object his = accessor_value.getValue(itemId); + List relate_items = itemDto.getRelate_items(); + if (relate_items != null && !relate_items.isEmpty()) { + StringBuilder sb = new StringBuilder(); + Iterator var8 = relate_items.iterator(); + + while (var8.hasNext()) { + String relate = (String) var8.next(); + Object obj = accessor_value.getValue(relate); + sb.append("key:" + relate + "value: " + obj + ";"); + } + if (!itemDto.getItem_code().endsWith("heartbeat") && !itemDto.getItem_code().endsWith("time") && !itemDto.getItem_code().endsWith("consumption")) { + // 存在上次点位值为null情况 则不记录日志 + if(!(his instanceof Float) && !(value instanceof Float)){ + log.info(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(),4, itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".") + 1), String.valueOf(his), String.valueOf(value)); +// LuceneLogDto luceneLogDto = new LuceneLogDto(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(),4, itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".") + 1), +// String.valueOf(his), String.valueOf(value)); +// luceneLogDto.setLogType(LogTypeEnum.DEVICE_LOG.getDesc()); +// String logLevel = paramService.findByCode(AcsConfig.LOGLEVEL).getValue(); +// if(StrUtil.isNotEmpty(logLevel) && isNumeric(logLevel) && (luceneLogDto.getLog_level() >= Integer.parseInt(logLevel))){ +// log.info("{}", JSON.toJSONString(luceneLogDto)); +// } + } + } + } else { + +// if (!itemDto.getItem_code().endsWith("heartbeat") && !itemDto.getItem_code().endsWith("time") && !itemDto.getItem_code().endsWith("consumption")) { +// if(!(his instanceof Float) && !(value instanceof Float)){ +// LuceneLogDto luceneLogDto = new LuceneLogDto(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(), itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".") + 1), +// String.valueOf(his), String.valueOf(value)); +// luceneLogDto.setLogType(LogTypeEnum.DEVICE_LOG.getDesc()); +// log.info("{}", JSON.toJSONString(luceneLogDto)); +// } +// } + + if (!itemDto.getItem_code().endsWith("heartbeat") && !itemDto.getItem_code().endsWith("time") && !itemDto.getItem_code().endsWith("consumption")) { + log.info(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(),4, itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".") + 1), String.valueOf(his), String.valueOf(value)); +// if(!(his instanceof Float) && !(value instanceof Float)){ +// LuceneLogDto luceneLogDto = new LuceneLogDto(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(),4, itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".") + 1), +// String.valueOf(his), String.valueOf(value)); +// luceneLogDto.setLogType(LogTypeEnum.DEVICE_LOG.getDesc()); +// String logLevel = paramService.findByCode(AcsConfig.LOGLEVEL).getValue(); +// if(StrUtil.isNotEmpty(logLevel) && isNumeric(logLevel) && (luceneLogDto.getLog_level() >= Integer.parseInt(logLevel))){ +// log.info("{}", JSON.toJSONString(luceneLogDto)); +// } +// } + } + + } + } + + static { + udw = UnifiedDataAccessorFactory.getAccessor(OpcConfig.udw_opc_value_key); + canReadOpcValues = new ConcurrentHashMap(); + opcCodeOpcEntityMapping = new ConcurrentHashMap(); + } + + public static boolean isNumeric(String str) { + return Pattern.compile("^[0-9]+$").matcher(str).matches(); } } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcEntity.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcEntity.java new file mode 100644 index 0000000..8708c3f --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcEntity.java @@ -0,0 +1,176 @@ +package org.nl.acs.opc; + +import org.nl.acs.udw.UnifiedDataAccessor; +import org.nl.acs.udw.UnifiedDataAccessorFactory; +import org.openscada.opc.lib.da.Group; +import org.openscada.opc.lib.da.Item; +import org.openscada.opc.lib.da.ItemState; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; + +public class OpcEntity { + @Autowired + OpcServerService opcServerService; + private final UnifiedDataAccessor udw; + private Map> items; + private Map> someFailDevices; + private String opcCode; + + public OpcEntity(String opcCode) { + this.udw = UnifiedDataAccessorFactory.getAccessor(OpcConfig.udw_opc_value_key); + this.items = new ConcurrentHashMap(); + this.someFailDevices = new ConcurrentHashMap(); + this.opcCode = opcCode; + } + + public void reload(List> opcItemDtos) { + Map> itemCodes = new ConcurrentHashMap(); + (opcItemDtos.stream().flatMap(Collection::stream).collect(Collectors.groupingBy(OpcItemDto::getDevice_code))).forEach((deviceCodes, opcItemDtoList) -> { + itemCodes.put(deviceCodes, opcItemDtoList.stream().map(OpcItemDto::getItem_code).collect(Collectors.toList())); + }); + DeviceOpcSynchronizeAutoRun.itemCodeOpcItemDtoMapping.putAll((Map)opcItemDtos.stream().flatMap(Collection::stream).collect(Collectors.toMap(OpcItemDto::getItem_code, (obj) -> { + return obj; + },(k, v) -> k))); + if (this.items.size() == 0) { + itemCodes.values().stream().flatMap(Collection::stream).forEach((key) -> { + this.udw.setValue(key, (Object)null); + }); + this.addItemsIntoGroup(itemCodes); + } else { + if (this.someFailDevices.size() > 0) { + this.reAddDevices(); + } + + } + } + + private void reAddDevices() { + Map> addItems = new ConcurrentHashMap(); + StringBuilder err_message = new StringBuilder(); + this.someFailDevices.forEach((deviceCode, itemCodesList) -> { + itemCodesList.forEach((itemCode) -> { + try { + Group group = DeviceOpcSynchronizeAutoRun.getGroup(this.opcCode); + ((List)addItems.computeIfAbsent(deviceCode, (key) -> { + return new ArrayList(); + })).add(group.addItem(itemCode)); + } catch (Exception var6) { + err_message.append(itemCode).append(" 添加失败; "); + } + + }); + List deviceItems = (List)addItems.get(deviceCode); + if (deviceItems != null && deviceItems.size() == itemCodesList.size()) { + this.someFailDevices.remove(deviceCode); + } else if (itemCodesList.size() == 0) { + addItems.remove(deviceCode); + } else { + assert deviceItems != null; + + ((List)this.someFailDevices.get(deviceCode)).removeAll(deviceItems); + } + + synchronized(this.opcCode.intern()) { + this.items.putAll(addItems); + } + + if (err_message.length() > 0) { + String errMsg = err_message.toString(); + //this.log.warn("{}:{}", com.wxzd.wcs.opc.OpcConfig.resource_code, errMsg); + } + + }); + } + + private void addItemsIntoGroup(Map> itemCodes) { + try { + Group group = DeviceOpcSynchronizeAutoRun.getGroup(this.opcCode); + StringBuilder err_message = new StringBuilder(); + Map> items = new ConcurrentHashMap(); + itemCodes.forEach((deviceCode, itemCodesList) -> { + itemCodesList.forEach((itemCode) -> { + try { + ((List)items.computeIfAbsent(deviceCode, (key) -> { + return new ArrayList(); + })).add(group.addItem(itemCode)); + } catch (Exception var7) { + ((List)this.someFailDevices.computeIfAbsent(deviceCode, (key) -> { + return new ArrayList(); + })).add(itemCode); + this.udw.setValue(itemCode, (Object)null); + err_message.append(itemCode).append(" 添加失败; "); + } + + }); + List deviceItems = (List)items.get(deviceCode); + if (deviceItems != null && deviceItems.size() != itemCodesList.size()) { + items.remove(deviceCode); + this.someFailDevices.put(deviceCode, itemCodesList); + } + + }); + synchronized(this.opcCode.intern()) { + this.items = items; + } + + if (err_message.length() > 0) { + String errMsg = err_message.toString(); +// this.log.warn("{}:{}", OpcConfig.resource_code, errMsg); + } + } catch (Exception var8) { + var8.printStackTrace(); + } + + } + + public void cleanUdwCache() { + this.items.values().stream().flatMap(Collection::stream).map(Item::getId).forEach((key) -> { + this.udw.setValue(key, (Object)null); + }); + } + + public Map readAll() throws Exception { + return opcServerService.getServer(this.opcCode).read(true, (Item[])this.items.values().stream().flatMap(Collection::stream).toArray((x$0) -> { + return new Item[x$0]; + })); + } + + public Map readDividually() { + Map result = new HashMap(); + CompletableFuture[] futures = (CompletableFuture[])this.items.entrySet().stream().map((entry) -> { + return CompletableFuture.runAsync(() -> { + try { + Group group = DeviceOpcSynchronizeAutoRun.getGroup(this.opcCode); + result.putAll(group.read(true, (Item[])((List)entry.getValue()).toArray(new Item[0]))); + } catch (Exception var5) { + String deviceCode = (String)entry.getKey(); + // to do +// this.someFailDevices.put(deviceCode, ((List)entry.getValue()).stream().map(Item::getId).collect(Collectors.toList())); + this.items.remove(deviceCode); + } + + }, DeviceOpcSynchronizeAutoRun.executorService); + }).toArray((x$0) -> { + return new CompletableFuture[x$0]; + }); + CompletableFuture.allOf(futures).join(); + return result; + } + + + public UnifiedDataAccessor getUdw() { + return this.udw; + } + + public Map> getItems() { + return this.items; + } + + public String getOpcCode() { + return this.opcCode; + } +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcServerService.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcServerService.java index 3e1f7a3..bd0bd37 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcServerService.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcServerService.java @@ -18,4 +18,6 @@ public interface OpcServerService { void writeInteger(String var1, ItemValue... var2); void clearServer(String var1); + + void cleanGroups(String var1); } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcServerServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcServerServiceImpl.java index 4308b31..920f525 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcServerServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcServerServiceImpl.java @@ -145,6 +145,24 @@ public class OpcServerServiceImpl implements OpcServerService, ApplicationAutoIn this.groups.remove(code); } + public void cleanGroups(String opcCode) { + Group group = (Group)this.groups.get(opcCode); + if (group != null) { + Server server = group.getServer(); + + try { + group.remove(); + } catch (JIException var5) { + var5.printStackTrace(); + } + + this.groups.remove(opcCode); + server.disconnect(); + this.servers.remove(opcCode); + } + + } + public void writeInteger(String code, ItemValue... values) { try { Group group = this.getServer(code); diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcUtl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcUtl.java index 5221918..293d6fa 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcUtl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcUtl.java @@ -3,22 +3,11 @@ package org.nl.acs.opc; import cn.hutool.core.util.NumberUtil; import lombok.extern.slf4j.Slf4j; import org.jinterop.dcom.common.JIException; -import org.jinterop.dcom.core.IJIUnsigned; -import org.jinterop.dcom.core.JIArray; -import org.jinterop.dcom.core.JIString; -import org.jinterop.dcom.core.JIUnsignedByte; -import org.jinterop.dcom.core.JIUnsignedShort; -import org.jinterop.dcom.core.JIVariant; +import org.jinterop.dcom.core.*; import org.nl.acs.device_driver.driver.ItemValue; import org.nl.common.exception.BadRequestException; import org.openscada.opc.lib.common.ConnectionInformation; -import org.openscada.opc.lib.da.AddFailedException; -import org.openscada.opc.lib.da.AutoReconnectController; -import org.openscada.opc.lib.da.Group; -import org.openscada.opc.lib.da.Item; -import org.openscada.opc.lib.da.ItemState; -import org.openscada.opc.lib.da.Server; -import org.openscada.opc.lib.da.WriteRequest; +import org.openscada.opc.lib.da.*; import java.util.ArrayList; import java.util.Iterator; diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/domain/Opc.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/domain/Opc.java index 7a2bc7e..022356e 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/domain/Opc.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/domain/Opc.java @@ -2,17 +2,9 @@ package org.nl.acs.opc.domain; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.copier.CopyOptions; -import com.baomidou.mybatisplus.annotation.FieldFill; -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 com.baomidou.mybatisplus.annotation.*; import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; +import lombok.*; import lombok.experimental.Accessors; import org.nl.acs.common.base.CommonModel; diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/domain/OpcPlc.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/domain/OpcPlc.java index 44dee9f..745f9a5 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/domain/OpcPlc.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/domain/OpcPlc.java @@ -2,17 +2,9 @@ package org.nl.acs.opc.domain; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.copier.CopyOptions; -import com.baomidou.mybatisplus.annotation.FieldFill; -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 com.baomidou.mybatisplus.annotation.*; import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; +import lombok.*; import lombok.experimental.Accessors; import org.nl.acs.common.base.CommonModel; diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/rest/OpcController.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/rest/OpcController.java index f000a29..4e49baa 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/rest/OpcController.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/rest/OpcController.java @@ -11,14 +11,7 @@ import org.springframework.data.domain.Pageable; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.io.IOException; diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/service/dto/OpcDto.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/service/dto/OpcDto.java index 19d9d66..16482ed 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/service/dto/OpcDto.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/service/dto/OpcDto.java @@ -1,11 +1,7 @@ package org.nl.acs.opc.service.dto; import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; +import lombok.*; import lombok.experimental.Accessors; import java.io.Serializable; diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/service/dto/OpcPlcDto.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/service/dto/OpcPlcDto.java index 2c03621..3183466 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/service/dto/OpcPlcDto.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/service/dto/OpcPlcDto.java @@ -1,11 +1,7 @@ package org.nl.acs.opc.service.dto; import io.swagger.annotations.ApiModelProperty; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; +import lombok.*; import lombok.experimental.Accessors; import java.io.Serializable; diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/service/impl/OpcServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/service/impl/OpcServiceImpl.java index 77a42be..6c199fc 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/service/impl/OpcServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/service/impl/OpcServiceImpl.java @@ -33,13 +33,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; /** * @author jiaolm diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index 4a32883..8ebbc29 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -56,6 +56,7 @@ import org.nl.common.utils.CodeUtil; import org.nl.config.SpringContextHolder; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @@ -79,6 +80,7 @@ import java.util.stream.Collectors; */ @Service @Slf4j +@Lazy // @CacheConfig(cacheNames = TaskService.CACHE_KEY) @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) public class TaskServiceImpl extends CommonServiceImpl implements TaskService, ApplicationAutoInitial { diff --git a/acs/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml b/acs/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml index b64926b..a4d013c 100644 --- a/acs/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml +++ b/acs/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml @@ -7,8 +7,8 @@ spring: db-type: com.alibaba.druid.pool.DruidDataSource driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy # url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true - url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:xftn_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true - username: ${DB_USER:generallu} + url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:tn_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true + username: ${DB_USER:root} # password: ${DB_PWD:Root.123456} password: ${DB_PWD:123456} # 初始连接数 diff --git a/acs/nladmin-ui/src/assets/images/logo.png b/acs/nladmin-ui/src/assets/images/logo.png index fbfa3c9..a1ca19b 100644 Binary files a/acs/nladmin-ui/src/assets/images/logo.png and b/acs/nladmin-ui/src/assets/images/logo.png differ diff --git a/lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml b/lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml index d8c8114..37eb038 100644 --- a/lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml +++ b/lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml @@ -6,9 +6,9 @@ spring: druid: db-type: com.alibaba.druid.pool.DruidDataSource driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy - url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:xftn_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true + url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:tn_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true # url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:stand_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true - username: ${DB_USER:generallu} + username: ${DB_USER:root} password: ${DB_PWD:123456} # password: ${DB_PWD:P@ssw0rd} # 初始连接数