Commit 98280ae5 by 宋祥

Merge branch 'dev-sx' of http://git.pseer.com:8800/platform/hg-smart into dev

parents c1f3fe4f 87208322
......@@ -53,4 +53,9 @@ public class DcUser {
@AliasNameAnon(name = "手机")
private String Mobile;
/**
* 员工编号
*/
@AliasNameAnon(name = "员工编号")
private String Ygid;
}
......@@ -139,7 +139,7 @@ public class ServiceHGPZ009 extends ServiceBase {
// 默认新增企业管理员账号
String userId = fPz009.getLoginPrefix() + "0000";
HGXSTools.XsUser.addUser(fPz009.getAccountCode(), userId, fPz009.getAccountName(),
null, null, null);
null, null, null, "1");
// 关联企业管理员角色
this.insertGroupMember(fPz009, userId);
// 新增组织机构顶级
......
......@@ -21,11 +21,11 @@ import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import java.io.IOException;
import java.util.ArrayList;
......@@ -190,7 +190,9 @@ public class ServiceHGXSUser extends ServiceBase {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
HGPZ009 dbPz009 = HGPZTools.HgPz009.getByCode(MapUtils.getString(queryMap, HGPZ009.FIELD_ACCOUNT_CODE));
Integer ord = MapUtils.getInteger(queryMap, "ord");
syncDcUserSingle(dbPz009, ord);
DcUserList dcUserList = new DcUserList();
dcUserList.setOrd(ord);
syncDcUserSingle(dbPz009, dcUserList);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("同步德诚用户信息成功");
} catch (Exception e) {
......@@ -259,7 +261,7 @@ public class ServiceHGXSUser extends ServiceBase {
HGPZ009 dbPz009 = HGPZTools.HgPz009.getByCode(accountCode);
for (DcUserList dcUserList : dcUserLists) {
try {
syncDcUserSingle(dbPz009, dcUserList.getOrd());
syncDcUserSingle(dbPz009, dcUserList);
} catch (Exception e) {
log.error("同步德诚用户失败:{}", e.getMessage(), e);
}
......@@ -270,40 +272,42 @@ public class ServiceHGXSUser extends ServiceBase {
* 同步单个用户
*
* @param dbPz009
* @param ord
* @param dcUserList
* @throws IOException
*/
private void syncDcUserSingle(HGPZ009 dbPz009, Integer ord) throws Exception {
private void syncDcUserSingle(HGPZ009 dbPz009, DcUserList dcUserList) throws Exception {
// 获取用户详情
DcUser zbUser = DcOpenApi.userDetail(ord);
if (zbUser == null) {
DcUser dcUser = DcOpenApi.userDetail(dcUserList.getOrd());
if (dcUser == null || StringUtils.isBlank(dcUser.getYgid())) {
return;
}
String userId = dbPz009.getLoginPrefix() + ord;
// 判断用户是否存在
User dbUser = HGXSTools.XsUser.getByLogin(userId);
User dbUser = HGXSTools.XsUser.getByLogin(dcUser.getYgid());
if (dbUser == null) {
this.syncDcSingleUserAdd(zbUser, dbPz009, userId);
this.syncDcSingleUserAdd(dcUserList, dcUser, dbPz009);
} else {
this.syncDcSingleUserModify(zbUser, userId);
this.syncDcSingleUserModify(dcUserList, dcUser);
}
}
/**
* 新增用户
*
* @param zbUser
* @param dcUserList
* @param dcUser
* @param dbPz009
* @param userId
* @throws Exception
*/
private void syncDcSingleUserAdd(DcUser zbUser, HGPZ009 dbPz009, String userId) throws Exception {
private void syncDcSingleUserAdd(DcUserList dcUserList, DcUser dcUser, HGPZ009 dbPz009) throws Exception {
String userId = dcUser.getYgid();
// -1:冻结用户,1:正常
String isLock = HGXSUtils.XsUser.convertIsLock(dcUserList.getStatus());
// 新增用户
HGXSTools.XsUser.addUser(dbPz009.getAccountCode(), userId, zbUser.getName(), zbUser.getSex(), zbUser.getEmail(),
zbUser.getCardid());
HGXSTools.XsUser.addUser(dbPz009.getAccountCode(), userId, dcUser.getName(), dcUser.getSex(), dcUser.getEmail(),
dcUser.getCardid(), isLock);
// 新增用户和组织机构关系
Map addMap = new HashMap();
addMap.put("orgId", dbPz009.getLoginPrefix() + zbUser.getOrgsid());
addMap.put("orgId", dbPz009.getLoginPrefix() + dcUser.getOrgsid());
addMap.put("userId", userId);
addMap.put("recCreator", "System");
addMap.put("recCreateTime", DateUtils.shortDateTime());
......@@ -311,17 +315,20 @@ public class ServiceHGXSUser extends ServiceBase {
}
/**
* @param zbUser
* @param userId
* @param dcUserList
* @param dcUser
*/
private void syncDcSingleUserModify(DcUser zbUser, String userId) {
private void syncDcSingleUserModify(DcUserList dcUserList, DcUser dcUser) {
Map updateMap = new HashMap();
updateMap.put(User.FIELD_LOGIN_NAME, userId);
updateMap.put(User.FIELD_USER_NAME, zbUser.getName());
updateMap.put(User.FIELD_GENDER, HGXSUtils.XsUser.convertGender(zbUser.getSex()));
updateMap.put(User.FIELD_EMAIL, zbUser.getEmail());
updateMap.put(User.FIELD_MOBILE, zbUser.getMobile());
updateMap.put(User.FIELD_ID_CARD, zbUser.getCardid() == null ? " " : zbUser.getCardid());
updateMap.put(User.FIELD_LOGIN_NAME, dcUser.getYgid());
updateMap.put(User.FIELD_USER_NAME, dcUser.getName());
updateMap.put(User.FIELD_GENDER, HGXSUtils.XsUser.convertGender(dcUser.getSex()));
updateMap.put(User.FIELD_EMAIL, dcUser.getEmail());
updateMap.put(User.FIELD_MOBILE, dcUser.getMobile());
updateMap.put(User.FIELD_ID_CARD, dcUser.getCardid() == null ? " " : dcUser.getCardid());
// -1:冻结用户,1:正常
String isLock = HGXSUtils.XsUser.convertIsLock(dcUserList.getStatus());
updateMap.put(User.FIELD_IS_LOCKED, isLock);
updateMap.put(User.FIELD_REC_REVISOR, "System");
updateMap.put(User.FIELD_REC_REVISE_TIME, DateUtils.shortDateTime());
dao.update(HgXsSqlConstant.HgXsUser.UPDATE_DC_USER, updateMap);
......
......@@ -123,6 +123,7 @@
MOBILE = #mobile#,
EMAIL = #email#,
ID_CARD = #idCard#,
IS_LOCKED = #isLocked#,
REC_REVISOR = #recRevisor#,
REC_REVISE_TIME = #recReviseTime#
WHERE LOGIN_NAME = #loginName#
......
......@@ -206,9 +206,11 @@ public class HGXSTools {
* @param userName
* @param gender
* @param mobile
* @param idCard
* @param isLock
*/
public static void addUser(String accountCode, String userId, String userName, String gender, String mobile,
String idCard) throws Exception {
String idCard, String isLock) throws Exception {
Map inInfoRowMap = new HashMap();
inInfoRowMap.put("userId", userId);
inInfoRowMap.put("loginName", userId);
......
......@@ -48,6 +48,16 @@ public class HGXSUtils {
}
}
/**
* 转换锁定状态
*
* @param status
* @return
*/
public static String convertIsLock(String status) {
// -1:冻结用户,1:正常
return "冻结".equals(status) ? "-1" : "1";
}
}
/**
......
package com.baosight.xservices.xs.service;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sc.util.HGSCUtil;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.iplat4j.core.ei.EiBlock;
......@@ -105,11 +104,12 @@ public class ServiceXS0102 extends ServiceEPBase implements LoginConstants {
}
}
String userGroupEname = (String) inInfoRowMap.get("groupName");
String isLocked = (String) inInfoRowMap.get("isLocked");
inInfoRowMap.put("userGroupEname", userGroupEname);
inInfoRowMap.put("password", password);
inInfoRowMap.put("rePass", rePass);
inInfoRowMap.put("status", "1");
inInfoRowMap.put("isLocked", "1");
inInfoRowMap.put("isLocked", StringUtils.isBlank(isLocked) ? "1" : isLocked);
inInfoRowMap.put("recCreator", UserSession.getUser().getUsername());
inInfoRowMap.put("recCreateTime", DateUtils.curDateTimeStr14());
String accountExpireDays = StringUtils.defaultIfEmpty(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment