|
|
@@ -6,10 +6,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.tuoheng.api.entity.domain.Feedback; |
|
|
|
import com.tuoheng.api.entity.domain.Stream; |
|
|
|
import com.tuoheng.api.entity.domain.Tenant; |
|
|
|
import com.tuoheng.api.entity.domain.User; |
|
|
|
import com.tuoheng.api.entity.request.FeedbackQuery; |
|
|
|
import com.tuoheng.api.mapper.FeedbackMapper; |
|
|
|
import com.tuoheng.api.mapper.StreamMapper; |
|
|
|
import com.tuoheng.api.mapper.TenantMapper; |
|
|
|
import com.tuoheng.api.mapper.UserMapper; |
|
|
|
import com.tuoheng.api.service.IFeedbackService; |
|
|
|
import com.tuoheng.common.common.BaseServiceImpl; |
|
|
@@ -41,22 +43,24 @@ public class FeedbackServiceImpl extends BaseServiceImpl<FeedbackMapper, Feedbac |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private UserMapper userMapper; |
|
|
|
@Autowired |
|
|
|
private TenantMapper tenantMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public JsonResult submit(Feedback feedback) { |
|
|
|
if(StringUtils.isEmpty(feedback.getOpenid())){ |
|
|
|
if (StringUtils.isEmpty(feedback.getOpenid())) { |
|
|
|
return JsonResult.error("openid为空"); |
|
|
|
} |
|
|
|
Stream stream = streamMapper.selectById(feedback.getStreamId()); |
|
|
|
|
|
|
|
if(ObjectUtil.isNotNull(stream)){ |
|
|
|
if (ObjectUtil.isNotNull(stream)) { |
|
|
|
feedback.setTenantId(stream.getTenantId()); |
|
|
|
feedback.setStreamName(stream.getName()); |
|
|
|
feedback.setStreamAdminId(stream.getStreamAdminId()); |
|
|
|
feedback.setStreamAdminName(stream.getStreamAdminName()); |
|
|
|
feedback.setType(1); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
return JsonResult.error("河流信息不存在"); |
|
|
|
} |
|
|
|
return super.add(feedback); |
|
|
@@ -64,10 +68,10 @@ public class FeedbackServiceImpl extends BaseServiceImpl<FeedbackMapper, Feedbac |
|
|
|
|
|
|
|
@Override |
|
|
|
public JsonResult my(FeedbackQuery query) { |
|
|
|
if(null == query.getPage() || null == query.getLimit()){ |
|
|
|
if (null == query.getPage() || null == query.getLimit()) { |
|
|
|
return JsonResult.error("分页数据为空"); |
|
|
|
} |
|
|
|
if(StringUtils.isEmpty(query.getOpenid())){ |
|
|
|
if (StringUtils.isEmpty(query.getOpenid())) { |
|
|
|
return JsonResult.error("openid为空"); |
|
|
|
} |
|
|
|
|
|
|
@@ -76,62 +80,64 @@ public class FeedbackServiceImpl extends BaseServiceImpl<FeedbackMapper, Feedbac |
|
|
|
IPage<Feedback> pageData = feedbackMapper.selectPage(page, new LambdaQueryWrapper<Feedback>() |
|
|
|
.eq(Feedback::getMark, 1) |
|
|
|
.eq(Feedback::getOpenid, query.getOpenid()) |
|
|
|
.eq(Feedback::getType,1) |
|
|
|
.eq(Feedback::getType, 1) |
|
|
|
.orderByDesc(Feedback::getCreateTime)); |
|
|
|
pageData.getRecords().stream().map(vo -> { |
|
|
|
Stream stream = streamMapper.selectById(vo.getStreamId()); |
|
|
|
if(StringUtils.isNotNull(stream)){ |
|
|
|
vo.setStreamImage(CommonUtils.getImageURL(stream.getImage())); |
|
|
|
} |
|
|
|
if (StringUtils.isNotNull(vo.getStatus())){ |
|
|
|
if(vo.getStatus()==4){ |
|
|
|
User user = userMapper.selectById(vo.getStreamAdminId()); |
|
|
|
//判空 |
|
|
|
if(StringUtils.isNull(user)){ |
|
|
|
throw new ServiceException(HttpStatus.BAD_REQUEST.value(),"当前反馈问题id"+vo.getId()+"查询不到对应责任河湖长"); |
|
|
|
Stream stream = streamMapper.selectById(vo.getStreamId()); |
|
|
|
if (StringUtils.isNotNull(stream)) { |
|
|
|
vo.setStreamImage(CommonUtils.getImageURL(stream.getImage())); |
|
|
|
} |
|
|
|
vo.setRealname(user.getRealname()); |
|
|
|
} |
|
|
|
if(vo.getStatus()==3){ |
|
|
|
User user = userMapper.selectById(Integer.parseInt(vo.getUpdateUser().toString())); |
|
|
|
//判空 |
|
|
|
if(StringUtils.isNull(user)){ |
|
|
|
throw new ServiceException(HttpStatus.BAD_REQUEST.value(),"当前反馈问题id"+vo.getId()+"查询不到对应责任河湖长"); |
|
|
|
if (StringUtils.isNotNull(vo.getStatus())) { |
|
|
|
if (vo.getStatus() == 4) { |
|
|
|
User user = userMapper.selectById(vo.getStreamAdminId()); |
|
|
|
//判空 |
|
|
|
if (StringUtils.isNull(user)) { |
|
|
|
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "当前反馈问题id" + vo.getId() + "查询不到对应责任河湖长"); |
|
|
|
} |
|
|
|
vo.setRealname(user.getRealname()); |
|
|
|
} |
|
|
|
if (vo.getStatus() == 3) { |
|
|
|
User user = userMapper.selectById(Integer.parseInt(vo.getUpdateUser().toString())); |
|
|
|
//判空 |
|
|
|
if (StringUtils.isNull(user)) { |
|
|
|
Tenant tenant = tenantMapper.selectById(Integer.parseInt(vo.getUpdateUser().toString())); |
|
|
|
vo.setRealname(tenant.getName()); |
|
|
|
} else { |
|
|
|
vo.setRealname(user.getRealname()); |
|
|
|
} |
|
|
|
} else if (vo.getStatus() == 1 || vo.getStatus() == 2) { |
|
|
|
vo.setHandleTime(null); |
|
|
|
} |
|
|
|
} |
|
|
|
vo.setRealname(user.getRealname()); |
|
|
|
}else if(vo.getStatus()==1 || vo.getStatus()==2){ |
|
|
|
vo.setHandleTime(null); |
|
|
|
} |
|
|
|
} |
|
|
|
//反馈图片地址 |
|
|
|
if(StringUtils.isNotEmpty(vo.getFeedbackUrl())){ |
|
|
|
String[] feedbackUrls = vo.getFeedbackUrl().split(","); |
|
|
|
if(StringUtils.isNotEmpty(feedbackUrls)){ |
|
|
|
for (int i = 0; i < feedbackUrls.length; i++) { |
|
|
|
if(StringUtils.isNotEmpty(feedbackUrls[i])){ |
|
|
|
feedbackUrls[i] = CommonConfig.imageURL + feedbackUrls[i]; |
|
|
|
//反馈图片地址 |
|
|
|
if (StringUtils.isNotEmpty(vo.getFeedbackUrl())) { |
|
|
|
String[] feedbackUrls = vo.getFeedbackUrl().split(","); |
|
|
|
if (StringUtils.isNotEmpty(feedbackUrls)) { |
|
|
|
for (int i = 0; i < feedbackUrls.length; i++) { |
|
|
|
if (StringUtils.isNotEmpty(feedbackUrls[i])) { |
|
|
|
feedbackUrls[i] = CommonConfig.imageURL + feedbackUrls[i]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//反馈图片封面地址,取第一张图 |
|
|
|
vo.setFeedbackCover(feedbackUrls[0]); |
|
|
|
vo.setFeedbackUrl(StringUtils.join(feedbackUrls, ",")); |
|
|
|
} |
|
|
|
} |
|
|
|
//反馈图片封面地址,取第一张图 |
|
|
|
vo.setFeedbackCover(feedbackUrls[0]); |
|
|
|
vo.setFeedbackUrl(StringUtils.join(feedbackUrls, ",")); |
|
|
|
} |
|
|
|
|
|
|
|
//处理图片地址 |
|
|
|
if(StringUtils.isNotEmpty(vo.getHandleUrl())){ |
|
|
|
String[] handleUrls = vo.getHandleUrl().split(","); |
|
|
|
if(StringUtils.isNotEmpty(handleUrls)){ |
|
|
|
for (int i = 0; i < handleUrls.length; i++) { |
|
|
|
if(StringUtils.isNotEmpty(handleUrls[i])){ |
|
|
|
handleUrls[i] = CommonConfig.imageURL + handleUrls[i]; |
|
|
|
//处理图片地址 |
|
|
|
if (StringUtils.isNotEmpty(vo.getHandleUrl())) { |
|
|
|
String[] handleUrls = vo.getHandleUrl().split(","); |
|
|
|
if (StringUtils.isNotEmpty(handleUrls)) { |
|
|
|
for (int i = 0; i < handleUrls.length; i++) { |
|
|
|
if (StringUtils.isNotEmpty(handleUrls[i])) { |
|
|
|
handleUrls[i] = CommonConfig.imageURL + handleUrls[i]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
vo.setHandleUrl(StringUtils.join(handleUrls, ",")); |
|
|
|
} |
|
|
|
} |
|
|
|
vo.setHandleUrl(StringUtils.join(handleUrls, ",")); |
|
|
|
} |
|
|
|
|
|
|
|
return vo; |
|
|
|
return vo; |
|
|
|
} |
|
|
|
).collect(Collectors.toList()); |
|
|
|
return JsonResult.success(pageData); |