| @@ -3,13 +3,19 @@ package com.ruoyi.web.controller.agentcenter; | |||
| import com.ruoyi.agentcenter.domain.TAgentTask; | |||
| import com.ruoyi.agentcenter.service.ITAgentTaskService; | |||
| import com.ruoyi.agentcenter.dto.AgentTaskVillageGroup; | |||
| import com.ruoyi.agentcenter.vo.TaskDistrib; | |||
| import com.ruoyi.agentcenter.vo.TaskFinish; | |||
| import com.ruoyi.common.core.controller.BaseController; | |||
| import com.ruoyi.common.core.domain.AjaxResult; | |||
| import com.ruoyi.common.core.page.TableDataInfo; | |||
| import com.ruoyi.common.utils.DateUtils; | |||
| import com.ruoyi.common.utils.PageUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.security.access.prepost.PreAuthorize; | |||
| import org.springframework.validation.annotation.Validated; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| @@ -36,6 +42,7 @@ public class AccountingAgentTaskController extends BaseController | |||
| public TableDataInfo todoTaskList(TAgentTask task) | |||
| { | |||
| startPage(); | |||
| task.setHandleUser(getUsername()); | |||
| PageUtils.orderBy("org_code"); | |||
| List<TAgentTask> tAgentTasks = tAgentTaskService.getTodoTaskList(task); | |||
| return getDataTable(tAgentTasks); | |||
| @@ -49,7 +56,20 @@ public class AccountingAgentTaskController extends BaseController | |||
| public AjaxResult processedTaskList(TAgentTask task) | |||
| { | |||
| startPage(); | |||
| task.setHandleUser(getUsername()); | |||
| List<AgentTaskVillageGroup> tAgentTasks = tAgentTaskService.getProcessedTaskList(task); | |||
| return getDataTable(tAgentTasks).toAjaxResult().put("overdue", tAgentTaskService.getAgentTaskOverdueFinishVillageCount(task)); | |||
| } | |||
| /** | |||
| * 完成 | |||
| */ | |||
| @PreAuthorize("@ss.hasPermi('accounting:task:finish')") | |||
| @PostMapping(value = "/finish") | |||
| public AjaxResult finish(@Validated @RequestBody TaskFinish taskFinish) | |||
| { | |||
| taskFinish.setHandleUser(getUsername()); | |||
| taskFinish.setHandleDate(DateUtils.getNowDate()); | |||
| return toAjax(tAgentTaskService.finish(taskFinish)); | |||
| } | |||
| } | |||
| @@ -10,6 +10,7 @@ import com.ruoyi.agentcenter.dto.AgentTaskVillageGroup; | |||
| import com.ruoyi.agentcenter.vo.AgentTaskUser; | |||
| import com.ruoyi.agentcenter.vo.CountyTaskSummary; | |||
| import com.ruoyi.agentcenter.vo.TaskDistrib; | |||
| import com.ruoyi.agentcenter.vo.TaskFinish; | |||
| import com.ruoyi.agentcenter.vo.TaskRevoke; | |||
| /** | |||
| @@ -129,6 +130,7 @@ public interface ITAgentTaskService | |||
| public int distrib(TaskDistrib task); | |||
| public int revoke(TaskRevoke task); | |||
| public int audit(TAgentTask task); | |||
| public int finish(TaskFinish task); | |||
| public List<AgentTaskUser> userList(AgentTaskUser user); | |||
| public List<AgentTaskTownNumGroup> getUndistribTaskList(TAgentTask tAgentTask, AgentTaskTownNumGroup summary); | |||
| @@ -19,6 +19,7 @@ import com.ruoyi.agentcenter.dto.AgentTaskVillageGroup; | |||
| import com.ruoyi.agentcenter.vo.AgentTaskUser; | |||
| import com.ruoyi.agentcenter.vo.CountyTaskSummary; | |||
| import com.ruoyi.agentcenter.vo.TaskDistrib; | |||
| import com.ruoyi.agentcenter.vo.TaskFinish; | |||
| import com.ruoyi.agentcenter.vo.TaskRevoke; | |||
| import com.ruoyi.common.core.domain.entity.SysDept; | |||
| import com.ruoyi.common.core.domain.entity.SysUser; | |||
| @@ -373,6 +374,7 @@ public class TAgentTaskServiceImpl implements ITAgentTaskService | |||
| } | |||
| @Override | |||
| @Transactional(rollbackFor = Exception.class) | |||
| public int distrib(TaskDistrib task) | |||
| { | |||
| List<String> orgCodeList = ContainerUtils.mapToList(task.getItems(), TaskDistrib.TaskDistribItem::getOrgCode); | |||
| @@ -394,6 +396,7 @@ public class TAgentTaskServiceImpl implements ITAgentTaskService | |||
| .setDistriDate(DateUtils.getNowDate()) | |||
| .setDistriUser(taskDistribItem.getHandleUser()) | |||
| .setDistriNick(sysUserMapper.selectUserByUserName(taskDistribItem.getHandleUser()).getNickName()) | |||
| .setHandleUser(taskDistribItem.getHandleUser()) | |||
| .setEndAt(DateUtil.format(dateTime, "yyyy-MM-dd")) | |||
| ; | |||
| }); | |||
| @@ -426,6 +429,22 @@ public class TAgentTaskServiceImpl implements ITAgentTaskService | |||
| return tAgentTaskMapper.updateTAgentTask(dbTask); | |||
| } | |||
| @Override | |||
| public int finish(TaskFinish task) | |||
| { | |||
| TAgentTask dbTask = tAgentTaskMapper.selectTAgentTaskById(task.getTaskId()); | |||
| ASSERT.EXP(TAgentTask.AGENT_STATUS_PROCESSING.equals(dbTask.getAgentStatus()), "任务不是正在处理"); | |||
| ASSERT.EXP(task.getHandleUser().equals(dbTask.getHandleUser()), "无权完成此任务"); | |||
| dbTask.setHandleRemark(task.getHandleRemark()) | |||
| .setAgentStatus(TAgentTask.AGENT_STATUS_FINISHED) | |||
| .setHandleDate(DateUtils.getNowDate()) | |||
| ; | |||
| return tAgentTaskMapper.updateTAgentTask(dbTask); | |||
| } | |||
| @Override | |||
| public List<AgentTaskUser> userList(AgentTaskUser agentTaskUser) | |||
| { | |||
| @@ -0,0 +1,28 @@ | |||
| package com.ruoyi.agentcenter.vo; | |||
| import cn.hutool.core.bean.BeanUtil; | |||
| import com.ruoyi.agentcenter.domain.TAgentTask; | |||
| import lombok.Data; | |||
| import lombok.experimental.Accessors; | |||
| import javax.validation.constraints.NotBlank; | |||
| import javax.validation.constraints.NotEmpty; | |||
| import javax.validation.constraints.NotNull; | |||
| import java.util.Date; | |||
| @Data | |||
| @Accessors(chain = true) | |||
| public class TaskFinish | |||
| { | |||
| @NotNull(message = "任务ID不能为空") | |||
| private Long taskId; | |||
| private String handleRemark; | |||
| private String handleUser; | |||
| private Date handleDate; | |||
| public TAgentTask toAgentTask() | |||
| { | |||
| return BeanUtil.copyProperties(this, TAgentTask.class).setId(taskId); | |||
| } | |||
| } | |||
| @@ -659,6 +659,7 @@ | |||
| <if test="townCode != null and townCode != ''"> and town_code = #{townCode}</if> | |||
| <if test="orderYear != null and orderYear != ''"> and order_year = #{orderYear}</if> | |||
| <if test="orderMonth != null and orderMonth != ''"> and order_month = #{orderMonth}</if> | |||
| <if test="handleUser != null and handleUser != ''"> and handle_user = #{handleUser}</if> | |||
| <if test="params != null"> | |||
| <if test="params.townCodeList != null"> | |||
| AND town_code IN (null <foreach collection="params.townCodeList" item="i">,#{i}</foreach> ) | |||