| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.net.URLEncoder; |
| | |
| | | import com.ruoyi.system.query.TaskListQuery; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.system.*; |
| | | import com.ruoyi.web.controller.tool.EmailUtils; |
| | | import com.ruoyi.web.controller.tool.MsgUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | |
| | | private TTaskCleanService taskCleanerService; |
| | | @Resource |
| | | private TNoticeService noticeService; |
| | | @Resource |
| | | private TNoticeSetService noticeSetService; |
| | | |
| | | @Resource |
| | | private TEarlyWarningService earlyWarningService; |
| | | @Resource |
| | |
| | | private TDeptService deptService; |
| | | @Resource |
| | | private ISysUserService sysUserService; |
| | | @Resource |
| | | private TDictDataService dictDataService; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | |
| | | taskCleanerService.save(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Resource |
| | | private MsgUtils msgUtils; |
| | | @Resource |
| | | private TNoticeSetService noticeSetService; |
| | | @Resource |
| | | private TDictDataService dictDataService; |
| | | @Log(title = "审核任务", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "审核任务") |
| | | @PostMapping(value = "/audit") |
| | | public R<Boolean> audit(@RequestBody TTaskAuditDTO dto) { |
| | | public R<Boolean> audit(@RequestBody TTaskAuditDTO dto) throws Exception { |
| | | dto.setAuditTime(LocalDateTime.now()); |
| | | TTask task = taskCleanerService.getById(dto.getTaskId()); |
| | | SysUser sysUser = sysUserService.selectUserById(Long.valueOf(task.getPatrolInspector())); |
| | | |
| | | TTaskDetail one = taskDetailService.lambdaQuery().eq(TTaskDetail::getTaskId, dto.getTaskId()) |
| | | .eq(TTaskDetail::getHandleType,1) |
| | | .orderByDesc(BaseModel::getCreateTime).last("limit 1").one(); |
| | |
| | | TNotice tNotice = new TNotice(); |
| | | TNoticeSet noticeSet = noticeSetService.lambdaQuery().eq(TNoticeSet::getType, 2).last("limit 1") |
| | | .one(); |
| | | // 邮箱 |
| | | TDictData email = dictDataService.lambdaQuery().eq(TDictData::getDataType,4).one(); |
| | | // 授权码 |
| | | TDictData code = dictDataService.lambdaQuery().eq(TDictData::getDataType,5).one(); |
| | | |
| | | tNotice.setUserId(task.getPatrolInspector()); |
| | | tNotice.setStatus(1); |
| | | tNotice.setDataId(task.getId()); |
| | |
| | | // 增加消息 |
| | | tNotice.setNoticeType(1); |
| | | tNotice.setNoticeContent("【"+location.getLocationName()+"】任务不合格,请重新上传!"); |
| | | if (sysUser!=null){ |
| | | switch (noticeSet.getNoticeType()) { |
| | | case 1: |
| | | msgUtils.sendMsg1(sysUser.getPhonenumber(),location.getLocationName(),"驳回"); |
| | | break; |
| | | case 2: |
| | | if (StringUtils.hasLength(email.getDataContent())&&StringUtils.hasLength(code.getDataContent())){ |
| | | EmailUtils.sendEmail(sysUser.getEmail(),email.getDataContent(),code.getDataContent(),"【" + location.getLocationName() + "】任务不合格,请重新上传!"); |
| | | } |
| | | break; |
| | | case 3: |
| | | break; |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | }else{ |
| | | if (dto.getClearStatus()==2){ |
| | | if (StringUtils.hasLength(location.getUnqualifiedTaskId())){ |
| | |
| | | tNotice.setNoticeType(2); |
| | | tNotice.setNoticeContent("【"+location.getLocationName()+"】任务已通过"); |
| | | } |
| | | if (sysUser!=null){ |
| | | switch (noticeSet.getNoticeType()) { |
| | | case 1: |
| | | msgUtils.sendMsg1(sysUser.getPhonenumber(),location.getLocationName(),"通过"); |
| | | break; |
| | | case 2: |
| | | if (StringUtils.hasLength(email.getDataContent())&&StringUtils.hasLength(code.getDataContent())){ |
| | | EmailUtils.sendEmail(sysUser.getEmail(),email.getDataContent(),code.getDataContent(),"【" + location.getLocationName() + "】任务已通过"); |
| | | } |
| | | break; |
| | | case 3: |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | noticeService.save(tNotice); |
| | | dto.setAuditPerson(tokenService.getLoginUser().getUserId()+""); |
| | |
| | | taskDetailService.updateById(one); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Log(title = "批量审核任务", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "批量审核任务") |
| | | @PostMapping(value = "/auditBatch") |
| | |
| | | }else{ |
| | | tTaskDetail.setHandleType(2); |
| | | // 如果是初次审核就通过 将状态设置为已完成 |
| | | List<TTaskDetail> list = taskDetailService.lambdaQuery().eq(TTaskDetail::getTaskId, s).list(); |
| | | if (list.isEmpty()){ |
| | | List<TTaskDetail> list = taskDetailService.lambdaQuery() |
| | | .eq(TTaskDetail::getHandleType, 1).eq(TTaskDetail::getTaskId, s).list(); |
| | | if (list.size() == 1) { |
| | | byId.setStatus(6); |
| | | taskCleanerService.updateById(byId); |
| | | }else{ |
| | |
| | | taskDetailService.saveBatch(tTaskDetails); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "详情任务") |
| | | @GetMapping(value = "/detail") |
| | | public R<TaskDetailVO> detail(@RequestParam String id) { |
| | |
| | | taskDetailVO.setRecords(list); |
| | | return R.ok(taskDetailVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "详情任务-根据任务编号") |
| | | @GetMapping(value = "/detailByTaskCode") |
| | | public R<TaskDetailVO> detailByTaskCode(@RequestParam String taskCode) { |
| | |
| | | |
| | | return R.ok(taskDetailVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "详情任务-操作记录-详情") |
| | | @GetMapping(value = "/detailRecord") |
| | | public R<TaskRecordDetailVO> detailRecord(@RequestParam String id) { |
| | |
| | | taskDetailVO.setTaskDetail(byId4); |
| | | return R.ok(taskDetailVO); |
| | | } |
| | | |
| | | @Log(title = "批量删除任务", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除任务") |
| | | @DeleteMapping(value = "/deleteByIds") |