diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java index 965869be12..9d455af694 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java @@ -3,7 +3,7 @@ package com.epmet.service.impl; import com.epmet.common.token.constant.LoginConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; -import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.security.dto.GovTokenDto; import com.epmet.commons.tools.security.password.PasswordUtils; import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.DateUtils; @@ -45,6 +45,8 @@ public class GovWebServiceImpl implements GovWebService { private CpUserDetailRedis cpUserDetailRedis; @Autowired private EpmetUserFeignClient epmetUserFeignClient; + @Autowired + private ThirdLoginServiceImpl thirdLoginService; /** * @param formDTO @@ -105,7 +107,11 @@ public class GovWebServiceImpl implements GovWebService { String token = jwtTokenUtils.createToken(map); logger.info("app:" + formDTO.getApp() + ";client:" + formDTO.getClient() + ";userId:" + userId + ";生成token[" + token + "]"); int expire = jwtTokenProperties.getExpire(); - TokenDto tokenDto = new TokenDto(); + + String orgIdPath = thirdLoginService.getOrgIdPath(userId); + String[] orgIdPathParts = orgIdPath.split(":"); + + GovTokenDto tokenDto = new GovTokenDto(); tokenDto.setCustomerId(formDTO.getCustomerId()); tokenDto.setApp(formDTO.getApp()); tokenDto.setClient(formDTO.getClient()); @@ -113,6 +119,13 @@ public class GovWebServiceImpl implements GovWebService { tokenDto.setToken(token); tokenDto.setUpdateTime(System.currentTimeMillis()); tokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime()); + tokenDto.setAgencyId(orgIdPathParts[orgIdPathParts.length - 1]); + tokenDto.setRootAgencyId(orgIdPathParts[0]); + tokenDto.setDeptIdList(thirdLoginService.getDeptartmentIdList(userId)); + tokenDto.setGridIdList(thirdLoginService.getGridIdList(userId)); + tokenDto.setRoleList(thirdLoginService.queryGovStaffRoles(userId, orgIdPathParts[orgIdPathParts.length - 1])); + tokenDto.setOrgIdPath(orgIdPath); + cpUserDetailRedis.set(tokenDto, expire); logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss")); return token; diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingFormDTO.java index 8ce4e063b9..b14c58b47c 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingFormDTO.java @@ -17,9 +17,7 @@ package com.epmet.dto.form; -import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; import lombok.Data; import org.hibernate.validator.constraints.Length; @@ -36,70 +34,75 @@ public class IcBulidingFormDTO implements Serializable { public interface DeleteGroup extends CustomerClientShowGroup { } - @NotBlank(message = "楼栋ID不能为空", groups = { UpdateGroup.class,DeleteGroup.class}) + public interface AddShowGroup extends CustomerClientShowGroup { + } + + public interface UpdateShowGroup extends CustomerClientShowGroup { + } + @NotBlank(message = "楼栋ID不能为空", groups = { UpdateShowGroup.class,DeleteGroup.class}) private String buildingId; /** * 组织id */ - @NotBlank(message = "组织id不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @NotBlank(message = "组织id不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) private String agencyId; /** * 网格id */ - @NotBlank(message = "网格不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @NotBlank(message = "网格不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) private String gridId; /** * 小区id */ - @NotBlank(message = "小区id不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @NotBlank(message = "小区id不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) private String neighborHoodId; /** * 楼栋名称 */ - @NotBlank(message = "楼栋名称不能为空", groups = {AddGroup.class, UpdateGroup.class}) - @Length(max=10,message = "楼栋名称不能超过10个字", groups = {AddGroup.class, UpdateGroup.class}) + @NotBlank(message = "楼栋名称不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) + @Length(max=10,message = "楼栋名称不能超过10个字", groups = {AddShowGroup.class, UpdateShowGroup.class}) private String buildingName; /** * 楼栋类型 */ - @NotBlank(message = "楼栋类型不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @NotBlank(message = "楼栋类型不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) private String type=""; /** * 客户id */ - /* @NotBlank(message = "客户id不能为空", groups = {AddGroup.class, UpdateGroup.class}) + /* @NotBlank(message = "客户id不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) private String customerId;*/ /** * 排序 */ - @NotNull(message = "排序不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @NotNull(message = "排序不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) private Integer sort = 0; /** * 总单元数 */ - @NotNull(message = "总单元数不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @NotNull(message = "总单元数不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) private Integer totalUnitNum=1; /** * 总楼层总数 */ - @NotNull(message = "总楼层总数不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @NotNull(message = "总楼层总数不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) private Integer totalFloorNum; /** * 总户数 */ - @NotNull(message = "总户数不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @NotNull(message = "总户数不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) private Integer totalHouseNum; /** * 坐标位置 diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseFormDTO.java index cb557aa572..58376e2032 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseFormDTO.java @@ -17,9 +17,7 @@ package com.epmet.dto.form; -import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; import lombok.Data; import javax.validation.constraints.NotBlank; @@ -35,23 +33,29 @@ public class IcHouseFormDTO implements Serializable { public interface DeleteGroup extends CustomerClientShowGroup { } - @NotBlank(message = "房屋ID不能为空", groups = { UpdateGroup.class,DeleteGroup.class}) + public interface AddShowGroup extends CustomerClientShowGroup { + } + + public interface UpdateShowGroup extends CustomerClientShowGroup { + } + + @NotBlank(message = "房屋ID不能为空", groups = { UpdateShowGroup.class,DeleteGroup.class}) private String houseId; /** * 小区id */ - @NotBlank(message = "小区id不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @NotBlank(message = "小区id不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) private String neighborHoodId; - @NotBlank(message = "所属楼栋ID不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @NotBlank(message = "所属楼栋ID不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) private String buildingId; /** * 所属单元id */ - @NotBlank(message = "所属单元id不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @NotBlank(message = "所属单元id不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) private String buildingUnitId; @@ -59,43 +63,43 @@ public class IcHouseFormDTO implements Serializable { /** * 门牌号 */ - @NotBlank(message = "门牌号不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @NotBlank(message = "门牌号不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) private String doorName; /** * 房屋类型,这里存储字典value就可以 */ - @NotBlank(message = "房屋类型不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @NotBlank(message = "房屋类型不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) private String houseType; /** * 存储字典value */ - @NotBlank(message = "房屋用途不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @NotBlank(message = "房屋用途不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) private String purpose; /** * 1出租;0未出租 */ - @NotNull(message = "是否出租不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @NotNull(message = "是否出租不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) private Integer rentFlag; /** * 房主姓名 */ - @NotBlank(message = "房主姓名不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @NotBlank(message = "房主姓名不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) private String ownerName; /** * 房主电话 */ - @NotBlank(message = "房主电话不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @NotBlank(message = "房主电话不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) private String ownerPhone; /** * 房主身份证号 */ - @NotBlank(message = "房主身份证号不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @NotBlank(message = "房主身份证号不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) private String ownerIdCard; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcNeighborHoodFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcNeighborHoodFormDTO.java index 98a6ad0fde..97d196e60d 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcNeighborHoodFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcNeighborHoodFormDTO.java @@ -17,9 +17,7 @@ package com.epmet.dto.form; -import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; import lombok.Data; import org.hibernate.validator.constraints.Length; @@ -35,59 +33,56 @@ public class IcNeighborHoodFormDTO implements Serializable { public interface DeleteGroup extends CustomerClientShowGroup { } + + public interface AddShowGroup extends CustomerClientShowGroup { + } + public interface UpdateShowGroup extends CustomerClientShowGroup { + } /** * 小区id */ - @NotBlank(message = "小区id不能为空", groups = {UpdateGroup.class,DeleteGroup.class}) + @NotBlank(message = "小区id不能为空", groups = {UpdateShowGroup.class,DeleteGroup.class}) private String neighborHoodId; /** * 小区名称 */ - @NotBlank(message = "小区名称不能为空", groups = {AddGroup.class, UpdateGroup.class}) - @Length(max=50,message = "小区名称不能超过50个字", groups = {AddGroup.class, UpdateGroup.class}) + @NotBlank(message = "小区名称不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) + @Length(max=50,message = "小区名称不能超过50个字", groups = {AddShowGroup.class, UpdateShowGroup.class}) private String neighborHoodName; - /** - * 客户id - */ - /* @NotBlank(message = "客户id不能为空", groups = {AddGroup.class, UpdateGroup.class}) - private String customerId;*/ - /** * 组织id */ - @NotBlank(message = "组织id不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @NotBlank(message = "组织id不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) private String agencyId; /** * 网格id */ - @NotBlank(message = "网格id不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @NotBlank(message = "网格id不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) private String gridId; /** * 关联物业id */ - @NotBlank(message = "关联物业ID不能为空", groups = {UpdateGroup.class}) + @NotBlank(message = "关联物业ID不能为空", groups = {AddShowGroup.class,UpdateShowGroup.class}) private String propertyId; /** * 详细地址 */ - @NotBlank(message = "详细地址不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @NotBlank(message = "详细地址不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) private String address; /** * 备注 */ - @NotBlank(message = "备注不能为空", groups = {UpdateGroup.class}) - @Length(max=500,message = "备注不能超过500个字", groups = {AddGroup.class, UpdateGroup.class}) + @Length(max=500,message = "备注不能超过500个字", groups = {AddShowGroup.class, UpdateShowGroup.class}) private String remark; /** * 坐标位置 */ - //@NotBlank(message = "坐标位置不能为空", groups = {AddGroup.class, UpdateGroup.class}) private String location; diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java index 763abf8efc..f3edc781e1 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java @@ -25,7 +25,6 @@ import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dao.IcBuildingUnitDao; import com.epmet.dto.BuildingTreeLevelDTO; @@ -90,7 +89,7 @@ public class BuildingController { @PostMapping("buildingadd") public Result buildingAdd(@LoginUser TokenDto tokenDTO, @RequestBody IcBulidingFormDTO formDTO){ //效验数据 - ValidatorUtils.validateEntity(formDTO, AddGroup.class); + ValidatorUtils.validateEntity(formDTO, IcBulidingFormDTO.AddShowGroup.class); String customerId = tokenDTO.getCustomerId(); // String customerId = "123123"; @@ -101,7 +100,7 @@ public class BuildingController { @PostMapping("buildingupdate") public Result buildingUpdate(@LoginUser TokenDto tokenDTO, @RequestBody IcBulidingFormDTO formDTO){ //效验数据 - ValidatorUtils.validateEntity(formDTO, UpdateGroup.class); + ValidatorUtils.validateEntity(formDTO, IcBulidingFormDTO.UpdateShowGroup.class); String customerId = tokenDTO.getCustomerId(); // String customerId = "123123"; buildingService.UpdateBuilding(customerId,formDTO); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java index 8bc4378e8f..12295301a1 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java @@ -23,8 +23,6 @@ import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.commons.tools.validator.group.AddGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.form.IcHouseFormDTO; import com.epmet.dto.form.IcNeighborHoodFormDTO; import com.epmet.dto.form.ListIcNeighborHoodFormDTO; @@ -76,7 +74,7 @@ public class HouseController { @PostMapping("houseadd") public Result houseAdd(@LoginUser TokenDto tokenDTO, @RequestBody IcHouseFormDTO formDTO){ //效验数据 - ValidatorUtils.validateEntity(formDTO, AddGroup.class); + ValidatorUtils.validateEntity(formDTO, IcHouseFormDTO.AddShowGroup.class); String customerId = tokenDTO.getCustomerId(); // String customerId = "123123"; @@ -87,7 +85,7 @@ public class HouseController { @PostMapping("houseupdate") public Result houseUpdate(@LoginUser TokenDto tokenDTO, @RequestBody IcHouseFormDTO formDTO){ //效验数据 - ValidatorUtils.validateEntity(formDTO, UpdateGroup.class); + ValidatorUtils.validateEntity(formDTO, IcHouseFormDTO.UpdateShowGroup.class); String customerId = tokenDTO.getCustomerId(); // String customerId = "123123"; houseService.updateHouse(customerId,formDTO); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java index 823363814a..6bbab45e12 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/NeighborHoodController.java @@ -24,8 +24,6 @@ import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.commons.tools.validator.group.AddGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dao.IcBuildingDao; import com.epmet.dto.form.IcNeighborHoodFormDTO; import com.epmet.dto.form.ListIcNeighborHoodFormDTO; @@ -89,7 +87,7 @@ public class NeighborHoodController { @PostMapping("neighborhoodadd") public Result neighborhoodadd(@LoginUser TokenDto tokenDTO, @RequestBody IcNeighborHoodFormDTO formDTO){ //效验数据 - ValidatorUtils.validateEntity(formDTO, AddGroup.class); + ValidatorUtils.validateEntity(formDTO, IcNeighborHoodFormDTO.AddShowGroup.class); String customerId = tokenDTO.getCustomerId(); // String customerId = "123123"; @@ -100,7 +98,7 @@ public class NeighborHoodController { @PostMapping("neighborhoodupdate") public Result neighborhoodupdate(@LoginUser TokenDto tokenDTO, @RequestBody IcNeighborHoodFormDTO formDTO){ //效验数据 - ValidatorUtils.validateEntity(formDTO, UpdateGroup.class); + ValidatorUtils.validateEntity(formDTO, IcNeighborHoodFormDTO.UpdateShowGroup.class); String customerId = tokenDTO.getCustomerId(); // String customerId = "123123"; neighborHoodService.UpdateNeighborhood(customerId,formDTO);