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

Merge remote-tracking branch 'origin/master'

parents 1c44890c 0c48ef28
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
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;
...@@ -39,7 +38,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> { ...@@ -39,7 +38,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return * @return
* @throws AppException * @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> { ...@@ -49,7 +48,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return * @return
* @throws AppException * @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> { ...@@ -58,7 +57,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @param userId 密码 * @param userId 密码
* @return * @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> { ...@@ -66,7 +65,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @param user * @param user
* @return * @return
*/ */
List<MenuEntity> findOutlookBarList(IUser user); public List<MenuEntity> findOutlookBarList(IUser user);
/** /**
* 查询用户所有有权限的菜单ID * 查询用户所有有权限的菜单ID
...@@ -74,7 +73,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> { ...@@ -74,7 +73,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @param userEntity * @param userEntity
* @return * @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> { ...@@ -86,7 +85,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return * @return
* @throws AppException * @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> { ...@@ -101,7 +100,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return * @return
* @throws AppException * @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; String userName, String mobile) throws AppException;
/** /**
...@@ -113,11 +112,32 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> { ...@@ -113,11 +112,32 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return * @return
* @throws AppException * @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(); 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,13 +2,12 @@ package com.mortals.xhx.base.system.user.web; ...@@ -2,13 +2,12 @@ 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;
...@@ -18,13 +17,20 @@ import com.mortals.xhx.base.system.role.service.RoleUserService; ...@@ -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.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;
...@@ -42,6 +48,9 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic ...@@ -42,6 +48,9 @@ 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("用户信息");
...@@ -49,9 +58,9 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic ...@@ -49,9 +58,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)));
} }
...@@ -70,26 +79,20 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic ...@@ -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 { 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());
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); 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) {
...@@ -106,12 +109,28 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic ...@@ -106,12 +109,28 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
} }
@PostMapping({"refreshUser"}) @RequestMapping(value = "repassword", method = RequestMethod.POST)
@UnAuth public String rePassword(@RequestBody UserEntity userEntity) {
public Rest<Object> refreshUser() { JSONObject ret = new JSONObject();
log.info("刷新用户"); try {
this.service.refreshUser(); //查询用户是否存在
return Rest.ok("用户同步刷新操作成功"); 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; ...@@ -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.HolderType;
import com.mortals.xhx.common.code.StatusEnum; import com.mortals.xhx.common.code.StatusEnum;
import com.mortals.xhx.common.code.YesNoEnum; 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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -39,7 +42,7 @@ import static com.mortals.framework.ap.SysConstains.*; ...@@ -39,7 +42,7 @@ import static com.mortals.framework.ap.SysConstains.*;
public class CertificateCatalogController extends BaseCRUDJsonBodyMappingController<CertificateCatalogService,CertificateCatalogEntity,Long> { public class CertificateCatalogController extends BaseCRUDJsonBodyMappingController<CertificateCatalogService,CertificateCatalogEntity,Long> {
@Autowired @Autowired
private ParamService paramService; private CertificateDocumentService certificateDocumentService;
public CertificateCatalogController(){ public CertificateCatalogController(){
super.setModuleDesc( "证照目录"); super.setModuleDesc( "证照目录");
...@@ -50,6 +53,10 @@ public class CertificateCatalogController extends BaseCRUDJsonBodyMappingControl ...@@ -50,6 +53,10 @@ public class CertificateCatalogController extends BaseCRUDJsonBodyMappingControl
this.addDict(model,"status", IBaseEnum.getEnumMap(StatusEnum.class)); this.addDict(model,"status", IBaseEnum.getEnumMap(StatusEnum.class));
this.addDict(model,"holderType", IBaseEnum.getEnumMap(HolderType.class)); this.addDict(model,"holderType", IBaseEnum.getEnumMap(HolderType.class));
this.addDict(model,"inspect", IBaseEnum.getEnumMap(YesNoEnum.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); 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; package com.mortals.xhx.module.child.web;
import com.mortals.framework.common.Rest;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.annotation.DataPermission;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.child.model.ChildLicenseEntity; import com.mortals.xhx.module.child.model.ChildLicenseEntity;
import com.mortals.xhx.module.child.service.ChildLicenseService; import com.mortals.xhx.module.child.service.ChildLicenseService;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import java.util.HashMap; import java.util.HashMap;
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;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import java.util.Arrays; import java.util.Arrays;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*; import static com.mortals.framework.ap.SysConstains.*;
import com.mortals.xhx.common.code.*; import com.mortals.xhx.common.code.*;
/** /**
* * 行业许可子证
* 行业许可子证 *
* * @author zxfei
* @author zxfei * @date 2024-07-28
* @date 2024-07-28 */
*/
@RestController @RestController
@RequestMapping("child/license") @RequestMapping("child/license")
public class ChildLicenseController extends BaseCRUDJsonBodyMappingController<ChildLicenseService,ChildLicenseEntity,Long> { public class ChildLicenseController extends BaseCRUDJsonBodyMappingController<ChildLicenseService, ChildLicenseEntity, Long> {
@Autowired @Autowired
private ParamService paramService; private ParamService paramService;
public ChildLicenseController(){ public ChildLicenseController() {
super.setModuleDesc( "行业许可子证"); super.setModuleDesc("行业许可子证");
} }
@Override @Override
...@@ -48,5 +59,9 @@ public class ChildLicenseController extends BaseCRUDJsonBodyMappingController<Ch ...@@ -48,5 +59,9 @@ public class ChildLicenseController extends BaseCRUDJsonBodyMappingController<Ch
super.init(model, context); 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