java110-core/src/main/java/com/java110/core/factory/GenerateCodeFactory.java
@@ -281,11 +281,11 @@ private static String PLATFORM_CODE = "0001"; public static String nextId(String idLength) { return nextId(idLength,true); return nextId(idLength, true); } @SuppressWarnings("finally") public static String nextId(String idLength,boolean hasRandom) { public static String nextId(String idLength, boolean hasRandom) { LOCK.lock(); try { if (lastCount == ONE_STEP) { @@ -294,8 +294,8 @@ count = lastCount++; } finally { LOCK.unlock(); String id = (hasRandom?getRandom():"") + String.format(idLength, count); id = id.replace("-",""); String id = (hasRandom ? getRandom() : "") + String.format(idLength, count); id = id.replace("-", ""); return id; } } @@ -346,7 +346,7 @@ * @throws GenerateCodeException */ public static String getGeneratorId(String prefix) throws GenerateCodeException { return getGeneratorId(prefix,false); return getGeneratorId(prefix, false); } /** @@ -355,19 +355,20 @@ * @return * @throws GenerateCodeException */ public static String getGeneratorId(String prefix,boolean longId) throws GenerateCodeException { public static String getGeneratorId(String prefix, boolean longId) throws GenerateCodeException { if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) { //2+14+4+6 //7920230518235714886 if(longId) { if (longId) { return prefix + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_DEFAULT) + nextId("%06d"); }else { } else { return prefix + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H) + nextId("%04d"); } } //调用服务 return getCode(prefix); } /** * pgId生成 * @@ -376,7 +377,7 @@ */ public static String getDetailId(String prefix) throws GenerateCodeException { if (!MappingConstant.VALUE_ON.equals(MappingCache.getValue(MappingConstant.KEY_NEED_INVOKE_GENERATE_ID))) { return prefix + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_O) + nextId("%06d",false); return prefix + DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_O) + nextId("%06d", false); } //调用服务 return getCode(prefix); @@ -1021,4 +1022,9 @@ return uuid.toString().replaceAll("-", ""); } public static String getLink() { String time = DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_H); time = time.substring(2); return time + nextId("%04d",false); } } service-user/src/main/java/com/java110/user/cmd/owner/AuditAuthOwnerCmd.java
@@ -25,6 +25,7 @@ import com.java110.utils.util.ListUtil; import org.springframework.beans.factory.annotation.Autowired; import java.security.acl.Owner; import java.util.List; /** @@ -92,11 +93,11 @@ String memberId = ""; // todo 如果是业主 if(OwnerDto.OWNER_TYPE_CD_OWNER.equals(ownerAppUserDtos.get(0).getOwnerTypeCd())){ if (OwnerDto.OWNER_TYPE_CD_OWNER.equals(ownerAppUserDtos.get(0).getOwnerTypeCd())) { memberId = bindOwner(ownerAppUserDtos.get(0)); }else { } else { //todo 如果是成员 memberId = bindOwnerMember(ownerAppUserDtos.get(0),userId); memberId = bindOwnerMember(ownerAppUserDtos.get(0), userId); } @@ -119,16 +120,17 @@ /** * 绑定成员 * * @param ownerAppUserDto * @return */ private String bindOwnerMember(OwnerAppUserDto ownerAppUserDto,String userId) { private String bindOwnerMember(OwnerAppUserDto ownerAppUserDto, String userId) { // todo 查看 房屋是否有业主,如果没有添加业主 OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto(); ownerRoomRelDto.setRoomId(ownerAppUserDto.getRoomId()); List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelInnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto); if(ListUtil.isNull(ownerRoomRelDtos)){ if (ListUtil.isNull(ownerRoomRelDtos)) { throw new CmdException("房屋未绑定业主"); } @@ -147,8 +149,14 @@ }); List<OwnerDto> ownerDtos = ownerV1InnerServiceSMOImpl.queryOwners(ownerDto); if(!ListUtil.isNull(ownerDtos)){ if (!ListUtil.isNull(ownerDtos)) { return ownerDtos.get(0).getMemberId(); } String personRole = OwnerDto.PERSON_ROLE_OWNER; if (OwnerDto.OWNER_TYPE_CD_MEMBER.equals(ownerAppUserDto.getOwnerTypeCd())) { personRole = OwnerDto.PERSON_ROLE_MEMBER; } OwnerPo ownerPo = new OwnerPo(); @@ -164,6 +172,8 @@ ownerPo.setIdCard(ownerAppUserDto.getIdCard()); ownerPo.setState(OwnerDto.STATE_FINISH); ownerPo.setOwnerFlag(OwnerDto.OWNER_FLAG_TRUE); ownerPo.setPersonType(OwnerDto.PERSON_TYPE_PERSON); ownerPo.setPersonRole(personRole); ownerPo.setAddress("无"); ownerV1InnerServiceSMOImpl.saveOwner(ownerPo); @@ -172,6 +182,7 @@ /** * 绑定业主 * * @param ownerAppUserDto * @return */ @@ -182,13 +193,13 @@ ownerRoomRelDto.setRoomId(ownerAppUserDto.getRoomId()); List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelInnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto); if(ListUtil.isNull(ownerRoomRelDtos)){ if (ListUtil.isNull(ownerRoomRelDtos)) { throw new CmdException("房屋未绑定业主"); } OwnerPo ownerPo = new OwnerPo(); ownerPo.setLink(ownerAppUserDto.getLink()); // ownerPo.setName(ownerAppUserDto.getAppUserName()); // ownerPo.setName(ownerAppUserDto.getAppUserName()); ownerPo.setMemberId(ownerRoomRelDtos.get(0).getOwnerId()); ownerPo.setOwnerId(ownerRoomRelDtos.get(0).getOwnerId()); ownerV1InnerServiceSMOImpl.updateOwner(ownerPo); service-user/src/main/java/com/java110/user/cmd/owner/SaveOwnerMemberCmd.java
@@ -127,10 +127,14 @@ @Override public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException { Assert.jsonObjectHaveKey(reqJson, "name", "请求报文中未包含name"); Assert.jsonObjectHaveKey(reqJson, "link", "请求报文中未包含link"); Assert.jsonObjectHaveKey(reqJson, "sex", "请求报文中未包含sex"); Assert.jsonObjectHaveKey(reqJson, "ownerId", "请求报文中未包含业主"); if(!reqJson.containsKey("link") || StringUtil.isEmpty(reqJson.getString("link"))){ reqJson.put("link",GenerateCodeFactory.getLink()); } Assert.jsonObjectHaveKey(reqJson, "communityId", "请求报文中未包含communityId"); if (reqJson.containsKey("ownerPhotoUrl")) {