|
|
@@ -18,6 +18,7 @@ import com.zhongshu.card.client.type.OrganizationUserType;
|
|
|
import com.zhongshu.card.client.type.UserState;
|
|
|
import com.zhongshu.card.server.core.dao.org.*;
|
|
|
import com.zhongshu.card.server.core.dao.school.DictInfoDao;
|
|
|
+import com.zhongshu.card.server.core.dataConfig.CardSystemDefault;
|
|
|
import com.zhongshu.card.server.core.domain.org.*;
|
|
|
import com.zhongshu.card.server.core.domain.school.DictInfo;
|
|
|
import com.zhongshu.card.server.core.model.org.OrgBindUserParam;
|
|
|
@@ -183,10 +184,12 @@ public class OrganizationUserServiceImpl extends SuperService {
|
|
|
if (StringUtils.isEmpty(param.getOrgOid())) {
|
|
|
return ResultContent.buildFail("orgOid不能为空");
|
|
|
}
|
|
|
+
|
|
|
UserAccount userAccount = userCountDao.findTopByUserId(param.getUserId());
|
|
|
if (ObjectUtils.isEmpty(userAccount)) {
|
|
|
return ResultContent.buildFail(String.format("用户信息不存在:%s", param.getUserId()));
|
|
|
}
|
|
|
+
|
|
|
Organization organization = organizationDao.findTopByOid(param.getOrgOid());
|
|
|
if (ObjectUtils.isEmpty(organization)) {
|
|
|
return ResultContent.buildFail(String.format("机构信息不存在:%s", param.getOrgOid()));
|
|
|
@@ -207,6 +210,8 @@ public class OrganizationUserServiceImpl extends SuperService {
|
|
|
} else {
|
|
|
organizationUser = organizationUserDao.findTopByOrganizationAndUser(organization, userAccount);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
if (ObjectUtils.isEmpty(organizationUser)) {
|
|
|
// 添加
|
|
|
if (ObjectUtils.isNotEmpty(codeTemp)) {
|
|
|
@@ -223,7 +228,7 @@ public class OrganizationUserServiceImpl extends SuperService {
|
|
|
return ResultContent.buildFail(String.format("code已存在:%s", param.getCode()));
|
|
|
}
|
|
|
// 编辑
|
|
|
- BeanUtils.copyProperties(param, organizationUser);
|
|
|
+ BeanUtils.copyProperties(param, organizationUser, "id");
|
|
|
|
|
|
// 删除以前的角色
|
|
|
List<Role> oldRoles = organizationUser.getRoles();
|
|
|
@@ -444,8 +449,10 @@ public class OrganizationUserServiceImpl extends SuperService {
|
|
|
|
|
|
ImportResultModel model = new ImportResultModel();
|
|
|
try {
|
|
|
- int startRow = 2;
|
|
|
+ int startRow = 3;
|
|
|
ImportParams params = new ImportParams();
|
|
|
+ params.setHeadRows(1);
|
|
|
+ params.setTitleRows(1);
|
|
|
List<ExcelUserParam> list = ExcelImportUtil.importExcel(file.getInputStream(),
|
|
|
ExcelUserParam.class, params);
|
|
|
model.setTotal(list.size());
|
|
|
@@ -487,15 +494,18 @@ public class OrganizationUserServiceImpl extends SuperService {
|
|
|
if (StringUtils.isNotBlank(param1.getSexStr())) {
|
|
|
addParam.setSex(CommonUtil.getSexByStr(param1.getSexStr()));
|
|
|
}
|
|
|
- String passWord = param1.getCardNumber().substring(12, 18);
|
|
|
- passWord = passWord.toLowerCase().replace("x", "0");
|
|
|
+ String passWord = CardSystemDefault.DEFAULT_PASSWORD;
|
|
|
+ if (StringUtils.isNotEmpty(param1.getCardNumber())) {
|
|
|
+ param1.getCardNumber().substring(12, 18);
|
|
|
+ passWord = passWord.toLowerCase().replace("x", "0");
|
|
|
+ }
|
|
|
addParam.setPassWord(passWord);
|
|
|
userList.add(addParam);
|
|
|
}
|
|
|
startRow++;
|
|
|
}
|
|
|
|
|
|
- // 添加到对应的结构中
|
|
|
+ // 添加到对应的机构中
|
|
|
for (UserCountAddParam param : userList) {
|
|
|
ResultContent resultContent = saveOrgUser(param);
|
|
|
log.info("添加日志: {}", resultContent.getMsg());
|
|
|
@@ -504,6 +514,7 @@ public class OrganizationUserServiceImpl extends SuperService {
|
|
|
model.setFailDetails(failDetails);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
return ResultContent.buildFail(String.format("导入出错:%s", e.getMessage()));
|
|
|
}
|
|
|
return ResultContent.buildSuccess(model);
|
|
|
@@ -519,8 +530,9 @@ public class OrganizationUserServiceImpl extends SuperService {
|
|
|
public void exportProjectUser(HttpServletRequest request, HttpServletResponse response,
|
|
|
OrganizationUserSearch param) {
|
|
|
param.setIsSearchProject(Boolean.TRUE);
|
|
|
+ Assert.hasText(param.getProjectOid(), "projectOid不能为空");
|
|
|
|
|
|
- Organization organization = organizationDao.findTopByOid(param.getOid());
|
|
|
+ Organization organization = organizationDao.findTopByOid(param.getProjectOid());
|
|
|
Pageable pageable = PageRequest.of(0, Integer.MAX_VALUE);
|
|
|
Page<OrganizationUser> page = organizationUserDao.page(pageable, param);
|
|
|
|
|
|
@@ -543,7 +555,7 @@ public class OrganizationUserServiceImpl extends SuperService {
|
|
|
execlParam.setDatas(maps);
|
|
|
|
|
|
List<CommonExeclTd> tds = new ArrayList<>();
|
|
|
- tds.add(CommonExeclTd.build("人员编号", "code"));
|
|
|
+ tds.add(CommonExeclTd.build("人员编码", "code"));
|
|
|
tds.add(CommonExeclTd.build("姓名", "name"));
|
|
|
tds.add(CommonExeclTd.build("性别", "sexStr"));
|
|
|
tds.add(CommonExeclTd.build("手机号", "phone"));
|