| | |
| | | package com.zy.crm.manager.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.crm.manager.mapper.PlanTypeMapper; |
| | | import com.zy.crm.manager.entity.PlanType; |
| | | import com.zy.crm.manager.service.PlanTypeService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.zy.crm.system.entity.Dept; |
| | | import com.zy.crm.system.entity.User; |
| | | import com.zy.crm.system.service.DeptService; |
| | | import com.zy.crm.system.service.UserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("planTypeService") |
| | | public class PlanTypeServiceImpl extends ServiceImpl<PlanTypeMapper, PlanType> implements PlanTypeService { |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | | @Autowired |
| | | private DeptService deptService; |
| | | |
| | | @Override |
| | | public User findPlanLeader(PlanType planType) { |
| | | Dept dept; |
| | | switch (planType.getType()) { |
| | | // 货架 |
| | | case 1: |
| | | dept = deptService.selectOne(new EntityWrapper<Dept>().eq("memo", "货架")); |
| | | if (Cools.isEmpty(dept)) { |
| | | throw new CoolException("未查找到货架规划部"); |
| | | } |
| | | return userService.getDeptManager(planType.getHostId(), dept.getId()); |
| | | // 集成 |
| | | case 2: |
| | | dept = deptService.selectOne(new EntityWrapper<Dept>().eq("memo", "集成")); |
| | | if (Cools.isEmpty(dept)) { |
| | | throw new CoolException("未查找到集成规划部"); |
| | | } |
| | | return userService.getDeptManager(planType.getHostId(), dept.getId()); |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public User findPriQuoteLeader(PlanType planType) { |
| | | Dept dept; |
| | | switch (planType.getType()) { |
| | | // 货架 |
| | | case 1: |
| | | dept = deptService.selectOne(new EntityWrapper<Dept>().eq("memo", "货架")); |
| | | if (Cools.isEmpty(dept)) { |
| | | throw new CoolException("未查找到货架规划部"); |
| | | } |
| | | return userService.getDeptManager(planType.getHostId(), dept.getId()); |
| | | // 集成 |
| | | case 2: |
| | | dept = deptService.selectOne(new EntityWrapper<Dept>().eq("memo", "集成")); |
| | | if (Cools.isEmpty(dept)) { |
| | | throw new CoolException("未查找到集成规划部"); |
| | | } |
| | | return userService.getDeptManager(planType.getHostId(), dept.getId()); |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |