|
|
@@ -38,58 +38,60 @@ public class UserBMOImpl extends ApiBaseBMO implements IUserBMO {
|
|
|
|
|
|
JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
|
|
|
business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_ORG_STAFF_REL);
|
|
|
- business.put(CommonConstant.HTTP_SEQ,1);
|
|
|
- business.put(CommonConstant.HTTP_INVOKE_MODEL,CommonConstant.HTTP_INVOKE_MODEL_S);
|
|
|
+ business.put(CommonConstant.HTTP_SEQ, 1);
|
|
|
+ business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
|
|
|
JSONArray businessOrgStaffRels = new JSONArray();
|
|
|
JSONObject businessOrgStaffRel = new JSONObject();
|
|
|
- businessOrgStaffRel.put("relId","-1");
|
|
|
- businessOrgStaffRel.put("storeId",paramInJson.getString("storeId"));
|
|
|
- businessOrgStaffRel.put("staffId",paramInJson.getString("userId"));
|
|
|
- businessOrgStaffRel.put("orgId",paramInJson.getString("orgId"));
|
|
|
- businessOrgStaffRel.put("relCd",paramInJson.getString("relCd"));
|
|
|
+ businessOrgStaffRel.put("relId", "-1");
|
|
|
+ businessOrgStaffRel.put("storeId", paramInJson.getString("storeId"));
|
|
|
+ businessOrgStaffRel.put("staffId", paramInJson.getString("userId"));
|
|
|
+ businessOrgStaffRel.put("orgId", paramInJson.getString("orgId"));
|
|
|
+ businessOrgStaffRel.put("relCd", paramInJson.getString("relCd"));
|
|
|
businessOrgStaffRels.add(businessOrgStaffRel);
|
|
|
- business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessOrgStaffRel",businessOrgStaffRels);
|
|
|
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessOrgStaffRel", businessOrgStaffRels);
|
|
|
|
|
|
return business;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 添加员工
|
|
|
+ *
|
|
|
* @param paramInJson
|
|
|
* @return
|
|
|
*/
|
|
|
- public JSONObject addStaff(JSONObject paramInJson){
|
|
|
+ public JSONObject addStaff(JSONObject paramInJson) {
|
|
|
|
|
|
JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
|
|
|
business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_STORE_USER);
|
|
|
- business.put(CommonConstant.HTTP_SEQ,1);
|
|
|
- business.put(CommonConstant.HTTP_INVOKE_MODEL,CommonConstant.HTTP_INVOKE_MODEL_S);
|
|
|
+ business.put(CommonConstant.HTTP_SEQ, 1);
|
|
|
+ business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
|
|
|
JSONArray businessStoreUsers = new JSONArray();
|
|
|
JSONObject businessStoreUser = new JSONObject();
|
|
|
- businessStoreUser.put("storeId",paramInJson.getString("storeId"));
|
|
|
- businessStoreUser.put("storeUserId","-1");
|
|
|
- businessStoreUser.put("userId",paramInJson.getString("userId"));
|
|
|
- businessStoreUser.put("relCd",paramInJson.getString("relCd"));
|
|
|
+ businessStoreUser.put("storeId", paramInJson.getString("storeId"));
|
|
|
+ businessStoreUser.put("storeUserId", "-1");
|
|
|
+ businessStoreUser.put("userId", paramInJson.getString("userId"));
|
|
|
+ businessStoreUser.put("relCd", paramInJson.getString("relCd"));
|
|
|
businessStoreUsers.add(businessStoreUser);
|
|
|
- business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessStoreUser",businessStoreUsers);
|
|
|
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessStoreUser", businessStoreUsers);
|
|
|
|
|
|
return business;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 添加用户
|
|
|
+ *
|
|
|
* @param paramObj
|
|
|
*/
|
|
|
- public JSONObject addUser(JSONObject paramObj, DataFlowContext dataFlowContext){
|
|
|
+ public JSONObject addUser(JSONObject paramObj, DataFlowContext dataFlowContext) {
|
|
|
|
|
|
//校验json 格式中是否包含 name,email,levelCd,tel
|
|
|
- Assert.jsonObjectHaveKey(paramObj,"name","请求参数中未包含name 节点,请确认");
|
|
|
+ Assert.jsonObjectHaveKey(paramObj, "name", "请求参数中未包含name 节点,请确认");
|
|
|
//Assert.jsonObjectHaveKey(paramObj,"email","请求参数中未包含email 节点,请确认");
|
|
|
- Assert.jsonObjectHaveKey(paramObj,"tel","请求参数中未包含tel 节点,请确认");
|
|
|
- Assert.jsonObjectHaveKey(paramObj,"orgId", "请求报文格式错误或未包含部门信息");
|
|
|
- Assert.jsonObjectHaveKey(paramObj,"address", "请求报文格式错误或未包含地址信息");
|
|
|
- Assert.jsonObjectHaveKey(paramObj,"sex", "请求报文格式错误或未包含性别信息");
|
|
|
- Assert.jsonObjectHaveKey(paramObj,"relCd", "请求报文格式错误或未包含员工角色");
|
|
|
+ Assert.jsonObjectHaveKey(paramObj, "tel", "请求参数中未包含tel 节点,请确认");
|
|
|
+ Assert.jsonObjectHaveKey(paramObj, "orgId", "请求报文格式错误或未包含部门信息");
|
|
|
+ Assert.jsonObjectHaveKey(paramObj, "address", "请求报文格式错误或未包含地址信息");
|
|
|
+ Assert.jsonObjectHaveKey(paramObj, "sex", "请求报文格式错误或未包含性别信息");
|
|
|
+ Assert.jsonObjectHaveKey(paramObj, "relCd", "请求报文格式错误或未包含员工角色");
|
|
|
|
|
|
|
|
|
if (paramObj.containsKey("email") && !StringUtil.isEmpty(paramObj.getString("email"))) {
|
|
|
@@ -99,29 +101,65 @@ public class UserBMOImpl extends ApiBaseBMO implements IUserBMO {
|
|
|
|
|
|
JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
|
|
|
business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_USER_INFO);
|
|
|
- business.put(CommonConstant.HTTP_SEQ,1);
|
|
|
- business.put(CommonConstant.HTTP_INVOKE_MODEL,CommonConstant.HTTP_INVOKE_MODEL_S);
|
|
|
+ business.put(CommonConstant.HTTP_SEQ, 1);
|
|
|
+ business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
|
|
|
|
|
|
- business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessUser",refreshParamIn(paramObj));
|
|
|
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessUser", refreshParamIn(paramObj));
|
|
|
|
|
|
return business;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 注册用户
|
|
|
+ *
|
|
|
+ * @param paramObj
|
|
|
+ */
|
|
|
+ public JSONObject registerUser(JSONObject paramObj, DataFlowContext dataFlowContext) {
|
|
|
+
|
|
|
+ //校验json 格式中是否包含 name,email,levelCd,tel
|
|
|
+ Assert.jsonObjectHaveKey(paramObj, "name", "请求参数中未包含name 节点,请确认");
|
|
|
+ //Assert.jsonObjectHaveKey(paramObj,"email","请求参数中未包含email 节点,请确认");
|
|
|
+ Assert.jsonObjectHaveKey(paramObj, "tel", "请求参数中未包含tel 节点,请确认");
|
|
|
+ Assert.jsonObjectHaveKey(paramObj, "password", "请求参数中未包含password 节点,请确认");
|
|
|
+
|
|
|
+
|
|
|
+ if (paramObj.containsKey("email") && !StringUtil.isEmpty(paramObj.getString("email"))) {
|
|
|
+ Assert.isEmail(paramObj, "email", "不是有效的邮箱格式");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
|
|
|
+ business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_USER_INFO);
|
|
|
+ business.put(CommonConstant.HTTP_SEQ, 1);
|
|
|
+ business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
|
|
|
+
|
|
|
+ //paramObj.put("userId","-1");
|
|
|
+ paramObj.put("levelCd", UserLevelConstant.USER_LEVEL_ORDINARY);
|
|
|
+ //设置默认密码
|
|
|
+ String userPassword = paramObj.getString("password");
|
|
|
+ userPassword = AuthenticationFactory.passwdMd5(userPassword);
|
|
|
+ paramObj.put("password", userPassword);
|
|
|
+
|
|
|
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessUser", paramObj);
|
|
|
+
|
|
|
+ return business;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 对请求报文处理
|
|
|
+ *
|
|
|
* @param paramObj
|
|
|
* @return
|
|
|
*/
|
|
|
- private JSONObject refreshParamIn(JSONObject paramObj){
|
|
|
+ private JSONObject refreshParamIn(JSONObject paramObj) {
|
|
|
//paramObj.put("userId","-1");
|
|
|
paramObj.put("levelCd", UserLevelConstant.USER_LEVEL_STAFF);
|
|
|
//设置默认密码
|
|
|
String staffDefaultPassword = MappingCache.getValue(MappingConstant.KEY_STAFF_DEFAULT_PASSWORD);
|
|
|
- Assert.hasLength(staffDefaultPassword,"映射表中未设置员工默认密码,请检查"+MappingConstant.KEY_STAFF_DEFAULT_PASSWORD);
|
|
|
+ Assert.hasLength(staffDefaultPassword, "映射表中未设置员工默认密码,请检查" + MappingConstant.KEY_STAFF_DEFAULT_PASSWORD);
|
|
|
staffDefaultPassword = AuthenticationFactory.passwdMd5(staffDefaultPassword);
|
|
|
- paramObj.put("password",staffDefaultPassword);
|
|
|
+ paramObj.put("password", staffDefaultPassword);
|
|
|
return paramObj;
|
|
|
}
|
|
|
|
|
|
@@ -167,20 +205,21 @@ public class UserBMOImpl extends ApiBaseBMO implements IUserBMO {
|
|
|
|
|
|
/**
|
|
|
* 删除商户
|
|
|
+ *
|
|
|
* @param paramInJson
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject deleteStaff(JSONObject paramInJson) {
|
|
|
JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
|
|
|
business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_DELETE_STORE_USER);
|
|
|
- business.put(CommonConstant.HTTP_SEQ,1);
|
|
|
- business.put(CommonConstant.HTTP_INVOKE_MODEL,CommonConstant.HTTP_INVOKE_MODEL_S);
|
|
|
+ business.put(CommonConstant.HTTP_SEQ, 1);
|
|
|
+ business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
|
|
|
JSONArray businessStoreUsers = new JSONArray();
|
|
|
JSONObject businessStoreUser = new JSONObject();
|
|
|
- businessStoreUser.put("storeId",paramInJson.getString("storeId"));
|
|
|
- businessStoreUser.put("userId",paramInJson.getString("userId"));
|
|
|
+ businessStoreUser.put("storeId", paramInJson.getString("storeId"));
|
|
|
+ businessStoreUser.put("userId", paramInJson.getString("userId"));
|
|
|
businessStoreUsers.add(businessStoreUser);
|
|
|
- business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessStoreUser",businessStoreUsers);
|
|
|
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessStoreUser", businessStoreUsers);
|
|
|
|
|
|
return business;
|
|
|
|
|
|
@@ -188,6 +227,7 @@ public class UserBMOImpl extends ApiBaseBMO implements IUserBMO {
|
|
|
|
|
|
/**
|
|
|
* 删除商户
|
|
|
+ *
|
|
|
* @param paramInJson
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -197,11 +237,11 @@ public class UserBMOImpl extends ApiBaseBMO implements IUserBMO {
|
|
|
|
|
|
JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
|
|
|
business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_REMOVE_USER_INFO);
|
|
|
- business.put(CommonConstant.HTTP_SEQ,1);
|
|
|
- business.put(CommonConstant.HTTP_INVOKE_MODEL,CommonConstant.HTTP_INVOKE_MODEL_S);
|
|
|
+ business.put(CommonConstant.HTTP_SEQ, 1);
|
|
|
+ business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
|
|
|
JSONObject businessStoreUser = new JSONObject();
|
|
|
- businessStoreUser.put("userId",paramInJson.getString("userId"));
|
|
|
- business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessUser",businessStoreUser);
|
|
|
+ businessStoreUser.put("userId", paramInJson.getString("userId"));
|
|
|
+ business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessUser", businessStoreUser);
|
|
|
|
|
|
return business;
|
|
|
|