158 lines
4.2 KiB
Plaintext
158 lines
4.2 KiB
Plaintext
package com.jysoft.property.controller;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
import com.jysoft.property.entity.GreenPropertyEntity;
|
|
import com.jysoft.property.service.PropertyService;
|
|
import com.jysoft.visitor.service.VisitorService;
|
|
import com.nationalelectirc.Constant.Constant;
|
|
import com.nationalelectirc.utils.RestResult;
|
|
import com.nationalelectric.greenH5.GreenBaseController;
|
|
import com.nationalelectric.greenH5.po.GreenUserInfo;
|
|
import com.nationalelectric.greenH5.po.GreenVisitor;
|
|
|
|
@Controller
|
|
@RequestMapping("/greenProperty")
|
|
public class PropertyController extends GreenBaseController {
|
|
|
|
@Autowired
|
|
private PropertyService service;
|
|
|
|
/**
|
|
* 通过用户id获取服务记录
|
|
*
|
|
* @param entity
|
|
* 数据
|
|
* @return 响应数据
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping(value = "/getPropertyByUserId", method = { RequestMethod.POST })
|
|
public RestResult getPropertyByUserId(GreenPropertyEntity entity) {
|
|
try {
|
|
GreenUserInfo info = getUserInfo(entity.getUserId());
|
|
if (info == null) {
|
|
return new RestResult(Constant.FAILED, "非法用户");
|
|
}
|
|
} catch (Exception e) {
|
|
return new RestResult(Constant.FAILED, "非法用户");
|
|
}
|
|
return service.getPropertyByUserId(entity);
|
|
|
|
}
|
|
|
|
/**
|
|
* 添加服务记录
|
|
*
|
|
* @param entity
|
|
* 数据
|
|
* @return 响应数据
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping(value = "/addProperty", method = { RequestMethod.POST })
|
|
public RestResult addProperty(GreenPropertyEntity entity) {
|
|
try {
|
|
GreenUserInfo info = getUserInfo(entity.getUserId());
|
|
if (info == null) {
|
|
return new RestResult(Constant.FAILED, "非法用户");
|
|
}
|
|
} catch (Exception e) {
|
|
return new RestResult(Constant.FAILED, "非法用户");
|
|
}
|
|
return service.addProperty(entity);
|
|
|
|
}
|
|
|
|
/**
|
|
* 获取服务类型
|
|
*
|
|
* @param entity
|
|
* 数据
|
|
* @return 响应数据
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping(value = "/getPropertyType", method = { RequestMethod.POST })
|
|
public RestResult getPropertyType(GreenPropertyEntity entity) {
|
|
try {
|
|
GreenUserInfo info = getUserInfo(entity.getUserId());
|
|
if (info == null) {
|
|
return new RestResult(Constant.FAILED, "非法用户");
|
|
}
|
|
} catch (Exception e) {
|
|
return new RestResult(Constant.FAILED, "非法用户");
|
|
}
|
|
return service.getPropertyType();
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* 获取服务类型
|
|
*
|
|
* @param entity
|
|
* 数据
|
|
* @return 响应数据
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping(value = "/getProperty", method = { RequestMethod.POST })
|
|
public RestResult getProperty(GreenPropertyEntity entity) {
|
|
try {
|
|
GreenUserInfo info = getUserInfo(entity.getUserId());
|
|
if (info == null) {
|
|
return new RestResult(Constant.FAILED, "非法用户");
|
|
}
|
|
} catch (Exception e) {
|
|
return new RestResult(Constant.FAILED, "非法用户");
|
|
}
|
|
return service.getProperty(entity);
|
|
}
|
|
|
|
|
|
/**
|
|
* 获取服务类型
|
|
*
|
|
* @param entity
|
|
* 数据
|
|
* @return 响应数据
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping(value = "/updateProperty", method = { RequestMethod.POST })
|
|
public RestResult updateProperty(GreenPropertyEntity entity) {
|
|
try {
|
|
GreenUserInfo info = getUserInfo(entity.getUserId());
|
|
if (info == null) {
|
|
return new RestResult(Constant.FAILED, "非法用户");
|
|
}
|
|
} catch (Exception e) {
|
|
return new RestResult(Constant.FAILED, "非法用户");
|
|
}
|
|
return service.updateProperty(entity);
|
|
}
|
|
|
|
/**
|
|
* @MethodName: addServiceEvaluate
|
|
* @Description: 服务评价
|
|
* @author cwchen
|
|
* @param entity
|
|
* @return RestResult
|
|
* @date 2024-05-16 10:19:34
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping(value = "/addServiceEvaluate", method = { RequestMethod.POST })
|
|
public RestResult addServiceEvaluate(GreenPropertyEntity entity) {
|
|
try {
|
|
GreenUserInfo info = getUserInfo(entity.getUserId());
|
|
if (info == null) {
|
|
return new RestResult(Constant.FAILED, "非法用户");
|
|
}
|
|
} catch (Exception e) {
|
|
return new RestResult(Constant.FAILED, "非法用户");
|
|
}
|
|
return service.addServiceEvaluate(entity);
|
|
}
|
|
|
|
}
|