Browse Source

resi-group新增initapplygroup接口,epmet-user新增根据客户id、用户id查询居民注册信息接口

master
yinzuomei 5 years ago
parent
commit
59cce5e2e2
  1. 6
      epmet-module/resi-group/resi-group-server/pom.xml
  2. 29
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java
  3. 0
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/.gitkeep
  4. 23
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallback.java
  5. 28
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java
  6. 10
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java
  7. 19
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java
  8. 7
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java
  9. 29
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserResiInfoFormDTO.java
  10. 17
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java
  11. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiInfoDao.java
  12. 13
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiInfoService.java
  13. 17
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java
  14. 24
      epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml

6
epmet-module/resi-group/resi-group-server/pom.xml

@ -58,6 +58,12 @@
<artifactId>feign-httpclient</artifactId>
<version>10.3.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-user-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

29
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java

@ -0,0 +1,29 @@
package com.epmet.modules.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.UserResiInfoDTO;
import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.modules.feign.fallback.EpmetUserFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @Description epmet_user服务fegin
* @Author yinzuomei
* @Date 2020/3/16 14:48
*/
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallback.class )
public interface EpmetUserFeignClient {
/**
* @param userResiInfoFormDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.UserResiInfoDTO>
* @Author yinzuomei
* @Description 查询用户注册信息
* @Date 2020/3/30 10:45
**/
@PostMapping(value = "epmetuser/userresiinfo/getUserResiInfoDTO", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<UserResiInfoDTO> getUserResiInfoDTO(UserResiInfoFormDTO userResiInfoFormDTO);
}

0
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/.gitkeep

23
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallback.java

@ -0,0 +1,23 @@
package com.epmet.modules.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.UserResiInfoDTO;
import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.modules.feign.EpmetUserFeignClient;
import org.springframework.stereotype.Component;
/**
* @Description epmet_user服务fegin
* @Author yinzuomei
* @Date 2020/3/16 14:53
*/
@Component
public class EpmetUserFeignClientFallback implements EpmetUserFeignClient {
@Override
public Result<UserResiInfoDTO> getUserResiInfoDTO(UserResiInfoFormDTO userResiInfoFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserResiInfoDTO", userResiInfoFormDTO);
}
}

28
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java

@ -21,18 +21,17 @@ 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.dto.form.UserResiInfoFormDTO;
import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.modules.group.service.ResiGroupService;
import com.epmet.modules.utils.ModuleConstant;
import com.epmet.resi.group.dto.group.form.*;
import com.epmet.resi.group.dto.group.result.CreatedResultDTO;
import com.epmet.resi.group.dto.group.result.GroupSummarizeResultDTO;
import com.epmet.resi.group.dto.group.result.MyGroupResultDTO;
import com.epmet.resi.group.dto.group.result.RecommendGroupResultDTO;
import oracle.jdbc.proxy.annotation.Post;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -159,6 +158,23 @@ public class ResiGroupController {
ValidatorUtils.validateEntity(applyJoinGroupFormDTO);
return resiGroupService.applyJoinGroup(applyJoinGroupFormDTO);
}
//加入小组界面初始化
/**
* @param tokenDto
* @return com.epmet.commons.tools.utils.Result
* @Author yinzuomei
* @Description 加入小组界面初始化
* 只有已经注册过的居民才可以加入小组
* @Date 2020/3/30 10:11
**/
@PostMapping("initapplygroup")
public Result initApplyGroup(@LoginUser TokenDto tokenDto,@RequestParam("customerId") String customerId) {
if (null == tokenDto) {
return new Result().error(ModuleConstant.USER_NOT_NULL);
}
UserResiInfoFormDTO resiUserInfoFormDTO = new UserResiInfoFormDTO();
resiUserInfoFormDTO.setUserId(tokenDto.getUserId());
resiUserInfoFormDTO.setCustomerId(customerId);
return resiGroupService.initApplyGroup(resiUserInfoFormDTO);
}
}

10
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ResiGroupService.java

@ -21,6 +21,7 @@ package com.epmet.modules.group.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.modules.group.entity.ResiGroupEntity;
import com.epmet.resi.group.dto.group.ResiGroupDTO;
import com.epmet.resi.group.dto.group.form.*;
@ -162,4 +163,13 @@ public interface ResiGroupService extends BaseService<ResiGroupEntity> {
* @Date 2020/3/29 20:01
**/
Result applyJoinGroup(ApplyJoinGroupFormDTO applyJoinGroupFormDTO);
/**
* @param resiUserInfoFormDTO
* @return com.epmet.commons.tools.utils.Result
* @Author yinzuomei
* @Description 加入小组界面初始化
* @Date 2020/3/30 10:17
**/
Result initApplyGroup(UserResiInfoFormDTO resiUserInfoFormDTO);
}

19
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java

@ -25,9 +25,11 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.UserResiInfoDTO;
import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.modules.feign.EpmetUserFeignClient;
import com.epmet.modules.group.dao.ResiGroupDao;
import com.epmet.modules.group.entity.ResiGroupEntity;
import com.epmet.modules.group.entity.ResiGroupOperationEntity;
import com.epmet.modules.group.service.ResiGroupOperationService;
import com.epmet.modules.group.service.ResiGroupService;
import com.epmet.modules.member.service.GroupMemeberOperationService;
@ -76,6 +78,9 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
@Autowired
private GroupMemeberOperationService groupMemeberOperationService;
@Autowired
private EpmetUserFeignClient epmetUserFeignClient;
@Override
public PageData<ResiGroupDTO> page(Map<String, Object> params) {
IPage<ResiGroupEntity> page = baseDao.selectPage(
@ -265,6 +270,18 @@ public class ResiGroupServiceImpl extends BaseServiceImpl<ResiGroupDao, ResiGrou
return new Result();
}
@Override
public Result initApplyGroup(UserResiInfoFormDTO resiUserInfoFormDTO) {
if (StringUtils.isNotBlank(resiUserInfoFormDTO.getUserId()) && StringUtils.isNotBlank(resiUserInfoFormDTO.getCustomerId())) {
Result<UserResiInfoDTO> result = epmetUserFeignClient.getUserResiInfoDTO(resiUserInfoFormDTO);
if (!result.success() || null == result.getData()) {
return new Result().error(ModuleConstant.NOT_REGISTERED);
}
return new Result();
}
return new Result().error(ModuleConstant.USER_NOT_NULL);
}
private ResiGroupEntity structureResiGroupEntity(ApplyCreateGroupFormDTO applyCreateGroupFormDTO) {
ResiGroupEntity resiGroupEntity = new ResiGroupEntity();
resiGroupEntity.setCustomerId(applyCreateGroupFormDTO.getCustomerId());

7
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java

@ -58,6 +58,13 @@ public interface ModuleConstant extends Constant {
*/
String REJECT_MODIFYGROUPINFO="只有群主才能修改群信息";
/**
* 申请加入小组时需要根据groupId查询组信息
*/
String QUERY_GROUPINFO_FAILED="查询组信息失败";
/**
* 申请加入小组时需要根据groupId查询组信息
*/
String NOT_REGISTERED="为注册的居民不能加入小组";
}

29
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserResiInfoFormDTO.java

@ -0,0 +1,29 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 居民注册信息查询入参DTO
* @Author yinzuomei
* @Date 2020/3/30 10:26
*/
@Data
public class UserResiInfoFormDTO implements Serializable {
private static final long serialVersionUID = 2802831913959599147L;
/**
* 用户当前网格所属客户不能为空
*/
@NotBlank(message = "客户id不能为空")
private String customerId;
/**
* 用户id
*/
@NotBlank(message="用户id不能为空")
private String userId;
}

17
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java

@ -26,6 +26,7 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.UserResiInfoDTO;
import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.excel.UserResiInfoExcel;
import com.epmet.service.UserResiInfoService;
import org.springframework.beans.factory.annotation.Autowired;
@ -45,7 +46,7 @@ import java.util.Map;
@RestController
@RequestMapping("userresiinfo")
public class UserResiInfoController {
@Autowired
private UserResiInfoService userResiInfoService;
@ -91,4 +92,16 @@ public class UserResiInfoController {
ExcelUtils.exportExcelToTarget(response, null, list, UserResiInfoExcel.class);
}
}
/**
* @param userResiInfoFormDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.UserResiInfoDTO>
* @Author yinzuomei
* @Description 查询用户注册信息
* @Date 2020/3/30 10:49
**/
@PostMapping("getUserResiInfoDTO")
public Result<UserResiInfoDTO> getUserResiInfoDTO(@RequestBody UserResiInfoFormDTO userResiInfoFormDTO) {
ValidatorUtils.validateEntity(userResiInfoFormDTO);
return userResiInfoService.getUserResiInfoDTO(userResiInfoFormDTO);
}
}

14
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiInfoDao.java

@ -18,6 +18,8 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.UserResiInfoDTO;
import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.entity.UserResiInfoEntity;
import org.apache.ibatis.annotations.Mapper;
@ -29,5 +31,13 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface UserResiInfoDao extends BaseDao<UserResiInfoEntity> {
}
/**
* @return com.epmet.dto.UserResiInfoDTO
* @param userResiInfoFormDTO
* @Author yinzuomei
* @Description 查询用户注册信息
* @Date 2020/3/30 11:10
**/
UserResiInfoDTO selectUserResiInfoDTO(UserResiInfoFormDTO userResiInfoFormDTO);
}

13
epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserResiInfoService.java

@ -19,7 +19,9 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.UserResiInfoDTO;
import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.entity.UserResiInfoEntity;
import java.util.List;
@ -92,4 +94,13 @@ public interface UserResiInfoService extends BaseService<UserResiInfoEntity> {
* @date 2020-03-30
*/
void delete(String[] ids);
}
/**
* @param userResiInfoFormDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.UserResiInfoDTO>
* @Author yinzuomei
* @Description 查询用户注册信息
* @Date 2020/3/30 11:07
**/
Result<UserResiInfoDTO> getUserResiInfoDTO(UserResiInfoFormDTO userResiInfoFormDTO);
}

17
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java

@ -23,8 +23,10 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.UserResiInfoDao;
import com.epmet.dto.UserResiInfoDTO;
import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.entity.UserResiInfoEntity;
import com.epmet.redis.UserResiInfoRedis;
import com.epmet.service.UserResiInfoService;
@ -101,4 +103,17 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}
/**
* @param userResiInfoFormDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.UserResiInfoDTO>
* @Author yinzuomei
* @Description 查询用户注册信息
* @Date 2020/3/30 11:07
**/
@Override
public Result<UserResiInfoDTO> getUserResiInfoDTO(UserResiInfoFormDTO userResiInfoFormDTO) {
UserResiInfoDTO userResiInfoDTO=baseDao.selectUserResiInfoDTO(userResiInfoFormDTO);
return new Result<UserResiInfoDTO>().ok(userResiInfoDTO);
}
}

24
epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml

@ -20,5 +20,27 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!-- 查询用户注册信息 -->
<select id="selectUserResiInfoDTO" parameterType="com.epmet.dto.form.UserResiInfoFormDTO"
resultType="com.epmet.dto.UserResiInfoDTO">
SELECT
uri.id,
uc.USER_ID,
uri.REG_MOBILE,
uri.SURNAME,
uri.`NAME`,
uri.STREET,
uri.DISTRICT,
uri.BUILDING_ADDRESS,
uri.RESI_VISIT_ID
FROM
user_customer uc
LEFT JOIN user_resi_info uri ON ( uc.USER_ID = uri.USER_ID )
WHERE
uc.DEL_FLAG = '0'
AND uri.DEL_FLAG = '0'
AND uc.CUSTOMER_ID = #{customerId}
AND uc.USER_ID = #{userId}
</select>
</mapper>
</mapper>

Loading…
Cancel
Save