Browse Source

意见反馈接口新增

zdm 6 years ago
parent
commit
7eaa8d3fe7

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

@ -60,6 +60,18 @@ public class HealthyHouseMapping {
            public static final String GET_FACILITIESERVERS_BY_ID = "/getFacilitieServersById";
            public static final String GET_FACILITIESERVERS_BY_FIELD = "/getFacilitieServersByField";
        }
        //意见反馈
        public static class FeedBack {
            public static final String CREATE = "/create/feedBacks";
            public static final String DELETE = "/delete/feedBacks";
            public static final String UPDATE = "/update/feedBacks";
            public static final String PAGE = "/page/feedBacks";
            public static final String LIST = "/list/feedBacks";
            public static final String GET_FEEDBACK_BY_ID = "/getFeedBackById";
            public static final String GET_FEEDBACKS_BY_FIELD = "/getFeedBacksByField";
            public static final String UPDATE_FEEDBACKS_BY_ID = "/updateFeedBacksById";
        }
    }

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

@ -34,7 +34,7 @@ public class FacilitiesServerController extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取设施服务列表", responseContainer = "List")
    @GetMapping(value = HealthyHouseMapping.HealthyHouse.FacilitiesServer.PAGE)
    public PageEnvelop<FacilityServer> getDictionaries(
    public PageEnvelop<FacilityServer> getFacilitiesServer(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器", defaultValue = "")
@ -51,7 +51,7 @@ public class FacilitiesServerController extends EnvelopRestEndpoint {
    @ApiOperation(value = "创建设施服务")
    @PostMapping(value = HealthyHouseMapping.HealthyHouse.FacilitiesServer.CREATE)
    public ObjEnvelop<FacilityServer> createDictionary(
    public ObjEnvelop<FacilityServer> createFacilitiesServer(
            @ApiParam(name = "FacilityServer", value = "设施服务JSON结构")
            @RequestBody FacilityServer facilityServer) throws IOException {
        List<FacilityServer> facilityServerList = null;
@ -81,7 +81,7 @@ public class FacilitiesServerController extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取设施服务")
    @GetMapping(value = HealthyHouseMapping.HealthyHouse.FacilitiesServer.GET_FACILITIESERVERS_BY_ID)
    public ObjEnvelop<FacilityServer> getDictionary(
    public ObjEnvelop<FacilityServer> getFacilitiesServer(
            @ApiParam(name = "id", value = "设施服务ID", defaultValue = "")
            @RequestParam(value = "id") String id) throws Exception {
        FacilityServer facilityServer = facilityServerService.findById(id);
@ -93,7 +93,7 @@ public class FacilitiesServerController extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取设施服务")
    @GetMapping(value = HealthyHouseMapping.HealthyHouse.FacilitiesServer.GET_FACILITIESERVERS_BY_FIELD)
    public ListEnvelop<FacilityServer> getDictionaryByPhoneticCode(
    public ListEnvelop<FacilityServer> getFacilitiesServerByField(
            @ApiParam(name = "field", value = "查找字段名", required = true)
            @RequestParam(value = "field") String field,
            @ApiParam(name = "value", value = "检索值")
@ -104,7 +104,7 @@ public class FacilitiesServerController extends EnvelopRestEndpoint {
    @ApiOperation(value = "更新设施服务")
    @PutMapping(value = HealthyHouseMapping.HealthyHouse.FacilitiesServer.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ObjEnvelop<FacilityServer> updateDictionary(
    public ObjEnvelop<FacilityServer> updateFacilitiesServer(
            @ApiParam(name = "FacilityServer", value = "设施服务JSON结构")
            @RequestBody FacilityServer facilityServer) throws Exception {
        if (StringUtils.isEmpty(facilityServer.getCode())) {
@ -123,7 +123,7 @@ public class FacilitiesServerController extends EnvelopRestEndpoint {
    @ApiOperation(value = "删除设施服务")
    @DeleteMapping(value = HealthyHouseMapping.HealthyHouse.FacilitiesServer.DELETE)
    public Envelop deleteDictionary(
    public Envelop deleteFacilitiesServer(
            @ApiParam(name = "facilitiesServerId", value = "设施服务ID")
            @RequestParam(value = "facilitiesServerId") String facilitiesServerId) throws Exception {
        FacilityServer facilityServer = new FacilityServer();

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

@ -0,0 +1,119 @@
package com.yihu.jw.healthyhouse.controller.user;
import com.yihu.jw.healthyhouse.model.user.FeedBack;
import com.yihu.jw.healthyhouse.service.user.FeedBackService;
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.http.MediaType;
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 = "FeedBack", description = "意见反馈管理", tags = {"意见反馈管理"})
public class FeedBackController extends EnvelopRestEndpoint {
    @Autowired
    private FeedBackService feedBackService;
    @ApiOperation(value = "获取意见反馈列表", responseContainer = "List")
    @GetMapping(value = HealthyHouseMapping.HealthyHouse.FeedBack.PAGE)
    public PageEnvelop<FeedBack> getFeedBacks(
            @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<FeedBack> feedBackList = feedBackService.search(fields, filters, sorts, page, size);
        return success(feedBackList, (null == feedBackList) ? 0 : feedBackList.size(), page, size);
    }
    @ApiOperation(value = "创建/更新(id存在)意见反馈")
    @PostMapping(value = HealthyHouseMapping.HealthyHouse.FeedBack.CREATE)
    public ObjEnvelop<FeedBack> createFeedBack(
            @ApiParam(name = "FeedBack", value = "意见反馈JSON结构")
            @RequestBody FeedBack feedBack) throws IOException {
        feedBack = feedBackService.save(feedBack);
        return success(feedBack);
    }
    @ApiOperation(value = "获取意见反馈")
    @GetMapping(value = HealthyHouseMapping.HealthyHouse.FeedBack.GET_FEEDBACK_BY_ID)
    public ObjEnvelop<FeedBack> getFeedBack(
            @ApiParam(name = "id", value = "意见反馈ID", defaultValue = "")
            @RequestParam(value = "id") String id) throws Exception {
        FeedBack feedBack = feedBackService.findById(id);
        if (feedBack == null) {
            return failed("意见反馈不存在!", ObjEnvelop.class);
        }
        return success(feedBack);
    }
    @ApiOperation(value = "管理员根据id获取/或回复意见反馈,需改变意见反馈回复状态")
    @GetMapping(value = HealthyHouseMapping.HealthyHouse.FeedBack.UPDATE_FEEDBACKS_BY_ID)
    public ObjEnvelop<FeedBack> getFeedBackAndUpdate(
            @ApiParam(name = "id", value = "意见反馈ID(必要)", defaultValue = "")
            @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "feedBackJson", value = "意见反馈Json(非必要,有回复内容,需提供。)", defaultValue = "")
            @RequestParam(value = "feedBackJson", required = false) String feedBackJson) throws Exception {
        FeedBack feedBackOld = feedBackService.findById(id);
        if (feedBackOld == null) {
            return failed("意见反馈不存在!", ObjEnvelop.class);
        }
        if (StringUtils.isNotEmpty(feedBackJson)) {
            FeedBack feedBack = toEntity(feedBackJson, FeedBack.class);
            feedBackOld.setFlag(2);
            feedBackOld.setReplyContent(feedBack.getReplyContent());
            feedBackOld.setUpdateUser(feedBack.getUpdateUser());
        } else {
            //根据id获取意见反馈,打开待反馈信息
            feedBackOld.setFlag(1);
        }
        feedBackOld = feedBackService.save(feedBackOld);
        return success(feedBackOld);
    }
    @ApiOperation(value = "获取意见反馈:根据日期,根据反馈人等")
    @GetMapping(value = HealthyHouseMapping.HealthyHouse.FeedBack.GET_FEEDBACKS_BY_FIELD)
    public ListEnvelop<FeedBack> getFeedBackByField(
            @ApiParam(name = "field", value = "查找字段名", required = true)
            @RequestParam(value = "field") String field,
            @ApiParam(name = "value", value = "检索值")
            @RequestParam(value = "value") String value) throws Exception {
        List<FeedBack> feedBackList = feedBackService.findByField(field, value);
        return success(feedBackList);
    }
    @ApiOperation(value = "删除意见反馈")
    @DeleteMapping(value = HealthyHouseMapping.HealthyHouse.FeedBack.DELETE)
    public Envelop deleteFeedBack(
            @ApiParam(name = "facilitiesServerId", value = "意见反馈ID")
            @RequestParam(value = "facilitiesServerId") String facilitiesServerId) throws Exception {
        FeedBack feedBack = feedBackService.findById(facilitiesServerId);
        feedBackService.delete(feedBack);
        return success("success");
    }
}

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

@ -0,0 +1,16 @@
package com.yihu.jw.healthyhouse.dao.user;
import com.yihu.jw.healthyhouse.model.user.FeedBack;
import org.springframework.data.jpa.repository.JpaRepository;
/**
 * 意见反馈dao
 * @author zdm
 * @version 1.0
 * @created 2018.09.21
 */
public interface FeedBackDao extends JpaRepository<FeedBack, Long> {
    FeedBack findById(String id);
}

+ 1 - 1
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/dao/UserDao.java

@ -1,4 +1,4 @@
package com.yihu.jw.healthyhouse.dao;
package com.yihu.jw.healthyhouse.dao.user;
import com.yihu.jw.healthyhouse.model.user.User;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

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

@ -0,0 +1,161 @@
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 = "feedback")
public class FeedBack extends UuidIdentityEntityWithOperator {
    //反馈类型,1建议、2投诉、3报修、4其他
    @Column(name = "feed_type", nullable = false)
    private String  feedType;
    //提出意见的用户联系电话
    @Column(name = "user_telephone", nullable = false)
    private String  userTelephone;
    //意见内容
    @Column(name = "content", nullable = false)
    private String  content;
    //反馈的处理状态:0未阅,1待处理,2已处理
    @Column(name = "flag", nullable = false)
    private Integer  flag;
    //回复内容
    @Column(name = "replyContent", nullable = false)
    private String  replyContent;
    //是否有附件,0无,1有
    @Column(name = "enclosureFlag", nullable = false)
    private String  enclosureFlag;
    //设施编号
    @Column(name = "facilitieCode", nullable = false)
    private String  facilitieCode;
    //设施经度
    @Column(name = "facilitieLongitude", nullable = false)
    private double  facilitieLongitude;
    //设施维度
    @Column(name = "facilitieLatitude", nullable = false)
    private double  facilitieLatitude;
    //上传附件地址(多张图片地址,用逗号隔开)
    @Column(name = "pig_path", nullable = false)
    private String  pigPath;
    //反馈类型,1建议、2投诉、3报修、4其他
    private String  feedTypeName;
    //反馈的处理状态:0未阅,1待处理,2已处理
    private String  flagValue;
    //是否有附件,0无,1有
    private String  enclosureFlagValue;
    public String getFeedType() {
        return feedType;
    }
    public void setFeedType(String feedType) {
        this.feedType = feedType;
    }
    public String getUserTelephone() {
        return userTelephone;
    }
    public void setUserTelephone(String userTelephone) {
        this.userTelephone = userTelephone;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public Integer getFlag() {
        return flag;
    }
    public void setFlag(Integer flag) {
        this.flag = flag;
    }
    public String getReplyContent() {
        return replyContent;
    }
    public void setReplyContent(String replyContent) {
        this.replyContent = replyContent;
    }
    public String getEnclosureFlag() {
        return enclosureFlag;
    }
    public void setEnclosureFlag(String enclosureFlag) {
        this.enclosureFlag = enclosureFlag;
    }
    public String getFacilitieCode() {
        return facilitieCode;
    }
    public void setFacilitieCode(String facilitieCode) {
        this.facilitieCode = facilitieCode;
    }
    public double getFacilitieLongitude() {
        return facilitieLongitude;
    }
    public void setFacilitieLongitude(double facilitieLongitude) {
        this.facilitieLongitude = facilitieLongitude;
    }
    public double getFacilitieLatitude() {
        return facilitieLatitude;
    }
    public void setFacilitieLatitude(double facilitieLatitude) {
        this.facilitieLatitude = facilitieLatitude;
    }
    public String getPigPath() {
        return pigPath;
    }
    public void setPigPath(String pigPath) {
        this.pigPath = pigPath;
    }
    @Transient
    public String getFeedTypeName() {
        return feedTypeName;
    }
    public void setFeedTypeName(String feedTypeName) {
        this.feedTypeName = feedTypeName;
    }
    @Transient
    public String getFlagValue() {
        return flagValue;
    }
    public void setFlagValue(String flagValue) {
        this.flagValue = flagValue;
    }
    @Transient
    public String getEnclosureFlagValue() {
        return enclosureFlagValue;
    }
    public void setEnclosureFlagValue(String enclosureFlagValue) {
        this.enclosureFlagValue = enclosureFlagValue;
    }
}

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

@ -0,0 +1,28 @@
package com.yihu.jw.healthyhouse.service.user;
import com.yihu.jw.healthyhouse.dao.user.FeedBackDao;
import com.yihu.jw.healthyhouse.model.user.FeedBack;
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 FeedBackService extends BaseJpaService<FeedBack, FeedBackDao> {
    @Autowired
    private FeedBackDao feedBackDao;
    public FeedBack findById(String id) {
        return  feedBackDao.findById(id);
    }
}

+ 1 - 2
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/service/user/UserService.java

@ -2,7 +2,7 @@ package com.yihu.jw.healthyhouse.service.user;
import com.yihu.jw.exception.business.ManageException;
import com.yihu.jw.healthyhouse.constant.LoginInfo;
import com.yihu.jw.healthyhouse.dao.UserDao;
import com.yihu.jw.healthyhouse.dao.user.UserDao;
import com.yihu.jw.healthyhouse.model.user.User;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.wlyy.HouseUserContant;
@ -18,7 +18,6 @@ import org.springframework.util.StringUtils;
import org.springside.modules.persistence.DynamicSpecifications;
import org.springside.modules.persistence.SearchFilter;
import javax.persistence.criteria.*;
import javax.transaction.Transactional;
import java.util.*;