|
@@ -1,21 +1,12 @@
|
|
|
package com.abi.qms.platform.service.impl;
|
|
|
|
|
|
-import com.abi.qms.platform.dao.entity.BaseFactory;
|
|
|
-import com.abi.qms.platform.dao.entity.UserInfo;
|
|
|
-import com.abi.qms.platform.dao.entity.UserMappingInfoRole;
|
|
|
-import com.abi.qms.platform.dao.entity.UserRole;
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import com.abi.qms.platform.dao.entity.*;
|
|
|
import com.abi.qms.platform.dao.enums.TrueFalseEnum;
|
|
|
-import com.abi.qms.platform.dao.mapper.BaseFactoryMapper;
|
|
|
-import com.abi.qms.platform.dao.mapper.UserInfoMapper;
|
|
|
-import com.abi.qms.platform.dao.mapper.UserMappingInfoRoleMapper;
|
|
|
-import com.abi.qms.platform.dao.mapper.UserRoleMapper;
|
|
|
-import com.abi.qms.platform.dto.req.BatchEnableUserReq;
|
|
|
-import com.abi.qms.platform.dto.req.CreateUserReq;
|
|
|
-import com.abi.qms.platform.dto.req.ListUserReq;
|
|
|
-import com.abi.qms.platform.dto.req.UpdateUserReq;
|
|
|
-import com.abi.qms.platform.dto.res.GetUserInfoRes;
|
|
|
-import com.abi.qms.platform.dto.res.ListRoleTreeRes;
|
|
|
-import com.abi.qms.platform.dto.res.ListUserRes;
|
|
|
+import com.abi.qms.platform.dao.mapper.*;
|
|
|
+import com.abi.qms.platform.dao.vo.result.ListSubAccountVO;
|
|
|
+import com.abi.qms.platform.dto.req.*;
|
|
|
+import com.abi.qms.platform.dto.res.*;
|
|
|
import com.abi.qms.platform.infrastructure.util.AssertUtil;
|
|
|
import com.abi.qms.platform.infrastructure.util.PageUtil;
|
|
|
import com.abi.qms.platform.infrastructure.util.UserUtil;
|
|
@@ -27,11 +18,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
|
|
@@ -64,6 +55,9 @@ public class UserManagerServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo
|
|
|
@Autowired
|
|
|
private UserUtil userUtil;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private UserRoleDetailMapper userRoleDetailMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 创建用户
|
|
|
**/
|
|
@@ -266,5 +260,61 @@ public class UserManagerServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo
|
|
|
userInfoMapper.batchEnableUser(req);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public GetUserInfoWxRes getUserInfoWx(Long userInfoId) {
|
|
|
+ //查询用户
|
|
|
+ UserInfo userInfo = userInfoMapper.selectById(userInfoId);
|
|
|
+
|
|
|
+ //构造出参
|
|
|
+ GetUserInfoWxRes getUserInfoWxRes = PojoConverterUtils.copy(userInfo,GetUserInfoWxRes.class);
|
|
|
+ getUserInfoWxRes.setIsMainAccount(userUtil.getWholeUser().getIsMainAccount());
|
|
|
+
|
|
|
+ return getUserInfoWxRes;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void updatePhoneEmailWx(UpdatePhoneEmailWxReq req) {
|
|
|
+ //0-校验入参
|
|
|
+ UserInfo userInfo = userInfoMapper.selectById(req.getId());
|
|
|
+ if(Objects.isNull(userInfo)){
|
|
|
+ throw new BusinessException("该用户不存在。");
|
|
|
+ }
|
|
|
+ userInfo.setEmail(req.getEmail());
|
|
|
+ userInfo.setPhone(req.getPhone());
|
|
|
+ userInfo.setUpdateBy(userUtil.getWholeUser().getId());
|
|
|
+ userInfoMapper.updateById(userInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ListSubAccountWxRes listSubAccountWx() {
|
|
|
+ ListSubAccountWxRes listSubAccountWxRes = new ListSubAccountWxRes();
|
|
|
+ List<ListSubAccountVO> listSubAccountVOList = userInfoMapper.selectSubAccountList(userUtil.getWholeUser().getFactoryId());
|
|
|
+ if (CollectionUtil.isNotEmpty(listSubAccountVOList)) {
|
|
|
+ List<ListSubAccountWxRes.SubAccount> subAccountList = new ArrayList<>();
|
|
|
+ //循环构造出参
|
|
|
+ listSubAccountVOList.forEach(listSubAccountVO -> {
|
|
|
+ ListSubAccountWxRes.SubAccount subAccount = PojoConverterUtils.copy(listSubAccountVO, ListSubAccountWxRes.SubAccount.class);
|
|
|
+ List<ListSubAccountWxRes.ProductionLineName> productionLineNames = PojoConverterUtils.copyList(listSubAccountVO.getProductionLineNameList(), ListSubAccountWxRes.ProductionLineName.class);
|
|
|
+ subAccount.setProductionLineNameList(productionLineNames);
|
|
|
+ subAccountList.add(subAccount);
|
|
|
+ });
|
|
|
+ listSubAccountWxRes.setSubAccountList(subAccountList);
|
|
|
+ }
|
|
|
+ return listSubAccountWxRes;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ListSubAccountWxRes.SubAccount subAccountDetailWx(Long subUserInfoId) {
|
|
|
+ ListSubAccountVO listSubAccountVO = userInfoMapper.selectSubAccountDetail(subUserInfoId);
|
|
|
+ if(Objects.nonNull(listSubAccountVO)){
|
|
|
+ ListSubAccountWxRes.SubAccount subAccount = PojoConverterUtils.copy(listSubAccountVO, ListSubAccountWxRes.SubAccount.class);
|
|
|
+ List<ListSubAccountWxRes.ProductionLineName> productionLineNames = PojoConverterUtils.copyList(listSubAccountVO.getProductionLineNameList(), ListSubAccountWxRes.ProductionLineName.class);
|
|
|
+ subAccount.setProductionLineNameList(productionLineNames);
|
|
|
+ return subAccount;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|