Browse Source

getlatestgridinfo接口修改

dev_shibei_match
yinzuomei 5 years ago
parent
commit
fc0cf43a31
  1. 12
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/impl/ResiMineGridServiceImpl.java
  2. 6
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestGridInfoResultDTO.java
  3. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java

12
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/impl/ResiMineGridServiceImpl.java

@ -1,8 +1,8 @@
package com.epmet.modules.grid.service.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
@ -43,20 +43,22 @@ public class ResiMineGridServiceImpl implements ResiMineGridService {
**/
@Override
public LatestGridInfoResultDTO getLatestGridInfo(TokenDto tokenDto) {
LatestGridInfoResultDTO latestGridInfoResultDTO=new LatestGridInfoResultDTO();
if (null == tokenDto || StringUtils.isBlank(tokenDto.getUserId())) {
logger.error(String.format("居民端【%s】获取用户最近访问的网格失败:错误提示:%s",tokenDto.getUserId(),ModuleConstant.USER_NOT_NULL));
logger.warn(String.format("居民端获取用户最近访问的网格失败:tokenDto is null or userId is null"));
throw new RenException(ModuleConstant.USER_NOT_NULL);
}
if(!AppClientConstant.APP_RESI.equals(tokenDto.getApp())){
logger.error(String.format("居民端【%s】获取用户最近访问的网格失败,错误提示:%s",tokenDto.getUserId(),ModuleConstant.FOR_RESI_CALL));
logger.warn(String.format("居民端获取用户最近访问的网格失败,userId:%s,错误提示:%s",tokenDto.getUserId(),ModuleConstant.FOR_RESI_CALL));
throw new RenException(ModuleConstant.FOR_RESI_CALL);
}
logger.info(String.format("居民端获取用户最近访问网格入参%s", JSON.toJSONString(tokenDto)));
Result<LatestGridInfoResultDTO> userResult=epmetUserFeignClient.getLatestGridInfoByUserId(tokenDto.getUserId());
if(userResult.success()&&null!=userResult.getData()){
return userResult.getData();
}
logger.error(String.format("居民端用户【%s】获取用户最近访问网格失败,调用%s服务入参userId:%s,错误码:%s,错误提示:%s", tokenDto.getUserId(),ServiceConstant.EPMET_USER_SERVER,tokenDto.getUserId(),userResult.getCode(),userResult.getMsg()));
return null;
logger.warn(String.format("居民端获取用户最近访问网格失败,调用epmet-user-server服务返回%s",JSON.toJSONString(userResult)));
return latestGridInfoResultDTO;
}
/**

6
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LatestGridInfoResultDTO.java

@ -22,4 +22,10 @@ public class LatestGridInfoResultDTO implements Serializable {
* 用户最后一次访问的网格
*/
private String gridId;
public LatestGridInfoResultDTO(){
this.setCustomerId("");
this.setGridId("");
}
}

10
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java

@ -22,11 +22,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.GridVisitedConstant;
import com.epmet.dao.GridLatestDao;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.GridLatestDTO;
@ -149,13 +147,9 @@ public class GridLatestServiceImpl extends BaseServiceImpl<GridLatestDao, GridLa
**/
@Override
public Result<LatestGridInfoResultDTO> getLatestGridInfoByUserId(String userId) {
if(StringUtils.isBlank(userId)){
logger.error(GridVisitedConstant.USER_ID_NOTNULL);
throw new RenException(GridVisitedConstant.USER_ID_NOTNULL);
}
LatestGridInfoResultDTO latestGridInfoResultDTO = baseDao.selectLatestGridInfoByUserId(userId);
LatestGridInfoResultDTO latestGridInfoResultDTO= baseDao.selectLatestGridInfoByUserId(userId);
if (null == latestGridInfoResultDTO) {
return new Result<>();
return new Result<LatestGridInfoResultDTO>().ok(new LatestGridInfoResultDTO());
}
return new Result<LatestGridInfoResultDTO>().ok(latestGridInfoResultDTO);
}

Loading…
Cancel
Save