| | |
| | | import com.java110.dto.file.FileRelDto; |
| | | import com.java110.dto.org.OrgStaffRelDto; |
| | | import com.java110.dto.store.StoreUserDto; |
| | | import com.java110.dto.user.UserAttrDto; |
| | | import com.java110.dto.user.UserDto; |
| | | import com.java110.intf.common.IFileInnerServiceSMO; |
| | | import com.java110.intf.common.IFileRelInnerServiceSMO; |
| | | import com.java110.intf.store.IOrgStaffRelV1InnerServiceSMO; |
| | | import com.java110.intf.store.IStoreUserV1InnerServiceSMO; |
| | | import com.java110.intf.user.IOrgStaffRelInnerServiceSMO; |
| | | import com.java110.intf.user.IUserAttrV1InnerServiceSMO; |
| | | import com.java110.intf.user.IUserInnerServiceSMO; |
| | | import com.java110.intf.user.IUserV1InnerServiceSMO; |
| | | import com.java110.po.file.FileRelPo; |
| | | import com.java110.po.org.OrgStaffRelPo; |
| | | import com.java110.po.store.StoreUserPo; |
| | | import com.java110.po.user.UserAttrPo; |
| | | import com.java110.po.user.UserPo; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.utils.util.ListUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | ) |
| | | |
| | | @Java110ExampleDoc( |
| | | reqBody="{\"userId\":\"123123\",\"orgId\":\"102022091988250052\",\"orgName\":\"演示物业 / 件部\",\"username\":\"张三\",\"sex\":\"0\",\"email\":\"231@qq.com\",\"tel\":\"123\",\"address\":\"123\",\"relCd\":\"1000\",\"photo\":\"\",\"name\":\"张三\"}", |
| | | resBody="{'code':0,'msg':'成功'" |
| | | reqBody = "{\"userId\":\"123123\",\"orgId\":\"102022091988250052\",\"orgName\":\"演示物业 / 件部\",\"username\":\"张三\",\"sex\":\"0\",\"email\":\"231@qq.com\",\"tel\":\"123\",\"address\":\"123\",\"relCd\":\"1000\",\"photo\":\"\",\"name\":\"张三\"}", |
| | | resBody = "{'code':0,'msg':'成功'" |
| | | ) |
| | | |
| | | @Java110Cmd(serviceCode = "user.staff.modify") |
| | |
| | | @Autowired |
| | | private IStoreUserV1InnerServiceSMO storeUserV1InnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IUserAttrV1InnerServiceSMO userAttrV1InnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | Assert.jsonObjectHaveKey(reqJson, "staffId", "请求参数中未包含员工 节点,请确认"); |
| | |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | if (reqJson.containsKey("photo") && !StringUtils.isEmpty(reqJson.getString("photo"))) { |
| | | |
| | | if(reqJson.getString("photo").length()> 200){ |
| | | if (reqJson.getString("photo").length() > 200) { |
| | | FileDto fileDto = new FileDto(); |
| | | fileDto.setFileId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_file_id)); |
| | | fileDto.setFileName(fileDto.getFileId()); |
| | |
| | | fileDto.setCommunityId(reqJson.getString("communityId")); |
| | | String fileName = fileInnerServiceSMOImpl.saveFile(fileDto); |
| | | |
| | | reqJson.put("photo",fileName); |
| | | reqJson.put("photo", fileName); |
| | | } |
| | | |
| | | FileRelDto fileRelDto = new FileRelDto(); |
| | |
| | | UserDto userDto = new UserDto(); |
| | | userDto.setTel(userPo.getTel()); |
| | | userDto.setUserFlag("1"); |
| | | userDto.setLevelCd("01"); //员工 |
| | | userDto.setLevelCd(UserDto.LEVEL_CD_STAFF); //员工 |
| | | List<UserDto> users = userInnerServiceSMOImpl.getUsers(userDto); |
| | | if (users != null && users.size() > 0) { |
| | | if (!ListUtil.isNull(users)) { |
| | | for (UserDto user : users) { |
| | | if (!user.getUserId().equals(userPo.getUserId())) { |
| | | throw new IllegalArgumentException("员工手机号不能重复,请重新输入"); |
| | |
| | | if (flag < 1) { |
| | | throw new CmdException("保存用户异常"); |
| | | } |
| | | OrgStaffRelDto orgStaffRelDto = new OrgStaffRelDto(); |
| | | orgStaffRelDto.setStaffId(userPo.getUserId()); |
| | | List<OrgStaffRelDto> orgStaffRelDtoList = orgStaffRelInnerServiceSMOImpl.queryOrgInfoByStaffIds(orgStaffRelDto); |
| | | |
| | | if (orgStaffRelDtoList == null || orgStaffRelDtoList.size() < 1) { |
| | | return; |
| | | } |
| | | OrgStaffRelPo orgStaffRelPo = new OrgStaffRelPo(); |
| | | orgStaffRelPo.setRelCd(paramObj.getString("relCd")); |
| | | orgStaffRelPo.setRelId(orgStaffRelDtoList.get(0).getRelId()); |
| | | orgStaffRelPo.setOrgId(paramObj.getString("orgId")); |
| | | |
| | | flag = orgStaffRelV1InnerServiceSMOImpl.updateOrgStaffRel(orgStaffRelPo); |
| | | if (flag < 1) { |
| | | throw new CmdException("保存员工 失败"); |
| | | } |
| | | //todo 修改身份证 |
| | | updateStaffIdCard(users.get(0),paramObj); |
| | | |
| | | StoreUserDto storeUserDto = new StoreUserDto(); |
| | | storeUserDto.setUserId(userPo.getUserId()); |
| | | List<StoreUserDto> storeUserDtos = storeUserV1InnerServiceSMOImpl.queryStoreUsers(storeUserDto); |
| | | |
| | | if (storeUserDtos == null || storeUserDtos.size() < 1) { |
| | | if (ListUtil.isNull(storeUserDtos)) { |
| | | return; |
| | | } |
| | | |
| | | StoreUserPo storeUserPo = new StoreUserPo(); |
| | | storeUserPo.setRelCd(paramObj.getString("relCd")); |
| | | storeUserPo.setStoreUserId(storeUserDtos.get(0).getStoreUserId()); |
| | |
| | | if (flag < 1) { |
| | | throw new CmdException("保存员工 失败"); |
| | | } |
| | | |
| | | OrgStaffRelDto orgStaffRelDto = new OrgStaffRelDto(); |
| | | orgStaffRelDto.setStaffId(userPo.getUserId()); |
| | | List<OrgStaffRelDto> orgStaffRelDtos = orgStaffRelInnerServiceSMOImpl.queryOrgInfoByStaffIds(orgStaffRelDto); |
| | | |
| | | if (ListUtil.isNull(orgStaffRelDtos)) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | OrgStaffRelPo orgStaffRelPo = new OrgStaffRelPo(); |
| | | orgStaffRelPo.setRelCd(paramObj.getString("relCd")); |
| | | orgStaffRelPo.setRelId(orgStaffRelDtos.get(0).getRelId()); |
| | | orgStaffRelPo.setOrgId(paramObj.getString("orgId")); |
| | | |
| | | flag = orgStaffRelV1InnerServiceSMOImpl.updateOrgStaffRel(orgStaffRelPo); |
| | | if (flag < 1) { |
| | | throw new CmdException("保存员工 失败"); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 修改员工身份证号 |
| | | * @param userDto |
| | | * @param paramObj |
| | | */ |
| | | private void updateStaffIdCard(UserDto userDto, JSONObject paramObj) { |
| | | |
| | | if (!paramObj.containsKey("idCard")) { |
| | | return; |
| | | } |
| | | |
| | | UserAttrDto userAttrDto = new UserAttrDto(); |
| | | userAttrDto.setUserId(userDto.getUserId()); |
| | | userAttrDto.setSpecCd(UserAttrDto.SPEC_ID_CARD); |
| | | List<UserAttrDto> userAttrDtos = userAttrV1InnerServiceSMOImpl.queryUserAttrs(userAttrDto); |
| | | |
| | | if(!ListUtil.isNull(userAttrDtos)){ |
| | | UserAttrPo userAttrPo = new UserAttrPo(); |
| | | userAttrPo.setAttrId(userAttrDtos.get(0).getAttrId()); |
| | | userAttrV1InnerServiceSMOImpl.deleteUserAttr(userAttrPo); |
| | | } |
| | | |
| | | |
| | | String idCard = paramObj.getString("idCard"); |
| | | if (StringUtil.isEmpty(idCard)) { |
| | | return; |
| | | } |
| | | |
| | | UserAttrPo userAttrPo = new UserAttrPo(); |
| | | userAttrPo.setAttrId(GenerateCodeFactory.getAttrId()); |
| | | userAttrPo.setSpecCd(UserAttrDto.SPEC_ID_CARD); |
| | | userAttrPo.setUserId(userDto.getUserId()); |
| | | userAttrPo.setValue(idCard); |
| | | |
| | | userAttrV1InnerServiceSMOImpl.saveUserAttr(userAttrPo); |
| | | } |
| | | |
| | | |