userResource提交

master
赵嘉伟 3 years ago
parent 88f40558cb
commit 59454f195a

@ -1,7 +1,9 @@
package com.foreverwin.mesnac.dataimport.handler; package com.foreverwin.mesnac.dataimport.handler;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
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.common.util.StringUtil; import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.dataimport.handler.base.BaseHandler; import com.foreverwin.mesnac.dataimport.handler.base.BaseHandler;
import com.foreverwin.mesnac.dataimport.reader.FileReader; 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.dispatch.service.UserResourceService;
import com.foreverwin.mesnac.meapi.mapper.NwaUserMapper; import com.foreverwin.mesnac.meapi.mapper.NwaUserMapper;
import com.foreverwin.mesnac.meapi.mapper.ResrceMapper; import com.foreverwin.mesnac.meapi.mapper.ResrceMapper;
import com.foreverwin.mesnac.meapi.model.NwaUser;
import com.foreverwin.mesnac.meapi.model.Resrce; import com.foreverwin.mesnac.meapi.model.Resrce;
import com.foreverwin.modular.core.util.CommonMethods; import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.I18nUtil; import com.foreverwin.modular.core.util.I18nUtil;
@ -21,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.io.InputStream; import java.io.InputStream;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
import java.util.Map; import java.util.Map;
@ -43,6 +45,9 @@ public class UserResourceHandler extends BaseHandler {
@Autowired @Autowired
private UserResourceMapper userResourceMapper; private UserResourceMapper userResourceMapper;
@Autowired
private UserService userService;
@Override @Override
public String importFile(String site, InputStream inputStream, String fileType, String mode) throws Exception { public String importFile(String site, InputStream inputStream, String fileType, String mode) throws Exception {
int row = 0; 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()); Resrce resrce = resrceMapper.selectById(userResource.getResourceBo());
@ -153,10 +158,12 @@ public class UserResourceHandler extends BaseHandler {
} }
//设置资源描述 //设置资源描述
userResource.setResrceDescription(resrce.getDescription()); userResource.setResrceDescription(resrce.getDescription());
userResource.setExistUser("false");
//设置员工描述 //设置员工描述
NwaUser nwaUser = nwaUserMapper.selectById(HandleEnum.USER.getHandle(userResource.getSite(), userResource.getUserId())); List<UsrDto> userList = userService.findList(userResource.getUserId());
if(nwaUser != null){ if(userList != null && userList.size() > 0){
userResource.setUserDescription(nwaUser.getFullName()); userResource.setUserDescription(userList.get(0).getFullName());
userResource.setExistUser("true");
}else if("true".equals(userResource.getTemporaryUser())){ }else if("true".equals(userResource.getTemporaryUser())){
//不做任何操作 //不做任何操作
}else{ }else{

@ -106,6 +106,7 @@ 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());
userResource.setExistUser("false");
//NwaUser userByUserName = nwaUserService.findUserByUserName(userResource.getUserId()); //NwaUser userByUserName = nwaUserService.findUserByUserName(userResource.getUserId());
List<UsrDto> userByUserName = userService.findList(userResource.getUserId()); List<UsrDto> userByUserName = userService.findList(userResource.getUserId());
if("false".equals(userResource.getTemporaryUser()) && if("false".equals(userResource.getTemporaryUser()) &&
@ -114,6 +115,7 @@ public class UserResourceServiceImpl extends ServiceImpl<UserResourceMapper, Use
}else if(userByUserName != null && userByUserName.size() > 0){ }else if(userByUserName != null && userByUserName.size() > 0){
//userByUserName.setFullName(userResource.getUserDescription()); //userByUserName.setFullName(userResource.getUserDescription());
userResource.setUserDescription(userByUserName.get(0).getFullName()); userResource.setUserDescription(userByUserName.get(0).getFullName());
userResource.setExistUser("true");
//nwaUserService.saveOrUpdate(userByUserName); //nwaUserService.saveOrUpdate(userByUserName);
} }
userResource.setStatus(userResourceDto.getStatus()); userResource.setStatus(userResourceDto.getStatus());

Loading…
Cancel
Save