| | |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.ManLocDetl; |
| | | import com.zy.asrs.entity.Node; |
| | | import com.zy.asrs.mapper.ManLocDetlMapper; |
| | | import com.zy.asrs.service.NodeService; |
| | | import com.zy.common.entity.NodeExcel; |
| | | import com.zy.common.entity.NodeExcelListener; |
| | |
| | | private NodeService nodeService; |
| | | @Autowired |
| | | private TreeUtils treeUtils; |
| | | @Autowired |
| | | private ManLocDetlMapper manLocDetlMapper; |
| | | |
| | | @RequestMapping(value = "/node/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | @RequestMapping(value = "/node/add/auth") |
| | | @ManagerAuth |
| | | public R add(Node node) { |
| | | Node node1 = nodeService.selectByUuid(node.getName()); |
| | | if (!Cools.isEmpty(node1)) { |
| | | throw new CoolException("该编号/名称已存在"); |
| | | } |
| | | if (node.getType() != 1) { |
| | | Node parentNode = nodeService.selectById(node.getParentId()); |
| | | if (parentNode == null || parentNode.getStatus() == 0) { |
| | |
| | | nodeUtils.executePath(node); |
| | | node.setHostId(getHostId()); |
| | | node.setUuid(node.getName().toString()); |
| | | System.out.println(node.getUuid()); |
| | | node.setPath(nodeUtils.path.toString()); |
| | | node.setNamePath(nodeUtils.pathName.toString()); |
| | | node.setLevel(node.getType()); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequestMapping(value = "/node/update/auth") |
| | | @ManagerAuth |
| | | public R update(Node node){ |
| | | Node node1 = nodeService.selectByUuid(node.getName()); |
| | | if (!Cools.isEmpty(node1)) { |
| | | throw new CoolException("该编号/名称已存在"); |
| | | } |
| | | if (Cools.isEmpty(node) || null==node.getId()){ |
| | | return R.error(); |
| | | } |
| | |
| | | nodeUtils.executePath(node); |
| | | node.setPath(nodeUtils.path.toString()); |
| | | node.setNamePath(nodeUtils.pathName.toString()); |
| | | node.setUuid(node.getName()); |
| | | |
| | | manLocDetlMapper.updateLocNo0(node.getId(),node.getName()); |
| | | node.setUpdateBy(getUserId()); |
| | | node.setUpdateTime(new Date()); |
| | | nodeService.updateById(node); |