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

Merge remote-tracking branch 'origin/master'

parents 8e07e395 f106a3ca
......@@ -58,12 +58,7 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
// 令牌前缀
@Value("${token.prefix:}")
private String tokenPrefix;
// redis db
@Value("${spring.redis.database:}")
private Integer db;
@Value("${token.database:0}")
private Integer portalDb;
protected static final Long SECOND = 1l;
......@@ -104,11 +99,7 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
Claims claims = parseToken(token);
String uuid = (String) claims.get(SysConstains.LOGIN_USER_KEY);
String userKey = getTokenKey(uuid);
//cacheService.select(portalDb);
String userStr = cacheService.get(userKey);
/* RedisTemplate<String, String> redisTemplate = cacheService.selectDbRedisTemplate(portalDb);
String userStr =redisTemplate.opsForValue().get(userKey);
*/
//刷新token时间
UserEntity userEntity = JSONObject.parseObject(userStr, UserEntity.class);
if (!ObjectUtils.isEmpty(userEntity)) {
......
package com.mortals.xhx.base.system.user.model;
import com.mortals.framework.annotation.desensitization.MobileDesensitize;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.service.IUser;
import com.mortals.xhx.base.system.user.model.vo.UserVo;
......@@ -34,6 +35,7 @@ public class UserEntity extends UserVo implements IUser {
/**
* 用户手机号
*/
@MobileDesensitize
private String mobile;
/**
* 用户联系电话
......@@ -48,9 +50,19 @@ public class UserEntity extends UserVo implements IUser {
*/
private String qq;
/**
* 用户类型(0.系统用户,1.普通用户,2.工作人员)
* 用户类型(0.系统用户,1.普通用户,2.工作人员,3.巡查人员,4.窗口负责人)
*/
private Integer userType;
/**
* 用户所属部门id
*/
private Long deptId;
/**
* 所属部门名称
*/
private String deptName;
/**
* 所属站点id,多个逗号分隔
*/
......@@ -76,7 +88,23 @@ public class UserEntity extends UserVo implements IUser {
*/
private String lastLoginAddress;
/**
* 员工id
*/
private Long customerId;
/**
* 钉钉userId
*/
private String dingUserId;
public String getDingUserId() {
return dingUserId;
}
public void setDingUserId(String dingUserId) {
this.dingUserId = dingUserId;
}
public UserEntity(){}
/**
......@@ -100,6 +128,15 @@ public class UserEntity extends UserVo implements IUser {
public String getLoginPwd(){
return loginPwd;
}
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
/**
* 设置 登录密码,使用md5双次加密
* @param loginPwd
......@@ -132,6 +169,7 @@ public class UserEntity extends UserVo implements IUser {
@Override
public boolean isAdmin() {
return super.getId() == null ? false : super.getId().longValue() == SysConstains.ADMIN_ID;
// return true;
}
@Override
......@@ -208,7 +246,7 @@ public class UserEntity extends UserVo implements IUser {
this.qq = qq;
}
/**
* 获取 用户类型(0.系统用户,1.普通用户,2.工作人员)
* 获取 用户类型(0.系统用户,1.普通用户,2.工作人员,3.普通员工)
* @return Integer
*/
public Integer getUserType(){
......@@ -224,17 +262,17 @@ public class UserEntity extends UserVo implements IUser {
@Override
public Long getDeptId() {
return null;
return this.deptId;
}
@Override
public String getDeptName() {
return null;
return this.deptName;
}
@Override
public Long getCustomerId() {
return null;
return this.customerId;
}
@Override
......@@ -339,7 +377,9 @@ public class UserEntity extends UserVo implements IUser {
}
public void setCustomerId(Long customerId) {
this.customerId = customerId;
}
@Override
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,6 +4,8 @@ package com.mortals.xhx.base.system.user.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import lombok.Data;
import java.util.List;
/**
* 用户信息业务视图对象
*
......@@ -17,7 +19,7 @@ public class UserVo extends BaseEntityLong {
*/
private String siteName;
private String roleIds;
private List<Long> roleIds;
/**
* 唯一标识
*/
......@@ -36,4 +38,6 @@ public class UserVo extends BaseEntityLong {
* 过期时间
*/
private Long expireTime;
String roleIdStrs;
}
\ No newline at end of file
package com.mortals.xhx.module.certificate.model;
import java.util.List;
import java.util.List;
import java.util.ArrayList;
import java.math.BigDecimal;
import cn.hutool.core.date.DateUtil;
......@@ -8,6 +9,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.certificate.model.vo.CertificateCatalogVo;
import com.mortals.xhx.module.certificate.model.CertificateChildEntity;
import lombok.Data;
/**
* 证照目录实体对象
......@@ -99,6 +101,17 @@ public class CertificateCatalogEntity extends CertificateCatalogVo {
* 打印机纸盒
*/
private String paperSource;
/**
* 目录子证信息
*/
private List<CertificateChildEntity> certificateChildList=new ArrayList<>();;
public List<CertificateChildEntity> getCertificateChildList(){
return certificateChildList;
}
public void setCertificateChildList(List<CertificateChildEntity> certificateChildList){
this.certificateChildList = certificateChildList;
}
@Override
public int hashCode() {
return this.getId().hashCode();
......
package com.mortals.xhx.module.certificate.model;
import java.util.List;
import java.util.List;
import com.mortals.xhx.module.certificate.model.CertificateCatalogEntity;
/**
......
......@@ -8,24 +8,32 @@ import com.mortals.xhx.common.code.ClassifyType;
import com.mortals.xhx.common.utils.StringUtils;
import com.mortals.xhx.module.certificate.dao.CertificateCatalogDao;
import com.mortals.xhx.module.certificate.model.CertificateCatalogEntity;
import com.mortals.xhx.module.certificate.model.CertificateChildEntity;
import com.mortals.xhx.module.certificate.model.CertificateChildQuery;
import com.mortals.xhx.module.certificate.model.CertificateClassifyEntity;
import com.mortals.xhx.module.certificate.service.CertificateCatalogService;
import com.mortals.xhx.module.certificate.service.CertificateChildService;
import com.mortals.xhx.module.certificate.service.CertificateClassifyService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* CertificateCatalogService
* 证照目录 service实现
*
* @author zxfei
* @date 2022-10-14
*/
* CertificateCatalogService
* 证照目录 service实现
*
* @author zxfei
* @date 2022-10-14
*/
@Service("certificateCatalogService")
public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<CertificateCatalogDao, CertificateCatalogEntity, Long> implements CertificateCatalogService {
......@@ -41,21 +49,25 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
@Autowired
private CertificateClassifyService certificateClassifyService;
@Autowired
private CertificateChildService certificateChildService;
@Override
protected void saveBefore(CertificateCatalogEntity entity, Context context) throws AppException {
if(StringUtils.isEmpty(entity.getCatalogName())){
if (StringUtils.isEmpty(entity.getCatalogName())) {
throw new AppException("目录名称不能为空");
}
if(StringUtils.isEmpty(entity.getCatalogCode())){
if (StringUtils.isEmpty(entity.getCatalogCode())) {
throw new AppException("目录编码不能为空");
}
if(entity.getHolderType()==null){
if (entity.getHolderType() == null) {
throw new AppException("持有者类型不能为空");
}
if(entity.getClassifyId()==null){
if (entity.getClassifyId() == null) {
throw new AppException("目录分类不能为空");
}
if(entity.getIndustryId()==null){
if (entity.getIndustryId() == null) {
throw new AppException("所属行业不能为空");
}
......@@ -63,19 +75,19 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
@Override
protected void updateBefore(CertificateCatalogEntity entity, Context context) throws AppException {
if(StringUtils.isEmpty(entity.getCatalogName())){
if (StringUtils.isEmpty(entity.getCatalogName())) {
throw new AppException("目录名称不能为空");
}
if(StringUtils.isEmpty(entity.getCatalogCode())){
if (StringUtils.isEmpty(entity.getCatalogCode())) {
throw new AppException("目录编码不能为空");
}
if(entity.getHolderType()==null){
if (entity.getHolderType() == null) {
throw new AppException("持有者类型不能为空");
}
if(entity.getClassifyId()==null){
if (entity.getClassifyId() == null) {
throw new AppException("目录分类不能为空");
}
if(entity.getIndustryId()==null){
if (entity.getIndustryId() == null) {
throw new AppException("所属行业不能为空");
}
......@@ -84,7 +96,7 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
@Override
protected CertificateCatalogEntity findBefore(CertificateCatalogEntity params, PageInfo pageInfo, Context context) throws AppException {
if(StringUtils.isNotEmpty(params.getCatalogName())){
if (StringUtils.isNotEmpty(params.getCatalogName())) {
params.setCatalogName("%".concat(params.getCatalogName()).concat("%"));
}
return params;
......@@ -92,20 +104,72 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
@Override
protected void findAfter(CertificateCatalogEntity params, PageInfo pageInfo, Context context, List<CertificateCatalogEntity> list) throws AppException {
if(CollectionUtils.isNotEmpty(list)){
for(CertificateCatalogEntity entity:list){
if (CollectionUtils.isNotEmpty(list)) {
for (CertificateCatalogEntity entity : list) {
CertificateClassifyEntity certificateClassifyEntity = certificateClassifyService.get(entity.getClassifyId());
if(certificateClassifyEntity!=null){
if (certificateClassifyEntity != null) {
entity.setClassifyType(certificateClassifyEntity.getClassifyType());
}else {
} else {
entity.setClassifyType(ClassifyType.PRINCIPAL.getValue());
}
}
}
fillSubData(list);
}
@Override
protected void findAfter(CertificateCatalogEntity params, Context context, List<CertificateCatalogEntity> list) throws AppException {
fillSubData(list);
super.findAfter(params, context, list);
}
private void fillSubData(List<CertificateCatalogEntity> list) {
List<Long> idList = list.stream().map(i -> i.getId()).collect(Collectors.toList());
CertificateChildQuery certificateChildQuery = new CertificateChildQuery();
certificateChildQuery.setCatalogIdList(idList);
Map<Long, List<CertificateChildEntity>> certificateChildListMap = certificateChildService.find(certificateChildQuery).stream().collect(Collectors.groupingBy(CertificateChildEntity::getCatalogId));
list.forEach(item -> item.setCertificateChildList(certificateChildListMap.get(item.getId())));
}
@Override
protected void saveAfter(CertificateCatalogEntity entity, Context context) throws AppException {
if (!ObjectUtils.isEmpty(entity.getCertificateChildList())) {
entity.getCertificateChildList().stream().peek(item -> {
item.setCatalogId(entity.getId());
item.setCreateUserId(this.getContextUserId(context));
item.setCreateTime(new Date());
}).count();
certificateChildService.save(entity.getCertificateChildList());
}
super.saveAfter(entity, context);
}
@Override
protected void updateAfter(CertificateCatalogEntity entity, Context context) throws AppException {
if (!ObjectUtils.isEmpty(entity.getCertificateChildList())) {
Long[] certificateChildIds = certificateChildService.find(new CertificateChildQuery().catalogId(entity.getId())).stream().map(CertificateChildEntity::getId).toArray(Long[]::new);
certificateChildService.remove(certificateChildIds, context);
entity.getCertificateChildList().stream().peek(item -> {
item.setCatalogId(entity.getId());
item.setCreateUserId(this.getContextUserId(context));
item.setCreateTime(new Date());
item.setUpdateUserId(this.getContextUserId(context));
item.setUpdateTime(new Date());
}).count();
certificateChildService.save(entity.getCertificateChildList());
}
super.updateAfter(entity, context);
}
@Override
protected void removeAfter(Long[] ids, Context context, int result) throws AppException {
List<CertificateChildEntity> certificateChildlist = certificateChildService.find(new CertificateChildQuery().catalogIdList(Arrays.asList(ids)));
certificateChildService.removeList(certificateChildlist, context);
super.removeAfter(ids, context, result);
}
public static void main(String[] args){
public static void main(String[] args) {
// String excelFilePath = "D:/mortals/app/data/cpm/" + "excel/test1.xls";
// List<String> excelList = new ArrayList<>();
// excelList.add("i_1_姓名");
......
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