Commit b6d80801 authored by 廖旭伟's avatar 廖旭伟

达州一窗服务知识库系统

parent 3e46a91d
......@@ -9,6 +9,7 @@ import com.mortals.framework.util.AESUtil;
import com.mortals.framework.utils.ServletUtils;
import com.mortals.framework.web.interceptor.BaseInterceptor;
import com.mortals.xhx.base.framework.config.InterceptorConfig;
import com.mortals.xhx.common.key.Constant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
......@@ -72,7 +73,7 @@ public class AuthUserInterceptor extends BaseInterceptor {
if (ObjectUtils.isEmpty(loginUser)) {
ServletUtils.renderString(response, JSONObject.toJSONString(Rest.fail(ERROR_TOKEN_EXPIRED, ERROR_TOKEN_EXPIRED_CONTENT)));
return false;
} else if (loginUser.isAdmin() || loginUser.getUserType() == 1) {
} else if (loginUser.isAdmin() || loginUser.getUserType() == 1||loginUser.getUserType()== Constant.WORKMAN_USER) {
return super.preHandle(request, response, handler);
} else {
ServletUtils.renderString(response, JSONObject.toJSONString(Rest.fail(ERROR_USER_OPERATION, ERROR_USER_OPERATION_CONTENT)));
......
......@@ -139,6 +139,7 @@ public final class Constant {
public final static String USER_SITE_TREE = "user:site:tree";
/** 登录用户类型为工作人员 */
public final static int WORKMAN_USER = 99;
}
......@@ -4,7 +4,10 @@ import com.mortals.framework.model.OrderCol;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.OperTypeEnum;
import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.module.site.model.SiteMatterAssistViewsEntity;
import com.mortals.xhx.module.site.model.SiteMatterEntity;
import com.mortals.xhx.module.site.service.SiteMatterAssistViewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -18,12 +21,10 @@ import com.mortals.xhx.module.site.model.SiteMatterAssistEntity;
import com.mortals.xhx.module.site.service.SiteMatterAssistService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
......@@ -40,6 +41,8 @@ public class SiteMatterAssistController extends BaseCRUDJsonBodyMappingControlle
@Autowired
private ParamService paramService;
@Autowired
private SiteMatterAssistViewsService siteMatterAssistViewsService;
public SiteMatterAssistController(){
super.setModuleDesc( "辅助接件事项");
......@@ -69,6 +72,17 @@ public class SiteMatterAssistController extends BaseCRUDJsonBodyMappingControlle
@Override
protected int viewAfter(Long id, Map<String, Object> model, SiteMatterAssistEntity entity, Context context) throws AppException {
this.service.addViewsCount(id);
if(context!=null && context.getUser()!=null){
if(context.getUser().getUserType()== Constant.WORKMAN_USER){
SiteMatterAssistViewsEntity siteMatterAssistViewsEntity = new SiteMatterAssistViewsEntity();
siteMatterAssistViewsEntity.setAssistId(id);
siteMatterAssistViewsEntity.setViewUserId(context.getUser().getId());
siteMatterAssistViewsEntity.setViewUserName(context.getUser().getRealName());
siteMatterAssistViewsEntity.setCreateTime(new Date());
siteMatterAssistViewsEntity.setCreateUserId(1L);
siteMatterAssistViewsService.save(siteMatterAssistViewsEntity);
}
}
return 1;
}
......
package com.mortals.xhx.module.workman.web;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.pinyin.PinyinUtil;
import com.alibaba.fastjson.JSON;
......@@ -9,6 +10,7 @@ import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.FileUtil;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
......@@ -29,6 +31,7 @@ import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -79,14 +82,22 @@ public class WorkmanController extends BaseCRUDJsonBodyMappingController<Workman
JSONObject ret = new JSONObject();
try {
String ip = super.getRequestIP(request);
Map<String, Object> data = new HashMap<>();
WorkmanEntity workmanEntity = this.service.doLogin(query.getLoginName(), query.getLoginPwd(), ip);
if (query.getSiteId() != workmanEntity.getSiteId()) {
throw new AppException("当前工作人员不在当前站点下!");
}
// if (query.getSiteId() != workmanEntity.getSiteId()) {
// throw new AppException("当前工作人员不在当前站点下!");
// }
workmanEntity.setLastLoginAddress(ip);
//workmanEntity.setLoginTime(System.currentTimeMillis());
workmanEntity.setToken(IdUtil.fastSimpleUUID());
workmanEntity.setExpireTime(DateUtils.addCurrDate(7).getTime());
String token = authTokenService.createToken(workmanEntity);
data.put("token", token);
data.put("workmanEntity", workmanEntity);
ret.put(KEY_RESULT_DATA, data);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "工作人员登录成功!");
ret.put(KEY_RESULT_DATA, workmanEntity);
recordSysLog(request, getCurUser(), "工作人员登录成功!");
recordSysLog(request, workmanEntity, "工作人员登录成功!");
return ret.toJSONString();
} catch (Exception e) {
log.error("工作人员登录错误", e);
......
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