|
@@ -2,32 +2,35 @@ package com.github.zuihou.business.controller.productionResourceCenter;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.github.zuihou.base.R;
|
|
|
+import com.github.zuihou.base.controller.SuperController;
|
|
|
import com.github.zuihou.base.request.PageParams;
|
|
|
-import com.github.zuihou.business.productionResourceCenter.dao.ToolMapper;
|
|
|
-import com.github.zuihou.business.productionResourceCenter.entity.Tool;
|
|
|
+import com.github.zuihou.business.productionReadyCenter.entity.MachineCuttingTool;
|
|
|
+import com.github.zuihou.business.productionReadyCenter.service.MachineCuttingToolService;
|
|
|
+import com.github.zuihou.business.productionResourceCenter.dto.ToolPageDTO;
|
|
|
import com.github.zuihou.business.productionResourceCenter.dto.ToolSaveDTO;
|
|
|
import com.github.zuihou.business.productionResourceCenter.dto.ToolUpdateDTO;
|
|
|
-import com.github.zuihou.business.productionResourceCenter.dto.ToolPageDTO;
|
|
|
+import com.github.zuihou.business.productionResourceCenter.entity.Productionresource;
|
|
|
+import com.github.zuihou.business.productionResourceCenter.entity.Tool;
|
|
|
+import com.github.zuihou.business.productionResourceCenter.service.ProductionresourceBizService;
|
|
|
import com.github.zuihou.business.productionResourceCenter.service.ToolService;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-import com.github.zuihou.base.controller.SuperController;
|
|
|
-import com.github.zuihou.base.R;
|
|
|
-import com.github.zuihou.database.mybatis.conditions.Wraps;
|
|
|
import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
|
|
|
import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
|
|
|
import com.github.zuihou.log.annotation.SysLog;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import com.github.zuihou.security.annotation.PreAuth;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -46,6 +49,13 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
@SysLog(enabled = true)
|
|
|
public class ToolController extends SuperController<ToolService, Long, Tool, ToolPageDTO, ToolSaveDTO, ToolUpdateDTO> {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ProductionresourceBizService productionresourceBizService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MachineCuttingToolService machineCuttingToolService;
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public void query(PageParams<ToolPageDTO> params, IPage<Tool> page, Long defSize) {
|
|
|
ToolPageDTO data = params.getModel();
|
|
@@ -80,12 +90,20 @@ public class ToolController extends SuperController<ToolService, Long, Tool, Too
|
|
|
return success(tool);
|
|
|
}
|
|
|
|
|
|
- //
|
|
|
+ //刀具定时任务处理
|
|
|
+ @Scheduled(cron = "0 0/2 * * * *")
|
|
|
@ApiOperation(value = "同步刀具", notes = "同步刀具")
|
|
|
@PostMapping("/synchronousTool")
|
|
|
- public R<Boolean> synchronousTool(@RequestBody Tool model) {
|
|
|
+ public R<Boolean> synchronousTool() throws Exception {
|
|
|
+ List<Productionresource> dataList = productionresourceBizService.list(new LbqWrapper<Productionresource>().eq(Productionresource::getStatus, "1").ne(Productionresource::getOnlineStatus,"0").isNotNull(Productionresource::getModeSpecification));
|
|
|
+ List<Long> ids = dataList.stream().map(Productionresource::getId).collect(Collectors.toList());
|
|
|
+ MachineCuttingTool machineCuttingTool = new MachineCuttingTool();
|
|
|
+ machineCuttingTool.setIds(ids);
|
|
|
+ //同步更新处理
|
|
|
+ machineCuttingToolService.sysCuttingTools(machineCuttingTool);
|
|
|
+ //同步添加天轨处理订单
|
|
|
|
|
|
- return success(baseService.synchronousTool(model));
|
|
|
+ return R.success();
|
|
|
}
|
|
|
|
|
|
}
|