| | |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.system.AppealDetailVO; |
| | | import com.ruoyi.system.vo.system.AppealListVO; |
| | | import com.ruoyi.web.controller.tool.EmailUtils; |
| | | import com.ruoyi.web.controller.tool.MsgUtils; |
| | | import com.tencentcloudapi.es.v20180416.models.TaskDetail; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | } |
| | | @Resource |
| | | private TNoticeService noticeService; |
| | | @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 @Valid TAppealAuditDTO dto) { |
| | | public R<Boolean> audit(@RequestBody @Valid TAppealAuditDTO dto) throws Exception { |
| | | List<SysUser> sysUsers = sysUserService.selectAllList(); |
| | | TAppeal appeal = appealService.getById(dto.getId()); |
| | | SysUser sysUser = sysUsers.stream().filter(e -> e.getUserId().equals(Long.valueOf(dto.getAppealPerson()))) |
| | | .findFirst().orElse(null); |
| | | dto.setStatus(dto.getStatus()); |
| | | dto.setAuditPerson(tokenService.getLoginUser().getUserId()+""); |
| | | dto.setAuditTime(LocalDateTime.now()); |
| | |
| | | taskDetail.setTaskId(appeal.getTaskId()); |
| | | Long count = tTaskDetailService.lambdaQuery().eq(TTaskDetail::getTaskId, appeal.getTaskId()) |
| | | .eq(TTaskDetail::getHandleType, 1).count(); |
| | | 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(); |
| | | if (dto.getStatus()==2){ |
| | | taskDetail.setClearStatus(1); |
| | | taskDetail.setAuditTime(LocalDateTime.now()); |
| | |
| | | taskCleanService.updateById(byId); |
| | | tNotice.setNoticeType(5); |
| | | tNotice.setNoticeContent("【"+location.getLocationName()+"】任务申诉通过"); |
| | | if (sysUser!=null){ |
| | | switch (noticeSet.getNoticeType()) { |
| | | case 1: |
| | | msgUtils.sendMsg3(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{ |
| | | taskDetail.setClearStatus(2); |
| | | taskDetail.setAuditTime(LocalDateTime.now()); |
| | |
| | | taskDetail.setAppealId(dto.getId()); |
| | | tNotice.setNoticeType(4); |
| | | tNotice.setNoticeContent("【"+location.getLocationName()+"】任务申诉驳回"); |
| | | if (sysUser!=null){ |
| | | switch (noticeSet.getNoticeType()) { |
| | | case 1: |
| | | msgUtils.sendMsg3(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()+""); |