Explorar o código

设施服务 查询接口补充

zdm %!s(int64=7) %!d(string=hai) anos
pai
achega
b47c87e89c

+ 1 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/health/house/HealthyHouseMapping.java

@ -73,6 +73,7 @@ public class HealthyHouseMapping {
            public static final String GET_FACILITIESERVERS_BY_FIELD = "/getFacilitieServersByField";
            public static final String LIST_FACILITIESERVERS = "/list/listFacilitieServers";
            public static final String LIST_FACILITIESERVERS_BY_TYPE = "/list/listFacilitieServersByType";
            public static final String PAGE_FACILITIESERVERS_BY_TYPE = "/page/facilitieServersByType";
        }
        //意见反馈

+ 3 - 4
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/controller/facilities/FacilitiesController.java

@ -338,7 +338,7 @@ public class FacilitiesController extends EnvelopRestEndpoint {
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "facilityCategory", value = "设施分类:1小屋、2步道、3餐厅", defaultValue = "1")
            @RequestParam(value = "facilityCategory", required = false) String facilityCategory,
            @ApiParam(name = "facilityServerType", value = "非必传参数:设施服务类型(大类或小类):dinner就餐、measure测量、sports运动", defaultValue = "measure")
            @ApiParam(name = "facilityServerType", value = "非必传参数:设施服务类型(小类,用逗号隔开):dinner就餐、measure测量、sports运动", defaultValue = "measure")
            @RequestParam(value = "facilityServerType", required = false) String facilityServerType,
            @ApiParam(name = "facilityServerCodes", value = "非必传参数:设施服务编码,可多个,用逗号隔开", defaultValue = "jkxwServer003,HFHS7C5B5")
            @RequestParam(value = "facilityServerCodes", required = false) String facilityServerCodes) throws Exception {
@ -351,10 +351,9 @@ public class FacilitiesController extends EnvelopRestEndpoint {
                facilityList = facilityService.getFacilityByFacilityCode(facilityCodeList);
            }
        } else if (StringUtils.isNotEmpty(facilityServerType)) {
            //查找最小服务分类
             List<String> list= systemDictEntryService.getMinDictEntryCodeByCode(UserConstant.FACILITIES_SERVER_DICT_ID, facilityServerType);
            String[] serverTypeCodes = facilityServerType.split(",");
            //设施编码为空,设施服务类型不为空,按设施服务类型获取设施
            List<String> facilityCodeList = facilityService.getFacilityCodeByServerTypeList(list.toArray(new String[list.size()]));
            List<String> facilityCodeList = facilityService.getFacilityCodeByServerTypeList(serverTypeCodes);
            if (null != facilityCodeList && facilityCodeList.size() > 0) {
                facilityList = facilityService.getFacilityByFacilityCode(facilityCodeList);
            }

+ 29 - 1
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/controller/facilities/FacilitiesServerController.java

@ -1,6 +1,7 @@
package com.yihu.jw.healthyhouse.controller.facilities;
import com.yihu.jw.healthyhouse.constant.SystemDictConstant;
import com.yihu.jw.healthyhouse.constant.UserConstant;
import com.yihu.jw.healthyhouse.model.dict.SystemDictEntry;
import com.yihu.jw.healthyhouse.model.facility.FacilityServer;
import com.yihu.jw.healthyhouse.service.dict.SystemDictEntryService;
@ -169,7 +170,7 @@ public class FacilitiesServerController extends EnvelopRestEndpoint {
                String filters = "type=" + obj[0].toString();
                facilityServerList = facilityServerService.search("", filters, "");
                map.put("name",null==obj[1]?"":obj[1].toString());
                map.put(obj[0].toString(), facilityServerList);
                map.put("code", facilityServerList);
                mapList.add(map);
            }
@ -178,4 +179,31 @@ public class FacilitiesServerController extends EnvelopRestEndpoint {
    }
    @ApiOperation(value = "需求变更:按照服务分类查询-服务-获取设施服务列表", responseContainer = "List")
    @GetMapping(value = HealthyHouseMapping.HealthyHouse.FacilitiesServer.PAGE_FACILITIESERVERS_BY_TYPE)
    public PageEnvelop<FacilityServer> getFacilitiesServerByType(
            @ApiParam(name = "serverType", value = "服务分类", defaultValue = "")
            @RequestParam(value = "serverType", required = false) String serverType,
            @ApiParam(name = "serverName", value = "服务名称", defaultValue = "")
            @RequestParam(value = "serverName", required = false) String serverName,
            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
            @RequestParam(value = "size", required = false) Integer size,
            @ApiParam(name = "page", value = "页码", defaultValue = "1")
            @RequestParam(value = "page", required = false) Integer page) throws Exception {
        if(StringUtils.isNotBlank(serverType)){
            List<String> stringList = systemDictEntryService.getMinDictEntryCodeByCode(UserConstant.FACILITIES_SERVER_DICT_ID, serverType);
            return facilityServerService.getFacilitiesServerByType(stringList.toArray(new String[stringList.size()]), serverName, page, size);
        }else{
            StringBuilder fis=new StringBuilder();
            if(StringUtils.isNotBlank(serverName)){
                fis.append("name?"+serverName+" g1;");
            }
            List<FacilityServer> facilityServerList = facilityServerService.search(null, fis.toString(), null, page, size);
            return success(facilityServerList, null==facilityServerList?0:facilityServerList.size(), page, size);
        }
    }
}

+ 34 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/service/facility/FacilityServerService.java

@ -3,15 +3,21 @@ package com.yihu.jw.healthyhouse.service.facility;
import com.yihu.jw.healthyhouse.dao.facility.FacilityServerDao;
import com.yihu.jw.healthyhouse.model.facility.Facility;
import com.yihu.jw.healthyhouse.model.facility.FacilityServer;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.hibernate.Query;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * 设施服务管理器.
@ -26,6 +32,8 @@ public class FacilityServerService extends BaseJpaService<FacilityServer, Facili
    @Autowired
    private FacilityServerDao facilityServerDao;
    @Autowired
    private JdbcTemplate jdbcTempalte;
    public FacilityServer findById(String id) {
        return  facilityServerDao.findById(id);
@ -50,5 +58,31 @@ public class FacilityServerService extends BaseJpaService<FacilityServer, Facili
        return code;
    }
    /**
     * 按类型分页查找
     * @param page
     * @param size
     * @param serverName
     * @return
     */
    public PageEnvelop<FacilityServer> getFacilitiesServerByType(String[] type, String serverName, int page, int size){
        StringBuffer sql = new StringBuffer("SELECT  fs.id as id,fs.code as code,fs.name as name,fs.num  as num,fs.type as type FROM facility_server fs WHERE fs.type IN (" +type+")");
        StringBuffer sqlCount = new StringBuffer("SELECT count(1) FROM facility_server fs WHERE fs.type IN (" +type+")");
        List<Object> args = new ArrayList<>();
        args.add(type);
        if(StringUtils.isNotBlank(serverName)){
            sql.append(" AND fs.name like '%").append(serverName).append("%'");
            sqlCount.append(" AND fs.name like '%").append(serverName).append("%'");
            args.add(serverName);
        }
        sql.append(" ORDER BY fs.create_time DESC ").append((page-1)*size).append(",").append(size);
        List<FacilityServer> list = jdbcTempalte.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(FacilityServer.class));
        List<Map<String,Object>> countList = jdbcTempalte.queryForList(sqlCount.toString());
        long count = Long.valueOf(countList.get(0).get("count").toString());
        return PageEnvelop.getSuccessListWithPage("查找成功",list, page, size,count);
    }
}

+ 7 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/service/facility/FacilityService.java

@ -12,6 +12,8 @@ import com.yihu.jw.healthyhouse.service.area.BaseTownService;
import com.yihu.jw.healthyhouse.service.dict.SystemDictEntryService;
import com.yihu.jw.healthyhouse.util.facility.msg.FacilityMsg;
import com.yihu.jw.healthyhouse.util.poi.ExcelUtils;
import com.yihu.jw.restmodel.base.notice.UserNoticeVO;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.http.HTTPResponse;
import com.yihu.jw.util.http.HttpClientKit;
import com.yihu.mysql.query.BaseJpaService;
@ -24,6 +26,8 @@ import org.hibernate.Query;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -61,6 +65,7 @@ public class FacilityService extends BaseJpaService<Facility, FacilityDao> {
    public Facility findById(String id) {
        return facilityDao.findById(id);
    }
@ -407,4 +412,6 @@ public class FacilityService extends BaseJpaService<Facility, FacilityDao> {
        return query.list();
    }
}