| | |
| | | @Autowired |
| | | private IFileInnerServiceSMO fileInnerServiceSMOImpl; |
| | | |
| | | |
| | | @Override |
| | | public String getServiceCode() { |
| | | return ServiceCodeConstant.SERVICE_CODE_USER_STAFF_ADD; |
| | |
| | | return HttpMethod.POST; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public int getOrder() { |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) { |
| | | //获取数据上下文对象 |
| | | |
| | | |
| | | //获取数据上下文对象 |
| | | Assert.jsonObjectHaveKey(reqJson, "storeId", "请求参数中未包含storeId 节点,请确认"); |
| | | Assert.jsonObjectHaveKey(reqJson, "storeTypeCd", "请求参数中未包含storeTypeCd 节点,请确认"); |
| | | //判断请求报文中包含 userId 并且 不为-1时 将已有用户添加为员工,反之,则添加用户再将用户添加为员工 |
| | | String userId = ""; |
| | | String oldUserId = ""; |
| | | |
| | | String relCd = reqJson.getString("relCd");//员工 组织 岗位 |
| | | |
| | | if (!reqJson.containsKey("userId") || "-1".equals(reqJson.getString("userId"))) { |
| | | //将userId 强制写成-1 |
| | | oldUserId = "-1"; |
| | |
| | | reqJson.put("userId", userId); |
| | | //添加用户 |
| | | userBMOImpl.addUser(reqJson, context); |
| | | |
| | | } |
| | | |
| | | reqJson.put("userId", userId); |
| | | reqJson.put("relCd", "-1".equals(oldUserId) ? StoreUserRelConstant.REL_COMMON : StoreUserRelConstant.REL_ADMIN); |
| | | |
| | | userBMOImpl.addStaff(reqJson, context); |
| | | |
| | | //重写 员工岗位 |
| | | reqJson.put("relCd", relCd); |
| | | userBMOImpl.addStaffOrg(reqJson, context); |
| | | |
| | | if (reqJson.containsKey("photo") && !StringUtils.isEmpty(reqJson.getString("photo"))) { |
| | | FileDto fileDto = new FileDto(); |
| | | fileDto.setFileId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_file_id)); |
| | |
| | | String fileName = fileInnerServiceSMOImpl.saveFile(fileDto); |
| | | reqJson.put("photoId", fileDto.getFileId()); |
| | | reqJson.put("fileSaveName", fileName); |
| | | |
| | | JSONObject businessUnit = new JSONObject(); |
| | | businessUnit.put("fileRelId", "-1"); |
| | | businessUnit.put("relTypeCd", "12000"); |
| | |
| | | FileRelPo fileRelPo = BeanConvertUtil.covertBean(businessUnit, FileRelPo.class); |
| | | super.insert(context, fileRelPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FILE_REL); |
| | | } |
| | | |
| | | commit(context); |
| | | |
| | | //如果不成功直接返回 |
| | | if (context.getResponseEntity().getStatusCode() != HttpStatus.OK) { |
| | | return; |
| | | } |
| | | |
| | | //赋权 |
| | | privilegeUserDefault(context, reqJson); |
| | | } |
| | | |
| | | /** |
| | |
| | | HttpEntity<String> httpEntity = new HttpEntity<String>(paramInObj.toJSONString(), header); |
| | | doRequest(dataFlowContext, appService, httpEntity); |
| | | responseEntity = dataFlowContext.getResponseEntity(); |
| | | |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | dataFlowContext.setResponseEntity(responseEntity); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |