| | |
| | | package com.panzhihua.sangeshenbian.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.sangeshenbian.annotation.DistributedLock; |
| | | import com.panzhihua.sangeshenbian.model.dto.*; |
| | | import com.panzhihua.sangeshenbian.model.entity.Complaint; |
| | | import com.panzhihua.sangeshenbian.model.entity.ComplaintAuditRecord; |
| | | import com.panzhihua.sangeshenbian.model.entity.ComplaintProgress; |
| | | import com.panzhihua.sangeshenbian.model.entity.ProblemType; |
| | | import com.panzhihua.sangeshenbian.model.entity.*; |
| | | import com.panzhihua.sangeshenbian.model.query.ComplaintQuery; |
| | | import com.panzhihua.sangeshenbian.model.vo.ComplaintVO; |
| | | import com.panzhihua.sangeshenbian.model.vo.DispatchVO; |
| | | import com.panzhihua.sangeshenbian.service.IComplaintCommentService; |
| | | import com.panzhihua.sangeshenbian.service.IComplaintService; |
| | | import com.panzhihua.sangeshenbian.service.IProblemTypeService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | private final IComplaintService complaintService; |
| | | private final IProblemTypeService problemTypeService; |
| | | private final IComplaintCommentService complaintCommentService; |
| | | @GetMapping("/problem-type/list") |
| | | @ApiOperation("获取诉求问题类型列表") |
| | | public R<List<ProblemType>> problemTypeList() { |
| | |
| | | @ApiOperation(value = "录入诉求") |
| | | @DistributedLock(lockName = "complaint_serial_number_lock") |
| | | public R<?> save(@Valid @RequestBody Complaint complaint) { |
| | | complaintService.saveComplaint(complaint, getUserId()); |
| | | complaintService.saveComplaint(complaint, getLoginUserInfo()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 诉求录入并上报 |
| | | */ |
| | | @PostMapping("/saveAndReport") |
| | | @ApiOperation(value = "诉求录入并上报") |
| | | public R<?> saveAndReport(@Valid @RequestBody ComplaintVO complaintVO) { |
| | | complaintService.saveAndReport(complaintVO, getLoginUserInfo()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 诉求录入并办结 |
| | | */ |
| | | @PostMapping("/saveAndComplete") |
| | | @ApiOperation(value = "诉求录入并办结") |
| | | public R<?> saveAndComplete(@Valid @RequestBody ComplaintSaveAndCompleteDTO complaintVO) { |
| | | complaintService.saveAndComplete(complaintVO, getLoginUserInfo()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 上报撤回 |
| | | */ |
| | | @PostMapping("/revoke") |
| | | @ApiOperation(value = "诉求上报撤回") |
| | | public R<?> reportWithdraw(@RequestBody ComplaintReportWithdrawDTO dto) { |
| | | complaintService.reportWithdraw(dto, getLoginUserInfo()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/list") |
| | | @ApiOperation("工单列表") |
| | |
| | | @GetMapping("/detail") |
| | | @ApiOperation("工单详情") |
| | | public R<ComplaintVO> detail(@ApiParam(name = "id", value = "工单id", required = true) Long id) { |
| | | return R.ok(complaintService.detail(id)); |
| | | return R.ok(complaintService.detail(id,getLoginUserInfo())); |
| | | } |
| | | |
| | | @GetMapping("/progress/{complaintId}") |
| | |
| | | public R<List<ComplaintProgress>> progress(@ApiParam(name = "complaintId", value = "诉求id", required = true) @PathVariable("complaintId") Long complaintId) { |
| | | return R.ok(complaintService.progress(complaintId)); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/save-process") |
| | | @ApiOperation("办理进度录入") |
| | |
| | | complaintService.saveReport(complaintReportDTO, getLoginUserInfo()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 诉求下派 |
| | |
| | | public R<List<DispatchVO>> getDispatchList() { |
| | | return R.ok(complaintService.getDispatchList(getLoginUserInfo())); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 评价诉求 |
| | | * @param complaintComment |
| | | * @return |
| | | */ |
| | | @PostMapping("/commentComplaint") |
| | | @ApiOperation(value = "评价诉求") |
| | | public R<?> commentComplaint(@RequestBody ComplaintComment complaintComment){ |
| | | int count = complaintCommentService.count(new LambdaQueryWrapper<ComplaintComment>().eq(ComplaintComment::getComplaintId, complaintComment.getComplaintId()) |
| | | .eq(ComplaintComment::getDelFlag, 0)); |
| | | if(0 != count){ |
| | | return R.fail("不能重复评价"); |
| | | } |
| | | Long userId = getLoginUserInfo().getUserId(); |
| | | complaintComment.setUserId(userId); |
| | | complaintComment.setCreateTime(new Date()); |
| | | complaintComment.setCreateBy(userId); |
| | | complaintComment.setUpdateBy(userId); |
| | | complaintComment.setUpdateTime(new Date()); |
| | | complaintComment.setDelFlag(0); |
| | | complaintCommentService.save(complaintComment); |
| | | Complaint complaint = complaintService.getById(complaintComment.getComplaintId()); |
| | | complaint.setStatus(8); |
| | | complaint.setCommentRate(complaintComment.getRate()); |
| | | complaintService.updateById(complaint); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/getComplaintCommentInfo/{id}") |
| | | @ApiOperation(value = "获取诉求评价") |
| | | public R<ComplaintComment> getComplaintCommentInfo(@PathVariable("id") Long id){ |
| | | ComplaintComment one = complaintCommentService.getOne(new LambdaQueryWrapper<ComplaintComment>().eq(ComplaintComment::getComplaintId, id).eq(ComplaintComment::getDelFlag, 0)); |
| | | return R.ok(one); |
| | | } |
| | | } |