94 lines
2.6 KiB
Plaintext
94 lines
2.6 KiB
Plaintext
|
|
package com.jysoft.questionnaire.controller;
|
||
|
|
|
||
|
|
import java.util.Date;
|
||
|
|
import java.util.HashMap;
|
||
|
|
|
||
|
|
import javax.servlet.http.HttpServletRequest;
|
||
|
|
|
||
|
|
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.questionnaire.entity.GreenQuestionnaire;
|
||
|
|
import com.jysoft.questionnaire.service.QuestionnaireService;
|
||
|
|
import com.nationalelectirc.Constant.Constant;
|
||
|
|
import com.nationalelectirc.utils.RestResult;
|
||
|
|
import com.nationalelectric.greenH5.GreenBaseController;
|
||
|
|
import com.nationalelectric.greenH5.po.GreenUserInfo;
|
||
|
|
|
||
|
|
@Controller
|
||
|
|
@RequestMapping("/greenQuestionnaire")
|
||
|
|
public class QuestionnaireController extends GreenBaseController {
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
private QuestionnaireService service;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取问卷列表
|
||
|
|
*
|
||
|
|
* @param entity
|
||
|
|
* 数据
|
||
|
|
* @return 响应数据
|
||
|
|
*/
|
||
|
|
@ResponseBody
|
||
|
|
@RequestMapping(value = "/getQuestionnaireList", method = { RequestMethod.POST })
|
||
|
|
public RestResult getQuestionnaireList(GreenQuestionnaire 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.getQuestionnaireList(entity);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取问卷详情
|
||
|
|
*
|
||
|
|
* @param entity
|
||
|
|
* 数据
|
||
|
|
* @return 响应数据
|
||
|
|
*/
|
||
|
|
@ResponseBody
|
||
|
|
@RequestMapping(value = "/getQuestionnaireById", method = { RequestMethod.POST })
|
||
|
|
public RestResult getQuestionnaireById(GreenQuestionnaire 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.getQuestionnaireById(entity);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 提交问卷
|
||
|
|
*
|
||
|
|
* @param entity
|
||
|
|
* 数据
|
||
|
|
* @return 响应数据
|
||
|
|
*/
|
||
|
|
@ResponseBody
|
||
|
|
@RequestMapping(value = "/updateQuestionnaire", method = { RequestMethod.POST })
|
||
|
|
public RestResult updateQuestionnaire(GreenQuestionnaire 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.updateQuestionnaire(entity);
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|