Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/jiwei/wlyy2.0 into dev

huangzhiyong 6 years ago
parent
commit
1e963f1dbe

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

@ -117,6 +117,18 @@ public class HealthyHouseMapping {
            public static final String DOWNLOAD_BY_PATH="/dfs/downloadByPath";
        }
        //账号申诉
        public static class Appeal {
            public static final String CREATE = "/create/appeals";
            public static final String DELETE = "/delete/appeals";
            public static final String UPDATE = "/update/appeals";
            public static final String PAGE = "/page/appeals";
            public static final String LIST = "/list/appeals";
            public static final String GET_APPEAL_BY_ID = "/getAppealById";
            public static final String GET_APPEALS_BY_FIELD = "/getAppealsByField";
            public static final String UPDATE_APPEAL_BY_ID = "/updateAppealById";
        }
    }

+ 1 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/controller/dfs/FastDFSController.java

@ -71,6 +71,7 @@ public class FastDFSController extends EnvelopRestEndpoint {
        fileResource.setStoragePath(path);
        fileResource.setFileSize(String.valueOf(fileSize));
        fileResource.setFileName(fileName);
        fileResource.setCreateUser(creator);
        fileResource=  fileResourceService.save(fileResource);
        path = groupName.substring(1, groupName.length() - 1) + "/" + remoteFileName.substring(1, remoteFileName.length() - 1);
        fileResource.setStoragePath( fastdfs_file_url + path);

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

@ -0,0 +1,121 @@
package com.yihu.jw.healthyhouse.controller.user;
import com.yihu.jw.healthyhouse.model.user.Appeal;
import com.yihu.jw.healthyhouse.service.user.AppealService;
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/26.
 */
@RestController
@RequestMapping(HealthyHouseMapping.api_healthyHouse_common)
@Api(value = "Appeal", description = "账号申诉管理", tags = {"账号申诉管理"})
public class AppealController extends EnvelopRestEndpoint {
    @Autowired
    private AppealService AppealService;
    @ApiOperation(value = "获取账号申诉列表", responseContainer = "List")
    @GetMapping(value = HealthyHouseMapping.HealthyHouse.Appeal.PAGE)
    public PageEnvelop<Appeal> getAppeals(
            @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<Appeal> appealList = AppealService.search(fields, filters, sorts, page, size);
        return success(appealList, (null == appealList) ? 0 : appealList.size(), page, size);
    }
    @ApiOperation(value = "创建/更新(id存在)账号申诉")
    @PostMapping(value = HealthyHouseMapping.HealthyHouse.Appeal.CREATE)
    public ObjEnvelop<Appeal> createAppeal(
            @ApiParam(name = "Appeal", value = "账号申诉JSON结构")
            @RequestBody Appeal appeal) throws IOException {
        if(StringUtils.isEmpty(appeal.getCreateUser())){
            return failed("账号申诉人(createUser)不能为空!",ObjEnvelop.class);
        }
        appeal = AppealService.save(appeal);
        return success(appeal);
    }
    @ApiOperation(value = "获取账号申诉")
    @GetMapping(value = HealthyHouseMapping.HealthyHouse.Appeal.GET_APPEAL_BY_ID)
    public ObjEnvelop<Appeal> getAppeal(
            @ApiParam(name = "id", value = "账号申诉ID", defaultValue = "")
            @RequestParam(value = "id") String id) throws Exception {
        Appeal appeal = AppealService.findById(id);
        if (appeal == null) {
            return failed("账号申诉不存在!", ObjEnvelop.class);
        }
        return success(appeal);
    }
    @ApiOperation(value = "管理员根据id获取/或回复账号申诉,需改变账号申诉回复状态")
    @GetMapping(value = HealthyHouseMapping.HealthyHouse.Appeal.UPDATE_APPEAL_BY_ID)
    public ObjEnvelop<Appeal> getAppealAndUpdate(
            @ApiParam(name = "id", value = "账号申诉ID(必要)", defaultValue = "")
            @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "appealJson", value = "账号申诉Json(非必要,有回复内容,需提供。)", defaultValue = "")
            @RequestParam(value = "appealJson", required = false) String appealJson) throws Exception {
        Appeal appealOld = AppealService.findById(id);
        if (appealOld == null) {
            return failed("账号申诉不存在!", ObjEnvelop.class);
        }
        if (StringUtils.isNotEmpty(appealJson)) {
            Appeal appeal = toEntity(appealJson, Appeal.class);
            appealOld.setFlag(2);
            appealOld.setReplyContent(appeal.getReplyContent());
            appealOld.setUpdateUser(appeal.getUpdateUser());
        } else {
            //根据id获取账号申诉,打开申诉信息
            appealOld.setFlag(1);
        }
        appealOld = AppealService.save(appealOld);
        return success(appealOld);
    }
    @ApiOperation(value = "获取账号申诉:根据日期,根据反馈人等")
    @GetMapping(value = HealthyHouseMapping.HealthyHouse.Appeal.GET_APPEALS_BY_FIELD)
    public ListEnvelop<Appeal> getAppealByField(
            @ApiParam(name = "field", value = "查找字段名", required = true)
            @RequestParam(value = "field") String field,
            @ApiParam(name = "value", value = "检索值")
            @RequestParam(value = "value") String value) throws Exception {
        List<Appeal> appealList = AppealService.findByField(field, value);
        return success(appealList);
    }
    @ApiOperation(value = "删除账号申诉")
    @DeleteMapping(value = HealthyHouseMapping.HealthyHouse.Appeal.DELETE)
    public Envelop deleteAppeal(
            @ApiParam(name = "appealId", value = "账号申诉ID")
            @RequestParam(value = "appealId") String appealId) throws Exception {
        Appeal appeal = AppealService.findById(appealId);
        AppealService.delete(appeal);
        return success("success");
    }
}

+ 15 - 15
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/controller/user/FacilityUsedRecordController.java

@ -45,17 +45,17 @@ public class FacilityUsedRecordController extends EnvelopRestEndpoint {
            @RequestParam(value = "size", required = false) Integer size,
            @ApiParam(name = "page", value = "页码", defaultValue = "1")
            @RequestParam(value = "page", required = false) Integer page) throws Exception {
        List<FacilityUsedRecord> FacilityUsedRecordList = facilityUsedRecordService.search(fields, filters, sorts, page, size);
        return success(FacilityUsedRecordList, (null == FacilityUsedRecordList) ? 0 : FacilityUsedRecordList.size(), page, size);
        List<FacilityUsedRecord> facilityUsedRecordList = facilityUsedRecordService.search(fields, filters, sorts, page, size);
        return success(facilityUsedRecordList, (null == facilityUsedRecordList) ? 0 : facilityUsedRecordList.size(), page, size);
    }
    @ApiOperation(value = "创建/更新(id存在)用户使用导航记录")
    @PostMapping(value = HealthyHouseMapping.HealthyHouse.FacilityUsedRecord.CREATE)
    public ObjEnvelop<FacilityUsedRecord> createFacilityUsedRecord(
            @ApiParam(name = "FacilityUsedRecord", value = "用户使用导航记录JSON结构")
            @RequestBody FacilityUsedRecord FacilityUsedRecord) throws IOException {
        FacilityUsedRecord = facilityUsedRecordService.save(FacilityUsedRecord);
        return success(FacilityUsedRecord);
            @ApiParam(name = "facilityUsedRecord", value = "用户使用导航记录JSON结构")
            @RequestBody FacilityUsedRecord facilityUsedRecord) throws IOException {
        facilityUsedRecord = facilityUsedRecordService.save(facilityUsedRecord);
        return success(facilityUsedRecord);
    }
    @ApiOperation(value = "获取用户使用导航记录")
@ -63,11 +63,11 @@ public class FacilityUsedRecordController extends EnvelopRestEndpoint {
    public ObjEnvelop<FacilityUsedRecord> getFacilityUsedRecord(
            @ApiParam(name = "id", value = "用户使用导航记录ID", defaultValue = "")
            @RequestParam(value = "id") String id) throws Exception {
        FacilityUsedRecord FacilityUsedRecord = facilityUsedRecordService.findById(id);
        if (FacilityUsedRecord == null) {
        FacilityUsedRecord facilityUsedRecord = facilityUsedRecordService.findById(id);
        if (facilityUsedRecord == null) {
            return failed("用户使用导航记录不存在!", ObjEnvelop.class);
        }
        return success(FacilityUsedRecord);
        return success(facilityUsedRecord);
    }
    @ApiOperation(value = "获取用户使用导航记录:根据日期,根据反馈人等")
@ -77,17 +77,17 @@ public class FacilityUsedRecordController extends EnvelopRestEndpoint {
            @RequestParam(value = "field") String field,
            @ApiParam(name = "value", value = "检索值")
            @RequestParam(value = "value") String value) throws Exception {
        List<FacilityUsedRecord> FacilityUsedRecordList = facilityUsedRecordService.findByField(field, value);
        return success(FacilityUsedRecordList);
        List<FacilityUsedRecord> facilityUsedRecordList = facilityUsedRecordService.findByField(field, value);
        return success(facilityUsedRecordList);
    }
    @ApiOperation(value = "删除用户使用导航记录")
    @DeleteMapping(value = HealthyHouseMapping.HealthyHouse.FacilityUsedRecord.DELETE)
    public Envelop deleteFacilityUsedRecord(
            @ApiParam(name = "facilitiesServerId", value = "用户使用导航记录ID")
            @RequestParam(value = "facilitiesServerId") String facilitiesServerId) throws Exception {
        FacilityUsedRecord FacilityUsedRecord = facilityUsedRecordService.findById(facilitiesServerId);
        facilityUsedRecordService.delete(FacilityUsedRecord);
            @ApiParam(name = "facilityUsedRecordId", value = "用户使用导航记录ID")
            @RequestParam(value = "facilityUsedRecordId") String facilityUsedRecordId) throws Exception {
        FacilityUsedRecord facilityUsedRecord = facilityUsedRecordService.findById(facilityUsedRecordId);
        facilityUsedRecordService.delete(facilityUsedRecord);
        return success("success");
    }

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

@ -53,7 +53,7 @@ public class FeedBackController extends EnvelopRestEndpoint {
    @ApiOperation(value = "创建/更新(id存在)意见反馈")
    @PostMapping(value = HealthyHouseMapping.HealthyHouse.FeedBack.CREATE)
    public ObjEnvelop<FeedBack> createFeedBack(
            @ApiParam(name = "FeedBack", value = "意见反馈JSON结构")
            @ApiParam(name = "feedBack", value = "意见反馈JSON结构")
            @RequestBody FeedBack feedBack) throws IOException {
        feedBack = feedBackService.save(feedBack);
        return success(feedBack);

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

@ -52,7 +52,7 @@ public class NavigationServiceEvaluationController extends EnvelopRestEndpoint {
    @ApiOperation(value = "创建/更新(id存在)服务评价")
    @PostMapping(value = HealthyHouseMapping.HealthyHouse.NavigationServiceEvaluation.CREATE)
    public ObjEnvelop<NavigationServiceEvaluation> createNavigationServiceEvaluation(
            @ApiParam(name = "NavigationServiceEvaluation", value = "服务评价JSON结构")
            @ApiParam(name = "navigationServiceEvaluation", value = "服务评价JSON结构")
            @RequestBody NavigationServiceEvaluation navigationServiceEvaluation) throws IOException {
        navigationServiceEvaluation = navigationServiceEvaluationService.save(navigationServiceEvaluation);
        return success(navigationServiceEvaluation);
@ -84,9 +84,9 @@ public class NavigationServiceEvaluationController extends EnvelopRestEndpoint {
    @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);
            @ApiParam(name = "navigationServiceEvaluationId", value = "服务评价ID")
            @RequestParam(value = "navigationServiceEvaluationId") String navigationServiceEvaluationId) throws Exception {
        NavigationServiceEvaluation navigationServiceEvaluation = navigationServiceEvaluationService.findById(navigationServiceEvaluationId);
        navigationServiceEvaluationService.delete(navigationServiceEvaluation);
        return success("success");
    }

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

@ -0,0 +1,16 @@
package com.yihu.jw.healthyhouse.dao.user;
import com.yihu.jw.healthyhouse.model.user.Appeal;
import org.springframework.data.jpa.repository.JpaRepository;
/**
 * 账号申诉
 * @author zdm
 * @version 1.0
 * @created 2018.09.26
 */
public interface AppealDao extends JpaRepository<Appeal, Long> {
    Appeal findById(String id);
}

+ 2 - 2
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/model/facility/Facility.java

@ -264,7 +264,7 @@ public class Facility extends UuidIdentityEntityWithOperator {
    }
    @Formula("( SELECT a.value FROM system_dict_entries a WHERE a.dict_id = 5 AND a.code = status )")
    @Formula("( SELECT a.value FROM system_dict_entries a WHERE a.dict_id = 3 AND a.code = status )")
    public String getStatusName() {
        return statusName;
    }
@ -281,7 +281,7 @@ public class Facility extends UuidIdentityEntityWithOperator {
        this.facilityServerRelation = facilityServerRelation;
    }
    @Formula("( SELECT a.value FROM system_dict_entries a WHERE a.dict_id = 3 AND a.code = category )")
    @Formula("( SELECT a.value FROM system_dict_entries a WHERE a.dict_id = 5 AND a.code = category )")
    public String getCategoryValue() {
        return categoryValue;
    }

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

@ -0,0 +1,106 @@
package com.yihu.jw.healthyhouse.model.user;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import org.hibernate.annotations.Formula;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 账号申诉
 * @author zdm
 * @version 1.0
 * @created 2018.09.26
 */
@Entity
@Table(name = "appeal")
public class Appeal extends UuidIdentityEntityWithOperator {
    //账号申诉类型:0手机号无法使用,1收不到验证码,3其他
    @Column(name = "type")
    private String type;
    //问题和建议
    @Column(name = "content")
    private String content;
    //用户电话号码
    @Column(name = "user_telephone")
    private String userTelephone;
    //图片路径
    @Column(name = "img_path")
    private String imgPath;
    // 处理状态:0未阅,1待处理,2已处理,3废弃
    @Column(name = "flag")
    private Integer flag;
    //处理备注
    @Column(name = "reply_content")
    private String replyContent;
    //账号申诉类型值:0手机号无法使用,1收不到验证码,3其他
    private String typeValue;
    // 处理状态值:0未阅,1待处理,2已处理,3废弃
    private String flagValue;
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getUserTelephone() {
        return userTelephone;
    }
    public void setUserTelephone(String userTelephone) {
        this.userTelephone = userTelephone;
    }
    public String getImgPath() {
        return imgPath;
    }
    public void setImgPath(String imgPath) {
        this.imgPath = imgPath;
    }
    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;
    }
    @Formula("( SELECT a.value FROM system_dict_entries a WHERE a.dict_id = 9 AND a.code = type )")
    public String getTypeValue() {
        return typeValue;
    }
    public void setTypeValue(String typeValue) {
        this.typeValue = typeValue;
    }
    @Formula("( SELECT a.value FROM system_dict_entries a WHERE a.dict_id = 10 AND a.code = flag )")
    public String getFlagValue() {
        return flagValue;
    }
    public void setFlagValue(String flagValue) {
        this.flagValue = flagValue;
    }
}

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

@ -0,0 +1,28 @@
package com.yihu.jw.healthyhouse.service.user;
import com.yihu.jw.healthyhouse.dao.user.AppealDao;
import com.yihu.jw.healthyhouse.model.user.Appeal;
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.26
 */
@Service
@Transactional
public class AppealService extends BaseJpaService<Appeal, AppealDao> {
    @Autowired
    private AppealDao AppealDao;
    public Appeal findById(String id) {
        return  AppealDao.findById(id);
    }
}