| | |
| | | import com.java110.core.factory.AuthenticationFactory; |
| | | import com.java110.core.smo.user.IUserInnerServiceSMO; |
| | | import com.java110.dto.user.UserDto; |
| | | import com.java110.po.org.OrgStaffRelPo; |
| | | import com.java110.po.store.StoreUserPo; |
| | | import com.java110.po.store.StoreUserRelPo; |
| | | import com.java110.po.user.UserPo; |
| | | import com.java110.utils.cache.MappingCache; |
| | | import com.java110.utils.constant.BusinessTypeConstant; |
| | | import com.java110.utils.constant.CommonConstant; |
| | | import com.java110.utils.constant.MappingConstant; |
| | | import com.java110.utils.constant.UserLevelConstant; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Autowired |
| | | private IUserInnerServiceSMO userInnerServiceSMOImpl; |
| | | |
| | | public JSONObject addStaffOrg(JSONObject paramInJson) { |
| | | public void addStaffOrg(JSONObject paramInJson, DataFlowContext dataFlowContext) { |
| | | |
| | | 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); |
| | | 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")); |
| | | businessOrgStaffRels.add(businessOrgStaffRel); |
| | | business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessOrgStaffRel",businessOrgStaffRels); |
| | | |
| | | return business; |
| | | 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")); |
| | | OrgStaffRelPo orgStaffRelPo = BeanConvertUtil.covertBean(businessOrgStaffRel, OrgStaffRelPo.class); |
| | | super.insert(dataFlowContext, orgStaffRelPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_ORG_STAFF_REL); |
| | | } |
| | | |
| | | /** |
| | | * 添加员工 |
| | | * |
| | | * @param paramInJson |
| | | * @return |
| | | */ |
| | | public JSONObject addStaff(JSONObject paramInJson){ |
| | | public void addStaff(JSONObject paramInJson, DataFlowContext dataFlowContext) { |
| | | |
| | | 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); |
| | | 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")); |
| | | businessStoreUsers.add(businessStoreUser); |
| | | business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessStoreUser",businessStoreUsers); |
| | | businessStoreUser.put("storeId", paramInJson.getString("storeId")); |
| | | businessStoreUser.put("storeUserId", "-1"); |
| | | businessStoreUser.put("userId", paramInJson.getString("userId")); |
| | | businessStoreUser.put("relCd", paramInJson.getString("relCd")); |
| | | |
| | | return business; |
| | | StoreUserPo storeUserPo = BeanConvertUtil.covertBean(businessStoreUser, StoreUserPo.class); |
| | | super.insert(dataFlowContext, storeUserPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_STORE_USER); |
| | | } |
| | | |
| | | /** |
| | | * 添加用户 |
| | | * |
| | | * @param paramObj |
| | | */ |
| | | public JSONObject addUser(JSONObject paramObj, DataFlowContext dataFlowContext){ |
| | | public void 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"))) { |
| | |
| | | } |
| | | |
| | | |
| | | 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.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessUser",refreshParamIn(paramObj)); |
| | | |
| | | return business; |
| | | UserPo userPo = BeanConvertUtil.covertBean(refreshParamIn(paramObj), UserPo.class); |
| | | super.insert(dataFlowContext, userPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_USER_INFO); |
| | | } |
| | | |
| | | /** |
| | | * 注册用户 |
| | | * |
| | | * @param paramObj |
| | | */ |
| | | public void 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", "不是有效的邮箱格式"); |
| | | } |
| | | |
| | | //paramObj.put("userId","-1"); |
| | | paramObj.put("levelCd", UserLevelConstant.USER_LEVEL_ORDINARY); |
| | | //设置默认密码 |
| | | String userPassword = paramObj.getString("password"); |
| | | userPassword = AuthenticationFactory.passwdMd5(userPassword); |
| | | paramObj.put("password", userPassword); |
| | | |
| | | if (paramObj.containsKey("openId") && !"-1".equals(paramObj.getString("openId"))) { |
| | | JSONArray userAttr = new JSONArray(); |
| | | JSONObject userAttrObj = new JSONObject(); |
| | | userAttrObj.put("attrId", "-1"); |
| | | userAttrObj.put("specCd", "100201911001"); |
| | | userAttrObj.put("value", paramObj.getString("openId")); |
| | | userAttr.add(userAttrObj); |
| | | paramObj.put("businessUserAttr", userAttr); |
| | | } |
| | | |
| | | UserPo userPo = BeanConvertUtil.covertBean(paramObj, UserPo.class); |
| | | super.insert(dataFlowContext, userPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_USER_INFO); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 对请求报文处理 |
| | | * |
| | | * @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; |
| | | } |
| | | |
| | | public JSONObject modifyStaff(JSONObject paramObj, DataFlowContext dataFlowContext) { |
| | | public void modifyStaff(JSONObject paramObj, DataFlowContext dataFlowContext) { |
| | | //校验json 格式中是否包含 name,email,levelCd,tel |
| | | |
| | | JSONObject business = JSONObject.parseObject("{\"datas\":{}}"); |
| | | business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_MODIFY_USER_INFO); |
| | | 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", builderStaffInfo(paramObj, dataFlowContext)); |
| | | |
| | | return business; |
| | | UserPo userPo = BeanConvertUtil.covertBean(builderStaffInfo(paramObj, dataFlowContext), UserPo.class); |
| | | super.update(dataFlowContext, userPo, BusinessTypeConstant.BUSINESS_TYPE_MODIFY_USER_INFO); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | /** |
| | | * 删除商户 |
| | | * |
| | | * @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); |
| | | JSONArray businessStoreUsers = new JSONArray(); |
| | | JSONObject businessStoreUser = new JSONObject(); |
| | | businessStoreUser.put("storeId",paramInJson.getString("storeId")); |
| | | businessStoreUser.put("userId",paramInJson.getString("userId")); |
| | | businessStoreUsers.add(businessStoreUser); |
| | | business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessStoreUser",businessStoreUsers); |
| | | public void deleteStaff(JSONObject paramInJson, DataFlowContext dataFlowContext) { |
| | | |
| | | return business; |
| | | JSONObject businessStoreUser = new JSONObject(); |
| | | businessStoreUser.put("storeId", paramInJson.getString("storeId")); |
| | | businessStoreUser.put("userId", paramInJson.getString("userId")); |
| | | |
| | | |
| | | UserPo userPo = BeanConvertUtil.covertBean(businessStoreUser, UserPo.class); |
| | | super.delete(dataFlowContext, userPo, BusinessTypeConstant.BUSINESS_TYPE_DELETE_STORE_USER); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 删除商户 |
| | | * |
| | | * @param paramInJson |
| | | * @return |
| | | */ |
| | | public JSONObject deleteUser(JSONObject paramInJson) { |
| | | public void deleteUser(JSONObject paramInJson, DataFlowContext dataFlowContext) { |
| | | //校验json 格式中是否包含 name,email,levelCd,tel |
| | | |
| | | |
| | | 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); |
| | | 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")); |
| | | |
| | | return business; |
| | | UserPo userPo = BeanConvertUtil.covertBean(businessStoreUser, UserPo.class); |
| | | super.delete(dataFlowContext, userPo, BusinessTypeConstant.BUSINESS_TYPE_REMOVE_USER_INFO); |
| | | |
| | | } |
| | | |