| | |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.dto.owner.OwnerAttrDto; |
| | | import com.java110.dto.owner.OwnerDto; |
| | | import com.java110.intf.user.IOwnerAttrInnerServiceSMO; |
| | | import com.java110.intf.user.IOwnerV1InnerServiceSMO; |
| | | import com.java110.po.owner.OwnerAttrPo; |
| | | import com.java110.po.owner.OwnerPo; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpEntity; |
| | |
| | | |
| | | @Autowired |
| | | private IOwnerAttrInnerServiceSMO ownerAttrInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOwnerV1InnerServiceSMO ownerV1InnerServiceSMOImpl; |
| | | |
| | | public static final String DEFAULT_COMMUNITY_ID = "123"; //特殊化需求 这里写死 |
| | | |
| | | @Autowired |
| | | private OutRestTemplate outRestTemplate; |
| | |
| | | |
| | | /** |
| | | * 添加业主 |
| | | * |
| | | * @param reqJson |
| | | * @return |
| | | */ |
| | | private String saveOwner(JSONObject reqJson) { |
| | | |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.add("Authorization","Bearer "+reqJson.getString("token")); |
| | | headers.add("Authorization", "Bearer " + reqJson.getString("token")); |
| | | |
| | | HttpEntity httpEntity = new HttpEntity("",headers); |
| | | HttpEntity httpEntity = new HttpEntity("", headers); |
| | | |
| | | ResponseEntity<String> userInfo = outRestTemplate.exchange(getUserInfo+"?userId="+reqJson.getString("userId"), HttpMethod.GET,httpEntity,String.class); |
| | | ResponseEntity<String> userInfo = outRestTemplate.exchange(getUserInfo + "?userId=" + reqJson.getString("userId"), HttpMethod.GET, httpEntity, String.class); |
| | | |
| | | |
| | | return ""; |
| | | JSONObject result = JSONObject.parseObject(userInfo.getBody()); |
| | | |
| | | if (result.getIntValue("code") != 200) { |
| | | throw new CmdException(result.getString("msg")); |
| | | } |
| | | |
| | | JSONObject data = result.getJSONObject("data"); |
| | | |
| | | OwnerPo ownerPo = new OwnerPo(); |
| | | ownerPo.setOwnerId(GenerateCodeFactory.getGeneratorId("99")); |
| | | ownerPo.setMemberId(ownerPo.getOwnerId()); |
| | | ownerPo.setAge("1"); |
| | | ownerPo.setOwnerFlag(OwnerDto.OWNER_FLAG_TRUE); |
| | | ownerPo.setOwnerTypeCd(OwnerDto.OWNER_TYPE_CD_OWNER); |
| | | ownerPo.setAddress("无"); |
| | | ownerPo.setCommunityId(DEFAULT_COMMUNITY_ID); |
| | | ownerPo.setIdCard(data.getString("idNo")); |
| | | ownerPo.setLink(data.getString("phoneNumber")); |
| | | ownerPo.setName(data.getString("realName")); |
| | | ownerPo.setRemark("通过接口新增"); |
| | | ownerPo.setSex(data.getString("sex") == null ? "1" : "0"); |
| | | ownerPo.setState(OwnerDto.STATE_FINISH); |
| | | ownerPo.setUserId("-1"); |
| | | int flag = ownerV1InnerServiceSMOImpl.saveOwner(ownerPo); |
| | | if (flag < 1) { |
| | | throw new CmdException("保存业主失败"); |
| | | } |
| | | |
| | | OwnerAttrPo ownerAttrPo = new OwnerAttrPo(); |
| | | ownerAttrPo.setAttrId(GenerateCodeFactory.getGeneratorId("11")); |
| | | ownerAttrPo.setCommunityId(DEFAULT_COMMUNITY_ID); |
| | | ownerAttrPo.setValue(reqJson.getString("userId")); |
| | | ownerAttrPo.setMemberId(ownerPo.getMemberId()); |
| | | ownerAttrPo.setSpecCd(OwnerAttrDto.SPEC_CD_EXT_OWNER_ID); |
| | | |
| | | flag = ownerAttrInnerServiceSMOImpl.saveOwnerAttr(ownerAttrPo); |
| | | if (flag < 1) { |
| | | throw new CmdException("保存业主失败"); |
| | | } |
| | | return ownerPo.getOwnerId(); |
| | | } |
| | | } |