| @@ -2,7 +2,9 @@ package com.ruoyi.web.controller.agentcenter; | |||
| import com.ruoyi.agentcenter.domain.TAgentTask; | |||
| import com.ruoyi.agentcenter.service.ITAgentTaskService; | |||
| import com.ruoyi.agentcenter.vo.AgentTaskVillageGroup; | |||
| 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.PageUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -15,7 +17,7 @@ import java.util.Arrays; | |||
| import java.util.List; | |||
| /** | |||
| * 任务清单Controller | |||
| * 会计任务清单Controller | |||
| * | |||
| * @author zhao | |||
| * @date 2023-05-06 | |||
| @@ -28,7 +30,7 @@ public class AccountingAgentTaskController extends BaseController | |||
| private ITAgentTaskService tAgentTaskService; | |||
| /** | |||
| * 获取任务清单列表(按镇村分组) | |||
| * 待分配任务列表 | |||
| */ | |||
| @PreAuthorize("@ss.hasPermi('agentcenter:task:list')") | |||
| @GetMapping(value = "/todoTaskList") | |||
| @@ -36,11 +38,19 @@ public class AccountingAgentTaskController extends BaseController | |||
| { | |||
| startPage(); | |||
| PageUtils.orderBy("org_code"); | |||
| task.putParam("agentStatusList", Arrays.asList(TAgentTask.AGENT_STATUS_READY, TAgentTask.AGENT_STATUS_PROCESSING)); | |||
| List<TAgentTask> tAgentTasks = tAgentTaskService.selectTAgentTaskList(task); | |||
| tAgentTasks.forEach((x) -> { | |||
| x.setOtherCount(x.getAllCount() - x.getContracCount() - x.getVoucherCount()); | |||
| }); | |||
| List<TAgentTask> tAgentTasks = tAgentTaskService.getTodoTaskList(task); | |||
| return getDataTable(tAgentTasks); | |||
| } | |||
| /** | |||
| * 已完成任务列表 | |||
| */ | |||
| @PreAuthorize("@ss.hasPermi('agentcenter:task:list')") | |||
| @GetMapping(value = "/processedTaskList") | |||
| public AjaxResult processedTaskList(TAgentTask task) | |||
| { | |||
| startPage(); | |||
| List<AgentTaskVillageGroup> tAgentTasks = tAgentTaskService.getProcessedTaskList(task); | |||
| return getDataTable(tAgentTasks).toAjaxResult().put("overdue", tAgentTaskService.getAgentTaskOverdueFinishVillageCount(task)); | |||
| } | |||
| } | |||
| @@ -60,11 +60,11 @@ public class TAgentContraction extends BaseEntity | |||
| private Date orderAt; | |||
| /** 上报年度(截) */ | |||
| @Excel(name = "上报年度(截)") | |||
| @Excel(name = "上报年度") | |||
| private String orderYear; | |||
| /** 上报月份(截) */ | |||
| @Excel(name = "上报月份(截)") | |||
| @Excel(name = "上报月份") | |||
| private String orderMonth; | |||
| /** 任务状态 字典 agent_status */ | |||
| @@ -23,6 +23,7 @@ public class TAgentTask extends BaseEntity | |||
| public static final String AGENT_STATUS_READY = "1"; | |||
| public static final String AGENT_STATUS_PROCESSING = "2"; | |||
| public static final String AGENT_STATUS_FINISHED = "3"; | |||
| public static final String AGENT_STATUS_AUDITED = "4"; | |||
| private static final long serialVersionUID = 1L; | |||
| @@ -106,4 +106,6 @@ public interface TAgentTaskMapper | |||
| public List<AgentTaskTownGroup> getAgentTaskGroupByTown(TAgentTask tAgentTask); | |||
| public List<AgentTaskVillageGroup> getAgentTaskGroupByVillage(TAgentTask tAgentTask); | |||
| public List<AgentTaskVillageGroup> getProcessedAgentTaskGroupByVillage(TAgentTask tAgentTask); | |||
| public Long getAgentTaskOverdueFinishVillageCount(TAgentTask tAgentTask); | |||
| } | |||
| @@ -5,6 +5,7 @@ import java.util.function.Consumer; | |||
| import com.ruoyi.agentcenter.domain.TAgentTask; | |||
| import com.ruoyi.agentcenter.vo.AgentTaskTownGroup; | |||
| import com.ruoyi.agentcenter.vo.AgentTaskVillageGroup; | |||
| /** | |||
| * 任务清单Service接口 | |||
| @@ -114,4 +115,8 @@ public interface ITAgentTaskService | |||
| public int syncTAgentTaskCount(TAgentTask tAgentTask); | |||
| public List<AgentTaskTownGroup> getTownTaskList(TAgentTask tAgentTask); | |||
| public List<TAgentTask> getTodoTaskList(TAgentTask tAgentTask); | |||
| public List<AgentTaskVillageGroup> getProcessedTaskList(TAgentTask tAgentTask); | |||
| public Long getAgentTaskOverdueFinishVillageCount(TAgentTask tAgentTask); | |||
| } | |||
| @@ -1,6 +1,7 @@ | |||
| package com.ruoyi.agentcenter.service.impl; | |||
| import java.util.ArrayList; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.function.Consumer; | |||
| @@ -17,6 +18,7 @@ import com.ruoyi.common.enums.Enums; | |||
| import com.ruoyi.common.utils.ContainerUtils; | |||
| import com.ruoyi.common.utils.DateUtils; | |||
| import com.ruoyi.common.utils.DeptUtils; | |||
| import com.ruoyi.common.utils.PageUtils; | |||
| import com.ruoyi.common.utils.StringUtils; | |||
| import com.ruoyi.system.mapper.SysDeptMapper; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -333,4 +335,42 @@ public class TAgentTaskServiceImpl implements ITAgentTaskService | |||
| } | |||
| return agentTaskGroupByTown; | |||
| } | |||
| @Override | |||
| public List<TAgentTask> getTodoTaskList(TAgentTask tAgentTask) | |||
| { | |||
| tAgentTask.putParam("agentStatusList", Arrays.asList(TAgentTask.AGENT_STATUS_READY, TAgentTask.AGENT_STATUS_PROCESSING)); | |||
| List<TAgentTask> tAgentTasks = tAgentTaskMapper.selectTAgentTaskList(tAgentTask); | |||
| tAgentTasks.forEach((x) -> { | |||
| x.setOtherCount(x.getAllCount() - x.getContracCount() - x.getVoucherCount()); | |||
| }); | |||
| return tAgentTasks; | |||
| } | |||
| @Override | |||
| public List<AgentTaskVillageGroup> getProcessedTaskList(TAgentTask tAgentTask) | |||
| { | |||
| tAgentTask.putParam("agentStatusList", Arrays.asList(TAgentTask.AGENT_STATUS_FINISHED, TAgentTask.AGENT_STATUS_AUDITED)); | |||
| List<AgentTaskVillageGroup> list = tAgentTaskMapper.getProcessedAgentTaskGroupByVillage(tAgentTask); | |||
| if(CollectionUtil.isNotEmpty(list)) | |||
| { | |||
| PageUtils.orderBy("org_code"); | |||
| List<TAgentTask> tAgentTasks = tAgentTaskMapper.selectTAgentTaskList(tAgentTask); | |||
| tAgentTasks.forEach((x) -> { | |||
| x.setOtherCount(x.getAllCount() - x.getContracCount() - x.getVoucherCount()); | |||
| }); | |||
| Map<String, List<TAgentTask>> taskGroup = ContainerUtils.groupingBy(tAgentTasks, TAgentTask::getOrgCode); | |||
| list.forEach((x) -> { | |||
| x.setTaskList(taskGroup.getOrDefault(x.getOrgCode(), new ArrayList<>())); | |||
| }); | |||
| } | |||
| return list; | |||
| } | |||
| @Override | |||
| public Long getAgentTaskOverdueFinishVillageCount(TAgentTask tAgentTask) | |||
| { | |||
| tAgentTask.putParam("agentStatusList", Arrays.asList(TAgentTask.AGENT_STATUS_FINISHED, TAgentTask.AGENT_STATUS_AUDITED)); | |||
| return tAgentTaskMapper.getAgentTaskOverdueFinishVillageCount(tAgentTask); | |||
| } | |||
| } | |||
| @@ -1,5 +1,6 @@ | |||
| package com.ruoyi.agentcenter.vo; | |||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||
| import com.ruoyi.agentcenter.domain.TAgentTask; | |||
| import lombok.Data; | |||
| import lombok.experimental.Accessors; | |||
| @@ -16,13 +17,14 @@ public class AgentTaskVillageGroup | |||
| private Long numApprovalFinish; | |||
| private Long numExcept; | |||
| private String townCode; | |||
| private Long numNotApproval; | |||
| private String orgName; | |||
| private String orgCode; | |||
| private Long bookId; | |||
| private String bookName; | |||
| private Date distriDate; | |||
| private Date handleDate; | |||
| private String distriDate; | |||
| private String handleDate; | |||
| private String endAt; | |||
| private String handleNick; | |||
| @@ -570,6 +570,7 @@ | |||
| <result property="handleDate" column="handle_date"/> | |||
| <result property="endAt" column="end_at"/> | |||
| <result property="handleNick" column="handle_nick"/> | |||
| <result property="numNotApproval" column="num_not_approval"/> | |||
| </resultMap> | |||
| <select id="getAgentTaskGroupByVillage" parameterType="TAgentTask" resultMap="AgentTaskVillageGroupResultMap"> | |||
| @@ -578,7 +579,7 @@ | |||
| IFNULL(SUM(IF(agent_status = '3', 1, 0)), 0) as num_process_finish, | |||
| IFNULL(SUM(IF(is_audit = 'Y', 1, 0)), 0) as num_approval_finish, | |||
| org_name, org_code, town_code, | |||
| MAX(end_at) as end_at, MAX(handle_date) as handle_date, MAX(end_at) as end_at, handle_nick | |||
| MAX(end_at) as end_at, MAX(handle_date) as handle_date, MAX(distri_date) as distri_date, handle_nick | |||
| FROM | |||
| t_agent_task | |||
| <where> | |||
| @@ -595,4 +596,51 @@ | |||
| GROUP BY org_code | |||
| ORDER BY org_code | |||
| </select> | |||
| <select id="getProcessedAgentTaskGroupByVillage" parameterType="TAgentTask" resultMap="AgentTaskVillageGroupResultMap"> | |||
| SELECT | |||
| COUNT(*) as num, | |||
| IFNULL(SUM(IF(is_audit != 'Y', 1, 0)), 0) as num_not_approval, | |||
| IFNULL(SUM(IF(is_audit = 'Y', 1, 0)), 0) as num_approval_finish, | |||
| org_name, org_code, town_code, | |||
| MAX(end_at) as end_at, MAX(handle_date) as handle_date, MAX(distri_date) as distri_date, GROUP_CONCAT(DISTINCT audit_nick) as handle_nick | |||
| FROM | |||
| t_agent_task | |||
| <where> | |||
| AND agent_status IN ('3', '4') | |||
| <if test="agentCenter != null and agentCenter != ''"> and agent_center = #{agentCenter}</if> | |||
| <if test="countyCode != null and countyCode != ''"> and county_code = #{countyCode}</if> | |||
| <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="params != null"> | |||
| <if test="params.townCodeList != null"> | |||
| AND town_code IN (null <foreach collection="params.townCodeList" item="i">,#{i}</foreach> ) | |||
| </if> | |||
| </if> | |||
| </where> | |||
| GROUP BY org_code | |||
| ORDER BY town_code, org_code | |||
| </select> | |||
| <select id="getAgentTaskOverdueFinishVillageCount" parameterType="TAgentTask" resultType="Long"> | |||
| SELECT | |||
| COUNT(*) | |||
| FROM | |||
| t_agent_task | |||
| <where> | |||
| AND agent_status IN ('3', '4') | |||
| AND LEFT(handle_date, 10) > end_at | |||
| <if test="agentCenter != null and agentCenter != ''"> and agent_center = #{agentCenter}</if> | |||
| <if test="countyCode != null and countyCode != ''"> and county_code = #{countyCode}</if> | |||
| <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="params != null"> | |||
| <if test="params.townCodeList != null"> | |||
| AND town_code IN (null <foreach collection="params.townCodeList" item="i">,#{i}</foreach> ) | |||
| </if> | |||
| </if> | |||
| </where> | |||
| </select> | |||
| </mapper> | |||
| @@ -1,5 +1,7 @@ | |||
| package com.ruoyi.common.core.page; | |||
| import com.ruoyi.common.core.domain.AjaxResult; | |||
| import java.io.Serializable; | |||
| import java.util.List; | |||
| @@ -82,4 +84,14 @@ public class TableDataInfo implements Serializable | |||
| { | |||
| this.msg = msg; | |||
| } | |||
| public AjaxResult toAjaxResult() | |||
| { | |||
| AjaxResult result = new AjaxResult(); | |||
| result.put(AjaxResult.CODE_TAG, code); | |||
| result.put(AjaxResult.MSG_TAG, msg); | |||
| result.put("rows", rows); | |||
| result.put("total", total); | |||
| return result; | |||
| } | |||
| } | |||