Browse Source

rev:更新

master
gengby 8 months ago
parent
commit
e3837b3b92
  1. 2
      acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/InstructionService.java
  2. 9
      acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
  3. 5
      acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java
  4. 5
      acs/nladmin-system/src/main/java/org/nl/modules/system/service/impl/GenCodeServiceImpl.java

2
acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/InstructionService.java

@ -276,4 +276,6 @@ public interface InstructionService {
void init(String id); void init(String id);
List<Instruction> findByTaskCodeFromCache(String task_code);
} }

9
acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java

@ -1435,4 +1435,13 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
((SiemensConveyorDeviceDriver) startDeviceDriver).writing(list); ((SiemensConveyorDeviceDriver) startDeviceDriver).writing(list);
} }
} }
@Override
public List<Instruction> findByTaskCodeFromCache(String task_code) {
return Optional.ofNullable(instructions)
.orElse(new ArrayList<>())
.stream()
.filter(instruction -> instruction.getTask_code().equals(task_code))
.collect(Collectors.toList());
}
} }

5
acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java

@ -2,6 +2,7 @@ package org.nl.modules.quartz.task;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
@ -39,6 +40,10 @@ public class AutoCreateInst {
List<TaskDto> list = taskserver.queryAll("task_status = '0'"); List<TaskDto> list = taskserver.queryAll("task_status = '0'");
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
TaskDto acsTask = list.get(i); TaskDto acsTask = list.get(i);
List<Instruction> instructionList = instructionService.findByTaskCodeFromCache(acsTask.getTask_code());
if (ObjectUtil.isNotEmpty(instructionList)) {
continue;
}
if (StrUtil.equals(acsTask.getTask_type(), "7") && !StrUtil.startWith(acsTask.getTask_code(), "-")) { if (StrUtil.equals(acsTask.getTask_type(), "7") && !StrUtil.startWith(acsTask.getTask_code(), "-")) {
continue; continue;
} }

5
acs/nladmin-system/src/main/java/org/nl/modules/system/service/impl/GenCodeServiceImpl.java

@ -15,6 +15,8 @@ import org.nl.modules.wql.util.WqlUtil;
import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.CacheConfig;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
@ -98,13 +100,14 @@ public class GenCodeServiceImpl implements GenCodeService {
} }
@Override @Override
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public String codeDemo(Map form) { public String codeDemo(Map form) {
String code = (String) form.get("code"); String code = (String) form.get("code");
String id = this.queryIdByCode(code); String id = this.queryIdByCode(code);
//如果flag=1就执行更新数据库的操作 //如果flag=1就执行更新数据库的操作
String flag = (String) form.get("flag"); String flag = (String) form.get("flag");
WQLObject wo = WQLObject.getWQLObject("sys_code_rule_detail"); WQLObject wo = WQLObject.getWQLObject("sys_code_rule_detail");
JSONArray ja = wo.query("code_rule_id = '" + id + "'", " sort_num,type FOR UPDATE").getResultJSONArray(0); JSONArray ja = wo.query("code_rule_id = '" + id + "'", " sort_num,type").getResultJSONArray(0);
String demo = ""; String demo = "";
boolean is_same = true; boolean is_same = true;
for (int i = 0; i < ja.size(); i++) { for (int i = 0; i < ja.size(); i++) {

Loading…
Cancel
Save