|  |  | 
 |  |  | package com.doumee.service.business.impl; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import cn.hutool.core.bean.BeanUtil; | 
 |  |  | import com.doumee.core.annotation.excel.ExcelImporter; | 
 |  |  | import com.doumee.core.constants.ResponseStatus; | 
 |  |  | import com.doumee.core.exception.BusinessException; | 
 |  |  | import com.doumee.core.utils.Constants; | 
 |  |  | import com.doumee.core.utils.ScientificNotationTUtil; | 
 |  |  | import com.doumee.dao.admin.request.CarsImport; | 
 |  |  | import com.doumee.core.utils.DateUtil; | 
 |  |  | import com.doumee.dao.admin.request.JkLineImport; | 
 |  |  | import com.doumee.dao.business.CarsMapper; | 
 |  |  | import com.doumee.dao.business.CategoryMapper; | 
 |  |  | import com.doumee.dao.business.JkCustomerMapper; | 
 |  |  | import com.doumee.dao.business.dto.TelecomLineInfoDTO; | 
 |  |  | import com.doumee.dao.business.model.*; | 
 |  |  | import com.doumee.dao.business.vo.TelecomCategoryDataVO; | 
 |  |  | import com.doumee.dao.business.vo.TelecomJkLineListVO; | 
 |  |  | import com.doumee.dao.business.vo.TelecomLineCountVO; | 
 |  |  | import com.doumee.dao.business.vo.TelecomLineDataVO; | 
 |  |  | import com.doumee.service.business.third.model.LoginUserInfo; | 
 |  |  | import com.doumee.service.business.third.model.PageData; | 
 |  |  | import com.doumee.service.business.third.model.PageWrap; | 
 |  |  | 
 |  |  | import org.springframework.util.CollectionUtils; | 
 |  |  | import org.springframework.web.multipart.MultipartFile; | 
 |  |  |  | 
 |  |  | import java.math.BigDecimal; | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Objects; | 
 |  |  | import java.util.concurrent.TimeUnit; | 
 |  |  | import java.util.stream.Collectors; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * 交控-线路信息表Service实现 | 
 |  |  | 
 |  |  |     private JkLineMapper jkLineMapper; | 
 |  |  |     @Autowired | 
 |  |  |     private CategoryMapper categoryMapper; | 
 |  |  |     @Autowired | 
 |  |  |     private JkCustomerMapper jkCustomerMapper; | 
 |  |  |     @Autowired | 
 |  |  |     private CarsMapper carsMapper; | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public void deleteById(Integer id, LoginUserInfo user) { | 
 |  |  |         JkLine c = jkLineMapper.selectById(id); | 
 |  |  |         if(c == null||Constants.equalsInteger(c.getIsdeleted(),Constants.ONE)){ | 
 |  |  |             throw  new BusinessException(ResponseStatus.DATA_EMPTY); | 
 |  |  |         } | 
 |  |  |         //如果是新线路,检查是否有子线路,有则不允许删除 | 
 |  |  |         if(jkCustomerMapper.selectCount(new MPJLambdaWrapper<JkCustomer>().eq(JkCustomer::getIsdeleted,Constants.ZERO) | 
 |  |  |                 .eq(JkCustomer::getLineId,id)) >0){ | 
 |  |  |             throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"线路【"+c.getName()+"】下已存在客户信息,不允许删除!"); | 
 |  |  |         } | 
 |  |  |         jkLineMapper.update(null,new UpdateWrapper<JkLine>().lambda() | 
 |  |  |                 .set(JkLine::getIsdeleted,Constants.ONE) | 
 |  |  |                 .set(JkLine::getEditor,user.getId()) | 
 |  |  | 
 |  |  |     public void deleteByIdInBatch(List<Integer> ids, LoginUserInfo user) { | 
 |  |  |         if (CollectionUtils.isEmpty(ids)) { | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         for(Integer id :ids){ | 
 |  |  |             JkLine c = jkLineMapper.selectById(id); | 
 |  |  |             if(c == null||Constants.equalsInteger(c.getIsdeleted(),Constants.ONE)){ | 
 |  |  |                continue; | 
 |  |  |             } | 
 |  |  |             //如果是新线路,检查是否有子线路,有则不允许删除 | 
 |  |  |             if(jkCustomerMapper.selectCount(new MPJLambdaWrapper<JkCustomer>().eq(JkCustomer::getIsdeleted,Constants.ZERO) | 
 |  |  |                     .eq(JkCustomer::getLineId,id)) >0){ | 
 |  |  |                 throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"线路【"+c.getName()+"】下已存在客户信息,不允许删除!"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         jkLineMapper.update(null,new UpdateWrapper<JkLine>().lambda() | 
 |  |  |                 .set(JkLine::getIsdeleted,Constants.ONE) | 
 |  |  | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } |