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