| | |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.annotation.Java110Transactional; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.AbstractServiceCmdListener; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.core.factory.AuthenticationFactory; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | |
| | | import com.java110.utils.util.StringUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import java.util.List; |
| | |
| | | * 服务注册功能迁移 |
| | | */ |
| | | @Java110Cmd(serviceCode = "owner.ownerRegister") |
| | | public class OwnerRegisterCmd extends AbstractServiceCmdListener { |
| | | public class OwnerRegisterCmd extends Cmd { |
| | | private final static Logger logger = LoggerFactory.getLogger(OwnerRegisterCmd.class); |
| | | @Autowired |
| | | private IUserV1InnerServiceSMO userV1InnerServiceSMOImpl; |
| | |
| | | } |
| | | //添加小区楼 |
| | | addOwnerAppUser(reqJson, ownerDtos); |
| | | registerUser(reqJson); |
| | | registerUser(reqJson, ownerDtos); |
| | | |
| | | cmdDataFlowContext.setResponseEntity(ResultVo.success()); |
| | | } |
| | | |
| | | private void addOwnerAppUser(JSONObject paramInJson, List<OwnerDto> ownerDtos) { |
| | | List<CommunityDto> communityDtos = null; |
| | | CommunityDto tmpCommunityDto = null; |
| | | String communityName = "无"; |
| | | |
| | | if (ownerDtos == null || ownerDtos.size() < 1) { |
| | | CommunityDto communityDto = new CommunityDto(); |
| | | communityDto.setState("1100"); |
| | | communityDto.setCommunityId(paramInJson.getString("defaultCommunityId")); |
| | | communityDto.setPage(1); |
| | | communityDto.setRow(1); |
| | | communityDtos = communityInnerServiceSMOImpl.queryCommunitys(communityDto); |
| | | if (communityDtos != null && communityDtos.size() > 0) { |
| | | communityName = communityDtos.get(0).getName(); |
| | | } |
| | | OwnerAppUserPo ownerAppUserPo = BeanConvertUtil.covertBean(paramInJson, OwnerAppUserPo.class); |
| | | //状态类型,10000 审核中,12000 审核成功,13000 审核失败 |
| | | ownerAppUserPo.setState("12000"); |
| | | ownerAppUserPo.setAppTypeCd("10010"); |
| | | ownerAppUserPo.setAppUserId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_appUserId)); |
| | | ownerAppUserPo.setMemberId("-1"); |
| | | ownerAppUserPo.setCommunityName("-1"); |
| | | ownerAppUserPo.setCommunityId("无"); |
| | | ownerAppUserPo.setCommunityName(communityName); |
| | | ownerAppUserPo.setCommunityId(paramInJson.getString("defaultCommunityId")); |
| | | ownerAppUserPo.setAppUserName("游客"); |
| | | ownerAppUserPo.setIdCard("无"); |
| | | |
| | |
| | | } |
| | | return; |
| | | } |
| | | List<CommunityDto> communityDtos = null; |
| | | CommunityDto tmpCommunityDto = null; |
| | | |
| | | OwnerAppUserPo ownerAppUserPo = null; |
| | | for (OwnerDto ownerDto : ownerDtos) { |
| | | CommunityDto communityDto = new CommunityDto(); |
| | | communityDto.setState("1100"); |
| | | communityDto.setCommunityId(ownerDto.getCommunityId()); |
| | | communityDtos = communityInnerServiceSMOImpl.queryCommunitys(communityDto); |
| | | Assert.listOnlyOne(communityDtos, "手机号对应业主未查询到小区信息,请联系物业"); |
| | | if (communityDtos == null || communityDtos.size() < 1) { |
| | | continue; |
| | | } |
| | | tmpCommunityDto = communityDtos.get(0); |
| | | ownerAppUserPo = BeanConvertUtil.covertBean(paramInJson, OwnerAppUserPo.class); |
| | | //状态类型,10000 审核中,12000 审核成功,13000 审核失败 |
| | |
| | | * |
| | | * @param paramObj |
| | | */ |
| | | public void registerUser(JSONObject paramObj) { |
| | | Assert.jsonObjectHaveKey(paramObj, "name", "请求参数中未包含name 节点,请确认"); |
| | | Assert.jsonObjectHaveKey(paramObj, "tel", "请求参数中未包含tel 节点,请确认"); |
| | | Assert.jsonObjectHaveKey(paramObj, "password", "请求参数中未包含password 节点,请确认"); |
| | | public void registerUser(JSONObject paramObj, List<OwnerDto> ownerDtos) { |
| | | |
| | | if (paramObj.containsKey("email") && !StringUtil.isEmpty(paramObj.getString("email"))) { |
| | | Assert.isEmail(paramObj, "email", "不是有效的邮箱格式"); |
| | | } |
| | |
| | | userPassword = AuthenticationFactory.passwdMd5(userPassword); |
| | | paramObj.put("password", userPassword); |
| | | |
| | | |
| | | String tel = paramObj.getString("link"); |
| | | String name = tel; |
| | | if (ownerDtos != null && ownerDtos.size() > 0) { |
| | | name = ownerDtos.get(0).getName(); |
| | | } |
| | | UserPo userPo = BeanConvertUtil.covertBean(paramObj, UserPo.class); |
| | | userPo.setName(name); |
| | | userPo.setTel(tel); |
| | | int flag = userV1InnerServiceSMOImpl.saveUser(userPo); |
| | | if (flag < 1) { |
| | | throw new CmdException("注册失败"); |