diff --git a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/UserResourceHandler.java b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/UserResourceHandler.java index 65043a50..1df51c7d 100644 --- a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/UserResourceHandler.java +++ b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/UserResourceHandler.java @@ -1,7 +1,9 @@ package com.foreverwin.mesnac.dataimport.handler; import com.alibaba.fastjson.JSONObject; +import com.foreverwin.mesnac.common.dto.UsrDto; import com.foreverwin.mesnac.common.enums.HandleEnum; +import com.foreverwin.mesnac.common.service.UserService; import com.foreverwin.mesnac.common.util.StringUtil; import com.foreverwin.mesnac.dataimport.handler.base.BaseHandler; import com.foreverwin.mesnac.dataimport.reader.FileReader; @@ -13,7 +15,6 @@ import com.foreverwin.mesnac.dispatch.model.UserResource; import com.foreverwin.mesnac.dispatch.service.UserResourceService; import com.foreverwin.mesnac.meapi.mapper.NwaUserMapper; import com.foreverwin.mesnac.meapi.mapper.ResrceMapper; -import com.foreverwin.mesnac.meapi.model.NwaUser; import com.foreverwin.mesnac.meapi.model.Resrce; import com.foreverwin.modular.core.util.CommonMethods; import com.foreverwin.modular.core.util.I18nUtil; @@ -21,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired; import java.io.InputStream; import java.time.LocalDateTime; +import java.util.List; import java.util.Map; @@ -43,6 +45,9 @@ public class UserResourceHandler extends BaseHandler { @Autowired private UserResourceMapper userResourceMapper; + @Autowired + private UserService userService; + @Override public String importFile(String site, InputStream inputStream, String fileType, String mode) throws Exception { int row = 0; @@ -144,7 +149,7 @@ public class UserResourceHandler extends BaseHandler { }; } - String updateAndInsert(UserResource userResource,Long index){ + String updateAndInsert(UserResource userResource, Long index){ //判断资源是否存在 Resrce resrce = resrceMapper.selectById(userResource.getResourceBo()); @@ -153,10 +158,12 @@ public class UserResourceHandler extends BaseHandler { } //设置资源描述 userResource.setResrceDescription(resrce.getDescription()); + userResource.setExistUser("false"); //设置员工描述 - NwaUser nwaUser = nwaUserMapper.selectById(HandleEnum.USER.getHandle(userResource.getSite(), userResource.getUserId())); - if(nwaUser != null){ - userResource.setUserDescription(nwaUser.getFullName()); + List userList = userService.findList(userResource.getUserId()); + if(userList != null && userList.size() > 0){ + userResource.setUserDescription(userList.get(0).getFullName()); + userResource.setExistUser("true"); }else if("true".equals(userResource.getTemporaryUser())){ //不做任何操作 }else{ diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/UserResourceServiceImpl.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/UserResourceServiceImpl.java index 2f557530..583eb51c 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/UserResourceServiceImpl.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/UserResourceServiceImpl.java @@ -106,6 +106,7 @@ public class UserResourceServiceImpl extends ServiceImpl userByUserName = userService.findList(userResource.getUserId()); if("false".equals(userResource.getTemporaryUser()) && @@ -114,6 +115,7 @@ public class UserResourceServiceImpl extends ServiceImpl 0){ //userByUserName.setFullName(userResource.getUserDescription()); userResource.setUserDescription(userByUserName.get(0).getFullName()); + userResource.setExistUser("true"); //nwaUserService.saveOrUpdate(userByUserName); } userResource.setStatus(userResourceDto.getStatus());