userResource提交

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

@ -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;
@ -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<UsrDto> 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{

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

Loading…
Cancel
Save