Commit a89a87a6 authored by 赵啸非's avatar 赵啸非

添加用户反馈问答表

parent c7c4a57e
......@@ -10,14 +10,20 @@ import java.util.Date;
@Data
public class AppealReq extends BaseReq {
//绩效开始时间
private String performStartDate;
//绩效结束时间
private String performEndDate;
//申诉开始时间
private String apperalStartDate;
//申诉结束时间
private String appealEndDate;
//绩效类型
//类型
private String performType;
private Integer appealResult;
private Integer processStatus;
/**
* 当前员工id
*/
......
package com.mortals.xhx.busiz.rsp;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class AppealStatInfo {
/**
* 累计扣分
*/
private BigDecimal totalScore;
/**
* 累计次数
*/
private Integer totalTimes;
/**
* 今日扣分
*/
private BigDecimal todayScore;
/**
* 今日次数
*/
private Integer todayTimes;
}
......@@ -13,6 +13,12 @@ public class PerformInfo {
*/
private Long id;
private Long staffId;
private String staffName;
private String workNum;
/**
* 标题
*/
......@@ -25,7 +31,7 @@ public class PerformInfo {
/**
* 扣分时间
*/
private Date errorTime;
private Date happenTime;
/**
* 绩效规则id
*/
......@@ -34,6 +40,12 @@ public class PerformInfo {
* 规则名称
*/
private String ruleName;
/**
* 评分标准
*/
private String ruleDesc;
/**
* 增减类型(1.增加,2.扣除)
*/
......
......@@ -2,8 +2,29 @@ package com.mortals.xhx.busiz.rsp;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class PerformStatInfo {
/**
* 累计扣分
*/
private BigDecimal totalScore;
/**
* 累计次数
*/
private Integer totalTimes;
/**
* 今日扣分
*/
private BigDecimal todayScore;
/**
* 今日次数
*/
private Integer todayTimes;
}
package com.mortals.xhx.busiz.web;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.ap.CookieService;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.common.Rest;
import com.mortals.framework.service.IAuthTokenService;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.AESUtil;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.HttpUtil;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.framework.web.BaseJsonBodyController;
import com.mortals.xhx.base.login.web.LoginForm;
import com.mortals.xhx.base.system.menu.model.MenuEntity;
import com.mortals.xhx.base.system.menu.service.MenuService;
import com.mortals.xhx.base.system.resource.service.ResourceService;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.base.system.valid.service.ValidCodeService;
import com.mortals.xhx.common.key.RedisKey;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Set;
import static com.mortals.xhx.common.key.ErrorCode.ERROR_TOKEN_EXPIRED;
import static com.mortals.xhx.common.key.ErrorCode.ERROR_TOKEN_EXPIRED_CONTENT;
@RestController
@Slf4j
@RequestMapping("/api/v1/")
public class ApiLoginController extends BaseJsonBodyController {
@Autowired
private UserService userService;
@Autowired
private ValidCodeService validCodeService;
@Autowired
private ResourceService resourceService;
@Autowired
private MenuService menuService;
// @Autowired
// private ITokenService tokenService;
@Autowired
private ICacheService cacheService;
@Autowired
private IAuthTokenService authTokenService;
@RequestMapping("login")
public String login(@RequestBody LoginForm loginForm) throws Exception {
/*
JSONObject ret = new JSONObject();
String loginName = loginForm.getLoginName();
String password = loginForm.getPassword();
UserPdu userPdu = new UserPdu();
userPdu.setLoginName(loginName);
userPdu.setPassword(password);
String resp = userFeign.portalLogin(userPdu);
return resp;
*/
JSONObject ret = new JSONObject();
String loginName = loginForm.getLoginName();
String password = loginForm.getPassword();
String ip = super.getRequestIP(request);
if (StringUtils.isEmpty(loginName) || StringUtils.isEmpty(password)) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, "未获取到用户信息,请重新登录");
return ret.toJSONString();
}
UserEntity userEntity = null;
try {
loginForm.validate();
userEntity = userService.doLogin(loginName, password, ip);
userEntity.setLastLoginAddress(ip);
recordSysLog(request, userEntity, "用户登录系统成功!");
// 返回拥有的菜单数据
Set<String> urls = resourceService.findUrlSetByUserId(userEntity.getId());
List<MenuEntity> outlookBarList = menuService.findTreeMenu(userEntity, urls);
String currUserName = userEntity.getRealName();
if (currUserName == null || currUserName.trim().length() == 0) {
currUserName = "管理员";
}
JSONObject data = new JSONObject();
data.put("currUserName", currUserName);
data.put("barList", outlookBarList);
data.put("id", userEntity.getId());
data.put("userType", userEntity.getUserType());
userEntity.setLoginTime(System.currentTimeMillis());
userEntity.setToken(IdUtil.fastSimpleUUID());
userEntity.setExpireTime(DateUtils.addCurrDate(7).getTime());
userEntity.setMenuUrl(generateMenuUrlCode(urls));
String token = authTokenService.createToken(userEntity);
data.put("token", token);
//设置token 和过期时间
//data.put("expiresTime", DateUtils.addCurrDate(7).getTime());
generateMenuUrlCode(urls);
//this.generateBlackCookie(request, response, loginName, urls);
ret.put(KEY_RESULT_DATA, data);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "用户登录系统成功!");
ret.put("resources", urls);
return ret.toJSONString();
} catch (Exception e) {
log.error("login error ", e);
if (userEntity == null) {
userEntity = new UserEntity();
userEntity.setLoginName(loginName);
}
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, super.convertException(e));
return ret.toJSONString();
}
}
@RequestMapping("logout")
public void logout(HttpServletRequest request, HttpServletResponse response) throws Exception {
recordSysLog(request, "退出登录");
super.removeCurrUser(request);
}
@RequestMapping("index")
public String index() throws Exception {
JSONObject ret = new JSONObject();
IUser user = this.getCurUser();
if (user == null) {
return JSONObject.toJSONString(Rest.fail(ERROR_TOKEN_EXPIRED, ERROR_TOKEN_EXPIRED_CONTENT));
}
Set<String> urls = resourceService.findUrlSetByUserId(user.getId());
List<MenuEntity> outlookBarList = menuService.findTreeMenu(user, urls);
String currUserName = user.getRealName();
if (currUserName == null || currUserName.trim().length() == 0) {
currUserName = "管理员";
}
JSONObject data = new JSONObject();
String token = authTokenService.getToken(request);
data.put("token", token);
data.put("currUserName", currUserName);
data.put("barList", outlookBarList);
data.put("id", user.getId());
data.put("userType", user.getUserType());
ret.put(KEY_RESULT_DATA, data);
//this.generateBlackCookie(request, response, user.getLoginName(), urls);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "用户登录系统成功!");
ret.put("resources", urls);
return ret.toJSONString();
}
private void generateBlackCookie(HttpServletRequest request, HttpServletResponse response, String loginName, Set<String> urls) {
try {
String cacheKey = RedisKey.KEY_MENU_CACHE + loginName;
String securityKey = GlobalSysInfo.getPropertyValue(SysConstains.PROP_COOKIE_SECURITY_KEY);
//应为Cookie会超长,所以改为仅存储key将值放入redis
//CookieService.setCookieForAuth(request, response, securityKey, null);
StringBuilder sb = new StringBuilder();
if (urls != null && urls.size() > 0) {
for (String url : urls) {
int index = url.hashCode() & (Integer.MAX_VALUE - 1);
sb.append(index).append(",");
}
}
String menuUrl = sb.toString();
menuUrl = AESUtil.encrypt(menuUrl, securityKey);
cacheService.set(cacheKey, menuUrl, 604800);
HttpUtil.setCookieValue(request, response, SysConstains.COOKIE_MENU, cacheKey, -1);
} catch (Throwable e) {
}
}
private String generateMenuUrlCode(Set<String> urls) {
try {
String securityKey = GlobalSysInfo.getPropertyValue(SysConstains.PROP_COOKIE_SECURITY_KEY);
StringBuilder sb = new StringBuilder();
if (urls != null && urls.size() > 0) {
for (String url : urls) {
int index = url.hashCode() & (Integer.MAX_VALUE - 1);
sb.append(index).append(",");
}
}
String menuUrl = sb.toString();
return AESUtil.encrypt(menuUrl, securityKey);
} catch (Throwable e) {
log.error("编码异常", e);
return null;
}
}
@RequestMapping("parseToken")
public IUser parseToken() throws Exception {
IUser userEntity = authTokenService.getLoginUser(request);
if (!ObjectUtils.isEmpty(userEntity)) {
authTokenService.verifyToken(userEntity);
return userEntity;
}
return null;
}
}
......@@ -7,6 +7,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.web.BaseJsonBodyController;
import com.mortals.xhx.busiz.req.AppealReq;
import com.mortals.xhx.busiz.req.PerformReq;
import com.mortals.xhx.busiz.rsp.AppealStatInfo;
import com.mortals.xhx.busiz.rsp.PerformDetailInfo;
import com.mortals.xhx.busiz.rsp.PerformInfo;
import com.mortals.xhx.busiz.rsp.PerformStatInfo;
......@@ -49,6 +50,25 @@ public class AppealApiController extends BaseJsonBodyController {
private CheckOtherRecordService checkOtherRecordService;
/**
* 个人申诉绩效统计
*/
@PostMapping(value = "appeal/stat")
public Rest<AppealStatInfo> appealStat() {
String busiDesc = "H5个人申诉绩效统计";
Rest<AppealStatInfo> rest = Rest.ok(busiDesc + " 【成功】");
try {
//todo 查询当前登录人的绩效分数
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
log.error(busiDesc, e);
rest = Rest.fail(super.convertException(e));
}
return rest;
}
/**
* 申诉列表
*/
......@@ -57,10 +77,10 @@ public class AppealApiController extends BaseJsonBodyController {
String busiDesc = "个人申诉列表";
Rest<List<PerformAttendAppealEntity>> rest = Rest.ok(busiDesc + " 【成功】");
try {
if (ObjectUtils.isEmpty(appealReq.getPerformStartDate())) {
if (ObjectUtils.isEmpty(appealReq.getApperalStartDate())) {
//未设置时间的情况,默认为当月
appealReq.setPerformStartDate(DateUtil.beginOfMonth(new Date()).toDateStr());
appealReq.setPerformEndDate(DateUtil.today());
appealReq.setApperalStartDate(DateUtil.beginOfMonth(new Date()).toDateStr());
appealReq.setAppealEndDate(DateUtil.today());
}
recordSysLog(request, busiDesc + " 【成功】");
......
......@@ -105,10 +105,10 @@ public class PerformApiController extends BaseJsonBodyController {
/**
* 扣分加分详细
* 详细
*/
@PostMapping(value = "perform/detail")
public Rest<PerformDetailInfo> performDetail(@RequestBody PerformReq performReq) {
@PostMapping(value = "perform/info")
public Rest<PerformDetailInfo> performInfo(@RequestBody PerformReq performReq) {
String busiDesc = "个人绩效增减详细";
Rest<PerformDetailInfo> rest = Rest.ok(busiDesc + " 【成功】");
try {
......
......@@ -991,38 +991,6 @@ public class FeedbackQuery extends FeedbackEntity {
this.formContentNotList = formContentNotList;
}
/**
* 获取 表单内容
* @return formContentList
*/
public List<String> getFormContentList(){
return this.formContentList;
}
/**
* 设置 表单内容
* @param formContentList
*/
public void setFormContentList(List<String> formContentList){
this.formContentList = formContentList;
}
/**
* 获取 表单内容
* @return formContentNotList
*/
public List<String> getFormContentNotList(){
return this.formContentNotList;
}
/**
* 设置 表单内容
* @param formContentNotList
*/
public void setFormContentNotList(List<String> formContentNotList){
this.formContentNotList = formContentNotList;
}
/**
* 设置 序号,主键,自增长
* @param id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment