| | |
| | | package com.zy.acs.manager.manager.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.manager.common.domain.AreaShapeDto; |
| | | import com.zy.acs.manager.core.service.AreaGovernService; |
| | | import com.zy.acs.manager.manager.controller.param.MapAreaParam; |
| | | import com.zy.acs.manager.manager.entity.Area; |
| | | import com.zy.acs.manager.manager.entity.AreaAgv; |
| | | import com.zy.acs.manager.manager.enums.StatusType; |
| | | import com.zy.acs.manager.manager.mapper.AreaMapper; |
| | | import com.zy.acs.manager.manager.service.AreaAgvService; |
| | | import com.zy.acs.manager.manager.service.AreaService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @Autowired |
| | | private AreaGovernService areaGovernService; |
| | | @Autowired |
| | | private AreaAgvService areaAgvService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | return area; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Area modifyMapArea(MapAreaParam param, Long loginUserId) { |
| | | Long areaId = param.getId(); |
| | | Area area = this.getById(areaId); |
| | | |
| | | // area - agv |
| | | areaAgvService.remove(new LambdaQueryWrapper<AreaAgv>().eq(AreaAgv::getAreaId, areaId)); |
| | | if (!Cools.isEmpty(param.getAgvIds())) { |
| | | for (Long agvId : param.getAgvIds()) { |
| | | if (null == agvId) { continue; } |
| | | |
| | | if (!areaAgvService.save(new AreaAgv(areaId, agvId))) { |
| | | throw new RuntimeException("failed to save AreaAgv"); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | // area |
| | | boolean needModify = false; |
| | | if (!Cools.isEmpty(param.getName()) && !area.getName().equals(param.getName())) { |
| | | area.setName(param.getName()); |
| | | needModify = true; |
| | | } |
| | | |
| | | if (needModify) { |
| | | if (!this.updateById(area)) { |
| | | throw new RuntimeException("failed to update Area"); |
| | | } |
| | | } |
| | | |
| | | return area; |
| | | } |
| | | |
| | | } |