|
@@ -6,9 +6,11 @@ import com.xiaoan.common.constant.MsgCode;
|
|
|
import com.xiaoan.common.model.PageDto;
|
|
|
import com.xiaoan.common.util.ResultJson;
|
|
|
import com.xiaoan.domain.backend.IssueEntity;
|
|
|
+import com.xiaoan.domain.backend.ReplyEntity;
|
|
|
import com.xiaoan.domain.dto.request.IssueRequest;
|
|
|
import com.xiaoan.domain.dto.response.IssueResponse;
|
|
|
import com.xiaoan.service.backend.IssueService;
|
|
|
+import com.xiaoan.service.backend.ReplyService;
|
|
|
import com.xiaoan.web.aop.WebControllerLog;
|
|
|
import com.xiaoan.web.shiro.JwtUtil2;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -18,9 +20,10 @@ import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
+import tk.mybatis.mapper.entity.Condition;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
-import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@@ -36,6 +39,9 @@ public class IssueController extends BaseController {
|
|
|
@Autowired
|
|
|
private IssueService issueService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ReplyService replyService;
|
|
|
+
|
|
|
/**
|
|
|
* 全部人都可以看
|
|
|
* @param param
|
|
@@ -80,15 +86,18 @@ public class IssueController extends BaseController {
|
|
|
if (entity == null) {
|
|
|
return new ResultJson(MsgCode.e_COMMON_3001, MsgCode.msg_COMMON_3001);
|
|
|
}
|
|
|
-
|
|
|
- entity.setReply(item);
|
|
|
- entity.setUpdateTime(new Date());
|
|
|
-
|
|
|
- issueService.update(entity);
|
|
|
+ ReplyEntity replyEntity = new ReplyEntity();
|
|
|
+ replyEntity.setIssueId(id);
|
|
|
+ replyEntity.setReply(item);
|
|
|
+ replyService.save(replyEntity);
|
|
|
|
|
|
return new ResultJson(MsgCode.SUCCESS_CODE, MsgCode.msg_SUCCESS);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 只有管理员才能删除问题
|
|
|
*/
|
|
@@ -96,7 +105,7 @@ public class IssueController extends BaseController {
|
|
|
@WebControllerLog(description = "问题反馈-删除问题")
|
|
|
@ApiOperation("删除问题")
|
|
|
@GetMapping("delete/{id}")
|
|
|
- public ResultJson save(@PathVariable Long id){
|
|
|
+ public ResultJson delete(@PathVariable Long id){
|
|
|
issueService.deleteById(id);
|
|
|
return new ResultJson(MsgCode.SUCCESS_CODE, MsgCode.msg_SUCCESS);
|
|
|
}
|
|
@@ -111,6 +120,33 @@ public class IssueController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @RequiresPermissions("admin:issue:list")
|
|
|
+ @WebControllerLog(description = "问题反馈-查看详情")
|
|
|
+ @ApiOperation("查看详情")
|
|
|
+ @GetMapping("detail/{id}")
|
|
|
+ public ResultJson detail(@PathVariable Long id){
|
|
|
+ IssueEntity issueEntity = issueService.findById(id);
|
|
|
+ if (issueEntity == null) {
|
|
|
+ return new ResultJson(MsgCode.e_COMMON_3001, MsgCode.msg_COMMON_3001);
|
|
|
+ }
|
|
|
+
|
|
|
+ IssueResponse issueResponse = issueService.ResponseFindById(id);
|
|
|
+
|
|
|
+
|
|
|
+ Condition condition = new Condition(ReplyEntity.class);
|
|
|
+ condition.and().andEqualTo("issueId", id);
|
|
|
+
|
|
|
+ List<ReplyEntity> replyEntityList = replyService.findAll(condition);
|
|
|
+
|
|
|
+ HashMap<String, Object> resultMap = new HashMap<>();
|
|
|
+ resultMap.put("issue", issueResponse);
|
|
|
+ resultMap.put("reply", replyEntityList);
|
|
|
+
|
|
|
+
|
|
|
+ return new ResultJson(MsgCode.SUCCESS_CODE, resultMap);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|