Browse Source

Merge branch 'master' of http://121.42.41.42:7070/r/epmet-cloud into dev_dingV1

master
yinzuomei 3 years ago
parent
commit
61e2e1096e
  1. 12
      epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java
  2. 5
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/TopArticleFormDTO.java
  3. 2
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java
  4. 2
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java
  5. 20
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

12
epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java

@ -6,8 +6,10 @@ import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
import com.alibaba.fastjson.JSON;
import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.password.PasswordUtils;
import com.epmet.commons.tools.utils.CpUserDetailRedis;
@ -130,13 +132,13 @@ public class LoginServiceImpl implements LoginService {
}
}
} catch (WxErrorException e) {
log.error("->[getMaOpenId]::error[{}]", "解析微信code失败",e);
log.warn("->[getMaOpenId]::error[{}]", "解析微信code失败",e);
}
if (null == wxMaJscode2SessionResult) {
log.error(String.format("解析微信用户信息失败,app[%s],wxCode[%s],result:[%S]",app,wxCode, JSON.toJSONString(wxMaJscode2SessionResult)));
log.warn(String.format("解析微信用户信息失败,app[%s],wxCode[%s],result:[%S]",app,wxCode, JSON.toJSONString(wxMaJscode2SessionResult)));
throw new RenException("解析微信用户信息失败");
} else if (StringUtils.isBlank(wxMaJscode2SessionResult.getOpenid())) {
log.error(String.format("获取微信openid失败,app[%s],wxCode[%s]",app,wxCode));
log.warn(String.format("获取微信openid失败,app[%s],wxCode[%s]",app,wxCode));
throw new RenException("获取微信openid失败");
}
return wxMaJscode2SessionResult;
@ -366,6 +368,10 @@ public class LoginServiceImpl implements LoginService {
} else {
logger.error(String.format("运营人员%s退出成功,清空菜单和权限redis异常", tokenDto.getUserId()));
}
//如果是工作端退出,删除当前工作人员缓存
if(AppClientConstant.APP_GOV.equals(tokenDto.getApp())){
CustomerStaffRedis.delStaffInfoFormCache(tokenDto.getCustomerId(),tokenDto.getUserId());
}
return new Result();
}

5
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/TopArticleFormDTO.java

@ -22,5 +22,10 @@ public class TopArticleFormDTO {
*/
@NotBlank(message = "type不能为空,置顶:top,取消置顶:cancel_top")
private String type;
/**
* 封面图片
*/
private String imgUrl;
}

2
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/controller/ArticleController.java

@ -432,7 +432,7 @@ public class ArticleController {
@PostMapping("topArticle")
public Result topArticle(@RequestBody TopArticleFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO);
articleService.topArticle(formDTO.getArticleId(),formDTO.getType());
articleService.topArticle(formDTO.getArticleId(),formDTO.getType(),formDTO.getImgUrl());
return new Result();
}
/**

2
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/ArticleService.java

@ -256,5 +256,5 @@ public interface ArticleService extends BaseService<ArticleEntity> {
PublishedListResultDTO detailV2(ArticleListFormDTO formDTO);
void topArticle(String articleId, String type);
void topArticle(String articleId, String type,String imgUrl);
}

20
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

@ -878,7 +878,10 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
//1.查询文章详情信息
ArticleDetailResultDTO articleInfo = baseDao.selectArticleDetail(articleDetailFormDTO.getGridId(), articleDetailFormDTO.getArticleId());
if (null == articleInfo) {
throw new RenException(String.format(ModuleConstant.SPECIFIED_ARTICLE_NOT_FOUND_EXCEPTION_TEMPLATE, articleDetailFormDTO.getArticleId(), articleDetailFormDTO.getGridId()));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),
String.format(ModuleConstant.SPECIFIED_ARTICLE_NOT_FOUND_EXCEPTION_TEMPLATE, articleDetailFormDTO.getArticleId(), articleDetailFormDTO.getGridId()),
"文章已下线");
// throw new RenException(String.format(ModuleConstant.SPECIFIED_ARTICLE_NOT_FOUND_EXCEPTION_TEMPLATE, articleDetailFormDTO.getArticleId(), articleDetailFormDTO.getGridId()));
}
//2.判断当前用户当前文章当前网格是否存在访问记录
Map<String, Object> params = new HashMap<>();
@ -1777,7 +1780,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
}
@Override
public void topArticle(String articleId, String type) {
public void topArticle(String articleId, String type,String imgUrl) {
ArticleEntity articleEntity = baseDao.selectById(articleId);
if (null != articleEntity) {
/**
@ -1786,6 +1789,19 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
*/
if ("top".equals(type)) {
articleEntity.setIsTop(NumConstant.ONE);
if(StringUtils.isNotBlank(imgUrl)){
//如果没有封面图片的话,更新
LambdaQueryWrapper<ArticleCoverEntity> queryWrapper=new LambdaQueryWrapper();
queryWrapper.eq(ArticleCoverEntity::getArticleId,articleEntity);
if (articleCoverDao.selectCount(queryWrapper) == 0) {
ArticleCoverEntity articleCoverEntity=new ArticleCoverEntity();
articleCoverEntity.setCustomerId(articleEntity.getCustomerId());
articleCoverEntity.setArticleId(articleId);
articleCoverEntity.setImgUrl(imgUrl);
articleCoverEntity.setAuditStatus("pass");
articleCoverDao.insert(articleCoverEntity);
}
}
} else if ("cancel_top".equals(type)) {
articleEntity.setIsTop(NumConstant.ZERO);
}

Loading…
Cancel
Save