Browse Source

服务评价接口

zdm 6 years ago
parent
commit
9eb29b7bb8

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

@ -84,6 +84,18 @@ public class HealthyHouseMapping {
            public static final String GET_FACILITY_USED_RECORD_BY_FIELD = "/getFacilityUsedRecordByField";
            public static final String UPDATE_FACILITY_USED_RECORD_BY_ID = "/updateFacilityUsedRecordById";
        }
        //服务评价
        public static class NavigationServiceEvaluation {
            public static final String CREATE = "/create/navigationServiceEvaluation";
            public static final String DELETE = "/delete/navigationServiceEvaluation";
            public static final String UPDATE = "/update/navigationServiceEvaluation";
            public static final String PAGE = "/page/navigationServiceEvaluation";
            public static final String LIST = "/list/navigationServiceEvaluation";
            public static final String GET_NAVIGATION_SERVICE_EVALUATION_BY_ID = "/getNavigationServiceEvaluationById";
            public static final String GET_NAVIGATION_SERVICE_EVALUATION_BY_FIELD = "/getNavigationServiceEvaluationByField";
            public static final String UPDATE_NAVIGATION_SERVICE_EVALUATION_BY_ID = "/updateNavigationServiceEvaluationById";
        }
    }

+ 94 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/controller/user/NavigationServiceEvaluationController.java

@ -0,0 +1,94 @@
package com.yihu.jw.healthyhouse.controller.user;
import com.yihu.jw.healthyhouse.model.user.NavigationServiceEvaluation;
import com.yihu.jw.healthyhouse.service.user.NavigationServiceEvaluationService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.health.house.HealthyHouseMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.List;
/**
 * 服务评价
 * Created by zdm on 2018/9/21.
 */
@RestController
@RequestMapping(HealthyHouseMapping.api_healthyHouse_common)
@Api(value = "NavigationServiceEvaluation", description = "服务评价管理", tags = {"服务评价管理"})
public class NavigationServiceEvaluationController extends EnvelopRestEndpoint {
    @Autowired
    private NavigationServiceEvaluationService navigationServiceEvaluationService;
    @ApiOperation(value = "获取服务评价列表", responseContainer = "List")
    @GetMapping(value = HealthyHouseMapping.HealthyHouse.NavigationServiceEvaluation.PAGE)
    public PageEnvelop<NavigationServiceEvaluation> getNavigationServiceEvaluations(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器", defaultValue = "")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序", defaultValue = "")
            @RequestParam(value = "sorts", required = false) String sorts,
            @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 {
        List<NavigationServiceEvaluation> navigationServiceEvaluationList = navigationServiceEvaluationService.search(fields, filters, sorts, page, size);
        return success(navigationServiceEvaluationList, (null == navigationServiceEvaluationList) ? 0 : navigationServiceEvaluationList.size(), page, size);
    }
    @ApiOperation(value = "创建/更新(id存在)服务评价")
    @PostMapping(value = HealthyHouseMapping.HealthyHouse.NavigationServiceEvaluation.CREATE)
    public ObjEnvelop<NavigationServiceEvaluation> createNavigationServiceEvaluation(
            @ApiParam(name = "NavigationServiceEvaluation", value = "服务评价JSON结构")
            @RequestBody NavigationServiceEvaluation navigationServiceEvaluation) throws IOException {
        navigationServiceEvaluation = navigationServiceEvaluationService.save(navigationServiceEvaluation);
        return success(navigationServiceEvaluation);
    }
    @ApiOperation(value = "获取服务评价")
    @GetMapping(value = HealthyHouseMapping.HealthyHouse.NavigationServiceEvaluation.GET_NAVIGATION_SERVICE_EVALUATION_BY_ID)
    public ObjEnvelop<NavigationServiceEvaluation> getNavigationServiceEvaluation(
            @ApiParam(name = "id", value = "服务评价ID", defaultValue = "")
            @RequestParam(value = "id") String id) throws Exception {
        NavigationServiceEvaluation navigationServiceEvaluation = navigationServiceEvaluationService.findById(id);
        if (navigationServiceEvaluation == null) {
            return failed("服务评价不存在!", ObjEnvelop.class);
        }
        return success(navigationServiceEvaluation);
    }
    @ApiOperation(value = "获取服务评价:根据日期,根据评价人等")
    @GetMapping(value = HealthyHouseMapping.HealthyHouse.NavigationServiceEvaluation.GET_NAVIGATION_SERVICE_EVALUATION_BY_FIELD)
    public ListEnvelop<NavigationServiceEvaluation> getNavigationServiceEvaluationByField(
            @ApiParam(name = "field", value = "查找字段名", required = true)
            @RequestParam(value = "field") String field,
            @ApiParam(name = "value", value = "检索值")
            @RequestParam(value = "value") String value) throws Exception {
        List<NavigationServiceEvaluation> navigationServiceEvaluationList = navigationServiceEvaluationService.findByField(field, value);
        return success(navigationServiceEvaluationList);
    }
    @ApiOperation(value = "删除服务评价")
    @DeleteMapping(value = HealthyHouseMapping.HealthyHouse.NavigationServiceEvaluation.DELETE)
    public Envelop deleteNavigationServiceEvaluation(
            @ApiParam(name = "facilitiesServerId", value = "服务评价ID")
            @RequestParam(value = "facilitiesServerId") String facilitiesServerId) throws Exception {
        NavigationServiceEvaluation navigationServiceEvaluation = navigationServiceEvaluationService.findById(facilitiesServerId);
        navigationServiceEvaluationService.delete(navigationServiceEvaluation);
        return success("success");
    }
}

+ 16 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/dao/user/NavigationServiceEvaluationDao.java

@ -0,0 +1,16 @@
package com.yihu.jw.healthyhouse.dao.user;
import com.yihu.jw.healthyhouse.model.user.NavigationServiceEvaluation;
import org.springframework.data.jpa.repository.JpaRepository;
/**
 * 服务评价dao
 * @author zdm
 * @version 1.0
 * @created 2018.09.21
 */
public interface NavigationServiceEvaluationDao extends JpaRepository<NavigationServiceEvaluation, Long> {
    NavigationServiceEvaluation findById(String id);
}

+ 97 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/model/user/NavigationServiceEvaluation.java

@ -0,0 +1,97 @@
package com.yihu.jw.healthyhouse.model.user;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
 * 用户评价
 * @author zdm
 * @version 1.0
 * @created 2018.09.21
 */
@Entity
@Table(name = "navigation_service_evaluation")
public class NavigationServiceEvaluation extends UuidIdentityEntityWithOperator {
    //设施编码
    @Column(name = "facilitie_code", nullable = false)
    private String facilitieCode;
    //设施名称
    @Column(name = "facilitie_name")
    private String facilitieName;
    //服务编码
    @Column(name = "service_code")
    private String serviceCode;
    //服务名称
    @Column(name = "service_name")
    private String serviceName;
    //用户
    @Column(name = "user_id")
    private String userId;
    //分数:星星数量
    @Column(name = "score")
    private String score;
    //备注、意见或建议
    @Column(name = "remark")
    private String remark;
    public String getFacilitieCode() {
        return facilitieCode;
    }
    public void setFacilitieCode(String facilitieCode) {
        this.facilitieCode = facilitieCode;
    }
    public String getFacilitieName() {
        return facilitieName;
    }
    public void setFacilitieName(String facilitieName) {
        this.facilitieName = facilitieName;
    }
    public String getServiceCode() {
        return serviceCode;
    }
    public void setServiceCode(String serviceCode) {
        this.serviceCode = serviceCode;
    }
    public String getServiceName() {
        return serviceName;
    }
    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }
    public String getUserId() {
        return userId;
    }
    public void setUserId(String userId) {
        this.userId = userId;
    }
    public String getScore() {
        return score;
    }
    public void setScore(String score) {
        this.score = score;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

+ 28 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/service/user/NavigationServiceEvaluationService.java

@ -0,0 +1,28 @@
package com.yihu.jw.healthyhouse.service.user;
import com.yihu.jw.healthyhouse.dao.user.NavigationServiceEvaluationDao;
import com.yihu.jw.healthyhouse.model.user.NavigationServiceEvaluation;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
 * 服务评价.
 *
 * @author zdm
 * @version 1.0
 * @created 2018.09.21
 */
@Service
@Transactional
public class NavigationServiceEvaluationService extends BaseJpaService<NavigationServiceEvaluation, NavigationServiceEvaluationDao> {
    @Autowired
    private NavigationServiceEvaluationDao navigationServiceEvaluationDao;
    public NavigationServiceEvaluation findById(String id) {
        return  navigationServiceEvaluationDao.findById(id);
    }
}