提交 75285542 authored 作者: 邓砥奕's avatar 邓砥奕

[维修模块]修改维修task强转bug

上级 9d175f61
...@@ -95,6 +95,12 @@ public class DeviceLibraryController { ...@@ -95,6 +95,12 @@ public class DeviceLibraryController {
return ResultUtil.success(deviceLibraryService.getAllName()); return ResultUtil.success(deviceLibraryService.getAllName());
} }
@ApiOperation(value = "查询在库的装备所有型号", notes = "可以通过这个接口查询在库的装备所有型号")
@GetMapping("/select/libraray/models")
public ResponseEntity selectLibraryModels() {
return ResultUtil.success(deviceLibraryService.getAllInLibraryModels());
}
@ApiOperation(value = "模糊查询标签管理装备分页", notes = "可以通过这个接口查询装备列表") @ApiOperation(value = "模糊查询标签管理装备分页", notes = "可以通过这个接口查询装备列表")
@PostMapping("/selectTagDevicePage") @PostMapping("/selectTagDevicePage")
public ResponseEntity selectTagDevicePage(@RequestBody DeviceLibrarySelectVo deviceLibrarySelectVo) { public ResponseEntity selectTagDevicePage(@RequestBody DeviceLibrarySelectVo deviceLibrarySelectVo) {
......
...@@ -109,4 +109,9 @@ public interface DeviceLibraryService { ...@@ -109,4 +109,9 @@ public interface DeviceLibraryService {
* 查询拥有装备的所有单位 * 查询拥有装备的所有单位
*/ */
List<String> getAllUnit(); List<String> getAllUnit();
/**
* 查询在库所有装备的型号
*/
List<String> getAllInLibraryModels();
} }
...@@ -294,6 +294,20 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -294,6 +294,20 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
return new ArrayList<>(s); return new ArrayList<>(s);
} }
/**
* 查询在库所有装备的型号
*/
@Override
public List<String> getAllInLibraryModels() {
List<DeviceLibrary> deviceLibraryEntities = deviceLibraryDao.findAll(getAllotSelectSpecification(new DeviceLibrarySelectVo()));
//用Set存装备型号,排除重复名称
Set<String> s = new HashSet<>();
for (DeviceLibrary d:deviceLibraryEntities) {
s.add(d.getModel());
}
return new ArrayList<>(s);
}
@Override @Override
public List<DeviceLibrary> getAllList(DeviceLibrarySelectVo deviceLibrarySelectVo) { public List<DeviceLibrary> getAllList(DeviceLibrarySelectVo deviceLibrarySelectVo) {
return deviceLibraryDao.findAll(getSelectSpecification4(deviceLibrarySelectVo)); return deviceLibraryDao.findAll(getSelectSpecification4(deviceLibrarySelectVo));
...@@ -382,6 +396,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -382,6 +396,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
PredicateBuilder<DeviceLibrary> predicateBuilder = getPredicateBuilder(deviceLibrarySelectVo); PredicateBuilder<DeviceLibrary> predicateBuilder = getPredicateBuilder(deviceLibrarySelectVo);
String unit = userUtils.getCurrentUserUnitName(); String unit = userUtils.getCurrentUserUnitName();
predicateBuilder.eq("ownUnit",unit); predicateBuilder.eq("ownUnit",unit);
predicateBuilder.eq("locationUnit",unit);
predicateBuilder.eq("lifeStatus",2); predicateBuilder.eq("lifeStatus",2);
return predicateBuilder.build(); return predicateBuilder.build();
} }
......
...@@ -173,8 +173,7 @@ public class RepairController { ...@@ -173,8 +173,7 @@ public class RepairController {
public ResponseEntity continueCreateRepair(@RequestBody RepairBillSaveVo deviceRepairBillSaveVo) { public ResponseEntity continueCreateRepair(@RequestBody RepairBillSaveVo deviceRepairBillSaveVo) {
ResponseEntity responseEntity = createRepair(deviceRepairBillSaveVo); ResponseEntity responseEntity = createRepair(deviceRepairBillSaveVo);
ResultObj resultObj = (ResultObj) responseEntity.getBody(); ResultObj resultObj = (ResultObj) responseEntity.getBody();
Task task = (Task) Objects.requireNonNull(resultObj).getData(); TaskBto taskBto = (TaskBto) Objects.requireNonNull(resultObj).getData();
TaskBto taskBto = task.parse2Bto();
TaskBto parentTask = taskService.get(deviceRepairBillSaveVo.getTaskId()); TaskBto parentTask = taskService.get(deviceRepairBillSaveVo.getTaskId());
taskBto.setParentTaskId(parentTask.getId()); taskBto.setParentTaskId(parentTask.getId());
taskBto.setNodeIdDetail(parentTask.getNodeIdDetail() + deviceRepairBillSaveVo.getTaskId() + "."); taskBto.setNodeIdDetail(parentTask.getNodeIdDetail() + deviceRepairBillSaveVo.getTaskId() + ".");
......
...@@ -12,6 +12,9 @@ import org.springframework.scheduling.annotation.Scheduled; ...@@ -12,6 +12,9 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -31,11 +34,9 @@ public class SelfCheckSchedulerTask { ...@@ -31,11 +34,9 @@ public class SelfCheckSchedulerTask {
*/ */
private String cron3 = "0 0 0 1 1 ? *"; private String cron3 = "0 0 0 1 1 ? *";
private ThreadPoolTaskScheduler threadPoolTaskScheduler;
// @Async // @Async
// @Scheduled(cron = "0 0/1 * * * ? ") // @Scheduled(cron = "0 0 0 1 1/1 ? ")
// public void createSelfCheckTask() throws InterruptedException{ // public void createSelfCheckTask() {
// UnitsDao unitsDao = SpringUtils.getBean("unitsDao"); // UnitsDao unitsDao = SpringUtils.getBean("unitsDao");
// TaskService taskService = SpringUtils.getBean("taskServiceImpl"); // TaskService taskService = SpringUtils.getBean("taskServiceImpl");
// if (unitsDao != null && taskService!=null) { // if (unitsDao != null && taskService!=null) {
......
...@@ -6,6 +6,7 @@ import com.tykj.dev.device.library.service.DeviceLibraryService; ...@@ -6,6 +6,7 @@ import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.service.DeviceLogService; import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto; import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary; import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.selfcheck.base.SelfCheckSchedulerTask;
import com.tykj.dev.device.selfcheck.service.SelfCheckBillService; import com.tykj.dev.device.selfcheck.service.SelfCheckBillService;
import com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill; import com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill;
import com.tykj.dev.device.selfcheck.subject.vo.*; import com.tykj.dev.device.selfcheck.subject.vo.*;
...@@ -25,10 +26,15 @@ import io.swagger.annotations.ApiOperation; ...@@ -25,10 +26,15 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author dengdiyi * @author dengdiyi
...@@ -66,6 +72,39 @@ public class SelfCheckController { ...@@ -66,6 +72,39 @@ public class SelfCheckController {
@Autowired @Autowired
private MyWebSocket myWebSocket; private MyWebSocket myWebSocket;
/**
* 月度
*/
private String cron1 = "0 0 0 1 1/1 ? ";
/**
* 季度
*/
private String cron2 = "0 0 0 1 3,6,9,12 ? ";
/**
* 年度
*/
private String cron3 = "0 0 0 1 1 ? *";
@ApiOperation(value = "设置自查周期", notes = "可以通过这个接口设置自查周期")
@PostMapping(value = "/set/cycle/{type}")
public ResponseEntity setCycle(@PathVariable("type") int type) throws NoSuchMethodException, IllegalAccessException, NoSuchFieldException {
switch (type){
case 1:
setCorn(cron1);
return ResponseEntity.ok("自查周期更改为月度");
case 2:
setCorn(cron2);
return ResponseEntity.ok("自查周期更改为季度");
case 3:
setCorn(cron3);
return ResponseEntity.ok("自查周期更改为年度");
case 4:
setCorn("0 0/1 * * * ? ");
return ResponseEntity.ok("自查周期更改为每分钟");
default:return ResponseEntity.ok(ResultUtil.failed("设置失败:type只能为1,2,3"));
}
}
@ApiOperation(value = "装备比较", notes = "可以通过这个接口发起比较装备") @ApiOperation(value = "装备比较", notes = "可以通过这个接口发起比较装备")
@PostMapping(value = "/compare") @PostMapping(value = "/compare")
public ResponseEntity compare(@RequestBody CompareVo compareVo) { public ResponseEntity compare(@RequestBody CompareVo compareVo) {
...@@ -303,4 +342,12 @@ public class SelfCheckController { ...@@ -303,4 +342,12 @@ public class SelfCheckController {
return ResultUtil.success(list); return ResultUtil.success(list);
} }
private void setCorn(String cron) throws NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
Scheduled scheduled = SelfCheckSchedulerTask.class.getDeclaredMethod("createSelfCheckTask").getAnnotation(Scheduled.class);
InvocationHandler h = Proxy.getInvocationHandler(scheduled);
Field field = h.getClass().getDeclaredField("memberValues");
field.setAccessible(true);
Map memberValues = (Map)field.get(h);
memberValues.put("cron",cron);
}
} }
...@@ -24,11 +24,14 @@ import com.tykj.dev.device.sendback.repository.SendBackBillDao; ...@@ -24,11 +24,14 @@ import com.tykj.dev.device.sendback.repository.SendBackBillDao;
import com.tykj.dev.device.sendback.repository.SendBackBillDetailDao; import com.tykj.dev.device.sendback.repository.SendBackBillDetailDao;
import com.tykj.dev.device.storage.service.StorageBillService; import com.tykj.dev.device.storage.service.StorageBillService;
import com.tykj.dev.device.storage.subject.domin.StorageBill; import com.tykj.dev.device.storage.subject.domin.StorageBill;
import com.tykj.dev.device.task.repository.TaskDao;
import com.tykj.dev.device.task.service.TaskService; import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto; import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.device.taskselect.vo.SignatureSaveVo; import com.tykj.dev.device.taskselect.vo.SignatureSaveVo;
import com.tykj.dev.device.user.subject.service.UserPublicService; import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.misc.base.ResultObj; import com.tykj.dev.misc.base.ResultObj;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.exception.ApiException; import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.ResultUtil; import com.tykj.dev.misc.utils.ResultUtil;
import com.tykj.dev.misc.utils.Snowflake; import com.tykj.dev.misc.utils.Snowflake;
...@@ -105,6 +108,9 @@ public class TaskSelectController { ...@@ -105,6 +108,9 @@ public class TaskSelectController {
@Autowired @Autowired
private Snowflake snowflake; private Snowflake snowflake;
@Autowired
private TaskDao taskDao;
@ApiOperation(value = "查询业务对应页面的数据", notes = "可以通过这个接口查询业务对应页面的数据") @ApiOperation(value = "查询业务对应页面的数据", notes = "可以通过这个接口查询业务对应页面的数据")
@GetMapping("/manage/detail/{id}") @GetMapping("/manage/detail/{id}")
public ResponseEntity selectData(@PathVariable("id") int taskId) { public ResponseEntity selectData(@PathVariable("id") int taskId) {
...@@ -333,6 +339,22 @@ public class TaskSelectController { ...@@ -333,6 +339,22 @@ public class TaskSelectController {
} }
list.add(packingLibraryEntityList); list.add(packingLibraryEntityList);
list.add(deviceLibraryService.getAllotList(new DeviceLibrarySelectVo()).stream().filter(deviceLibraryEntity -> packingIdList.contains(deviceLibraryEntity.getPackingId())).sorted(Comparator.comparing(DeviceLibrary::getPackingId)).collect(Collectors.toList())); list.add(deviceLibraryService.getAllotList(new DeviceLibrarySelectVo()).stream().filter(deviceLibraryEntity -> packingIdList.contains(deviceLibraryEntity.getPackingId())).sorted(Comparator.comparing(DeviceLibrary::getPackingId)).collect(Collectors.toList()));
List<Task> tasks = taskDao.findAllByParentTaskId(taskId);
List<DeviceLibrary> deviceLibraries = new ArrayList<>();
if (tasks.size()==1){
Task task = tasks.get(0);
if (task.getBusinessType()==3){
if (task.getBillId()>0){
AllotBill allotBill = allotBillService.getOne(task.getBillId());
if (allotBill.getAllotCheckDetail()!=null){
StringSplitUtil.split(allotBill.getAllotCheckDetail()).forEach(integer -> {
deviceLibraries.add(deviceLibraryService.getOne(integer));
});
}
}
}
}
list.add(deviceLibraries);
return ResponseEntity.ok(new ResultObj(list,"查询成功")); return ResponseEntity.ok(new ResultObj(list,"查询成功"));
default:throw new ApiException(ResultUtil.failed("该接口不支持当前task业务类型")); default:throw new ApiException(ResultUtil.failed("该接口不支持当前task业务类型"));
} }
...@@ -430,5 +452,6 @@ public class TaskSelectController { ...@@ -430,5 +452,6 @@ public class TaskSelectController {
@GetMapping("/signature/create") @GetMapping("/signature/create")
public ResponseEntity createSignatureId(){ public ResponseEntity createSignatureId(){
return ResponseEntity.ok(snowflake.creatNextId()); return ResponseEntity.ok(snowflake.creatNextId());
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论