| | |
| | | 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.westcommittee.annotation.DistributedLock; |
| | | import com.panzhihua.westcommittee.model.dto.*; |
| | |
| | | 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 com.panzhihua.westcommittee.warpper.IdentityInformation; |
| | | 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.HashMap; |
| | | import java.util.List; |
| | | |
| | | import static cn.hutool.core.util.ObjectUtil.isNull; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @ApiOperation(value = "录入诉求") |
| | | @DistributedLock(lockName = "complaint_serial_number_lock") |
| | | public R<?> save(@Valid @RequestBody Complaint complaint) { |
| | | complaintService.saveComplaint(complaint, getLoginUserInfo()); |
| | | return R.ok(); |
| | | HashMap<String, String> map = complaintService.saveComplaint(complaint, getLoginUserInfo()); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getHouseAddress") |
| | | @ApiOperation(value = "录入诉求-获取详细地址") |
| | | public R<Page<String>> getHouseAddress(GetHouseAddressQuery query) { |
| | | Page<String> addressList = complaintService.getHouseAddress(query); |
| | | return R.ok(addressList); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | @GetMapping("/detail") |
| | | @ApiOperation("工单详情") |
| | | public R<ComplaintVO> detail(@ApiParam(name = "id", value = "工单id", required = true) Long id) { |
| | | public R<ComplaintVO> detail(Long id) { |
| | | return R.ok(complaintService.detail(id,getLoginUserInfo())); |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | |
| | | @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 = "userId", 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(),dto.getProblemType()); |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/setProblemType") |
| | | @ApiOperation(value = "分配问题类型") |
| | | public R<?> assignComplain(@Valid @RequestBody SetProblemTypeDto dto) { |
| | | // 判断是否管理员 |
| | | complaintService.setProblemType(getLoginUserInfo(),dto); |
| | | 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(); |
| | | } |
| | | |