kaiyu
2022-03-10 9dcca27f3e28febdf4d79c2b6017d15bb104cff2
screen-api/src/main/java/com/moral/api/service/impl/ServicesScopeServiceImpl.java
@@ -5,12 +5,11 @@
import com.moral.api.entity.ServicesScope;
import com.moral.api.mapper.OrganizationMapper;
import com.moral.api.mapper.ServicesScopeMapper;
import com.moral.api.pojo.vo.organization.OrganizationServicesScopeVO;
import com.moral.api.service.OrganizationService;
import com.moral.api.service.ServicesScopeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.moral.constant.Constants;
import io.swagger.models.auth.In;
import com.moral.util.RegionCodeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
@@ -63,21 +62,17 @@
            QueryWrapper<Organization> organizationQueryWrapper = new QueryWrapper<>();
            organizationQueryWrapper.eq("is_delete",Constants.NOT_DELETE);
            organizationQueryWrapper.eq("id",organizationId);
            if (!ObjectUtils.isEmpty(map.get("province_code"))){
                organizationQueryWrapper.eq("province_code",Integer.parseInt(map.get("province_code").toString()));
            }
            if (!ObjectUtils.isEmpty(map.get("city_code"))){
                organizationQueryWrapper.eq("city_code",Integer.parseInt(map.get("city_code").toString()));
            }
            if (!ObjectUtils.isEmpty(map.get("area_code"))){
                organizationQueryWrapper.eq("area_code",Integer.parseInt(map.get("area_code").toString()));
            if (!ObjectUtils.isEmpty(map.get("regionCode"))){
                String region = RegionCodeUtils.regionCodeConvertToName(Integer.parseInt(map.get("regionCode").toString()));
                organizationQueryWrapper.eq(region,Integer.parseInt(map.get("regionCode").toString()));
            }
            Organization organization = new Organization();
            organization = organizationMapper.selectById(organizationId);
            organization = organizationMapper.selectOne(organizationQueryWrapper);
            if (ObjectUtils.isEmpty(organization)){
                continue;
            }
            resultMap.put("organization",organization);
            resultMap.put("id",organization.getId());
            resultMap.put("name",organization.getName());
            QueryWrapper<ServicesScope> servicesScopeQueryWrapper = new QueryWrapper<>();
            servicesScopeQueryWrapper.eq("is_delete",Constants.NOT_DELETE);
            servicesScopeQueryWrapper.eq("organization_id",organizationId);
@@ -89,7 +84,17 @@
            if (servicesScopes.size()<1){
                continue;
            }
            resultMap.put("servicesScopes",servicesScopes);
            List<Map<String,Object>> servicesScopeList= new ArrayList<>();
            for (ServicesScope servicesScope:servicesScopes) {
                Map<String,Object> servicesScopeMap = new HashMap<>();
                servicesScopeMap.put("id",servicesScope.getId());
                servicesScopeMap.put("name",servicesScope.getName());
                servicesScopeMap.put("organizationId",servicesScope.getOrganizationId());
                servicesScopeMap.put("centerLongitude",servicesScope.getCenterLongitude());
                servicesScopeMap.put("centerLatitude",servicesScope.getCenterLatitude());
                servicesScopeList.add(servicesScopeMap);
            }
            resultMap.put("servicesScopes",servicesScopeList);
            resultList.add(resultMap);
        }
        if (resultList.size()<1){
@@ -98,7 +103,7 @@
        return resultList;
    }
    private OrganizationServicesScopeVO treeStructure(int orgId){
    /*private OrganizationServicesScopeVO treeStructure(int orgId){
        OrganizationServicesScopeVO organizationServicesScopeVO = new OrganizationServicesScopeVO();
        Organization organization = organizationMapper.selectById(orgId);
        organizationServicesScopeVO.setOrganization(organization);
@@ -119,5 +124,5 @@
        }
        //servicesScopeMapper.selectList()
        return null;
    }
    }*/
}