| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.Environment; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.AbstractServiceCmdListener; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) { |
| | | |
| | | Environment.isDevEnv(); |
| | | |
| | | if (!reqJson.containsKey("staffId")) { |
| | | reqJson.put("staffId", reqJson.getString("userId")); |
| | | } |
| | | |
| | | Assert.jsonObjectHaveKey(reqJson, "staffId", "请求参数中未包含staffId 节点,请确认"); |
| | | |
| | | StoreUserDto storeUserDt = new StoreUserDto(); |
| | | storeUserDt.setUserId(reqJson.getString("userId")); |
| | | List<StoreUserDto> storeUserDts = storeUserV1InnerServiceSMOImpl.queryStoreUsers(storeUserDt); |
| | | Assert.listOnlyOne(storeUserDts, "查询员工商户错误!"); |
| | | |
| | | //首先判断是否为 运营或者开发 |
| | | //查询store 信息 |
| | | StoreDto storeDto = new StoreDto(); |
| | | storeDto.setStoreId(reqJson.getString("storeId")); |
| | | if (!reqJson.containsKey("storeId")) { |
| | | storeDto.setStoreId(storeUserDts.get(0).getStoreId()); |
| | | } else { |
| | | storeDto.setStoreId(reqJson.getString("storeId")); |
| | | } |
| | | List<StoreDto> storeDtos = storeV1InnerServiceSMOImpl.queryStores(storeDto); |
| | | |
| | | Assert.listOnlyOne(storeDtos, "商户不存在"); |
| | |
| | | modifyStaff(reqJson, cmdDataFlowContext); |
| | | JSONObject paramOut = new JSONObject(); |
| | | paramOut.put("pwd", reqJson.getString("pwd")); |
| | | paramOut.put("code",0); |
| | | paramOut.put("msg","成功"); |
| | | ResponseEntity<String> responseEntity = new ResponseEntity<>(paramOut.toJSONString(), HttpStatus.OK); |
| | | cmdDataFlowContext.setResponseEntity(responseEntity); |
| | | |
| | |
| | | |
| | | UserDto userDto = new UserDto(); |
| | | userDto.setStatusCd("0"); |
| | | userDto.setUserId(paramObj.getString("userId")); |
| | | userDto.setUserId(paramObj.getString("staffId")); |
| | | List<UserDto> userDtos = userInnerServiceSMOImpl.getUserHasPwd(userDto); |
| | | |
| | | Assert.listOnlyOne(userDtos, "数据错误查询到多条用户信息或单条"); |
| | | |
| | | JSONObject userInfo = JSONObject.parseObject(JSONObject.toJSONString(userDtos.get(0))); |
| | | String pwd = GenerateCodeFactory.getRandomCode(6); |
| | | userInfo.putAll(paramObj); |
| | | //userInfo.putAll(paramObj); |
| | | userInfo.put("password", AuthenticationFactory.passwdMd5(pwd)); |
| | | paramObj.put("pwd", pwd); |
| | | |