hz-zhhq-app-service/greenH5modul/.svn/pristine/79/79e89025a7628598a2a78ac2b18...

199 lines
5.1 KiB
Plaintext
Raw Normal View History

2025-01-21 13:12:35 +08:00
package com.jysoft.card.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONObject;
import com.jysoft.card.service.CardService;
import com.jysoft.card.service.GreenCard;
import com.jysoft.property.entity.GreenPropertyEntity;
import com.jysoft.visitor.service.VisitorService;
import com.jysoft.visitor.util.ArtemisPost;
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;
import com.nationalelectric.greenH5.po.VisitorEventNotify;
import com.sgcc.uap.persistence.IHibernateDao;
/**
* @author bonus
* @date 2023-06-13
* @描述:访客管理
*
*/
@Controller
@RequestMapping("/greenCard")
public class CardController extends GreenBaseController {
@Autowired
private CardService service;
/**
* 添加来访记录
*
* @param entity
* 数据
* @return 响应数据
*/
@ResponseBody
@RequestMapping(value = "/addCard", method = { RequestMethod.POST })
public RestResult addCard(GreenCard 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.addCard(entity);
}
/**
* 通过id获取邀约记录
*
* @param entity
* 数据
* @return 响应数据
*/
@ResponseBody
@RequestMapping(value = "/getCard", method = { RequestMethod.POST })
public RestResult getCard(GreenCard 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.getCard(entity);
}
/**
* 修改信息状态
*
* @param entity
* 数据
* @return 响应数据
*/
@ResponseBody
@RequestMapping(value = "/updateCard", method = { RequestMethod.POST })
public RestResult updateCard(GreenCard 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.updateCard(entity);
}
/**
* 获取个人接收的访客记录
*
* @param entity
* 数据
* @return 响应数据
*/
@ResponseBody
@RequestMapping(value = "/getCardByUserId", method = { RequestMethod.POST })
public RestResult getCardByUserId(GreenCard 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.getCardByUserId(entity);
}
/**
* 获取个人发出的访客记录
*
* @param entity
* 数据
* @return 响应数据
*/
@ResponseBody
@RequestMapping(value = "/getIssueCardByUserId", method = { RequestMethod.POST })
public RestResult getIssueCardByUserId(GreenCard 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.getIssueCardByUserId(entity);
}
/**
* 获取服务类型
*
* @param entity
* 数据
* @return 响应数据
*/
@ResponseBody
@RequestMapping(value = "/getCardType", method = { RequestMethod.POST })
public RestResult getCardType(GreenCard 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.getCardType(entity);
}
/**
* 查询出行报备部门拥有审核权限人员
*
* @param map
* @return
*/
@RequestMapping(value = "/getDeptExamineAuth", method = RequestMethod.POST)
@Transactional(rollbackFor = Exception.class)
@ResponseBody
public RestResult getDeptExamineAuth(GreenCard 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.getDeptExamineAuth(entity);
}
}