| | |
| | | import com.panzhihua.westcommittee.service.IComplaintCommentService; |
| | | import com.panzhihua.westcommittee.service.IComplaintService; |
| | | import com.panzhihua.westcommittee.service.IProblemTypeService; |
| | | import com.panzhihua.westcommittee.warpper.GetHouseAddressQuery; |
| | | import io.swagger.annotations.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.checkerframework.checker.units.qual.C; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import static cn.hutool.core.util.ObjectUtil.isNull; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public R<?> save(@Valid @RequestBody Complaint complaint) { |
| | | complaintService.saveComplaint(complaint, getLoginUserInfo()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getHouseAddress") |
| | | @ApiOperation(value = "录入诉求-获取详细地址") |
| | | public R<Page<String>> getHouseAddress(GetHouseAddressQuery query) { |
| | | Page<String> addressList = complaintService.getHouseAddress(query); |
| | | return R.ok(addressList); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/save-process") |
| | | @ApiOperation("办理进度录入") |
| | | public R<?> saveProcess(@Valid @RequestBody ComplaintProcessDTO dto){ |
| | | Complaint byId = complaintService.getById(dto.getComplaintId()); |
| | | if(byId.getAssignStatus()==0){ |
| | | return R.fail("该诉求未分配"); |
| | | } |
| | | complaintService.saveProcess(dto,getLoginUserInfo()); |
| | | return R.ok(); |
| | | } |
| | |
| | | @PostMapping("/report") |
| | | @ApiOperation(value = "问题上报") |
| | | public R<?> report(@RequestBody ComplaintReportDTO complaintReportDTO) { |
| | | Complaint byId = complaintService.getById(complaintReportDTO.getComplaintId()); |
| | | if(byId.getAssignStatus()==0){ |
| | | return R.fail("该诉求未分配"); |
| | | } |
| | | |
| | | |
| | | complaintService.saveReport(complaintReportDTO, getLoginUserInfo()); |
| | | return R.ok(); |
| | | } |
| | |
| | | @PostMapping("/saveDelay") |
| | | @ApiOperation(value = "延期申请") |
| | | public R<?> saveDelay(@Valid @RequestBody ComplaintDelayDTO dto){ |
| | | Complaint byId = complaintService.getById(dto.getComplaintId()); |
| | | if(byId.getAssignStatus()==0){ |
| | | return R.fail("该诉求未分配"); |
| | | } |
| | | complaintService.saveDelay(dto, getLoginUserInfo()); |
| | | return R.ok(); |
| | | } |
| | |
| | | |
| | | |
| | | |
| | | @GetMapping("/getAllocationList") |
| | | @ApiOperation(value = "获取分配派单位列表") |
| | | public R<List<DispatchVO>> getAllocationList() { |
| | | return R.ok(complaintService.getAllocationList(getLoginUserInfo())); |
| | | } |
| | | |
| | | @GetMapping("/getDeptUserList") |
| | | @ApiOperation(value = "获取当前单位用户列表") |
| | | public R<Page<SysUserVO>> getDeptUserList(BasePage page) { |
| | |
| | | |
| | | @PostMapping("/assignComplain") |
| | | @ApiOperation(value = "分配诉求") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "complainId", value = "诉求id", required = true), |
| | | @ApiImplicitParam(name = "deptId", value = "单位id", required = true) |
| | | }) |
| | | public R<?> assignComplain(@RequestParam Long complainId,@RequestParam Integer deptId) { |
| | | complaintService.assignComplain(getLoginUserInfo(),complainId,deptId); |
| | | public R<?> assignComplain(@Valid@RequestBody AssignComplainDto dto) { |
| | | |
| | | complaintService.assignComplain(getLoginUserInfo(),dto.getComplainId(),dto.getDeptId(),dto.getRemark()); |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | complaint.setStatus(8); |
| | | complaint.setCommentRate(complaintComment.getRate()); |
| | | complaintService.updateById(complaint); |
| | | // 不满意 重新生成诉求 |
| | | if(complaintComment.getRate()==0){ |
| | | // 获取当前日期(年月日) |
| | | String datePrefix = new SimpleDateFormat("yyyyMMdd").format(new Date()); |
| | | |
| | | // 查询当前日期的最大流水号 |
| | | Complaint lastComplaint = complaintService.getOne(new LambdaQueryWrapper<Complaint>() |
| | | .likeRight(Complaint::getSerialNumber, datePrefix) // 查询以当前日期开头的流水号 |
| | | .orderByDesc(Complaint::getSerialNumber) |
| | | .last("limit 1")); |
| | | |
| | | String serialNumber; |
| | | if (isNull(lastComplaint)) { |
| | | // 如果当天没有记录,从 0001 开始 |
| | | serialNumber = datePrefix + "0001"; |
| | | } else { |
| | | // 获取当前日期的最大流水号,并递增 |
| | | String lastSerialNumber = lastComplaint.getSerialNumber(); |
| | | int num = Integer.parseInt(lastSerialNumber.substring(lastSerialNumber.length() - 4)); // 提取后4位数字 |
| | | serialNumber = datePrefix + String.format("%04d", num + 1); // 递增并格式化为4位 |
| | | } |
| | | Complaint complaint1 = new Complaint(); |
| | | BeanUtils.copyProperties(complaint,complaint1); |
| | | complaint1.setStatus(0); |
| | | complaint1.setSerialNumber(serialNumber); |
| | | complaint1.setAssignStatus(0); |
| | | complaint1.setCreateTime(new Date()); |
| | | complaint1.setId(null); |
| | | complaint1.setCompletionTime(null); |
| | | complaint1.setCompletionUserId(null); |
| | | complaint1.setCompletionUsername(null); |
| | | complaint1.setCompletionUserPhone(null); |
| | | complaint1.setCompletionImages(null); |
| | | complaint1.setCompletionUserLevel(null); |
| | | complaint1.setCompletionDescription(null); |
| | | complaint1.setCompletionVideos(null); |
| | | complaint1.setCompletionOtherDescription(null); |
| | | complaint1.setRemark(null); |
| | | complaint1.setNowLevelTime(new Date()); |
| | | complaint1.setNowLevelSms(0); |
| | | complaint1.setRedispatch(1); |
| | | complaintService.save(complaint1); |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |