package com.stylefeng.guns.modular.system.service.impl; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.stylefeng.guns.core.util.ToolUtil; 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; import java.util.*; @Service public class PhoneServiceImpl extends ServiceImpl implements IPhoneService { @Resource private PhoneMapper phoneMapper; @Autowired private IOpenCityService openCityService; /** * 获取所有系统电话 * @return * @throws Exception */ @Override public List queryPhones(String code) throws Exception { if(ToolUtil.isNotEmpty(code)){ OpenCity openCity = openCityService.openCity1(code); if(null == openCity){ return new ArrayList<>(); } return phoneMapper.selectList(new EntityWrapper().eq("openCityId", openCity.getId())); } return new ArrayList<>(); } /** * 获取客服电话(个人中心) * @param code * @return * @throws Exception */ @Override public Map queryCustomerPhone(String code) throws Exception { Map map = new HashMap<>(); OpenCity openCity = openCityService.openCity1(code); if(null == openCity){ return new HashMap<>(); } Phone phone = this.selectOne(new EntityWrapper().eq("openCityId", openCity.getId()).eq("type", 2).eq("platform", 1)); map.put("platform", null != phone ? phone.getPhone() : ""); phone = this.selectOne(new EntityWrapper().eq("openCityId", openCity.getId()).eq("type", 2).eq("platform", 2)); map.put("company", null != phone ? phone.getPhone() : ""); return map; } }