员工资源对应表

master
赵嘉伟 3 years ago
parent a31f7f5ca7
commit 5958922af8

@ -11,6 +11,7 @@ import java.util.List;
* @Since 2021-08-10 * @Since 2021-08-10
*/ */
public interface UserService { public interface UserService {
List<UsrDto> findList(String user); List<UsrDto> findList(String user);
IPage findPage(IPage page,String user); IPage findPage(IPage page,String user);

@ -1,9 +1,9 @@
package com.foreverwin.mesnac.dispatch.service.impl; package com.foreverwin.mesnac.dispatch.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.foreverwin.mesnac.common.dto.UsrDto;
import com.foreverwin.mesnac.common.enums.HandleEnum; import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.service.UserService;
import com.foreverwin.mesnac.dispatch.dto.UserResourceDto; import com.foreverwin.mesnac.dispatch.dto.UserResourceDto;
import com.foreverwin.mesnac.dispatch.mapper.UserResourceMapper; import com.foreverwin.mesnac.dispatch.mapper.UserResourceMapper;
import com.foreverwin.mesnac.dispatch.model.UserResource; import com.foreverwin.mesnac.dispatch.model.UserResource;
@ -13,7 +13,6 @@ import com.foreverwin.mesnac.meapi.service.NwaUserService;
import com.foreverwin.mesnac.meapi.service.ResrceService; import com.foreverwin.mesnac.meapi.service.ResrceService;
import com.foreverwin.modular.core.exception.BusinessException; import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.CommonMethods; import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -45,6 +44,10 @@ public class UserResourceServiceImpl extends ServiceImpl<UserResourceMapper, Use
@Autowired @Autowired
private NwaUserService nwaUserService; private NwaUserService nwaUserService;
@Autowired
private UserService userService;
@Override @Override
public List<NwaUser> findEmployeeList(String site) { public List<NwaUser> findEmployeeList(String site) {
return userResourceMapper.findEmployeeList(site); return userResourceMapper.findEmployeeList(site);
@ -62,7 +65,9 @@ public class UserResourceServiceImpl extends ServiceImpl<UserResourceMapper, Use
String userId = userResourceDto.getUserId(); String userId = userResourceDto.getUserId();
HashMap<String, Object> hashMap = new HashMap<>();; HashMap<String, Object> hashMap = new HashMap<>();;
List<NwaUser> nwaUserList = nwaUserService.selectList(null); // List<NwaUser> nwaUserList = nwaUserService.selectList(null);
List<UsrDto> nwaUserList = userService.findList(null);
List<UserResourceDto> userResourceList = userResourceMapper.findAll(site, resource, userId); List<UserResourceDto> userResourceList = userResourceMapper.findAll(site, resource, userId);
hashMap.put("users",nwaUserList); hashMap.put("users",nwaUserList);
hashMap.put("userResources",userResourceList); hashMap.put("userResources",userResourceList);
@ -88,14 +93,15 @@ public class UserResourceServiceImpl extends ServiceImpl<UserResourceMapper, Use
userResource.setUserId(userResourceDto.getUserId()); userResource.setUserId(userResourceDto.getUserId());
userResource.setTemporaryUser(userResourceDto.getTemporaryUser()); userResource.setTemporaryUser(userResourceDto.getTemporaryUser());
userResource.setUserDescription(userResourceDto.getUserDescription()); userResource.setUserDescription(userResourceDto.getUserDescription());
NwaUser userByUserName = nwaUserService.findUserByUserName(userResource.getUserId()); //NwaUser userByUserName = nwaUserService.findUserByUserName(userResource.getUserId());
List<UsrDto> userByUserName = userService.findList(userResource.getUserId());
if("false".equals(userResource.getTemporaryUser()) && if("false".equals(userResource.getTemporaryUser()) &&
userByUserName == null){ userByUserName.size() <= 0){
throw BusinessException.build("第"+(i+1)+"行的用户不存在,必须为临时用户"); throw BusinessException.build("第"+(i+1)+"行的用户不存在,必须为临时用户");
}else if(userByUserName != null){ }else if(userByUserName != null && userByUserName.size() > 0){
//userByUserName.setFullName(userResource.getUserDescription()); //userByUserName.setFullName(userResource.getUserDescription());
userResource.setUserDescription(userByUserName.getFullName()); userResource.setUserDescription(userByUserName.get(0).getFullName());
nwaUserService.saveOrUpdate(userByUserName); //nwaUserService.saveOrUpdate(userByUserName);
} }
userResource.setStatus(userResourceDto.getStatus()); userResource.setStatus(userResourceDto.getStatus());
userResource.setHandle("UserResourceBo:"+userResource.getSite()+","+ userResource.setHandle("UserResourceBo:"+userResource.getSite()+","+

@ -34,12 +34,6 @@
<groupId>com.foreverwin.mesnac</groupId> <groupId>com.foreverwin.mesnac</groupId>
<artifactId>meapi</artifactId> <artifactId>meapi</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.foreverwin.mesnac</groupId>
<artifactId>common</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.foreverwin.mesnac</groupId> <groupId>com.foreverwin.mesnac</groupId>
<artifactId>dispatch</artifactId> <artifactId>dispatch</artifactId>

@ -2,7 +2,6 @@ package com.foreverwin.mesnac.listener.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.mesnac.common.service.UserService;
import com.foreverwin.mesnac.listener.model.SysUser; import com.foreverwin.mesnac.listener.model.SysUser;
import com.foreverwin.mesnac.listener.model.Usr; import com.foreverwin.mesnac.listener.model.Usr;
import com.foreverwin.modular.core.util.FrontPage; import com.foreverwin.modular.core.util.FrontPage;
@ -17,7 +16,7 @@ import java.util.List;
* @author sungang * @author sungang
* @since 2020-10-16 * @since 2020-10-16
*/ */
public interface UsrService extends IService<Usr>, UserService { public interface UsrService extends IService<Usr> {
/** /**
* *

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.foreverwin.mesnac.common.dto.UsrDto; import com.foreverwin.mesnac.common.dto.UsrDto;
import com.foreverwin.mesnac.common.service.UserService;
import com.foreverwin.mesnac.listener.mapper.UsrMapper; import com.foreverwin.mesnac.listener.mapper.UsrMapper;
import com.foreverwin.mesnac.listener.model.SysUser; import com.foreverwin.mesnac.listener.model.SysUser;
import com.foreverwin.mesnac.listener.model.Usr; import com.foreverwin.mesnac.listener.model.Usr;
@ -26,7 +27,7 @@ import java.util.List;
*/ */
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class UsrServiceImpl extends ServiceImpl<UsrMapper, Usr> implements UsrService { public class UsrServiceImpl extends ServiceImpl<UsrMapper, Usr> implements UsrService,UserService {
@Autowired @Autowired

@ -616,7 +616,12 @@
SELECT U.USER_ID USER_NAME,ZNU.FULL_NAME FULL_NAME SELECT U.USER_ID USER_NAME,ZNU.FULL_NAME FULL_NAME
FROM USR U FROM USR U
INNER JOIN Z_NWA_USER ZNU ON ZNU.USER_NAME = U.USER_ID INNER JOIN Z_NWA_USER ZNU ON ZNU.USER_NAME = U.USER_ID
WHERE U.SITE=#{site} AND U.USER_ID = #{user} WHERE U.SITE=#{site}
<if test="user != null and user != ''">
AND (
U.USER_ID = #{user}
)
</if>
</select> </select>
<select id="findPage" resultMap="usrDto"> <select id="findPage" resultMap="usrDto">
@ -626,8 +631,8 @@
WHERE U.SITE=#{site} WHERE U.SITE=#{site}
<if test="user != null and user != ''"> <if test="user != null and user != ''">
AND ( AND (
U.USER_ID LIKE '%${user}%' U.USER_ID LIKE UPPER('%${user}%')
OR ZNU.FULL_NAME LIKE '%${user}%' OR ZNU.FULL_NAME LIKE UPPER('%${user}%')
) )
</if> </if>
</select> </select>

Loading…
Cancel
Save