Commit 6e82cebc authored by jiaorz's avatar jiaorz

Merge branch 'master-modify-cutAmount' into dev

# Conflicts:
#	xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/order/OrderPageVO.java
#	xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/BaseOrderBiz.java
#	xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderVehicleCrosstownBiz.java
#	xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/inner/OrderCancelBiz.java
#	xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/BaseOrderController.java
parent f9c614de
...@@ -65,11 +65,11 @@ public class MsgBiz { ...@@ -65,11 +65,11 @@ public class MsgBiz {
//获取所有朋友圈 //获取所有朋友圈
AppUserDTO appUserDTO = userBiz.getUserInfo(); AppUserDTO appUserDTO = userBiz.getUserInfo();
Integer userId = null; Integer userId = null;
if(appUserDTO != null) { if (appUserDTO != null) {
userId = appUserDTO.getImUserid(); userId = appUserDTO.getImUserid();
} }
page = page == null ? 1 : page; page = page == null ? 1 : page;
limit = limit == null ? 10 : limit; limit = limit == null ? 10 : limit;
Pageable pageable = PageRequest.of(--page, limit); Pageable pageable = PageRequest.of(--page, limit);
Query query = null; Query query = null;
List<Msg> msgList = null; List<Msg> msgList = null;
...@@ -80,7 +80,7 @@ public class MsgBiz { ...@@ -80,7 +80,7 @@ public class MsgBiz {
query.with(new Sort(Sort.Direction.DESC, "time")); query.with(new Sort(Sort.Direction.DESC, "time"));
msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), userId); msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), userId);
PageInfo<MsgVo> goodPageInfo = new PageInfo<>(replaceMsgResult(msgList)); PageInfo<MsgVo> goodPageInfo = new PageInfo<>(replaceMsgResult(msgList));
goodPageInfo.setPageSize(totalSize%limit == 0 ?totalSize/limit : totalSize/limit + 1); goodPageInfo.setPageSize(totalSize % limit == 0 ? totalSize / limit : totalSize / limit + 1);
return ObjectRestResponse.succ(goodPageInfo); return ObjectRestResponse.succ(goodPageInfo);
} else { } else {
List<Integer> ids = new ArrayList<>(); List<Integer> ids = new ArrayList<>();
...@@ -93,7 +93,7 @@ public class MsgBiz { ...@@ -93,7 +93,7 @@ public class MsgBiz {
msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), userId); msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), userId);
PageInfo<MsgVo> goodPageInfo = new PageInfo<>(replaceMsgResult(msgList)); PageInfo<MsgVo> goodPageInfo = new PageInfo<>(replaceMsgResult(msgList));
goodPageInfo.setPageSize(totalSize%limit == 0 ?totalSize/limit : totalSize/limit + 1); goodPageInfo.setPageSize(totalSize % limit == 0 ? totalSize / limit : totalSize / limit + 1);
return ObjectRestResponse.succ(goodPageInfo); return ObjectRestResponse.succ(goodPageInfo);
} }
...@@ -102,7 +102,7 @@ public class MsgBiz { ...@@ -102,7 +102,7 @@ public class MsgBiz {
public ObjectRestResponse getHotMsgList(Integer page, Integer limit) { public ObjectRestResponse getHotMsgList(Integer page, Integer limit) {
AppUserDTO appUserDTO = userBiz.getUserInfo(); AppUserDTO appUserDTO = userBiz.getUserInfo();
Integer userId = null; Integer userId = null;
if(appUserDTO != null) { if (appUserDTO != null) {
userId = appUserDTO.getImUserid(); userId = appUserDTO.getImUserid();
} }
page = page == null ? 1 : page; page = page == null ? 1 : page;
...@@ -117,72 +117,73 @@ public class MsgBiz { ...@@ -117,72 +117,73 @@ public class MsgBiz {
query.with(new Sort(Sort.Direction.DESC, "count.praise")); query.with(new Sort(Sort.Direction.DESC, "count.praise"));
List<Msg> msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), userId); List<Msg> msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), userId);
PageInfo<MsgVo> goodPageInfo = new PageInfo<>(replaceMsgResult(msgList)); PageInfo<MsgVo> goodPageInfo = new PageInfo<>(replaceMsgResult(msgList));
goodPageInfo.setPageSize(totalSize%limit == 0 ?totalSize/limit : totalSize/limit + 1); goodPageInfo.setPageSize(totalSize % limit == 0 ? totalSize / limit : totalSize / limit + 1);
return ObjectRestResponse.succ(goodPageInfo); return ObjectRestResponse.succ(goodPageInfo);
} }
public ObjectRestResponse get(String id){ public ObjectRestResponse get(String id) {
//获取所有朋友圈 //获取所有朋友圈
AppUserDTO appUserDTO = userBiz.getUserInfo(); AppUserDTO appUserDTO = userBiz.getUserInfo();
Integer userId = null; Integer userId = null;
if(appUserDTO != null) { if (appUserDTO != null) {
userId = appUserDTO.getImUserid(); userId = appUserDTO.getImUserid();
} }
if(id == null) { if (id == null) {
return ObjectRestResponse.paramIsEmpty(); return ObjectRestResponse.paramIsEmpty();
} }
Query query = new Query(Criteria.where("id").is(new ObjectId(id))); Query query = new Query(Criteria.where("id").is(new ObjectId(id)));
List<Msg> msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), userId); List<Msg> msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), userId);
List<MsgVo> msgVoList = replaceMsgResult(msgList); List<MsgVo> msgVoList = replaceMsgResult(msgList);
if(msgVoList.size() > 0) { if (msgVoList.size() > 0) {
return ObjectRestResponse.succ(msgVoList.get(0)); return ObjectRestResponse.succ(msgVoList.get(0));
} }
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
public ObjectRestResponse getMsgListByUserId(Integer page, Integer limit, Integer type) { public ObjectRestResponse getMsgListByUserId(Integer page, Integer limit, Integer type) {
//获取所有朋友圈 //获取所有朋友圈
page = page == null ? 1 : page; page = page == null ? 1 : page;
limit = limit == null ? 10 : limit; limit = limit == null ? 10 : limit;
AppUserDTO appUserDTO = userBiz.getUserInfo(); AppUserDTO appUserDTO = userBiz.getUserInfo();
Integer userId = null; Integer userId = null;
if(appUserDTO != null) { if (appUserDTO != null) {
userId = appUserDTO.getImUserid(); userId = appUserDTO.getImUserid();
} else { } else {
return ObjectRestResponse.createFailedResult(ResultCode.RSTOKEN_EXPIRED_CODE, "token失效"); return ObjectRestResponse.createFailedResult(ResultCode.RSTOKEN_EXPIRED_CODE, "token失效");
} }
Pageable pageable = PageRequest.of(--page, limit); Pageable pageable = PageRequest.of(--page, limit);
List<Integer> ids = new ArrayList<>(); List<Integer> ids = new ArrayList<>();
if(type != null) { if (type != null) {
ids.add(type); ids.add(type);
} }
if(type != null && type == 5) { if (type != null && type == 5) {
QuestionParamDto questionParamDto = new QuestionParamDto(); QuestionParamDto questionParamDto = new QuestionParamDto();
questionParamDto.setUserId(Long.parseLong(userId + "")); questionParamDto.setUserId(Long.parseLong(userId + ""));
return imQuestionBiz.getList(questionParamDto); return imQuestionBiz.getList(questionParamDto);
} }
Query query = new Query(Criteria.where("body.type").in(ids)); Query query = new Query(Criteria.where("body.type").in(ids));
query.addCriteria(Criteria.where("userId").is(userId)); query.addCriteria(Criteria.where("userId").is(userId));
int totalSize = mongoTemplate.find(query, Msg.class, "s_msg").size(); int totalSize = mongoTemplate.find(query, Msg.class, "s_msg").size();
query.with(pageable); query.with(pageable);
query.with(new Sort(Sort.Direction.DESC, "time")); query.with(new Sort(Sort.Direction.DESC, "time"));
List<Msg> msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), userId); List<Msg> msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), userId);
List<MsgVo> msgVoList = replaceMsgResult(msgList); List<MsgVo> msgVoList = replaceMsgResult(msgList);
PageInfo<MsgVo> goodPageInfo = new PageInfo<>(msgVoList); PageInfo<MsgVo> goodPageInfo = new PageInfo<>(msgVoList);
goodPageInfo.setPageSize(totalSize%limit == 0 ?totalSize/limit : totalSize/limit + 1); goodPageInfo.setPageSize(totalSize % limit == 0 ? totalSize / limit : totalSize / limit + 1);
return ObjectRestResponse.succ(PageDataVO.pageInfo(goodPageInfo)); return ObjectRestResponse.succ(PageDataVO.pageInfo(goodPageInfo));
} }
/** /**
* 删除消息 * 删除消息
*
* @param ids id字符串,用逗号隔开 * @param ids id字符串,用逗号隔开
* @return * @return
*/ */
public ObjectRestResponse deleteByList(String ids) { public ObjectRestResponse deleteByList(String ids) {
Integer userId = 0; Integer userId = 0;
AppUserDTO appUserDTO = userBiz.getUserInfo(); AppUserDTO appUserDTO = userBiz.getUserInfo();
if(appUserDTO == null) { if (appUserDTO == null) {
return ObjectRestResponse.createFailedResult(ResultCode.RSTOKEN_EXPIRED_CODE, ResultCode.getMsg(ResultCode.RSTOKEN_EXPIRED_CODE)); return ObjectRestResponse.createFailedResult(ResultCode.RSTOKEN_EXPIRED_CODE, ResultCode.getMsg(ResultCode.RSTOKEN_EXPIRED_CODE));
} }
if (StringUtils.isBlank(ids)) { if (StringUtils.isBlank(ids)) {
...@@ -195,7 +196,7 @@ public class MsgBiz { ...@@ -195,7 +196,7 @@ public class MsgBiz {
Query query = new Query(Criteria.where("id").in(set)); Query query = new Query(Criteria.where("id").in(set));
query.addCriteria(Criteria.where("userId").is(userId)); query.addCriteria(Criteria.where("userId").is(userId));
List<Msg> msgList = mongoTemplate.find(query, Msg.class, "s_msg"); List<Msg> msgList = mongoTemplate.find(query, Msg.class, "s_msg");
if(msgList.size() != set.size()) { //查询到的消息条数不等于查询的Id数 if (msgList.size() != set.size()) { //查询到的消息条数不等于查询的Id数
return ObjectRestResponse.createFailedResult(ResultCode.IM_DELETE_FAIL_CODE, ResultCode.getMsg(ResultCode.IM_DELETE_FAIL_CODE)); return ObjectRestResponse.createFailedResult(ResultCode.IM_DELETE_FAIL_CODE, ResultCode.getMsg(ResultCode.IM_DELETE_FAIL_CODE));
} }
DeleteResult deleteResult = mongoTemplate.remove(query, Msg.class, "s_msg"); DeleteResult deleteResult = mongoTemplate.remove(query, Msg.class, "s_msg");
...@@ -222,7 +223,7 @@ public class MsgBiz { ...@@ -222,7 +223,7 @@ public class MsgBiz {
//添加点赞 //添加点赞
List<Praise> praise = mongoTemplate.find(query, Praise.class, "s_praise"); List<Praise> praise = mongoTemplate.find(query, Praise.class, "s_praise");
msg.setPraises(replacePraiseResult(praise)); msg.setPraises(replacePraiseResult(praise));
if(userId != null) { if (userId != null) {
msg.setIsPraise(this.exists(userId, msg.getId()) ? 1 : 0); msg.setIsPraise(this.exists(userId, msg.getId()) ? 1 : 0);
msg.setIsCollect(this.existsCollect(userId, msg.getId()) ? 1 : 0); msg.setIsCollect(this.existsCollect(userId, msg.getId()) ? 1 : 0);
} else { } else {
...@@ -248,7 +249,7 @@ public class MsgBiz { ...@@ -248,7 +249,7 @@ public class MsgBiz {
public boolean exists(int userId, ObjectId msgId) { public boolean exists(int userId, ObjectId msgId) {
Query query = new Query(Criteria.where("msgId").is(msgId).and("userId").is(userId)); Query query = new Query(Criteria.where("msgId").is(msgId).and("userId").is(userId));
List<Praise> praise = mongoTemplate.find(query, Praise.class, "s_praise"); List<Praise> praise = mongoTemplate.find(query, Praise.class, "s_praise");
return praise.size() > 0 ? true :false; return praise.size() > 0 ? true : false;
} }
/** /**
...@@ -261,23 +262,25 @@ public class MsgBiz { ...@@ -261,23 +262,25 @@ public class MsgBiz {
public boolean existsCollect(int userId, ObjectId msgId) { public boolean existsCollect(int userId, ObjectId msgId) {
Query query = new Query(Criteria.where("msgId").is(msgId).and("userId").is(userId)); Query query = new Query(Criteria.where("msgId").is(msgId).and("userId").is(userId));
List<Comment> comments = mongoTemplate.find(query, Comment.class, "s_comment"); List<Comment> comments = mongoTemplate.find(query, Comment.class, "s_comment");
return comments.size() > 0 ? true :false; return comments.size() > 0 ? true : false;
} }
public List<MsgVo> replaceMsgResult(List<Msg> list) { public List<MsgVo> replaceMsgResult(List<Msg> list) {
List<MsgVo> msgVoList = new ArrayList<>(); List<MsgVo> msgVoList = new ArrayList<>();
for(Msg msg : list) { for (Msg msg : list) {
MsgVo msgVo = new MsgVo(); MsgVo msgVo = new MsgVo();
BeanUtil.copyProperties(msg, msgVo, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true)); if(msg != null) {
//添加用户昵称和头像 BeanUtil.copyProperties(msg, msgVo, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
ImiVo imiVo = userBiz.getUserInfo(msg.getUserId()); //添加用户昵称和头像
if(imiVo != null) { ImiVo imiVo = userBiz.getUserInfo(msg.getUserId());
msgVo.setNickname(imiVo.getNickname()); if (imiVo != null) {
msgVo.setPicUrl(imiVo.getHeadimgurl()); msgVo.setNickname(imiVo.getNickname());
} msgVo.setPicUrl(imiVo.getHeadimgurl());
//String address = AddressUtils.getMapaddress(msg.getLatitude().toString(), msg.getLongitude().toString()); }
msgVo.setAddress(msg.getLocation()); //String address = AddressUtils.getMapaddress(msg.getLatitude().toString(), msg.getLongitude().toString());
msgVo.setMsgId(msg.getId().toString()); msgVo.setAddress(msg.getLocation());
msgVo.setMsgId(msg.getId().toString());
}
msgVoList.add(msgVo); msgVoList.add(msgVo);
} }
return msgVoList; return msgVoList;
...@@ -285,30 +288,34 @@ public class MsgBiz { ...@@ -285,30 +288,34 @@ public class MsgBiz {
public List<PraiseVo> replacePraiseResult(List<Praise> list) { public List<PraiseVo> replacePraiseResult(List<Praise> list) {
List<PraiseVo> praiseVoArrayList = new ArrayList<>(); List<PraiseVo> praiseVoArrayList = new ArrayList<>();
for(Praise praise : list) { for (Praise praise : list) {
PraiseVo praiseVo = new PraiseVo(); PraiseVo praiseVo = new PraiseVo();
BeanUtil.copyProperties(praise, praiseVo, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true)); if (praise != null) {
//添加用户昵称和头像 BeanUtil.copyProperties(praise, praiseVo, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
ImiVo imiVo = userBiz.getUserInfo(praise.getUserId()); //添加用户昵称和头像
if(imiVo != null) { ImiVo imiVo = userBiz.getUserInfo(praise.getUserId());
praiseVo.setNickname(imiVo.getNickname()); if (imiVo != null) {
praiseVo.setPicUrl(imiVo.getHeadimgurl()); praiseVo.setNickname(imiVo.getNickname());
praiseVo.setPicUrl(imiVo.getHeadimgurl());
}
} }
praiseVoArrayList.add(praiseVo); praiseVoArrayList.add(praiseVo);
} }
return praiseVoArrayList; return praiseVoArrayList;
} }
public List<CommentVo> replaceCommentResult(List<Comment> list) { public List<CommentVo> replaceCommentResult(List<Comment> list) {
List<CommentVo> commentVoList = new ArrayList<>(); List<CommentVo> commentVoList = new ArrayList<>();
for(Comment comment : list) { for (Comment comment : list) {
CommentVo commentVo = new CommentVo(); CommentVo commentVo = new CommentVo();
BeanUtil.copyProperties(comment, commentVo, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true)); if (comment != null) {
//添加用户昵称和头像 BeanUtil.copyProperties(comment, commentVo, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
ImiVo imiVo = userBiz.getUserInfo(comment.getUserId()); //添加用户昵称和头像
if(imiVo != null) { ImiVo imiVo = userBiz.getUserInfo(comment.getUserId());
commentVo.setNickname(imiVo.getNickname()); if (imiVo != null) {
commentVo.setPicUrl(imiVo.getHeadimgurl()); commentVo.setNickname(imiVo.getNickname());
commentVo.setPicUrl(imiVo.getHeadimgurl());
}
} }
commentVoList.add(commentVo); commentVoList.add(commentVo);
} }
...@@ -318,7 +325,7 @@ public class MsgBiz { ...@@ -318,7 +325,7 @@ public class MsgBiz {
public Integer getNumber() { public Integer getNumber() {
Integer number = 0; Integer number = 0;
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData(); Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
if(MapUtils.isNotEmpty(dictionaryMap)) { if (MapUtils.isNotEmpty(dictionaryMap)) {
Dictionary dictionary = dictionaryMap.get(IM_TYPE + "_" + DictionaryKey.MSG_LIMIT_NUMBER); Dictionary dictionary = dictionaryMap.get(IM_TYPE + "_" + DictionaryKey.MSG_LIMIT_NUMBER);
if (dictionary != null && StringUtils.isNotBlank(dictionary.getDetail())) { if (dictionary != null && StringUtils.isNotBlank(dictionary.getDetail())) {
number = Integer.parseInt(dictionary.getDetail()); number = Integer.parseInt(dictionary.getDetail());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment