liujie
6 天以前 729a5a0592cac7750e8b476c5fcb25bfc3ff8d25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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.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.HashMap;
import java.util.List;
import java.util.Map;
 
 
@Service
public class PhoneServiceImpl extends ServiceImpl<PhoneMapper, Phone> implements IPhoneService {
 
    @Resource
    private PhoneMapper phoneMapper;
    
    @Autowired
    private IOpenCityService openCityService;
 
    /**
     * 获取所有系统电话
     * @return
     * @throws Exception
     */
    @Override
    public List<Phone> queryPhones(String code) throws Exception {
        OpenCity openCity = openCityService.openCity1(code);
        return phoneMapper.selectList(new EntityWrapper<Phone>().eq("openCityId", openCity));
    }
 
 
    /**
     * 获取客服电话(个人中心)
     * @param code
     * @return
     * @throws Exception
     */
    @Override
    public Map<String, Object> queryCustomerPhone(String code) throws Exception {
        Map<String, Object> map = new HashMap<>();
        OpenCity openCity = openCityService.openCity1(code);
        Phone phone = this.selectOne(new EntityWrapper<Phone>().eq("openCityId", openCity).eq("type", 2).eq("platform", 1));
        map.put("platform", null != phone ? phone.getPhone() : "");
        phone = this.selectOne(new EntityWrapper<Phone>().eq("openCityId", openCity).eq("type", 2).eq("platform", 2));
        map.put("company", null != phone ? phone.getPhone() : "");
        return map;
    }
}