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

Merge remote-tracking branch 'origin/master'

parents 5accba1e 6a9ccbdc
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
<id>product</id> <id>product</id>
<properties> <properties>
<profiles.active>product</profiles.active> <profiles.active>product</profiles.active>
<profiles.server.debug>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=15506</profiles.server.debug>
<profiles.filepath>/mortals/app/data/one</profiles.filepath> <profiles.filepath>/mortals/app/data/one</profiles.filepath>
<profiles.nacos.server-addr>192.168.0.252:8848</profiles.nacos.server-addr> <profiles.nacos.server-addr>192.168.0.252:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group> <profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
......
...@@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -74,12 +75,13 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi ...@@ -74,12 +75,13 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
// } // }
userEntity = userService.doLogin(loginName, password, ip); userEntity = userService.doLogin(loginName, password, ip);
userEntity.setLastLoginAddress(ip); userEntity.setLastLoginAddress(ip);
userEntity.setLoginTime(new Date().getTime());
// saveCurrUser(request, response, userEntity); // saveCurrUser(request, response, userEntity);
recordSysLog(request, userEntity, "用户登录系统成功!"); recordSysLog(request, userEntity, "用户登录系统成功!");
String tmpToken = userEntity.getId() + ":" + IdUtil.fastSimpleUUID(); String tmpToken = userEntity.getId() + ":" + IdUtil.fastSimpleUUID();
userEntity.setToken(tmpToken); userEntity.setToken(tmpToken);
userEntity.setExpireTime(DateUtils.addCurrDate(1).getTime()); userEntity.setExpireTime(DateUtils.addCurrDate(3).getTime());
String token = authTokenService.createToken(userEntity); String token = authTokenService.createToken(userEntity);
data.put("token", token); data.put("token", token);
// 返回拥有的菜单数据 // 返回拥有的菜单数据
...@@ -127,7 +129,7 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi ...@@ -127,7 +129,7 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
return JSONObject.toJSONString(Rest.fail(ERROR_TOKEN_EXPIRED, ERROR_TOKEN_EXPIRED_CONTENT)); return JSONObject.toJSONString(Rest.fail(ERROR_TOKEN_EXPIRED, ERROR_TOKEN_EXPIRED_CONTENT));
} }
Set<String> urls = resourceService.findUrlSetByUserId(user.getId()); Set<String> urls = resourceService.findUrlSetByUserId(user.getId());
log.info("userId:{},urls:{}", user.getId(),JSON.toJSONString(urls)); log.info("userId:{},urls:{}", user.getId(), JSON.toJSONString(urls));
List<MenuEntity> outlookBarList = menuService.findTreeMenu(user, urls); List<MenuEntity> outlookBarList = menuService.findTreeMenu(user, urls);
String currUserName = user.getRealName(); String currUserName = user.getRealName();
if (currUserName == null || currUserName.trim().length() == 0) { if (currUserName == null || currUserName.trim().length() == 0) {
...@@ -151,9 +153,6 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi ...@@ -151,9 +153,6 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
} }
@Override @Override
public void afterPropertiesSet() throws Exception { public void afterPropertiesSet() throws Exception {
log.info("初始化加载登录。。。"); log.info("初始化加载登录。。。");
......
...@@ -11,7 +11,6 @@ package com.mortals.xhx.base.system.param.dao.ibatis; ...@@ -11,7 +11,6 @@ package com.mortals.xhx.base.system.param.dao.ibatis;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis; import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.base.system.param.dao.ParamDao; import com.mortals.xhx.base.system.param.dao.ParamDao;
import com.mortals.xhx.base.system.param.model.ParamEntity; import com.mortals.xhx.base.system.param.model.ParamEntity;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
/** /**
......
...@@ -21,7 +21,7 @@ import java.util.Date; ...@@ -21,7 +21,7 @@ import java.util.Date;
* @author * @author
* @version 1.0.0 * @version 1.0.0
*/ */
public class ParamEntity extends ParamEntityExt implements IParam { public class ParamEntity extends BaseEntityLong implements IParam {
private static final long serialVersionUID = 1536307966363L; private static final long serialVersionUID = 1536307966363L;
/** 参数名称 */ /** 参数名称 */
......
package com.mortals.xhx.base.system.param.model;
import com.mortals.framework.model.BaseEntityLong;
import lombok.Data;
@Data
public class ParamEntityExt extends BaseEntityLong {
/** 素材分组名称 */
private String pictureGroupName;
}
...@@ -5,7 +5,6 @@ import com.mortals.framework.service.ICRUDCacheService; ...@@ -5,7 +5,6 @@ import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.framework.service.IParamService; import com.mortals.framework.service.IParamService;
import com.mortals.xhx.base.system.param.model.ParamEntity; import com.mortals.xhx.base.system.param.model.ParamEntity;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -45,35 +44,4 @@ public interface ParamService extends ICRUDCacheService<ParamEntity, Long>, IPar ...@@ -45,35 +44,4 @@ public interface ParamService extends ICRUDCacheService<ParamEntity, Long>, IPar
*/ */
Map<String, String> getParamBySecondOrganize(String firstOrganize,String secondOrganize, String... excludeParamKeys); Map<String, String> getParamBySecondOrganize(String firstOrganize,String secondOrganize, String... excludeParamKeys);
/**
* 获取热词列表
* @return
*/
String getHotWords();
/**
* 设置热词列表
* @return
*/
void setHotWords(String value);
/**
* 空白打印材料展示数量
* @return
*/
int getPrintDisplayQuantity();
/**
* 设置空白打印材料展示数量
* @return
*/
void setPrintDisplayQuantity(int value);
/**
* 通过Key设置参数值 value
* @param key
* @param value
* @return
*/
void setValueByKey(String key,String value);
} }
\ No newline at end of file
package com.mortals.xhx.base.system.param.service.impl; package com.mortals.xhx.base.system.param.service.impl;
import com.mortals.framework.common.code.YesNo; import cn.hutool.core.util.StrUtil;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.IParam; import com.mortals.framework.service.IParam;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.framework.util.DataUtil; import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.param.dao.ParamDao; import com.mortals.xhx.base.system.param.dao.ParamDao;
import com.mortals.xhx.base.system.param.model.ParamEntity; import com.mortals.xhx.base.system.param.model.ParamEntity;
import com.mortals.xhx.base.system.param.model.ParamQuery;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -30,14 +29,21 @@ import java.util.stream.Collectors; ...@@ -30,14 +29,21 @@ import java.util.stream.Collectors;
@Service("paramService") @Service("paramService")
public class ParamServiceImpl extends AbstractCRUDCacheServiceImpl<ParamDao, ParamEntity, Long> public class ParamServiceImpl extends AbstractCRUDCacheServiceImpl<ParamDao, ParamEntity, Long>
implements ParamService { implements ParamService {
private final String HOT_WORDS = "HotWords";
private final String PRINT_QUANTITY = "PrintDisplayQuantity";
@Override @Override
protected String getCacheName() { protected String getCacheName() {
return "ParamEntity.paramKey"; return "ParamEntity.paramKey";
} }
@Override
protected void saveBefore(ParamEntity entity, Context context) throws AppException {
//过滤换行符
entity.setParamKey(StrUtil.removeAllLineBreaks(entity.getParamKey()));
entity.setParamValue(StrUtil.removeAllLineBreaks(entity.getParamValue()));
super.saveBefore(entity, context);
}
@Override @Override
public String getValueByKey(String key) { public String getValueByKey(String key) {
List<ParamEntity> list = this.getCacheList(); List<ParamEntity> list = this.getCacheList();
...@@ -65,92 +71,6 @@ public class ParamServiceImpl extends AbstractCRUDCacheServiceImpl<ParamDao, Par ...@@ -65,92 +71,6 @@ public class ParamServiceImpl extends AbstractCRUDCacheServiceImpl<ParamDao, Par
).collect(Collectors.toMap(ParamEntity::getParamKey, ParamEntity::getParamValue, (o, n) -> n)); ).collect(Collectors.toMap(ParamEntity::getParamKey, ParamEntity::getParamValue, (o, n) -> n));
} }
@Override
public String getHotWords() {
return this.getParamValue(HOT_WORDS);
}
@Override
public void setHotWords(String value) {
List<ParamEntity> list = this.getCacheList();
ParamEntity entity = null;
for(ParamEntity paramEntity:list){
if(HOT_WORDS.equals(paramEntity.getParamKey())){
entity = paramEntity;
break;
}
}
if(entity!=null){
entity.setParamValue(value);
this.update(entity);
}else {
entity = new ParamEntity();
entity.setParamValue(value);
entity.setParamKey(HOT_WORDS);
entity.setName("热门搜索词汇");
entity.setCreateTime(new Date());
entity.setCreateUserId(1l);
entity.setCreateUserName("系统管理员");
this.save(entity);
}
}
@Override
public int getPrintDisplayQuantity() {
String printV = this.getParamValue(PRINT_QUANTITY);
return DataUtil.converStr2Int(printV,20);
}
@Override
public void setPrintDisplayQuantity(int value) {
List<ParamEntity> list = this.getCacheList();
ParamEntity entity = null;
for(ParamEntity paramEntity:list){
if(PRINT_QUANTITY.equals(paramEntity.getParamKey())){
entity = paramEntity;
break;
}
}
if(entity!=null){
entity.setParamValue(String.valueOf(value));
this.update(entity);
}else {
entity = new ParamEntity();
entity.setParamValue(String.valueOf(value));
entity.setParamKey(PRINT_QUANTITY);
entity.setName("空白打印材料展示数量");
entity.setCreateTime(new Date());
entity.setCreateUserId(1l);
entity.setCreateUserName("系统管理员");
this.save(entity);
}
}
@Override
public void setValueByKey(String key, String value) {
List<ParamEntity> list = this.getCacheList();
ParamEntity entity = null;
for(ParamEntity paramEntity:list){
if(key.equals(paramEntity.getParamKey())){
entity = paramEntity;
break;
}
}
if(entity!=null){
entity.setParamValue(String.valueOf(value));
this.update(entity);
}else {
entity = new ParamEntity();
entity.setParamValue(String.valueOf(value));
entity.setParamKey(key);
entity.setName("key");
entity.setCreateTime(new Date());
entity.setCreateUserId(1l);
entity.setCreateUserName("系统管理员");
this.save(entity);
}
}
@Override @Override
public boolean needRefresh() { public boolean needRefresh() {
......
package com.mortals.xhx.base.system.param.web; package com.mortals.xhx.base.system.param.web;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.RepeatSubmit;
import com.mortals.framework.common.code.PageDisplayType; import com.mortals.framework.common.code.PageDisplayType;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.util.FileUtil; import com.mortals.framework.util.FileUtil;
import org.springframework.beans.factory.annotation.Autowired; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.mortals.framework.web.BaseCRUDJsonMappingController;
import com.mortals.xhx.base.system.param.model.ParamEntity; import com.mortals.xhx.base.system.param.model.ParamEntity;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.DataSatusEnum; import com.mortals.xhx.common.code.DataSatusEnum;
import com.mortals.xhx.common.code.ModStatusEnum; import com.mortals.xhx.common.code.ModStatusEnum;
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.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
*
* 参数信息 * 参数信息
*
* @author: zxfei * @author: zxfei
* @date: 2021/11/30 10:04 * @date: 2022/5/7 15:38
*/ */
@RestController @RestController
@RequestMapping("param") @RequestMapping("param")
public class ParamController extends BaseCRUDJsonMappingController<ParamService, ParamForm, ParamEntity, Long> { public class ParamController extends BaseCRUDJsonBodyMappingController<ParamService, ParamEntity, Long> {
public ParamController() { public ParamController() {
super.setFormClass(ParamForm.class); super.setFormClass(ParamForm.class);
...@@ -39,21 +31,17 @@ public class ParamController extends BaseCRUDJsonMappingController<ParamService, ...@@ -39,21 +31,17 @@ public class ParamController extends BaseCRUDJsonMappingController<ParamService,
} }
@Override @Override
protected void init(HttpServletRequest request, HttpServletResponse response, ParamForm form, protected void init(Map<String, Object> model, Context context) {
Map<String, Object> model, Context context) {
Map<String, Object> status = new HashMap<String, Object>(); Map<String, Object> status = new HashMap<String, Object>();
status.put("validStatus", DataSatusEnum.getEnumMap(DataSatusEnum.CLOSE.getValue(), status.put("validStatus", DataSatusEnum.getEnumMap(DataSatusEnum.CLOSE.getValue(),
DataSatusEnum.DELETE.getValue(), DataSatusEnum.OVERDUE.getValue(), DataSatusEnum.USEOUT.getValue())); DataSatusEnum.DELETE.getValue(), DataSatusEnum.OVERDUE.getValue(), DataSatusEnum.USEOUT.getValue()));
status.put("modStatus", ModStatusEnum.getEnumMap()); status.put("modStatus", ModStatusEnum.getEnumMap());
status.put("displayType", getPageDisplayType()); status.put("displayType", getPageDisplayType());
model.put(KEY_RESULT_DICT, status); model.put(KEY_RESULT_DICT, status);
super.init(request, response, form, model, context);
} }
private Map<String, Object> getPageDisplayType() { private Map<String, Object> getPageDisplayType() {
PageDisplayType[] pageDisplayTypes = PageDisplayType.values(); PageDisplayType[] pageDisplayTypes = PageDisplayType.values();
Map<String, Object> result = new HashMap<>(pageDisplayTypes.length); Map<String, Object> result = new HashMap<>(pageDisplayTypes.length);
for (PageDisplayType pageDisplayType : pageDisplayTypes) { for (PageDisplayType pageDisplayType : pageDisplayTypes) {
...@@ -62,7 +50,6 @@ public class ParamController extends BaseCRUDJsonMappingController<ParamService, ...@@ -62,7 +50,6 @@ public class ParamController extends BaseCRUDJsonMappingController<ParamService,
return result; return result;
} }
public static void main(String[] args) { public static void main(String[] args) {
FileUtil.delete("E:\\pic\\1.png"); FileUtil.delete("E:\\pic\\1.png");
} }
......
package com.mortals.xhx.base.system.user.model; package com.mortals.xhx.base.system.user.model;
import com.mortals.framework.annotation.desensitization.MobileDesensitize; import com.fasterxml.jackson.annotation.JsonProperty;
import com.mortals.framework.ap.SysConstains; import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
import com.mortals.xhx.base.system.user.model.vo.UserVo; import com.mortals.xhx.base.system.user.model.vo.UserVo;
...@@ -23,6 +23,9 @@ public class UserEntity extends UserVo implements IUser { ...@@ -23,6 +23,9 @@ public class UserEntity extends UserVo implements IUser {
/** /**
* 登录密码,使用md5双次加密 * 登录密码,使用md5双次加密
*/ */
@JsonProperty(
access = JsonProperty.Access.WRITE_ONLY
)
private String loginPwd; private String loginPwd;
/** /**
* 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录 * 登录限制地址,多个IP地址用逗号分隔,可以使用IP段匹配,如:172.17.*非空:则只能该值内的IP可以登录
...@@ -35,7 +38,6 @@ public class UserEntity extends UserVo implements IUser { ...@@ -35,7 +38,6 @@ public class UserEntity extends UserVo implements IUser {
/** /**
* 用户手机号 * 用户手机号
*/ */
@MobileDesensitize
private String mobile; private String mobile;
/** /**
* 用户联系电话 * 用户联系电话
...@@ -49,20 +51,15 @@ public class UserEntity extends UserVo implements IUser { ...@@ -49,20 +51,15 @@ public class UserEntity extends UserVo implements IUser {
* QQ号码 * QQ号码
*/ */
private String qq; private String qq;
/**
* 用户类型(0.系统用户,1.普通用户,2.工作人员,3.巡查人员,4.窗口负责人)
*/
private Integer userType;
/** private Long customerId;
* 用户所属部门id
*/
private Long deptId; private Long deptId;
private String deptName;
/** /**
* 所属部门名称 * 用户类型(0.系统用户,1.普通用户,2.工作人员)
*/ */
private String deptName; private Integer userType;
/** /**
* 所属站点id,多个逗号分隔 * 所属站点id,多个逗号分隔
*/ */
...@@ -88,16 +85,23 @@ public class UserEntity extends UserVo implements IUser { ...@@ -88,16 +85,23 @@ public class UserEntity extends UserVo implements IUser {
*/ */
private String lastLoginAddress; private String lastLoginAddress;
/**
* 员工id
*/
private Long customerId;
/**
* 钉钉userId
*/
private String dingUserId; private String dingUserId;
public UserEntity(){}
public void setCustomerId(Long customerId) {
this.customerId = customerId;
}
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getDingUserId() { public String getDingUserId() {
return dingUserId; return dingUserId;
} }
...@@ -106,7 +110,6 @@ public class UserEntity extends UserVo implements IUser { ...@@ -106,7 +110,6 @@ public class UserEntity extends UserVo implements IUser {
this.dingUserId = dingUserId; this.dingUserId = dingUserId;
} }
public UserEntity(){}
/** /**
* 获取 登录名 * 获取 登录名
* @return String * @return String
...@@ -128,15 +131,6 @@ public class UserEntity extends UserVo implements IUser { ...@@ -128,15 +131,6 @@ public class UserEntity extends UserVo implements IUser {
public String getLoginPwd(){ public String getLoginPwd(){
return loginPwd; return loginPwd;
} }
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
/** /**
* 设置 登录密码,使用md5双次加密 * 设置 登录密码,使用md5双次加密
* @param loginPwd * @param loginPwd
...@@ -169,7 +163,6 @@ public class UserEntity extends UserVo implements IUser { ...@@ -169,7 +163,6 @@ public class UserEntity extends UserVo implements IUser {
@Override @Override
public boolean isAdmin() { public boolean isAdmin() {
return super.getId() == null ? false : super.getId().longValue() == SysConstains.ADMIN_ID; return super.getId() == null ? false : super.getId().longValue() == SysConstains.ADMIN_ID;
// return true;
} }
@Override @Override
...@@ -246,7 +239,7 @@ public class UserEntity extends UserVo implements IUser { ...@@ -246,7 +239,7 @@ public class UserEntity extends UserVo implements IUser {
this.qq = qq; this.qq = qq;
} }
/** /**
* 获取 用户类型(0.系统用户,1.普通用户,2.工作人员,3.普通员工) * 获取 用户类型(0.系统用户,1.普通用户,2.工作人员)
* @return Integer * @return Integer
*/ */
public Integer getUserType(){ public Integer getUserType(){
...@@ -262,17 +255,17 @@ public class UserEntity extends UserVo implements IUser { ...@@ -262,17 +255,17 @@ public class UserEntity extends UserVo implements IUser {
@Override @Override
public Long getDeptId() { public Long getDeptId() {
return this.deptId; return deptId;
} }
@Override @Override
public String getDeptName() { public String getDeptName() {
return this.deptName; return deptName;
} }
@Override @Override
public Long getCustomerId() { public Long getCustomerId() {
return this.customerId; return customerId;
} }
@Override @Override
...@@ -377,9 +370,7 @@ public class UserEntity extends UserVo implements IUser { ...@@ -377,9 +370,7 @@ public class UserEntity extends UserVo implements IUser {
} }
public void setCustomerId(Long customerId) {
this.customerId = customerId;
}
@Override @Override
public int hashCode() { public int hashCode() {
......
package com.mortals.xhx.base.system.user.model;
import com.mortals.framework.model.BaseEntityLong;
import lombok.Data;
/**
* Description:User
* date: 2021-9-26 16:11:48
*/
@Data
public class UserEntityExt extends BaseEntityLong {
/**
* 站点名称
*/
private String siteName;
private String roleIds;
/**
* 唯一标识
*/
private String token;
/**
* 菜单栏
*/
private String menuUrl;
/**
* 登录时间
*/
private Long loginTime;
/**
* 过期时间
*/
private Long expireTime;
private Long deptId;
private String deptName;
}
\ No newline at end of file
...@@ -4,8 +4,6 @@ package com.mortals.xhx.base.system.user.model.vo; ...@@ -4,8 +4,6 @@ package com.mortals.xhx.base.system.user.model.vo;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import lombok.Data; import lombok.Data;
import java.util.List;
/** /**
* 用户信息业务视图对象 * 用户信息业务视图对象
* *
...@@ -19,7 +17,7 @@ public class UserVo extends BaseEntityLong { ...@@ -19,7 +17,7 @@ public class UserVo extends BaseEntityLong {
*/ */
private String siteName; private String siteName;
private List<Long> roleIds; private String roleIds;
/** /**
* 唯一标识 * 唯一标识
*/ */
...@@ -38,6 +36,4 @@ public class UserVo extends BaseEntityLong { ...@@ -38,6 +36,4 @@ public class UserVo extends BaseEntityLong {
* 过期时间 * 过期时间
*/ */
private Long expireTime; private Long expireTime;
String roleIdStrs;
} }
\ No newline at end of file
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
package com.mortals.xhx.base.system.user.service; package com.mortals.xhx.base.system.user.service;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Result; import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICRUDCacheService; import com.mortals.framework.service.ICRUDCacheService;
...@@ -38,7 +39,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> { ...@@ -38,7 +39,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return * @return
* @throws AppException * @throws AppException
*/ */
public UserEntity doLogin(String loginName, String password, String loginIp) throws AppException; UserEntity doLogin(String loginName, String password, String loginIp) throws AppException;
/** /**
* 校验用户名与密码是否正确 * 校验用户名与密码是否正确
...@@ -48,7 +49,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> { ...@@ -48,7 +49,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return * @return
* @throws AppException * @throws AppException
*/ */
public UserEntity doCheckUser(String loginName, String password) throws AppException; UserEntity doCheckUser(String loginName, String password) throws AppException;
/** /**
* 检查用户是否存在 * 检查用户是否存在
...@@ -57,7 +58,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> { ...@@ -57,7 +58,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @param userId 密码 * @param userId 密码
* @return * @return
*/ */
public boolean existUser(String loginName, Long userId) throws AppException; boolean existUser(String loginName, Long userId) throws AppException;
/** /**
* 通过登录用户获取菜单功能权限 * 通过登录用户获取菜单功能权限
...@@ -65,7 +66,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> { ...@@ -65,7 +66,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @param user * @param user
* @return * @return
*/ */
public List<MenuEntity> findOutlookBarList(IUser user); List<MenuEntity> findOutlookBarList(IUser user);
/** /**
* 查询用户所有有权限的菜单ID * 查询用户所有有权限的菜单ID
...@@ -73,7 +74,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> { ...@@ -73,7 +74,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @param userEntity * @param userEntity
* @return * @return
*/ */
public Set<Long> findAllAuthIds(UserEntity userEntity) throws AppException; Set<Long> findAllAuthIds(UserEntity userEntity) throws AppException;
/** /**
* 查询用户记录 * 查询用户记录
...@@ -85,7 +86,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> { ...@@ -85,7 +86,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return * @return
* @throws AppException * @throws AppException
*/ */
public Result<UserEntity> find(Long platformId, UserEntity params, int currPage, int prePageResult) throws AppException; Result<UserEntity> find(Long platformId, UserEntity params, int currPage, int prePageResult) throws AppException;
/** /**
* 为客户创建用户 * 为客户创建用户
...@@ -100,7 +101,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> { ...@@ -100,7 +101,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return * @return
* @throws AppException * @throws AppException
*/ */
public UserEntity createUser(IUser currUser, Long customerId, String customerName, String loginName, String password, UserEntity createUser(IUser currUser, Long customerId, String customerName, String loginName, String password,
String userName, String mobile) throws AppException; String userName, String mobile) throws AppException;
/** /**
...@@ -112,32 +113,11 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> { ...@@ -112,32 +113,11 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return * @return
* @throws AppException * @throws AppException
*/ */
public boolean updateUserPwd(String loginName, String oldPwd, String newPwd) throws AppException; boolean updateUserPwd(String loginName, String oldPwd, String newPwd) throws AppException;
/**
*
* @param entity
*/
void doHandlerUser(UserEntity entity);
Rest<Void> refreshUser();
UserDao getUserDao(); UserDao getUserDao();
/**
* 发送手机验证码
* @param mobileNumber
* @throws AppException
*/
void sendSmsVerifyCode(String mobileNumber) throws AppException;
/**
* 手机验证码登录
* @param mobileNumber
* @param verifyCode
* @param loginIp
* @return
* @throws AppException
*/
UserEntity doSmsLogin(String mobileNumber, String verifyCode, String loginIp) throws AppException;
} }
\ No newline at end of file
...@@ -2,12 +2,13 @@ package com.mortals.xhx.base.system.user.web; ...@@ -2,12 +2,13 @@ package com.mortals.xhx.base.system.user.web;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.IBaseEnum; import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.common.Rest;
import com.mortals.framework.common.code.UserType; import com.mortals.framework.common.code.UserType;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.framework.web.BaseCRUDJsonMappingController;
import com.mortals.xhx.base.framework.annotation.Operlog; import com.mortals.xhx.base.framework.annotation.Operlog;
import com.mortals.xhx.base.system.role.model.RoleQuery; import com.mortals.xhx.base.system.role.model.RoleQuery;
import com.mortals.xhx.base.system.role.model.RoleUserEntity; import com.mortals.xhx.base.system.role.model.RoleUserEntity;
...@@ -17,20 +18,13 @@ import com.mortals.xhx.base.system.role.service.RoleUserService; ...@@ -17,20 +18,13 @@ import com.mortals.xhx.base.system.role.service.RoleUserService;
import com.mortals.xhx.base.system.user.model.UserEntity; import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.service.UserService; import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.code.UserStatus; import com.mortals.xhx.common.code.UserStatus;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService;
import io.jsonwebtoken.Claims; import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts; import io.jsonwebtoken.Jwts;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Base64; import java.util.Base64;
import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -48,9 +42,6 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic ...@@ -48,9 +42,6 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
private RoleService roleService; private RoleService roleService;
@Autowired @Autowired
private RoleUserService roleUserService; private RoleUserService roleUserService;
@Autowired
private DeptService deptService;
public UserController() { public UserController() {
super.setModuleDesc("用户信息"); super.setModuleDesc("用户信息");
...@@ -58,9 +49,9 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic ...@@ -58,9 +49,9 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
@Override @Override
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "userType", IBaseEnum.getEnumMap(UserType.class));
this.addDict(model, "status", UserStatus.getEnumMap()); this.addDict(model, "status", UserStatus.getEnumMap());
this.addDict(model, "roleIds", roleService.find(new RoleQuery()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getName()))); this.addDict(model, "roleIds", roleService.find(new RoleQuery()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getName())));
this.addDict(model, "deptId", deptService.find(new DeptQuery()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getDeptName(), (o, n) -> n)));
} }
...@@ -79,20 +70,26 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic ...@@ -79,20 +70,26 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
protected int editAfter(Long id, Map<String, Object> model, UserEntity entity, Context context) throws AppException { protected int editAfter(Long id, Map<String, Object> model, UserEntity entity, Context context) throws AppException {
RoleUserQuery roleUserQuery = new RoleUserQuery(); RoleUserQuery roleUserQuery = new RoleUserQuery();
roleUserQuery.setUserId(entity.getId()); roleUserQuery.setUserId(entity.getId());
List<Long> roleIds = roleUserService.find(roleUserQuery).stream().map(RoleUserEntity::getRoleId).collect(Collectors.toList()); String roleIds = roleUserService.find(roleUserQuery).stream().map(RoleUserEntity::getRoleId).map(String::valueOf).collect(Collectors.joining(","));
entity.setRoleIds(roleIds); entity.setRoleIds(roleIds);
return super.editAfter(id, model, entity, context); return super.editAfter(id, model, entity, context);
} }
@Override @Override
protected int saveAfter(UserEntity entity, Map<String, Object> model, Context context) throws AppException { protected int saveAfter(UserEntity entity, Map<String, Object> model, Context context) throws AppException {
if (entity.getId() == getCurUser().getId()) {
// TODO: 2022/8/15 更新redis session信息
//saveCurrUserForSession(request, response, userService.get(form.getEntity().getId(), false));
}
return super.saveAfter(entity, model, context); return super.saveAfter(entity, model, context);
} }
// @Override
// protected void saveBefore(UserEntity entity, Map<String, Object> model, Context context) throws AppException {
// if (!ObjectUtils.isEmpty(entity.getLoginName()) && service.existUser(entity.getLoginName(), entity.getId())) {
// throw new AppException("登录名已存在!");
// }
// super.saveBefore(entity, model, context);
// }
@RequestMapping(value = "change/password", method = RequestMethod.POST) @RequestMapping(value = "change/password", method = RequestMethod.POST)
@Operlog(msg = "密码修改成功!") @Operlog(msg = "密码修改成功!")
public String changePassword(@RequestParam String oldPwd, @RequestParam String newPwd) { public String changePassword(@RequestParam String oldPwd, @RequestParam String newPwd) {
...@@ -109,28 +106,12 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic ...@@ -109,28 +106,12 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
} }
@RequestMapping(value = "repassword", method = RequestMethod.POST) @PostMapping({"refreshUser"})
public String rePassword(@RequestBody UserEntity userEntity) { @UnAuth
JSONObject ret = new JSONObject(); public Rest<Object> refreshUser() {
try { log.info("刷新用户");
//查询用户是否存在 this.service.refreshUser();
boolean existUser = service.existUser(userEntity.getLoginName(), userEntity.getId()); return Rest.ok("用户同步刷新操作成功");
if(!existUser) throw new AppException("用户不存在!");
//修改密码
//service.doHandlerUser(userEntity);
service.update(userEntity,getContext());
//更新密码
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "密码修改成功!");
} catch (Exception e) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, super.convertException(e));
}
return ret.toJSONString();
} }
......
{
"local": {
"baseUrl": "http://127.0.0.1:17500/attendance"
},
"test": {
"baseUrl": "http://192.168.0.250:11011/onecert"
},
"test-remote": {
"baseUrl": "http://8.136.255.30:11011/onecert"
},
"yibin": {
"baseUrl": "http://112.19.80.237:11039/attendance",
"baseLogin": "http://192.168.0.98:11078/base"
},
"pengxi": {
"baseUrl": "http://118.122.189.109:11039/attendance",
"baseLogin": "http://192.168.0.98:11078/base"
},
"portal": {
"baseUrl": "http://192.168.0.98:11072/zwfw",
"baseLogin": "http://192.168.0.98:11078/base"
},
"portal-yibin": {
"baseUrl": "http://112.19.80.237:11078/zwfw"
}
}
\ No newline at end of file
###登录
POST {{baseUrl}}/login/login
Content-Type: application/json
{
"loginName": "admin",
"password": "admin",
"securityCode": "admin"
}
> {%
client.global.set("SmsSet_id", JSON.parse(response.body).data.id);
client.global.set("authToken", JSON.parse(response.body).data.token);
%}
###修改用户密码
POST {{baseUrl}}/user/change/password
Authorization: {{authToken}}
Content-Type: application/x-www-form-urlencoded
oldPwd=aA123!@#&newPwd=aA123!@#.
###首页
POST {{baseUrl}}/login/index
Authorization: {{authToken}}
Content-Type: application/json
{}
###获取用户信息
POST {{baseUrl}}/user/interlist
Content-Type: application/json
{}
\ No newline at end of file
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