| | |
| | | import com.java110.api.smo.DefaultAbstractComponentSMO; |
| | | import com.java110.core.component.BaseComponentSMO; |
| | | import com.java110.core.context.IPageData; |
| | | import com.java110.dto.basePrivilege.BasePrivilegeDto; |
| | | import com.java110.dto.org.OrgStaffRelDto; |
| | | import com.java110.entity.component.ComponentValidateResult; |
| | | import com.java110.api.smo.IStaffServiceSMO; |
| | | import com.java110.intf.community.IMenuInnerServiceSMO; |
| | | import com.java110.intf.user.IOrgStaffRelInnerServiceSMO; |
| | | import com.java110.utils.constant.ServiceConstant; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 员工服务类 |
| | |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | | |
| | | @Autowired |
| | | private IOrgStaffRelInnerServiceSMO iOrgStaffRelInnerServiceSMO; |
| | | |
| | | @Autowired |
| | | private IMenuInnerServiceSMO menuInnerServiceSMOImpl; |
| | | |
| | | /** |
| | | * 添加员工信息 |
| | |
| | | reqJson.put("name", reqJson.getString("username")); |
| | | reqJson.put("storeId", storeId); |
| | | reqJson.put("storeTypeCd", storeTypeCd); |
| | | responseEntity = this.callCenterService(restTemplate, pd, reqJson.toJSONString(), ServiceConstant.SERVICE_API_URL + "/api/user.staff.add", HttpMethod.POST); |
| | | responseEntity = this.callCenterService(restTemplate, pd, reqJson.toJSONString(), "user.staff.add", HttpMethod.POST); |
| | | return responseEntity; |
| | | } |
| | | |
| | |
| | | |
| | | Assert.jsonObjectHaveKey(pd.getReqData(), "page", "请求报文中未包含page节点"); |
| | | Assert.jsonObjectHaveKey(pd.getReqData(), "row", "请求报文中未包含rows节点"); |
| | | |
| | | JSONObject paramIn = JSONObject.parseObject(pd.getReqData()); |
| | | Assert.isInteger(paramIn.getString("page"), "page不是数字"); |
| | | Assert.isInteger(paramIn.getString("row"), "rows不是数字"); |
| | | int page = Integer.parseInt(paramIn.getString("page")); |
| | | int rows = Integer.parseInt(paramIn.getString("row")); |
| | | String staffName = paramIn.getString("staffName"); |
| | | //2级别组织信息 |
| | | if (paramIn.containsKey("orgLevel") && paramIn.getString("orgLevel").equals("2")) { |
| | | //默认只查看当前归属组织架构 |
| | | BasePrivilegeDto basePrivilegeDto = new BasePrivilegeDto(); |
| | | basePrivilegeDto.setResource("/viewAllOrganization"); |
| | | basePrivilegeDto.setUserId(pd.getUserId()); |
| | | List<Map> privileges = menuInnerServiceSMOImpl.checkUserHasResource(basePrivilegeDto); |
| | | if (privileges.size() == 0) { |
| | | //查询员工所属二级组织架构 |
| | | OrgStaffRelDto orgStaffRelDto = new OrgStaffRelDto(); |
| | | orgStaffRelDto.setStaffId(pd.getUserId()); |
| | | List<OrgStaffRelDto> orgStaffRelDtos = iOrgStaffRelInnerServiceSMO.queryOrgInfoByStaffIds(orgStaffRelDto); |
| | | if (orgStaffRelDtos.size() > 0) { |
| | | paramIn.put("branchOrgId", orgStaffRelDtos.get(0).getCompanyId());//当前人虽归属的二级组织信息 |
| | | paramIn.put("parentOrgId", orgStaffRelDtos.get(0).getCompanyId());//当前人虽归属的二级组织信息 |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | if (rows > 50) { |
| | | return new ResponseEntity<String>("rows 数量不能大于50", HttpStatus.BAD_REQUEST); |
| | |
| | | paramIn.put("storeId", storeId); |
| | | //if (StringUtil.isEmpty(staffName)) { |
| | | responseEntity = this.callCenterService(restTemplate, pd, "", |
| | | ServiceConstant.SERVICE_API_URL + "/api/query.staff.infos" + super.mapToUrlParam(paramIn), HttpMethod.GET); |
| | | "query.staff.infos" + super.mapToUrlParam(paramIn), HttpMethod.GET); |
| | | /* } else { |
| | | responseEntity = this.callCenterService(restTemplate, pd, "", |
| | | ServiceConstant.SERVICE_API_URL + "/api/query.staff.byName?rows=" + rows + "&page=" + page + "&storeId=" + storeId + "&name=" + staffName, HttpMethod.GET); |
| | | "query.staff.byName?rows=" + rows + "&page=" + page + "&storeId=" + storeId + "&name=" + staffName, HttpMethod.GET); |
| | | }*/ |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | | return responseEntity; |
| | |
| | | paramIn.put("name", paramIn.getString("username")); |
| | | //修改用户信息 |
| | | responseEntity = this.callCenterService(restTemplate, pd, paramIn.toJSONString(), |
| | | ServiceConstant.SERVICE_API_URL + "/api/user.staff.modify", HttpMethod.POST); |
| | | "user.staff.modify", HttpMethod.POST); |
| | | return responseEntity; |
| | | } |
| | | |
| | |
| | | newParam.put("storeId", result.getStoreId()); |
| | | //修改用户信息 |
| | | responseEntity = this.callCenterService(restTemplate, pd, newParam.toJSONString(), |
| | | ServiceConstant.SERVICE_API_URL + "/api/user.staff.delete", HttpMethod.POST); |
| | | "user.staff.delete", HttpMethod.POST); |
| | | return responseEntity; |
| | | } |
| | | |
| | |
| | | String storeTypeCd = JSONObject.parseObject(responseEntity.getBody().toString()).getString("storeTypeCd"); |
| | | //修改用户信息 |
| | | responseEntity = this.callCenterService(restTemplate, pd, "", |
| | | ServiceConstant.SERVICE_API_URL + "/api/query.privilegeGroup.noAddPrivilegeGroup?userId=" |
| | | "query.privilegeGroup.noAddPrivilegeGroup?userId=" |
| | | + _paramObj.getString("userId") + "&storeId=" + storeId + "&storeTypeCd=" + storeTypeCd, |
| | | HttpMethod.GET); |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | |
| | | String storeTypeCd = JSONObject.parseObject(responseEntity.getBody().toString()).getString("storeTypeCd"); |
| | | //修改用户信息 |
| | | responseEntity = this.callCenterService(restTemplate, pd, "", |
| | | ServiceConstant.SERVICE_API_URL + "/api/query.privilege.noAddPrivilege?userId=" |
| | | "query.privilege.noAddPrivilege?userId=" |
| | | + _paramObj.getString("userId") + "&storeId=" + storeId + "&storeTypeCd=" + storeTypeCd, |
| | | HttpMethod.GET); |
| | | if (responseEntity.getStatusCode() != HttpStatus.OK) { |
| | |
| | | |
| | | //修改用户信息 |
| | | responseEntity = this.callCenterService(restTemplate, pd, _paramObj.toJSONString(), |
| | | ServiceConstant.SERVICE_API_URL + "/api/add.privilege.userPrivilege", |
| | | "add.privilege.userPrivilege", |
| | | HttpMethod.POST); |
| | | |
| | | return responseEntity; |
| | |
| | | |
| | | //修改用户信息 |
| | | responseEntity = this.callCenterService(restTemplate, pd, _paramObj.toJSONString(), |
| | | ServiceConstant.SERVICE_API_URL + "/api/delete.privilege.userPrivilege", |
| | | "delete.privilege.userPrivilege", |
| | | HttpMethod.POST); |
| | | |
| | | return responseEntity; |