| | |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.PhoneMapper; |
| | | import com.stylefeng.guns.modular.system.model.OpenCity; |
| | | import com.stylefeng.guns.modular.system.model.Phone; |
| | | import com.stylefeng.guns.modular.system.service.IOpenCityService; |
| | | import com.stylefeng.guns.modular.system.service.IPhoneService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Resource |
| | | private PhoneMapper phoneMapper; |
| | | @Autowired |
| | | private IOpenCityService openCityService; |
| | | |
| | | /** |
| | | * 获取所有系统电话 |
| | |
| | | */ |
| | | @Override |
| | | public List<Phone> queryPhones(String code) throws Exception { |
| | | String province = code.substring(0, 2) + "0000"; |
| | | String city = code.substring(0, 4) + "00"; |
| | | |
| | | List<Phone> list = phoneMapper.queryPhones(province, city, code); |
| | | if(list.size() == 0){ |
| | | list = phoneMapper.queryPhones(province, city, null); |
| | | } |
| | | if(list.size() == 0){ |
| | | list = phoneMapper.queryPhones(province, null, null); |
| | | } |
| | | OpenCity openCity = openCityService.openCity1(code); |
| | | List<Phone> list = phoneMapper.queryPhones(openCity.getId()); |
| | | return list; |
| | | } |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public Map<String, Object> queryCustomerPhone(String code) throws Exception { |
| | | String province = code.substring(0, 2) + "0000"; |
| | | String city = code.substring(0, 4) + "00"; |
| | | |
| | | OpenCity openCity = openCityService.openCity1(code); |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | //平台电话 |
| | | Phone query = phoneMapper.query(2, 1, null, null, null); |
| | | Phone query = phoneMapper.queryInfo(openCity.getId(), 2, 1); |
| | | map.put("platform", null != query ? query.getPhone() : ""); |
| | | |
| | | //公司 |
| | | query = phoneMapper.query(2, null, province, city, code); |
| | | if(query == null){ |
| | | query = phoneMapper.query(2, null, province, city, null); |
| | | } |
| | | if(query == null){ |
| | | query = phoneMapper.query(2, null, province, null, null); |
| | | } |
| | | query = phoneMapper.queryInfo(openCity.getId(), 2, 2); |
| | | map.put("company", null != query ? query.getPhone() : ""); |
| | | |
| | | //调度电话 |
| | | query = phoneMapper.query(3, null, province, city, code); |
| | | if(query == null){ |
| | | query = phoneMapper.query(3, null, province, city, null); |
| | | } |
| | | if(query == null){ |
| | | query = phoneMapper.query(3, null, province, null, null); |
| | | } |
| | | query = phoneMapper.queryInfo(openCity.getId(), 3, null); |
| | | map.put("scheduling", null != query ? query.getPhone() : ""); |
| | | return map; |
| | | } |