|  |  | 
 |  |  | 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) | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public List<JkLine> findList(JkLine jkLine) { | 
 |  |  |  | 
 |  |  |         MPJLambdaWrapper<JkLine> queryWrapper = new MPJLambdaWrapper<>(); | 
 |  |  |         jkLine.setIsdeleted(Constants.ZERO); | 
 |  |  |         QueryWrapper<JkLine> wrapper = new QueryWrapper<>(jkLine); | 
 |  |  |         wrapper.lambda().orderByAsc(JkLine::getCode); | 
 |  |  |         return jkLineMapper.selectList(wrapper); | 
 |  |  |         queryWrapper.selectAll(JkLine.class ) | 
 |  |  |                 .selectAs(Member::getName,JkLine::getMemberName) | 
 |  |  |                 .selectAs(Cars::getCode,JkLine::getCarCode) | 
 |  |  |                 .leftJoin(Cars.class,Cars::getId,JkLine::getCarId ) | 
 |  |  |                 .leftJoin(Member.class,Member::getId,Cars::getMemberId ); | 
 |  |  |         jkLine.setIsdeleted(Constants.ZERO); | 
 |  |  |         if (jkLine.getIsdeleted() != null) { | 
 |  |  |             queryWrapper.eq(JkLine::getIsdeleted, jkLine.getIsdeleted()); | 
 |  |  |         } | 
 |  |  |         if (jkLine.getCategoryId() != null) { | 
 |  |  |             queryWrapper.eq(JkLine::getCategoryId, jkLine.getCategoryId()); | 
 |  |  |         } | 
 |  |  |         if (jkLine.getCarId() != null) { | 
 |  |  |             queryWrapper.eq(JkLine::getCarId, jkLine.getCarId()); | 
 |  |  |         } | 
 |  |  |         if (jkLine.getStatus() != null) { | 
 |  |  |             queryWrapper.eq(JkLine::getStatus, jkLine.getStatus()); | 
 |  |  |         } | 
 |  |  |         if (jkLine.getSortnum() != null) { | 
 |  |  |             queryWrapper.eq(JkLine::getSortnum, jkLine.getSortnum()); | 
 |  |  |         } | 
 |  |  |         queryWrapper.orderByAsc(JkLine::getCode); | 
 |  |  |         return jkLineMapper.selectJoinList(JkLine.class,queryWrapper); | 
 |  |  |     } | 
 |  |  |    | 
 |  |  |     @Override | 
 |  |  | 
 |  |  |         if(importing!=null && importing){ | 
 |  |  |             throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,已存在导入任务正在执行中,请稍后再试!"); | 
 |  |  |         } | 
 |  |  |         redisTemplate.opsForValue().set(Constants.RedisKeys.IMPORTING_JKLINE,true); | 
 |  |  |         redisTemplate.opsForValue().set(Constants.RedisKeys.IMPORTING_JKLINE,true,30, TimeUnit.MINUTES); | 
 |  |  |         try { | 
 |  |  |             ExcelImporter ie = null; | 
 |  |  |             List<JkLineImport> dataList =null; | 
 |  |  | 
 |  |  |         } | 
 |  |  |         return null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } |