| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -21,15 +21,17 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.constant.FieldConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.exception.EpmetErrorCode; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.exception.ErrorCode; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.exception.RenException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.page.PageData; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.security.dto.TokenDto; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.ConvertUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.commons.tools.utils.Result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dao.CustomerGridDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.CustomerGridDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.CustomerStaffGridDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.StaffGridListDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.form.CustomerGridFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.form.ListCustomerGridFormDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.form.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.result.AddGridResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.result.CustomerGridByUserIdResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.result.CustomerGridForStrangerResultDTO; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.result.GridDetailResultDTO; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -43,10 +45,7 @@ import org.springframework.beans.factory.annotation.Autowired; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.stereotype.Service; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.transaction.annotation.Transactional; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.Arrays; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.HashMap; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.List; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.Map; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					/** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					 * 客户网格表 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -169,6 +168,11 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return new Result<List<CustomerGridByUserIdResultDTO>>().ok(baseDao.getMyGrids(userId)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * 查询网格详情 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param customerGridFormDTO | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @return | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public Result<GridDetailResultDTO> griddetail(CustomerGridFormDTO customerGridFormDTO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        GridDetailResultDTO griddetail = baseDao.griddetail(customerGridFormDTO); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -178,4 +182,56 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return new Result<GridDetailResultDTO>().ok(griddetail); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public Result<AddGridResultDTO> addGrid(TokenDto tokenDto, AddGridFormDTO addGridFormDTO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        CustomerGridEntity customerGridEntity = new CustomerGridEntity(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        customerGridEntity.setCustomerId(baseDao.selectCustomerIdByUserId(tokenDto.getUserId())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        customerGridEntity.setGridName(addGridFormDTO.getGridName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        customerGridEntity.setDelFlag("0"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        customerGridEntity.setCreatedBy(tokenDto.getUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        customerGridEntity.setUpdatedBy(tokenDto.getUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        customerGridEntity.setTotalUser(0); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        customerGridEntity.setManageDistrict(addGridFormDTO.getManageDistrict()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        customerGridEntity.setPid(addGridFormDTO.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        customerGridEntity.setPids(baseDao.selectPidsByPid(addGridFormDTO.getAgencyId())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        baseDao.insert(customerGridEntity); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String gridId = baseDao.selectGridIdByGridName(addGridFormDTO.getGridName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        AddGridResultDTO addGridResultDTO = new AddGridResultDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        addGridResultDTO.setGridId(gridId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return new Result<AddGridResultDTO>().ok(addGridResultDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * 修改网格信息 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param tokenDto | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param editGridFormDTO | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public Result editGrid(TokenDto tokenDto, EditGridFormDTO editGridFormDTO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        CustomerGridDTO customerGridDTO = new CustomerGridDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        customerGridDTO.setManageDistrict(editGridFormDTO.getManageDistrict()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        customerGridDTO.setGridName(editGridFormDTO.getGridName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        customerGridDTO.setUpdatedBy(tokenDto.getUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        customerGridDTO.setId(editGridFormDTO.getGridId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        baseDao.editGrid(customerGridDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return new Result(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public Result deleteGrid(TokenDto tokenDto,DeleteGridFormDTO deleteGridFormDTO) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        UserIdDTO userIdDTO = new UserIdDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        userIdDTO.setUserId(tokenDto.getUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        deleteGridFormDTO.setUserId(tokenDto.getUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Result<GridStaffCountDTO> gridStaffCountDTOResult = epmetUserFeignClient.selectGridStaffCountByUserId(userIdDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (gridStaffCountDTOResult.getData().getEnableCount()==0){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            baseDao.deleteGrid(deleteGridFormDTO); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        }else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            return new Result().error(EpmetErrorCode.NOT_DEL_GRID.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return new Result(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
					 | 
				
				 | 
				
					
  |