| | |
| | | package com.panzhihua.westcommittee.api; |
| | | |
| | | 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.exceptions.ServiceException; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.west.SystemUserVo; |
| | | import com.panzhihua.westcommittee.annotation.DistributedLock; |
| | | import com.panzhihua.westcommittee.annotation.SysLog; |
| | | import com.panzhihua.westcommittee.model.dto.AssignComplainDto; |
| | | import com.panzhihua.westcommittee.model.dto.ComplaintProcessUpdateDto; |
| | | import com.panzhihua.westcommittee.model.entity.Complaint; |
| | | import com.panzhihua.westcommittee.model.entity.Department; |
| | | import com.panzhihua.westcommittee.model.entity.SystemUser; |
| | | import com.panzhihua.westcommittee.model.vo.ComplaintVO; |
| | | import com.panzhihua.westcommittee.model.vo.DispatchVO; |
| | | import com.panzhihua.westcommittee.service.IComplaintService; |
| | | import com.panzhihua.westcommittee.service.IDepartmentService; |
| | | import com.panzhihua.westcommittee.service.ISystemUserService; |
| | | import com.panzhihua.westcommittee.warpper.MgtComplaintQuery; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | import javax.validation.Valid; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author mitao |
| | |
| | | @RequiredArgsConstructor(onConstructor_ = {@Lazy}) |
| | | public class MgtComplaintController extends BaseController { |
| | | private final IComplaintService complaintService; |
| | | private final ISystemUserService systemUserService; |
| | | private final IDepartmentService departmentService; |
| | | |
| | | @PostMapping("/save") |
| | | @ApiOperation(value = "录入诉求") |
| | | @DistributedLock(lockName = "complaint_serial_number_lock") |
| | | public R<?> save(@Valid @RequestBody Complaint complaint) { |
| | | complaintService.saveComplaintAdmin(complaint, getLoginUserInfoWest()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @GetMapping("/getAllocationList") |
| | | @ApiOperation(value = "获取分配派单位列表") |
| | | public R<List<DispatchVO>> getAllocationList() { |
| | | SystemUserVo loginUserInfoWest = getLoginUserInfoWest(); |
| | | SystemUser systemUser = systemUserService.getById(loginUserInfoWest.getId()); |
| | | if(systemUser.getSystemRoleId()!=1){ |
| | | return R.fail("非管理员,无权限"); |
| | | } |
| | | List<DispatchVO> dispatchVOList = new ArrayList<>(); |
| | | Integer oneDepartmentId = systemUser.getOneDepartmentId(); |
| | | Department byId = departmentService.getById(oneDepartmentId); |
| | | List<Department> list1 = departmentService.list(new LambdaQueryWrapper<Department>().eq(Department::getTier, byId.getTier())); |
| | | for (Department department : list1) { |
| | | DispatchVO dispatchVO = new DispatchVO(); |
| | | dispatchVO.setId(department.getId().toString()); |
| | | dispatchVO.setName(department.getName()); |
| | | dispatchVOList.add(dispatchVO); |
| | | } |
| | | return R.ok(dispatchVOList); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/assignComplain") |
| | | @ApiOperation(value = "分配诉求") |
| | | public R<?> assignComplain(@Valid@RequestBody AssignComplainDto dto) { |
| | | complaintService.assignComplain(getLoginUserInfo(),dto.getComplainId(),dto.getDeptId(),dto.getRemark()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation("诉求列表") |
| | | @PostMapping("/page") |
| | |
| | | SystemUserVo loginUserInfo = getLoginUserInfoWest(); |
| | | return R.ok(complaintService.pageList(query,loginUserInfo)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation("诉求详情") |
| | | @GetMapping("/detail/{id}") |
| | | public R<ComplaintVO> detail(@ApiParam(name = "id", value = "诉求id", required = true) @PathVariable("id") Long id) { |