|
@@ -56,18 +56,18 @@ public class ComplaintSuggestionServiceImpl implements IComplaintSuggestionServi
|
|
* @return 投诉建议
|
|
* @return 投诉建议
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public ComplaintSuggestionVo queryById(Long suggestionId){
|
|
|
|
|
|
+ public ComplaintSuggestionVo queryById(Long suggestionId) {
|
|
ComplaintSuggestionVo vo = baseMapper.selectVoById(suggestionId);
|
|
ComplaintSuggestionVo vo = baseMapper.selectVoById(suggestionId);
|
|
SuggestionFjBo fjBo = new SuggestionFjBo();
|
|
SuggestionFjBo fjBo = new SuggestionFjBo();
|
|
fjBo.setSuggestionId(suggestionId);
|
|
fjBo.setSuggestionId(suggestionId);
|
|
List<SuggestionFjVo> suggestionFjVos = suggestionFjService.queryList(fjBo);
|
|
List<SuggestionFjVo> suggestionFjVos = suggestionFjService.queryList(fjBo);
|
|
- if (suggestionFjVos != null && !suggestionFjVos.isEmpty()){
|
|
|
|
|
|
+ if (suggestionFjVos != null && !suggestionFjVos.isEmpty()) {
|
|
vo.setSuggestionFjList(suggestionFjVos);
|
|
vo.setSuggestionFjList(suggestionFjVos);
|
|
}
|
|
}
|
|
//判断是否已读如果是未读设置成已读
|
|
//判断是否已读如果是未读设置成已读
|
|
String isRead = vo.getIsRead();
|
|
String isRead = vo.getIsRead();
|
|
Long userId = vo.getUserId();
|
|
Long userId = vo.getUserId();
|
|
- if (N.equals(isRead) && userId.equals(LoginHelper.getUserId())){
|
|
|
|
|
|
+ if (N.equals(isRead) && userId.equals(LoginHelper.getUserId())) {
|
|
vo.setIsRead(Y);
|
|
vo.setIsRead(Y);
|
|
ComplaintSuggestion update = MapstructUtils.convert(vo, ComplaintSuggestion.class);
|
|
ComplaintSuggestion update = MapstructUtils.convert(vo, ComplaintSuggestion.class);
|
|
baseMapper.updateById(update);
|
|
baseMapper.updateById(update);
|
|
@@ -77,8 +77,8 @@ public class ComplaintSuggestionServiceImpl implements IComplaintSuggestionServi
|
|
Object userNum = RedisUtils.getCacheObject(userSuggestionKey);
|
|
Object userNum = RedisUtils.getCacheObject(userSuggestionKey);
|
|
if (ObjectUtils.isNotEmpty(userNum)) {
|
|
if (ObjectUtils.isNotEmpty(userNum)) {
|
|
RedisUtils.setCacheObject(userSuggestionKey, Math.max((int) userNum - 1, 0));
|
|
RedisUtils.setCacheObject(userSuggestionKey, Math.max((int) userNum - 1, 0));
|
|
- }else {
|
|
|
|
- RedisUtils.setCacheObject(userSuggestionKey,0);
|
|
|
|
|
|
+ } else {
|
|
|
|
+ RedisUtils.setCacheObject(userSuggestionKey, 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return vo;
|
|
return vo;
|
|
@@ -93,8 +93,26 @@ public class ComplaintSuggestionServiceImpl implements IComplaintSuggestionServi
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public TableDataInfo<ComplaintSuggestionVo> queryPageList(ComplaintSuggestionBo bo, PageQuery pageQuery) {
|
|
public TableDataInfo<ComplaintSuggestionVo> queryPageList(ComplaintSuggestionBo bo, PageQuery pageQuery) {
|
|
|
|
+ Long userId = LoginHelper.getUserId();
|
|
LambdaQueryWrapper<ComplaintSuggestion> lqw = buildQueryWrapper(bo);
|
|
LambdaQueryWrapper<ComplaintSuggestion> lqw = buildQueryWrapper(bo);
|
|
Page<ComplaintSuggestionVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
Page<ComplaintSuggestionVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
|
+ if (result.getTotal() > 0) {
|
|
|
|
+ List<ComplaintSuggestionVo> records = result.getRecords();
|
|
|
|
+ for (ComplaintSuggestionVo record : records) {
|
|
|
|
+ //添加附件信息
|
|
|
|
+ Long suggestionId = record.getSuggestionId();
|
|
|
|
+ SuggestionFjBo fjBo = new SuggestionFjBo();
|
|
|
|
+ fjBo.setSuggestionId(suggestionId);
|
|
|
|
+ List<SuggestionFjVo> suggestionFjVos = suggestionFjService.queryList(fjBo);
|
|
|
|
+ if (suggestionFjVos != null && !suggestionFjVos.isEmpty()) {
|
|
|
|
+ record.setSuggestionFjList(suggestionFjVos);
|
|
|
|
+ }
|
|
|
|
+ //app首页统计减少一个数
|
|
|
|
+ String userSuggestionKey = COMPLAINT_SUGGESTION_NO + userId;
|
|
|
|
+ // 回复了这个用户的投诉数量变成0
|
|
|
|
+ RedisUtils.setCacheObject(userSuggestionKey, 0);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return TableDataInfo.build(result);
|
|
return TableDataInfo.build(result);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -117,7 +135,7 @@ public class ComplaintSuggestionServiceImpl implements IComplaintSuggestionServi
|
|
lqw.eq(StringUtils.isNotBlank(bo.getTitle()), ComplaintSuggestion::getTitle, bo.getTitle());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getTitle()), ComplaintSuggestion::getTitle, bo.getTitle());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getContent()), ComplaintSuggestion::getContent, bo.getContent());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getContent()), ComplaintSuggestion::getContent, bo.getContent());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getImages()), ComplaintSuggestion::getImages, bo.getImages());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getImages()), ComplaintSuggestion::getImages, bo.getImages());
|
|
- lqw.eq(bo.getCreatedTime() != null, ComplaintSuggestion::getCreatedTime, bo.getCreatedTime());
|
|
|
|
|
|
+ lqw.eq(bo.getPushTime() != null, ComplaintSuggestion::getPushTime, bo.getPushTime());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), ComplaintSuggestion::getStatus, bo.getStatus());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), ComplaintSuggestion::getStatus, bo.getStatus());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getReplyContent()), ComplaintSuggestion::getReplyContent, bo.getReplyContent());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getReplyContent()), ComplaintSuggestion::getReplyContent, bo.getReplyContent());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getType()), ComplaintSuggestion::getType, bo.getType());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getType()), ComplaintSuggestion::getType, bo.getType());
|
|
@@ -137,9 +155,9 @@ public class ComplaintSuggestionServiceImpl implements IComplaintSuggestionServi
|
|
@Override
|
|
@Override
|
|
public Boolean insertByBo(ComplaintSuggestionBo bo) {
|
|
public Boolean insertByBo(ComplaintSuggestionBo bo) {
|
|
Long userId = LoginHelper.getUserId();
|
|
Long userId = LoginHelper.getUserId();
|
|
- bo.setCreateTime(DateUtils.getNowDate());
|
|
|
|
bo.setUserId(userId);
|
|
bo.setUserId(userId);
|
|
ComplaintSuggestion add = MapstructUtils.convert(bo, ComplaintSuggestion.class);
|
|
ComplaintSuggestion add = MapstructUtils.convert(bo, ComplaintSuggestion.class);
|
|
|
|
+ add.setPushTime(DateUtils.getNowDate());
|
|
validEntityBeforeSave(add);
|
|
validEntityBeforeSave(add);
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
if (flag) {
|
|
if (flag) {
|
|
@@ -148,8 +166,8 @@ public class ComplaintSuggestionServiceImpl implements IComplaintSuggestionServi
|
|
Object allNum = RedisUtils.getCacheObject(COMPLAINT_SUGGESTION_NO_ALL);
|
|
Object allNum = RedisUtils.getCacheObject(COMPLAINT_SUGGESTION_NO_ALL);
|
|
if (ObjectUtils.isNotEmpty(allNum)) {
|
|
if (ObjectUtils.isNotEmpty(allNum)) {
|
|
RedisUtils.setCacheObject(COMPLAINT_SUGGESTION_NO_ALL, Math.max((int) allNum + 1, 0));
|
|
RedisUtils.setCacheObject(COMPLAINT_SUGGESTION_NO_ALL, Math.max((int) allNum + 1, 0));
|
|
- }else {
|
|
|
|
- RedisUtils.setCacheObject(COMPLAINT_SUGGESTION_NO_ALL,1);
|
|
|
|
|
|
+ } else {
|
|
|
|
+ RedisUtils.setCacheObject(COMPLAINT_SUGGESTION_NO_ALL, 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return flag;
|
|
return flag;
|
|
@@ -165,11 +183,12 @@ public class ComplaintSuggestionServiceImpl implements IComplaintSuggestionServi
|
|
public Boolean updateByBo(ComplaintSuggestionBo bo) {
|
|
public Boolean updateByBo(ComplaintSuggestionBo bo) {
|
|
Long userId = bo.getUserId();
|
|
Long userId = bo.getUserId();
|
|
String status = bo.getStatus();
|
|
String status = bo.getStatus();
|
|
- if (TWO.equals(status)){
|
|
|
|
|
|
+ ComplaintSuggestionVo complaintSuggestionVo = baseMapper.selectVoById(bo.getSuggestionId());
|
|
|
|
+ if (!complaintSuggestionVo.getStatus().equals(TWO) && TWO.equals(status)) {
|
|
|
|
+ bo.setReplyTime(DateUtils.getNowDate());
|
|
//判断是否有附件
|
|
//判断是否有附件
|
|
List<SuggestionFj> suggestionFjList = bo.getSuggestionFjList();
|
|
List<SuggestionFj> suggestionFjList = bo.getSuggestionFjList();
|
|
- if (suggestionFjList != null && !suggestionFjList.isEmpty()){
|
|
|
|
-
|
|
|
|
|
|
+ if (suggestionFjList != null && !suggestionFjList.isEmpty()) {
|
|
suggestionFjMapper.insertBatch(suggestionFjList);
|
|
suggestionFjMapper.insertBatch(suggestionFjList);
|
|
}
|
|
}
|
|
String userSuggestionKey = COMPLAINT_SUGGESTION_NO + userId;
|
|
String userSuggestionKey = COMPLAINT_SUGGESTION_NO + userId;
|
|
@@ -177,15 +196,15 @@ public class ComplaintSuggestionServiceImpl implements IComplaintSuggestionServi
|
|
Object userNum = RedisUtils.getCacheObject(userSuggestionKey);
|
|
Object userNum = RedisUtils.getCacheObject(userSuggestionKey);
|
|
if (ObjectUtils.isNotEmpty(userNum)) {
|
|
if (ObjectUtils.isNotEmpty(userNum)) {
|
|
RedisUtils.setCacheObject(userSuggestionKey, Math.max((int) userNum + 1, 0));
|
|
RedisUtils.setCacheObject(userSuggestionKey, Math.max((int) userNum + 1, 0));
|
|
- }else {
|
|
|
|
- RedisUtils.setCacheObject(userSuggestionKey,1);
|
|
|
|
|
|
+ } else {
|
|
|
|
+ RedisUtils.setCacheObject(userSuggestionKey, 1);
|
|
}
|
|
}
|
|
//往redis中新增 总数 投诉建议未回复的数量 app统计使用
|
|
//往redis中新增 总数 投诉建议未回复的数量 app统计使用
|
|
Object allNum = RedisUtils.getCacheObject(COMPLAINT_SUGGESTION_NO_ALL);
|
|
Object allNum = RedisUtils.getCacheObject(COMPLAINT_SUGGESTION_NO_ALL);
|
|
if (ObjectUtils.isNotEmpty(allNum)) {
|
|
if (ObjectUtils.isNotEmpty(allNum)) {
|
|
RedisUtils.setCacheObject(COMPLAINT_SUGGESTION_NO_ALL, Math.max((int) allNum - 1, 0));
|
|
RedisUtils.setCacheObject(COMPLAINT_SUGGESTION_NO_ALL, Math.max((int) allNum - 1, 0));
|
|
- }else {
|
|
|
|
- RedisUtils.setCacheObject(COMPLAINT_SUGGESTION_NO_ALL,0);
|
|
|
|
|
|
+ } else {
|
|
|
|
+ RedisUtils.setCacheObject(COMPLAINT_SUGGESTION_NO_ALL, 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
ComplaintSuggestion update = MapstructUtils.convert(bo, ComplaintSuggestion.class);
|
|
ComplaintSuggestion update = MapstructUtils.convert(bo, ComplaintSuggestion.class);
|
|
@@ -196,7 +215,7 @@ public class ComplaintSuggestionServiceImpl implements IComplaintSuggestionServi
|
|
/**
|
|
/**
|
|
* 保存前的数据校验
|
|
* 保存前的数据校验
|
|
*/
|
|
*/
|
|
- private void validEntityBeforeSave(ComplaintSuggestion entity){
|
|
|
|
|
|
+ private void validEntityBeforeSave(ComplaintSuggestion entity) {
|
|
//TODO 做一些数据校验,如唯一约束
|
|
//TODO 做一些数据校验,如唯一约束
|
|
}
|
|
}
|
|
|
|
|
|
@@ -209,7 +228,7 @@ public class ComplaintSuggestionServiceImpl implements IComplaintSuggestionServi
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
- if(isValid){
|
|
|
|
|
|
+ if (isValid) {
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|
}
|
|
}
|
|
return baseMapper.deleteByIds(ids) > 0;
|
|
return baseMapper.deleteByIds(ids) > 0;
|