puzhibing
2 天以前 6598b47440f5be4adc1c793bbfc9f187be50a179
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/AgentServiceImpl.java
@@ -5,14 +5,18 @@
import com.supersavedriving.driver.modular.system.dao.AgentMapper;
import com.supersavedriving.driver.modular.system.dao.TBranchOfficeAreaMapper;
import com.supersavedriving.driver.modular.system.model.Agent;
import com.supersavedriving.driver.modular.system.model.BranchOffice;
import com.supersavedriving.driver.modular.system.model.TBranchOfficeArea;
import com.supersavedriving.driver.modular.system.service.IAgentService;
import com.supersavedriving.driver.modular.system.service.IBranchOfficeService;
import com.supersavedriving.driver.modular.system.service.ITBranchOfficeAreaService;
import com.supersavedriving.driver.modular.system.warpper.OpenCityWarpper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
 * @author zhibing.pu
@@ -24,6 +28,9 @@
    @Autowired
    private TBranchOfficeAreaMapper branchOfficeAreaMapper;
    @Autowired
    private IBranchOfficeService branchOfficeService;
    /**
     * 获取开通省市数据
     * @return
@@ -31,7 +38,14 @@
     */
    @Override
    public List<OpenCityWarpper> queryOpenCity() throws Exception {
        List<TBranchOfficeArea> branchOfficeAreas = branchOfficeAreaMapper.selectList(new EntityWrapper<TBranchOfficeArea>());
        List<BranchOffice> branchOffices = branchOfficeService.selectList(new EntityWrapper<BranchOffice>().eq("status", 1));
        List<Integer> collect = new ArrayList<>();
        if(branchOffices.size() == 0){
            collect.add(-1);
        }else{
            collect = branchOffices.stream().map(BranchOffice::getId).collect(Collectors.toList());
        }
        List<TBranchOfficeArea> branchOfficeAreas = branchOfficeAreaMapper.selectList(new EntityWrapper<TBranchOfficeArea>().in("branchOfficeId", collect));
        List<OpenCityWarpper> province = new ArrayList<>();
        //遍历处理省级数据