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

Merge remote-tracking branch 'origin/master'

parents 1c44890c 0c48ef28
......@@ -8,7 +8,6 @@
package com.mortals.xhx.base.system.user.service;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICRUDCacheService;
......@@ -39,7 +38,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return
* @throws AppException
*/
UserEntity doLogin(String loginName, String password, String loginIp) throws AppException;
public UserEntity doLogin(String loginName, String password, String loginIp) throws AppException;
/**
* 校验用户名与密码是否正确
......@@ -49,7 +48,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return
* @throws AppException
*/
UserEntity doCheckUser(String loginName, String password) throws AppException;
public UserEntity doCheckUser(String loginName, String password) throws AppException;
/**
* 检查用户是否存在
......@@ -58,7 +57,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @param userId 密码
* @return
*/
boolean existUser(String loginName, Long userId) throws AppException;
public boolean existUser(String loginName, Long userId) throws AppException;
/**
* 通过登录用户获取菜单功能权限
......@@ -66,7 +65,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @param user
* @return
*/
List<MenuEntity> findOutlookBarList(IUser user);
public List<MenuEntity> findOutlookBarList(IUser user);
/**
* 查询用户所有有权限的菜单ID
......@@ -74,7 +73,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @param userEntity
* @return
*/
Set<Long> findAllAuthIds(UserEntity userEntity) throws AppException;
public Set<Long> findAllAuthIds(UserEntity userEntity) throws AppException;
/**
* 查询用户记录
......@@ -86,7 +85,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return
* @throws AppException
*/
Result<UserEntity> find(Long platformId, UserEntity params, int currPage, int prePageResult) throws AppException;
public Result<UserEntity> find(Long platformId, UserEntity params, int currPage, int prePageResult) throws AppException;
/**
* 为客户创建用户
......@@ -101,7 +100,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return
* @throws AppException
*/
UserEntity createUser(IUser currUser, Long customerId, String customerName, String loginName, String password,
public UserEntity createUser(IUser currUser, Long customerId, String customerName, String loginName, String password,
String userName, String mobile) throws AppException;
/**
......@@ -113,11 +112,32 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return
* @throws AppException
*/
boolean updateUserPwd(String loginName, String oldPwd, String newPwd) throws AppException;
public boolean updateUserPwd(String loginName, String oldPwd, String newPwd) throws AppException;
/**
*
* @param entity
*/
void doHandlerUser(UserEntity entity);
Rest<Void> refreshUser();
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
......@@ -8,8 +8,10 @@
package com.mortals.xhx.base.system.user.service.impl;
import cn.hutool.core.util.PhoneUtil;
import cn.hutool.core.util.RandomUtil;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.common.Rest;
import com.mortals.framework.common.code.UserType;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
......@@ -17,32 +19,26 @@ import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.IUser;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.framework.util.HttpUtil;
import com.mortals.framework.util.SecurityUtil;
import com.mortals.framework.util.StringUtils;
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.model.ResourceEntity;
import com.mortals.xhx.base.system.resource.service.ResourceService;
import com.mortals.xhx.base.system.role.dao.RoleUserDao;
import com.mortals.xhx.base.system.role.model.RoleUserEntity;
import com.mortals.xhx.base.system.role.model.RoleUserQuery;
import com.mortals.xhx.base.system.role.service.RoleUserService;
import com.mortals.xhx.base.system.user.dao.UserDao;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.user.UserPdu;
import com.mortals.xhx.feign.user.IUserFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* <p>Title: 用户信息</p>
......@@ -54,7 +50,6 @@ import java.util.stream.Collectors;
* @version 1.0.0
*/
@Service("userService")
@Slf4j
public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserEntity, Long> implements UserService {
......@@ -63,18 +58,27 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
@Autowired
private ResourceService resourceService;
@Autowired
private RoleUserService roleUserService;
private RoleUserDao roleUserDao;
@Lazy
@Autowired
private IUserFeign userFeign;
@Value("${sms.smsSendUrl:http://sms.wx3.com.cn/api/index/index}")
private String smsApiUrl;
@Value("${sms.apiId:ADsUXLrS81vZDU95}")
private String appid;
/**
* 短信模板ID
**/
private static String SMS_TPYE = "30";
private static String SMS_VERIFY_CODE_KEY = "login:sms:verify:";
@Override
protected String getExtKey(UserEntity data) {
return data.getLoginName();
}
private void doHandlerUser(UserEntity entity) throws AppException {
public void doHandlerUser(UserEntity entity) throws AppException {
if (StringUtils.isNotEmpty(entity.getLoginPwd())) {
try {
entity.setLoginPwd(SecurityUtil.md5DoubleEncoding(entity.getLoginPwd()));
......@@ -84,63 +88,98 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
} else {
entity.setLoginPwd(null);
}
// if (entity.isSystemUser()) {
// entity.setUserType(UserType.SYSTEM.getValue());
// } else {
// entity.setUserType(UserType.CUSTOMER.getValue());
// }
}
@Override
protected void saveBefore(UserEntity entity, Context context) throws AppException {
if (!ObjectUtils.isEmpty(entity.getLoginName()) && existUser(entity.getLoginName(), entity.getId())) {
throw new AppException("登录名已存在!");
}
this.doHandlerUser(entity);
}
@Override
protected void saveAfter(UserEntity entity, Context context) throws AppException {
if (CollectionUtils.isNotEmpty(entity.getRoleIds())) {
List<RoleUserEntity> roleUserEntityList = new ArrayList<>();
entity.getRoleIds().stream().forEach(item -> {
RoleUserEntity roleUserEntity = new RoleUserEntity();
roleUserEntity.setUserId(entity.getId());
roleUserEntity.setRoleId(item);
roleUserEntityList.add(roleUserEntity);
});
roleUserDao.insertBatch(roleUserEntityList);
}
}
@Override
protected void updateBefore(UserEntity entity, Context context) throws AppException {
// if (entity.getId().longValue() == SysConstains.ADMIN_ID && !context.getUser().isAdmin()) {
// throw new AppException("你没有权限执行该操作");
// }
//更新不更新密码字段
entity.setLoginPwd(null);
/* if (entity.getId().longValue() == SysConstains.ADMIN_ID && !context.getUser().isAdmin()) {
throw new AppException("你没有权限执行该操作");
}*/
if (entity.getId().longValue() == SysConstains.ADMIN_ID) {
throw new AppException("你没有权限执行该操作");
}
this.doHandlerUser(entity);
}
@Override
protected void saveAfter(UserEntity entity, Context context) throws AppException {
//新增角色
updateUserRole(entity);
super.saveAfter(entity, context);
protected void updateAfter(UserEntity entity, Context context) throws AppException {
if (CollectionUtils.isNotEmpty(entity.getRoleIds())) {
List<RoleUserEntity> roleUserEntityList = new ArrayList<>();
entity.getRoleIds().stream().forEach(item -> {
RoleUserEntity roleUserEntity = new RoleUserEntity();
roleUserEntity.setUserId(entity.getId());
roleUserEntity.setRoleId(item);
roleUserEntityList.add(roleUserEntity);
});
RoleUserEntity condition = new RoleUserEntity();
condition.setUserId(entity.getId());
roleUserDao.delete(condition);
roleUserDao.insertBatch(roleUserEntityList);
}
}
@Override
protected void updateAfter(UserEntity entity, Context context) throws AppException {
updateUserRole(entity);
super.updateAfter(entity, context);
protected UserEntity findBefore(UserEntity params, Context context) throws AppException {
// if (StringUtils.isNotEmpty(params.getDeptIds())) {
// params.setDeptIds(StringUtils.fillWithMark(params.getDeptIds(), ","));
// }
return super.findBefore(params, context);
}
private void updateUserRole(UserEntity entity) {
if (!ObjectUtils.isEmpty(entity.getId()) && entity.getId().longValue() != SysConstains.ADMIN_ID && !ObjectUtils.isEmpty(entity.getRoleIds())) {
RoleUserQuery roleUserQuery = new RoleUserQuery();
roleUserQuery.setUserId(entity.getId());
List<Long> idList = Arrays.asList(entity.getRoleIds().split(",")).stream().map(Long::parseLong).collect(Collectors.toList());
roleUserQuery.setRoleIdList(idList);
roleUserService.doDistributionRole(roleUserQuery);
}
@Override
protected UserEntity findBefore(UserEntity params, PageInfo pageInfo, Context context) throws AppException {
// if (StringUtils.isNotEmpty(params.getDeptIds())) {
// params.setDeptIds(StringUtils.fillWithMark(params.getDeptIds(), ","));
// }
return super.findBefore(params, pageInfo, context);
}
@Override
protected void findAfter(UserEntity params, PageInfo pageInfo, Context context, List<UserEntity> list) throws AppException {
list.stream().peek(item -> {
if (CollectionUtils.isNotEmpty(list)) {
list.stream().forEach(item -> {
RoleUserEntity query = new RoleUserEntity();
query.setUserId(item.getId());
List<RoleUserEntity> roleUserEntityList = roleUserDao.getList(query);
List<Long> roleIds = new ArrayList<>();
roleUserEntityList.stream().forEach(role -> {
roleIds.add(role.getRoleId());
});
item.setRoleIds(roleIds);
String roleIdStrs = StringUtils.join(roleIds, ",");
item.setRoleIdStrs(roleIdStrs);
RoleUserQuery roleUserQuery = new RoleUserQuery();
roleUserQuery.setUserId(item.getId());
String roleIds = roleUserService.find(roleUserQuery).stream().map(RoleUserEntity::getRoleId).map(String::valueOf).collect(Collectors.joining(","));
item.setRoleIds(roleIds);
}).count();
super.findAfter(params, pageInfo, context, list);
}
});
}
}
public UserEntity findByLoginName(String loginName) {
UserQuery params = new UserQuery();
params.setLoginName(loginName);
......@@ -164,6 +203,11 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
} catch (Exception e) {
throw new AppException("密码验认出错!", e);
}
UserEntity update = new UserEntity();
update.setId(sysUser.getId());
update.setLastLoginAddress(loginIp);
update.setLastLoginTime(new Date());
this.dao.update(update);
return sysUser;
}
......@@ -207,7 +251,7 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
urls.addAll(StringUtils.converStr2Set(url));
}
}
Set<Long> authIds = new HashSet<>();
Set<Long> authIds = new HashSet<Long>();
Map<Long, MenuEntity> menuMap = new HashMap<Long, MenuEntity>();
List<MenuEntity> userModuleList = this.menuService.findAllEnable();
for (MenuEntity sysModule : userModuleList) {
......@@ -215,7 +259,6 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
continue;
}
menuMap.put(sysModule.getId(), sysModule);
if (!user.isAdmin() && urls.contains(StringUtils.trim(sysModule.getUrl()))) {
authIds.add(sysModule.getId());
}
......@@ -264,6 +307,7 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
entity.initAttrValue();
entity.setLoginName(loginName);
entity.setRealName(userName);
entity.setCustomerId(customerId);
entity.setLoginPwd(password);
entity.setMobile(mobile);
entity.setUserType(UserType.CUSTOMER.getValue());
......@@ -309,6 +353,7 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
}
try {
sysUser.setLoginPwd(SecurityUtil.md5DoubleEncoding(newPwd));
} catch (Exception e) {
throw new AppException("密码转换异常!", e);
}
......@@ -317,78 +362,78 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
}
@Override
public Rest<Void> refreshUser() {
UserPdu userPdu = new UserPdu();
userPdu.setPage(1);
userPdu.setSize(-1);
Rest<RespData<List<UserPdu>>> resp = userFeign.list(userPdu);
if (resp.getCode() == YesNoEnum.YES.getValue()) {
List<UserPdu> userPduList = resp.getData().getData();
log.info("用户总数量:{}", userPduList.size());
if (!ObjectUtils.isEmpty(userPduList)) {
List<UserEntity> newUserList = userPduList.stream().map(newUser -> {
UserEntity userEntity = new UserEntity();
userEntity.initAttrValue();
BeanUtils.copyProperties(newUser, userEntity, new String[]{"id", "lastLoginTime", "lastLoginAddress"});
return userEntity;
}).collect(Collectors.toList());
List<UserEntity> saveUpdateUserList = newUserList.parallelStream().map(item -> {
UserEntity extCache = this.getExtCache(item.getLoginName());
if (ObjectUtils.isEmpty(extCache)) {
item.setCreateUserId(1L);
item.setCreateUserName("系统管理员");
item.setCreateTime(new Date());
return item;
} else {
//更新用户列表
item.setId(extCache.getId());
item.setUpdateUserId(1L);
item.setUpdateUserName("系统管理员");
item.setUpdateTime(new Date());
return item;
}
}).collect(Collectors.toList());
Map<Boolean, List<UserEntity>> saveUpdateCollect = saveUpdateUserList.stream().collect(Collectors.partitioningBy(x -> x.getId() == null));
if (!ObjectUtils.isEmpty(saveUpdateCollect.get(true))) {
//需要新增的用户
log.info("需要新增用户数量:{}", saveUpdateCollect.get(true).size());
saveUpdateCollect.get(true).stream().forEach(item -> {
this.getUserDao().insert(item);
this.putCache(item.getId() == null ? "" : item.getId().toString(), item);
//更新默认用户角色
RoleUserQuery roleUserQuery = new RoleUserQuery();
roleUserQuery.setUserId(item.getId());
roleUserQuery.setRoleIdList(Arrays.asList(1L));
roleUserService.doDistributionRole(roleUserQuery);
});
public UserDao getUserDao() {
return this.getDao();
}
if (!ObjectUtils.isEmpty(saveUpdateCollect.get(false))) {
//需要新增的用户
log.info("需要更新用户数量:{}", saveUpdateCollect.get(false).size());
saveUpdateCollect.get(false).stream().forEach(item -> {
this.getUserDao().update(item);
this.putCache(item.getId() == null ? "" : item.getId().toString(), item);
});
@Override
public void sendSmsVerifyCode(String mobileNumber) throws AppException {
if (StringUtils.isEmpty(mobileNumber)) {
throw new AppException("手机号不能为空");
}
if (!PhoneUtil.isPhone(mobileNumber)) {
throw new AppException("手机号码格式不正确");
}
//查找新增 与更新
UserEntity user = this.selectOne(new UserQuery().mobile(mobileNumber));
if (user == null) {
throw new AppException("手机号码:" + mobileNumber + "没有注册用户");
}
return Rest.ok();
String verifyCode = cacheService.get(SMS_VERIFY_CODE_KEY + mobileNumber);
if (StringUtils.isNotEmpty(verifyCode)) {
throw new AppException("当前手机号码已发送验证码,请稍后重试");
}
try {
Map<String, String> params = new HashMap<>();
params.put("appid", appid);
params.put("phone", mobileNumber);
params.put("type", SMS_TPYE);
String[] json = new String[2];
String vCode = RandomUtil.randomNumbers(6);
json[0] = vCode;
json[1] = "1";
params.put("json", JSONObject.toJSON(json).toString());
String resp = HttpUtil.doPost(smsApiUrl, params);
JSONObject respJson = JSONObject.parseObject(resp);
if (respJson.getIntValue("code") == 0) {
throw new AppException("短信发送失败:" + respJson.getString("message"));
}
//有效期60秒
cacheService.setnx(SMS_VERIFY_CODE_KEY + mobileNumber, vCode, 60);
} catch (Exception e) {
log.error("短信发送异常", e);
throw new AppException("短信发送异常");
}
@Override
public UserDao getUserDao() {
return getDao();
}
@Override
protected void removeAfter(Long[] ids, Context context, int result) throws AppException {
super.removeAfter(ids, context, result);
RoleUserQuery roleUserQuery = new RoleUserQuery();
roleUserQuery.setUserIdList(Arrays.asList(ids));
Long[] userIds = roleUserService.find(roleUserQuery).stream().map(RoleUserEntity::getId).toArray(Long[]::new);
roleUserService.remove(userIds, context);
public UserEntity doSmsLogin(String mobileNumber, String verifyCode, String loginIp) throws AppException {
if (StringUtils.isEmpty(mobileNumber)) {
throw new AppException("手机号不能为空");
}
if (StringUtils.isEmpty(verifyCode)) {
throw new AppException("验证码不能为空");
}
if (!PhoneUtil.isPhone(mobileNumber)) {
throw new AppException("手机号码格式不正确");
}
UserEntity customer = this.selectOne(new UserQuery().mobile(mobileNumber));
if (customer == null) {
throw new AppException("手机号码:" + mobileNumber + "没有注册用户");
}
String vCode = cacheService.get(SMS_VERIFY_CODE_KEY + mobileNumber);
if (StringUtils.isEmpty(vCode)) {
throw new AppException("验证码已失效");
}
if (!verifyCode.equals(vCode)) {
throw new AppException("验证码不正确");
}
UserEntity update = new UserEntity();
update.setId(customer.getId());
update.setLastLoginAddress(loginIp);
update.setLastLoginTime(new Date());
this.update(update);
return customer;
}
}
\ No newline at end of file
......@@ -2,13 +2,12 @@ package com.mortals.xhx.base.system.user.web;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.common.Rest;
import com.mortals.framework.common.code.UserType;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
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.system.role.model.RoleQuery;
import com.mortals.xhx.base.system.role.model.RoleUserEntity;
......@@ -18,13 +17,20 @@ 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.service.UserService;
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.Jwts;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Base64;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -42,6 +48,9 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
private RoleService roleService;
@Autowired
private RoleUserService roleUserService;
@Autowired
private DeptService deptService;
public UserController() {
super.setModuleDesc("用户信息");
......@@ -49,9 +58,9 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
@Override
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, "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)));
}
......@@ -70,26 +79,20 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
protected int editAfter(Long id, Map<String, Object> model, UserEntity entity, Context context) throws AppException {
RoleUserQuery roleUserQuery = new RoleUserQuery();
roleUserQuery.setUserId(entity.getId());
String roleIds = roleUserService.find(roleUserQuery).stream().map(RoleUserEntity::getRoleId).map(String::valueOf).collect(Collectors.joining(","));
List<Long> roleIds = roleUserService.find(roleUserQuery).stream().map(RoleUserEntity::getRoleId).collect(Collectors.toList());
entity.setRoleIds(roleIds);
return super.editAfter(id, model, entity, context);
}
@Override
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);
}
// @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)
@Operlog(msg = "密码修改成功!")
public String changePassword(@RequestParam String oldPwd, @RequestParam String newPwd) {
......@@ -106,12 +109,28 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
}
@PostMapping({"refreshUser"})
@UnAuth
public Rest<Object> refreshUser() {
log.info("刷新用户");
this.service.refreshUser();
return Rest.ok("用户同步刷新操作成功");
@RequestMapping(value = "repassword", method = RequestMethod.POST)
public String rePassword(@RequestBody UserEntity userEntity) {
JSONObject ret = new JSONObject();
try {
//查询用户是否存在
boolean existUser = service.existUser(userEntity.getLoginName(), userEntity.getId());
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();
}
......
......@@ -6,6 +6,9 @@ import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.HolderType;
import com.mortals.xhx.common.code.StatusEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.certificate.model.CertificateDocumentQuery;
import com.mortals.xhx.module.certificate.service.CertificateDocumentService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -39,7 +42,7 @@ import static com.mortals.framework.ap.SysConstains.*;
public class CertificateCatalogController extends BaseCRUDJsonBodyMappingController<CertificateCatalogService,CertificateCatalogEntity,Long> {
@Autowired
private ParamService paramService;
private CertificateDocumentService certificateDocumentService;
public CertificateCatalogController(){
super.setModuleDesc( "证照目录");
......@@ -50,6 +53,10 @@ public class CertificateCatalogController extends BaseCRUDJsonBodyMappingControl
this.addDict(model,"status", IBaseEnum.getEnumMap(StatusEnum.class));
this.addDict(model,"holderType", IBaseEnum.getEnumMap(HolderType.class));
this.addDict(model,"inspect", IBaseEnum.getEnumMap(YesNoEnum.class));
this.addDict(model,"documentId", certificateDocumentService.find(new CertificateDocumentQuery())
.stream().collect(Collectors.toMap(x->x.getId(),y->y.getDocumentName(),(o,n)->n)));
super.init(model, context);
}
......
package com.mortals.xhx.module.child.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.child.model.ChildLicenseDatasetEntity;
import java.util.ArrayList;
import java.util.List;
import com.mortals.xhx.module.child.model.ChildLicenseDatasetQuery;
import lombok.Data;
import com.mortals.framework.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
/**
* 行业许可子证数据集视图对象
*
* @author zxfei
* @date 2024-07-27
*/
@Data
public class ChildLicenseDatasetVo extends BaseEntityLong {
/**
* 字段编码
*/
private String fieldCode;
/**
* 字段名称
*/
private String fieldName;
/**
* 字段值
*/
private String fieldValue;
private Long appId;
private List<Long> idList;
private List<String> fieldNameList;
private List<String> fieldValueList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<ChildLicenseDatasetQuery> orConditionList;
/** AND条件集合,列表项之间是AND,项内容之间是OR,如:(list[0].1 or list[0].2) and (list[1].3 or list[1].4) */
private List<ChildLicenseDatasetQuery> andConditionList;
}
\ No newline at end of file
package com.mortals.xhx.module.child.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.child.model.ChildLicenseInfoFieldEntity;
import java.util.ArrayList;
import java.util.List;
import com.mortals.xhx.module.child.model.ChildLicenseInfoFieldQuery;
import lombok.Data;
import com.mortals.framework.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
/**
* 行业许可子证信息字段视图对象
*
* @author zxfei
* @date 2024-07-27
*/
@Data
public class ChildLicenseInfoFieldVo extends BaseEntityLong {
/** 序号,主键,自增长列表 */
private List <Long> idList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<ChildLicenseInfoFieldQuery> orConditionList;
/** AND条件集合,列表项之间是AND,项内容之间是OR,如:(list[0].1 or list[0].2) and (list[1].3 or list[1].4) */
private List<ChildLicenseInfoFieldQuery> andConditionList;
}
\ No newline at end of file
package com.mortals.xhx.module.child.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.child.model.ChildLicenseTempleteFieldEntity;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import com.mortals.framework.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
/**
* 行业许可子证模板信息字段视图对象
*
* @author zxfei
* @date 2024-07-27
*/
@Data
public class ChildLicenseTempleteFieldVo extends BaseEntityLong {
/** 序号,主键,自增长列表 */
private List <Long> idList;
}
\ No newline at end of file
package com.mortals.xhx.module.child.web;
import com.mortals.framework.common.Rest;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.annotation.DataPermission;
import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.child.model.ChildLicenseEntity;
import com.mortals.xhx.module.child.service.ChildLicenseService;
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.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.*;
import com.mortals.xhx.common.code.*;
/**
*
* 行业许可子证
*
* @author zxfei
* @date 2024-07-28
*/
* 行业许可子证
*
* @author zxfei
* @date 2024-07-28
*/
@RestController
@RequestMapping("child/license")
public class ChildLicenseController extends BaseCRUDJsonBodyMappingController<ChildLicenseService,ChildLicenseEntity,Long> {
public class ChildLicenseController extends BaseCRUDJsonBodyMappingController<ChildLicenseService, ChildLicenseEntity, Long> {
@Autowired
private ParamService paramService;
public ChildLicenseController(){
super.setModuleDesc( "行业许可子证");
public ChildLicenseController() {
super.setModuleDesc("行业许可子证");
}
@Override
......@@ -48,5 +59,9 @@ public class ChildLicenseController extends BaseCRUDJsonBodyMappingController<Ch
super.init(model, context);
}
@Override
@DataPermission
public Rest<Object> list(@RequestBody ChildLicenseEntity query) {
return super.list(query);
}
}
\ 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