From 8b6ccd591730e95ecd454c397215d6548e1e1179 Mon Sep 17 00:00:00 2001 From: yujintao Date: Mon, 9 Sep 2019 15:28:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../esua/epdc/feign/NewsFeignClient.java | 55 ++++++------- .../fallback/NewsFeignClientFallback.java | 8 +- .../epdc/service/impl/AppUserServiceImpl.java | 1 - .../epdc/service/impl/NewsServiceImpl.java | 2 +- .../epdc/form/EpdcNewsStatementFromDTO.java | 8 +- .../epdc/{dto => }/enums/AppNewsLikeEnum.java | 8 +- .../controller/EpdcAppNewsController.java | 77 ++++++++--------- .../epdc/service/impl/NewsServiceImpl.java | 82 +++++++++---------- .../epdc/enums/AppUserAuditStateEnum.java | 8 +- .../esua/epdc/enums/AppUserStateEnum.java | 12 +-- 10 files changed, 129 insertions(+), 132 deletions(-) rename esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/{dto => }/enums/AppNewsLikeEnum.java (69%) diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/NewsFeignClient.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/NewsFeignClient.java index 8ea391dec..1d8305aa3 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/NewsFeignClient.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/NewsFeignClient.java @@ -21,7 +21,7 @@ import java.util.List; * @email yujintao@elink-cn.com * @date 2019/9/5 19:20 */ -@FeignClient(name = ServiceConstant.EPDC_NEWS_SERVER, fallback = NewsFeignClientFallback.class,url = "http://localhost:9064") +@FeignClient(name = ServiceConstant.EPDC_NEWS_SERVER, fallback = NewsFeignClientFallback.class, url = "http://localhost:9064") public interface NewsFeignClient { /** @@ -58,25 +58,24 @@ public interface NewsFeignClient { Result browseNotice(@RequestBody EpdcNoticeBrowseFormDTO formDto); - - /*** - * @Description 移动端新闻列表 - * @Author qushutong - * @Date 2019/9/9 9:17 - * @Param [formDto] - * @Return com.elink.esua.epdc.commons.tools.utils.Result> - * @Exception - * - */ + /*** + * @Description 移动端新闻列表 + * @Author qushutong + * @Date 2019/9/9 9:17 + * @Param [formDto] + * @Return com.elink.esua.epdc.commons.tools.utils.Result> + * @Exception + * + */ @GetMapping("news/epdc-app/news/listNews") Result> listNews(@RequestBody EpdcNewsFromDTO formDto); /*** - * @Description 获取详情 - * @Author qushutong - * @Date 2019/9/9 10:20 - * @Param [id] - * @Return com.elink.esua.epdc.commons.tools.utils.Result + * @Description 获取详情 + * @Author qushutong + * @Date 2019/9/9 10:20 + * @Param [id] + * @Return com.elink.esua.epdc.commons.tools.utils.Result * @Exception * */ @@ -84,25 +83,25 @@ public interface NewsFeignClient { Result getNewsDetail(@PathVariable("newsId") String id); /*** - * @Description 点赞和踩 - * @Author qushutong - * @Date 2019/9/9 10:24 - * @Param [newsStatementFromDTO] - * @Return com.elink.esua.epdc.commons.tools.utils.Result + * @Description 点赞和踩 + * @Author qushutong + * @Date 2019/9/9 10:24 + * @Param [newsStatementFromDTO] + * @Return com.elink.esua.epdc.commons.tools.utils.Result * @Exception * */ @PostMapping("news/epdc-app/news/statement") - Result upDateStatement(@RequestBody EpdcNewsStatementFromDTO newsStatementFromDTO); + Result updateStatement(@RequestBody EpdcNewsStatementFromDTO newsStatementFromDTO); /*** * @Description - * @Author qushutong - * @Date 2019/9/9 10:36 - * @Param [newsBrowseFromDTO] - * @Return com.elink.esua.epdc.commons.tools.utils.Result - * @Exception - * + * @Author qushutong + * @Date 2019/9/9 10:36 + * @Param [newsBrowseFromDTO] + * @Return com.elink.esua.epdc.commons.tools.utils.Result + * @Exception + * */ @PostMapping("news/epdc-app/news/browse") Result modifyNewsBrowse(@RequestBody EpdcNewsBrowseFromDTO newsBrowseFromDTO); diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/NewsFeignClientFallback.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/NewsFeignClientFallback.java index b6d5476bd..5717b71ac 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/NewsFeignClientFallback.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/NewsFeignClientFallback.java @@ -43,16 +43,16 @@ public class NewsFeignClientFallback implements NewsFeignClient { @Override public Result getNewsDetail(String id) { - return ModuleUtils.feignConError(ServiceConstant.EPDC_NEWS_SERVER, "detail", id); + return ModuleUtils.feignConError(ServiceConstant.EPDC_NEWS_SERVER, "getNewsDetail", id); } @Override - public Result upDateStatement(EpdcNewsStatementFromDTO newsStatementFromDTO) { - return ModuleUtils.feignConError(ServiceConstant.EPDC_NEWS_SERVER, "statement", newsStatementFromDTO); + public Result updateStatement(EpdcNewsStatementFromDTO newsStatementFromDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPDC_NEWS_SERVER, "updateStatement", newsStatementFromDTO); } @Override public Result modifyNewsBrowse(EpdcNewsBrowseFromDTO newsBrowseFromDTO) { - return ModuleUtils.feignConError(ServiceConstant.EPDC_NEWS_SERVER, "browse", newsBrowseFromDTO); + return ModuleUtils.feignConError(ServiceConstant.EPDC_NEWS_SERVER, "modifyNewsBrowse", newsBrowseFromDTO); } } diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/AppUserServiceImpl.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/AppUserServiceImpl.java index 7858ce5e0..f6dcac11e 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/AppUserServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/AppUserServiceImpl.java @@ -1,7 +1,6 @@ package com.elink.esua.epdc.service.impl; import com.elink.esua.epdc.common.token.dto.TokenDto; -import com.elink.esua.epdc.common.token.property.TokenPropertise; import com.elink.esua.epdc.common.token.util.CpUserDetailRedis; import com.elink.esua.epdc.common.token.util.TokenUtil; import com.elink.esua.epdc.commons.tools.constant.NumConstant; diff --git a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/NewsServiceImpl.java b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/NewsServiceImpl.java index bd36fe0b0..b3ac7d128 100644 --- a/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/NewsServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/NewsServiceImpl.java @@ -58,7 +58,7 @@ public class NewsServiceImpl implements NewsService { @Override public Result upDateStatement(TokenDto userDetail, EpdcNewsStatementFromDTO newsStatementFromDTO) { newsStatementFromDTO.setUserId(userDetail.getUserId()); - return newsFeignClient.upDateStatement(newsStatementFromDTO); + return newsFeignClient.updateStatement(newsStatementFromDTO); } diff --git a/esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcNewsStatementFromDTO.java b/esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcNewsStatementFromDTO.java index 9ad622fc8..602e5b7da 100644 --- a/esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcNewsStatementFromDTO.java +++ b/esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcNewsStatementFromDTO.java @@ -6,9 +6,9 @@ import javax.validation.constraints.NotNull; import java.io.Serializable; /** - * @author: qushutong - * @Date: 2019/9/7 14:10 - * @Description: 新闻点赞和踩 + * @author: qushutong + * @Date: 2019/9/7 14:10 + * @Description: 新闻点赞和踩 */ @Data public class EpdcNewsStatementFromDTO implements Serializable { @@ -20,7 +20,7 @@ public class EpdcNewsStatementFromDTO implements Serializable { * newsId : 95429 */ @NotNull(message = "态度不能为空") - private int attitude; + private Integer attitude; @NotNull(message = "新闻id不能为空") private String newsId; diff --git a/esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/enums/AppNewsLikeEnum.java b/esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/enums/AppNewsLikeEnum.java similarity index 69% rename from esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/enums/AppNewsLikeEnum.java rename to esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/enums/AppNewsLikeEnum.java index 9c575baa2..0ed05d598 100644 --- a/esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/enums/AppNewsLikeEnum.java +++ b/esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/enums/AppNewsLikeEnum.java @@ -1,4 +1,6 @@ -package com.elink.esua.epdc.dto.enums; +package com.elink.esua.epdc.enums; + +import com.elink.esua.epdc.commons.tools.constant.NumConstant; /** * 用户审核状态枚举 @@ -12,11 +14,11 @@ public enum AppNewsLikeEnum { /** * 0-点赞 */ - LIKE("0"), + LIKE(NumConstant.ZERO_STR), /** * 1-踩 */ - UNLIKE("1"); + UNLIKE(NumConstant.ONE_STR); private String value; diff --git a/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/controller/EpdcAppNewsController.java b/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/controller/EpdcAppNewsController.java index 365354872..2cbd73ce1 100644 --- a/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/controller/EpdcAppNewsController.java +++ b/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/controller/EpdcAppNewsController.java @@ -18,98 +18,91 @@ package com.elink.esua.epdc.controller; import com.elink.esua.epdc.commons.tools.constant.Constant; -import com.elink.esua.epdc.commons.tools.page.PageData; -import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; import com.elink.esua.epdc.commons.tools.utils.Result; -import com.elink.esua.epdc.commons.tools.validator.AssertUtils; import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; -import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; -import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; -import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; -import com.elink.esua.epdc.dto.NewsDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcNewsBrowseFromDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcNewsFromDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcNewsStatementFromDTO; import com.elink.esua.epdc.dto.epdc.result.EpdcNewsDetailResultDTO; import com.elink.esua.epdc.dto.epdc.result.EpdcNewsResultDTO; -import com.elink.esua.epdc.excel.NewsExcel; import com.elink.esua.epdc.service.NewsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import javax.servlet.http.HttpServletResponse; import java.util.List; -import java.util.Map; - /** - * 新闻相关APP接口 - * @author: qushutong - * @Date: 2019/9/7 11:15 - * @Description: + * 新闻相关APP接口 + * + * @author: qushutong + * @Date: 2019/9/7 11:15 + * @Description: */ @RestController @RequestMapping(Constant.EPDC_APP + "news") public class EpdcAppNewsController { - + @Autowired private NewsService newsService; + /*** - * @Description 新闻列表 - * @Author qushutong - * @Date 2019/9/7 11:19 - * @Param [params] - * @Return com.elink.esua.epdc.commons.tools.utils.Result> + * @Description 新闻列表 + * @Author qushutong + * @Date 2019/9/7 11:19 + * @Param [params] + * @Return com.elink.esua.epdc.commons.tools.utils.Result> * @Exception * */ @GetMapping("listNews") - public Result> listNews(@RequestBody EpdcNewsFromDTO epdcNewsFromDTO){ + public Result> listNews(@RequestBody EpdcNewsFromDTO epdcNewsFromDTO) { ValidatorUtils.validateEntity(epdcNewsFromDTO); Result> listNews = newsService.listNews(epdcNewsFromDTO); return listNews; } + /*** - * @Description 新闻详情 - * @Author qushutong - * @Date 2019/9/7 14:13 - * @Param [id] - * @Return com.elink.esua.epdc.commons.tools.utils.Result + * @Description 新闻详情 + * @Author qushutong + * @Date 2019/9/7 14:13 + * @Param [id] + * @Return com.elink.esua.epdc.commons.tools.utils.Result * @Exception * */ @GetMapping("detail/{newsId}") - public Result getNewsDetail(@PathVariable("newsId") String id){ - Result newsDetail = newsService.getNewsDetail(id); + public Result getNewsDetail(@PathVariable("newsId") String id) { + Result newsDetail = newsService.getNewsDetail(id); return newsDetail; - } + } + /*** - * @Description 点赞或踩 - * @Author qushutong - * @Date 2019/9/7 14:15 - * @Param [] - * @Return com.elink.esua.epdc.commons.tools.utils.Result + * @Description 点赞或踩 + * @Author qushutong + * @Date 2019/9/7 14:15 + * @Param [] + * @Return com.elink.esua.epdc.commons.tools.utils.Result * @Exception * */ @PostMapping("statement") - public Result upDateStatement(@RequestBody EpdcNewsStatementFromDTO newsStatementFromDTO){ + public Result upDateStatement(@RequestBody EpdcNewsStatementFromDTO newsStatementFromDTO) { ValidatorUtils.validateEntity(newsStatementFromDTO); return newsService.modifyStatement(newsStatementFromDTO); } /*** - * @Description 新闻浏览 - * @Author qushutong - * @Date 2019/9/7 14:47 - * @Param [newsBrowseFromDTO] - * @Return com.elink.esua.epdc.commons.tools.utils.Result + * @Description 新闻浏览 + * @Author qushutong + * @Date 2019/9/7 14:47 + * @Param [newsBrowseFromDTO] + * @Return com.elink.esua.epdc.commons.tools.utils.Result * @Exception * */ @PostMapping("browse") - public Result modifyNewsBrowse(@RequestBody EpdcNewsBrowseFromDTO newsBrowseFromDTO){ + public Result modifyNewsBrowse(@RequestBody EpdcNewsBrowseFromDTO newsBrowseFromDTO) { ValidatorUtils.validateEntity(newsBrowseFromDTO); return newsService.modifyNewsBrowse(newsBrowseFromDTO); } diff --git a/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/NewsServiceImpl.java b/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/NewsServiceImpl.java index 893ad5465..194117b2c 100644 --- a/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/NewsServiceImpl.java +++ b/esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/NewsServiceImpl.java @@ -33,7 +33,7 @@ import com.elink.esua.epdc.commons.tools.utils.Result; import com.elink.esua.epdc.dao.NewsDao; import com.elink.esua.epdc.dto.NewsDTO; import com.elink.esua.epdc.dto.NewsUserAttitudeDTO; -import com.elink.esua.epdc.dto.enums.AppNewsLikeEnum; +import com.elink.esua.epdc.enums.AppNewsLikeEnum; import com.elink.esua.epdc.dto.epdc.form.EpdcNewsBrowseFromDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcNewsFromDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcNewsStatementFromDTO; @@ -76,7 +76,7 @@ public class NewsServiceImpl extends BaseServiceImpl implem private AdminFeignClient adminFeignClient; @Autowired - private NewsUserAttitudeService newsUserAttitudeService; + private NewsUserAttitudeService newsUserAttitudeService; @Override public PageData page(Map params) { @@ -94,28 +94,28 @@ public class NewsServiceImpl extends BaseServiceImpl implem return ConvertUtils.sourceToTarget(entityList, NewsDTO.class); } - private QueryWrapper getWrapper(Map params){ - String draft= (String) params.get("draft"); - String streetId=(String) params.get("streetId"); - String communityId=(String) params.get("communityId"); - String gridId=(String) params.get("gridId"); - String startTime=(String) params.get("startTime"); - String endTime=(String) params.get("endTime"); - String category=(String) params.get("category"); - String keyword=(String) params.get("keyword"); + private QueryWrapper getWrapper(Map params) { + String draft = (String) params.get("draft"); + String streetId = (String) params.get("streetId"); + String communityId = (String) params.get("communityId"); + String gridId = (String) params.get("gridId"); + String startTime = (String) params.get("startTime"); + String endTime = (String) params.get("endTime"); + String category = (String) params.get("category"); + String keyword = (String) params.get("keyword"); QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(streetId),"STREET_ID",streetId); - wrapper.eq(StringUtils.isNotBlank(communityId),"COMMUNITY_ID",communityId); - wrapper.eq(StringUtils.isNotBlank(gridId),"GRID_ID",gridId); - wrapper.ge(StringUtils.isNotBlank(startTime),"CREATED_TIME",startTime); - wrapper.lt(StringUtils.isNotBlank(endTime),"CREATED_TIME",endTime); - wrapper.eq(StringUtils.isNotBlank(category),"NEWS_CATERORY_ID",category); - wrapper.eq(StringUtils.isNotBlank(keyword),"NEWS_TITLE",keyword); + wrapper.eq(StringUtils.isNotBlank(streetId), "STREET_ID", streetId); + wrapper.eq(StringUtils.isNotBlank(communityId), "COMMUNITY_ID", communityId); + wrapper.eq(StringUtils.isNotBlank(gridId), "GRID_ID", gridId); + wrapper.ge(StringUtils.isNotBlank(startTime), "CREATED_TIME", startTime); + wrapper.lt(StringUtils.isNotBlank(endTime), "CREATED_TIME", endTime); + wrapper.eq(StringUtils.isNotBlank(category), "NEWS_CATERORY_ID", category); + wrapper.eq(StringUtils.isNotBlank(keyword), "NEWS_TITLE", keyword); //draft 前端传上来的一个标志 有则代表是存草稿箱的 1 - if(StringUtils.isNotEmpty(draft)){ - wrapper.eq(StringUtils.isNotBlank(draft),"NEWS_RELEASE_STATE","1"); - }else { - wrapper.eq(StringUtils.isNotBlank(draft),"NEWS_RELEASE_STATE","0"); + if (StringUtils.isNotEmpty(draft)) { + wrapper.eq(StringUtils.isNotBlank(draft), "NEWS_RELEASE_STATE", "1"); + } else { + wrapper.eq(StringUtils.isNotBlank(draft), "NEWS_RELEASE_STATE", "0"); } wrapper.orderByDesc("CREATED_TIME"); return wrapper; @@ -162,18 +162,18 @@ public class NewsServiceImpl extends BaseServiceImpl implem } @Override - public int checkCountByCategoryId(String categoryId){ + public int checkCountByCategoryId(String categoryId) { return baseDao.selectCountByCategoryId(categoryId); } @Override - public boolean modifyOnLine(Map parmas) { - String id=parmas.get("id"); - String onLineState=parmas.get("onLineState"); + public boolean modifyOnLine(Map parmas) { + String id = parmas.get("id"); + String onLineState = parmas.get("onLineState"); NewsDTO newsDTO = get(id); //判断下是不是上线 是的话才执行 - if("1".equals(newsDTO.getNewsUpDownState())){ + if ("1".equals(newsDTO.getNewsUpDownState())) { newsDTO.setNewsUpDownState(onLineState); NewsEntity entity = ConvertUtils.sourceToTarget(newsDTO, NewsEntity.class); updateById(entity); @@ -187,10 +187,10 @@ public class NewsServiceImpl extends BaseServiceImpl implem public void savePublishNews(NewsDTO newsDTO) { - publishNews(newsDTO,"0"); + publishNews(newsDTO, "0"); } - private void publishNews(NewsDTO newsDTO,String newsReleaseState ) { + private void publishNews(NewsDTO newsDTO, String newsReleaseState) { NewsEntity entity = ConvertUtils.sourceToTarget(newsDTO, NewsEntity.class); //发布的时候 默认是0 手动下线 为1 entity.setNewsUpDownState("0"); @@ -215,7 +215,7 @@ public class NewsServiceImpl extends BaseServiceImpl implem newsDepartmentService.deleteByNewsId(entity.getId()); } //判断是否是草稿箱 是的话 不执行下面操作 - if(YesOrNoEnum.YES.value().equals(newsReleaseState)){ + if (YesOrNoEnum.YES.value().equals(newsReleaseState)) { return; } // 通知所属部门id @@ -241,7 +241,7 @@ public class NewsServiceImpl extends BaseServiceImpl implem throw new RenException("获取部门信息失败"); } newsGridList = adminResult.getData(); - }else { + } else { } this.newsDepartmentService.save(entity.getId(), newsGridList); } @@ -249,7 +249,7 @@ public class NewsServiceImpl extends BaseServiceImpl implem @Override public void modifyDraftsPublic(String id) { NewsDTO newsDTO = get(id); - publishNews(newsDTO,"1"); + publishNews(newsDTO, YesOrNoEnum.YES.value()); } @@ -272,15 +272,15 @@ public class NewsServiceImpl extends BaseServiceImpl implem @Override public Result modifyStatement(EpdcNewsStatementFromDTO newsStatementFromDTO) { NewsDTO newsDTO = get(newsStatementFromDTO.getNewsId()); - NewsUserAttitudeDTO newsUserAttitudeDTO=new NewsUserAttitudeDTO(); + NewsUserAttitudeDTO newsUserAttitudeDTO = new NewsUserAttitudeDTO(); //表态 0赞;1踩 - NewsEntity newsEntity= ConvertUtils.sourceToTarget(newsDTO, NewsEntity.class); - if(YesOrNoEnum.YES.value().equals(newsStatementFromDTO.getAttitude())){ - newsEntity.setUnLikeNumber(newsDTO.getUnLikeNumber()+1); + NewsEntity newsEntity = ConvertUtils.sourceToTarget(newsDTO, NewsEntity.class); + if (AppNewsLikeEnum.LIKE.value().equals(newsStatementFromDTO.getAttitude())) { + newsEntity.setUnLikeNumber(newsDTO.getUnLikeNumber() + NumConstant.ONE); newsUserAttitudeDTO.setAttitudeFlag(AppNewsLikeEnum.LIKE.value()); - }else { - newsEntity.setLikeNumber(newsDTO.getLikeNumber()+1); + } else { + newsEntity.setLikeNumber(newsDTO.getLikeNumber() + NumConstant.ONE); newsUserAttitudeDTO.setAttitudeFlag(AppNewsLikeEnum.UNLIKE.value()); } baseDao.insert(newsEntity); @@ -294,10 +294,10 @@ public class NewsServiceImpl extends BaseServiceImpl implem @Override public Result modifyNewsBrowse(EpdcNewsBrowseFromDTO newsBrowseFromDTO) { NewsDTO newsDTO = get(newsBrowseFromDTO.getNewsId()); - NewsEntity newsEntity= ConvertUtils.sourceToTarget(newsDTO, NewsEntity.class); - newsEntity.setReadingAmount(newsDTO.getReadingAmount()+1); + NewsEntity newsEntity = ConvertUtils.sourceToTarget(newsDTO, NewsEntity.class); + newsEntity.setReadingAmount(newsDTO.getReadingAmount() + 1); baseDao.updateById(newsEntity); - return new Result(); + return new Result(); } } \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/enums/AppUserAuditStateEnum.java b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/enums/AppUserAuditStateEnum.java index 5384bf029..213cd6303 100644 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/enums/AppUserAuditStateEnum.java +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/enums/AppUserAuditStateEnum.java @@ -1,5 +1,7 @@ package com.elink.esua.epdc.enums; +import com.elink.esua.epdc.commons.tools.constant.NumConstant; + /** * 用户审核状态枚举 * @@ -12,15 +14,15 @@ public enum AppUserAuditStateEnum { /** * 0-未审核 */ - UNDER_AUDIT("0"), + UNDER_AUDIT(NumConstant.ZERO_STR), /** * 1-审核通过 */ - AUDIT_SUCCESS("1"), + AUDIT_SUCCESS(NumConstant.ONE_STR), /** * 2-审核未通过 */ - AUDIT_FAILURE("2"); + AUDIT_FAILURE(NumConstant.TWO_STR); private String value; diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/enums/AppUserStateEnum.java b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/enums/AppUserStateEnum.java index ecc36b51a..a6404e0d1 100644 --- a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/enums/AppUserStateEnum.java +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/enums/AppUserStateEnum.java @@ -1,5 +1,7 @@ package com.elink.esua.epdc.enums; +import com.elink.esua.epdc.commons.tools.constant.NumConstant; + /** * 用户状态枚举 * @@ -7,24 +9,24 @@ package com.elink.esua.epdc.enums; * @email yujintao@elink-cn.com * @date 2019/9/7 10:50 */ -public enum AppUserStateEnum { +public enum AppUserStateEnum { /** * 0已注册 */ - REGISTERED("0"), + REGISTERED(NumConstant.ZERO_STR), /** * 1未注册需扫码 */ - UNREGISTERED("1"), + UNREGISTERED(NumConstant.ONE_STR), /** * 2注册审核中 */ - UNDER_AUDIT("2"), + UNDER_AUDIT(NumConstant.TWO_STR), /** * 3注册审核失败 */ - AUDIT_FAILURE("2"); + AUDIT_FAILURE(NumConstant.THREE_STR); private String value;