| @@ -2,7 +2,7 @@ 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.agentcenter.dto.AgentTaskVillageGroup; | |||
| import com.ruoyi.common.core.controller.BaseController; | |||
| import com.ruoyi.common.core.domain.AjaxResult; | |||
| import com.ruoyi.common.core.page.TableDataInfo; | |||
| @@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| /** | |||
| @@ -0,0 +1,47 @@ | |||
| package com.ruoyi.web.controller.agentcenter; | |||
| import com.ruoyi.agentcenter.domain.TAgentTask; | |||
| import com.ruoyi.agentcenter.dto.AgentTaskVillageGroup; | |||
| import com.ruoyi.agentcenter.service.ITAgentTaskService; | |||
| import com.ruoyi.agentcenter.vo.AgentTaskUser; | |||
| import com.ruoyi.common.core.controller.BaseController; | |||
| import com.ruoyi.common.core.domain.AjaxResult; | |||
| import com.ruoyi.common.core.domain.entity.SysUser; | |||
| import com.ruoyi.common.core.page.TableDataInfo; | |||
| import com.ruoyi.common.utils.PageUtils; | |||
| import com.ruoyi.system.service.ISysDeptService; | |||
| import com.ruoyi.system.service.ISysUserService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.security.access.prepost.PreAuthorize; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RequestParam; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import java.util.List; | |||
| /** | |||
| * 会计任务用户Controller | |||
| * | |||
| * @author zhao | |||
| * @date 2023-05-06 | |||
| */ | |||
| @RestController | |||
| @RequestMapping("/task/user") | |||
| public class AgentTaskUserController extends BaseController | |||
| { | |||
| @Autowired | |||
| private ITAgentTaskService agentTaskService; | |||
| /** | |||
| * 分配用户列表 | |||
| */ | |||
| @PreAuthorize("@ss.hasPermi('agentcenter:task:list')") | |||
| @GetMapping(value = "/distribUserList") | |||
| public TableDataInfo distribUserList(AgentTaskUser agentTaskUser) | |||
| { | |||
| startPage(); | |||
| agentTaskUser.setAgentCenter(getUserAgentCenter()); | |||
| return getDataTable(agentTaskService.distribUserList(agentTaskUser)); | |||
| } | |||
| } | |||
| @@ -0,0 +1,116 @@ | |||
| package com.ruoyi.web.controller.agentcenter; | |||
| import com.ruoyi.agentcenter.dto.AgentTaskTownNumGroup; | |||
| import com.ruoyi.agentcenter.vo.TaskDistrib; | |||
| import com.ruoyi.common.core.domain.AjaxResult; | |||
| import org.springframework.security.access.prepost.PreAuthorize; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.validation.annotation.Validated; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.PathVariable; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import com.ruoyi.common.core.controller.BaseController; | |||
| import com.ruoyi.agentcenter.domain.TAgentTask; | |||
| import com.ruoyi.agentcenter.service.ITAgentTaskService; | |||
| import com.ruoyi.common.core.page.TableDataInfo; | |||
| import java.util.List; | |||
| /** | |||
| * 主管任务Controller | |||
| * | |||
| * @author zhao | |||
| * @date 2023-05-06 | |||
| */ | |||
| @RestController | |||
| @RequestMapping("/manager/task") | |||
| public class ManagerAgentTaskController extends BaseController | |||
| { | |||
| @Autowired | |||
| private ITAgentTaskService tAgentTaskService; | |||
| /** | |||
| * 全部任务列表 | |||
| */ | |||
| @PreAuthorize("@ss.hasPermi('agentcenter:task:list')") | |||
| @GetMapping(value = "/countyTaskSummary") | |||
| public AjaxResult countyTaskSummary(TAgentTask task) | |||
| { | |||
| task.setAgentCenter(getUserAgentCenter()); | |||
| task.setTownCode(null); | |||
| return AjaxResult.success(tAgentTaskService.countyTaskSummary(task)); | |||
| } | |||
| /** | |||
| * 全部任务列表 | |||
| */ | |||
| @PreAuthorize("@ss.hasPermi('agentcenter:task:list')") | |||
| @GetMapping(value = "/allTaskList") | |||
| public TableDataInfo allTaskList(TAgentTask task) | |||
| { | |||
| startPage(); | |||
| task.setAgentCenter(getUserAgentCenter()); | |||
| return getDataTable(tAgentTaskService.getTownTaskList(task)); | |||
| } | |||
| /** | |||
| * 待分配任务列表 | |||
| */ | |||
| @PreAuthorize("@ss.hasPermi('agentcenter:task:list')") | |||
| @GetMapping(value = "/undistribTaskList") | |||
| public AjaxResult undistribTaskList(TAgentTask task) | |||
| { | |||
| startPage(); | |||
| task.setAgentCenter(getUserAgentCenter()); | |||
| task.setAgentStatus(TAgentTask.AGENT_STATUS_READY); | |||
| AgentTaskTownNumGroup summary = new AgentTaskTownNumGroup(); | |||
| List<AgentTaskTownNumGroup> undistribTaskList = tAgentTaskService.getUndistribTaskList(task, summary); | |||
| TableDataInfo dataTable = getDataTable(undistribTaskList); | |||
| AjaxResult result = dataTable.toAjaxResult(); | |||
| result.put("numVillage", summary.getNumVillage()) | |||
| .put("numBook", summary.getNumBook()) | |||
| .put("allCount", summary.getAllCount()) | |||
| ; | |||
| return result; | |||
| } | |||
| /** | |||
| * 分配 | |||
| */ | |||
| @PreAuthorize("@ss.hasPermi('manager:task:distrib')") | |||
| @GetMapping(value = "/distrib/{id}") | |||
| public AjaxResult distrib(@PathVariable Long id, @Validated @RequestBody TaskDistrib taskDistrib) | |||
| { | |||
| TAgentTask task = taskDistrib.toAgentTask(); | |||
| task.setId(id); | |||
| task.setAuditUser(getUsername()); | |||
| return toAjax(tAgentTaskService.distrib(task)); | |||
| } | |||
| /** | |||
| * 撤回 | |||
| */ | |||
| @PreAuthorize("@ss.hasPermi('manager:task:revoke')") | |||
| @GetMapping(value = "/revoke/{id}") | |||
| public AjaxResult revoke(@PathVariable Long id, TAgentTask task) | |||
| { | |||
| task.setId(id); | |||
| return toAjax(tAgentTaskService.revoke(task)); | |||
| } | |||
| /** | |||
| * 审核 | |||
| */ | |||
| @PreAuthorize("@ss.hasPermi('manager:task:audit')") | |||
| @GetMapping(value = "/audit/{id}") | |||
| public AjaxResult audit(@PathVariable Long id) | |||
| { | |||
| TAgentTask task = new TAgentTask(); | |||
| task.setId(id); | |||
| task.setAuditUser(getUsername()); | |||
| return toAjax(tAgentTaskService.audit(task)); | |||
| } | |||
| } | |||
| @@ -1,36 +0,0 @@ | |||
| package com.ruoyi.web.controller.agentcenter; | |||
| import org.springframework.security.access.prepost.PreAuthorize; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import com.ruoyi.common.core.controller.BaseController; | |||
| import com.ruoyi.agentcenter.domain.TAgentTask; | |||
| import com.ruoyi.agentcenter.service.ITAgentTaskService; | |||
| import com.ruoyi.common.core.page.TableDataInfo; | |||
| /** | |||
| * 主管任务Controller | |||
| * | |||
| * @author zhao | |||
| * @date 2023-05-06 | |||
| */ | |||
| @RestController | |||
| @RequestMapping("/manager/task") | |||
| public class ManagerTaskController extends BaseController | |||
| { | |||
| @Autowired | |||
| private ITAgentTaskService tAgentTaskService; | |||
| /** | |||
| * 全部任务 | |||
| */ | |||
| @PreAuthorize("@ss.hasPermi('agentcenter:task:list')") | |||
| @GetMapping(value = "/allTaskList") | |||
| public TableDataInfo allTaskList(TAgentTask task) | |||
| { | |||
| startPage(); | |||
| return getDataTable(tAgentTaskService.getTownTaskList(task)); | |||
| } | |||
| } | |||
| @@ -39,6 +39,7 @@ public class DeptController extends BaseController | |||
| @GetMapping("/cityTree") | |||
| public AjaxResult cityTree(SysDept dept) | |||
| { | |||
| dept.setAgentCenter(getUserAgentCenter()); | |||
| return success(deptService.getCityTree(dept)); | |||
| } | |||
| @@ -0,0 +1,42 @@ | |||
| package com.ruoyi.web.controller.open; | |||
| import com.ruoyi.common.core.controller.BaseController; | |||
| import com.ruoyi.common.utils.StringUtils; | |||
| import com.ruoyi.system.service.ISysDeptService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Controller; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.PathVariable; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| /** | |||
| * 杂项::账套 | |||
| * | |||
| * @author zhao | |||
| */ | |||
| @Controller | |||
| public class BookController extends BaseController | |||
| { | |||
| @Autowired | |||
| private ISysDeptService deptService; | |||
| /** | |||
| * 进入远程账套 | |||
| */ | |||
| @GetMapping("/open/book/{orgCode}/{bookId}") | |||
| public void gotoRemoteBootSite(@PathVariable String orgCode, @PathVariable Long bookId, HttpServletResponse response) throws Exception | |||
| { | |||
| String remoteUrl = deptService.getRemoteUrlByOrgCode(orgCode); | |||
| if(StringUtils.isEmpty(remoteUrl)) | |||
| { | |||
| response.setStatus(HttpServletResponse.SC_NOT_FOUND); | |||
| } | |||
| else | |||
| { | |||
| // TODO: 直接切换账套 | |||
| response.sendRedirect(remoteUrl + "/book/book?bookId=" + bookId); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,4 +1,4 @@ | |||
| package com.ruoyi.agentcenter.vo; | |||
| package com.ruoyi.agentcenter.dto; | |||
| import lombok.Data; | |||
| import lombok.experimental.Accessors; | |||
| @@ -17,6 +17,7 @@ public class AgentTaskTownGroup | |||
| private String townCode; | |||
| private String orderYear; | |||
| private String orderMonth; | |||
| private Long numVillage; | |||
| private List<AgentTaskVillageGroup> villageList; | |||
| } | |||
| @@ -0,0 +1,31 @@ | |||
| package com.ruoyi.agentcenter.dto; | |||
| import lombok.Data; | |||
| import lombok.experimental.Accessors; | |||
| import java.util.List; | |||
| @Data | |||
| @Accessors(chain = true) | |||
| public class AgentTaskTownNumGroup | |||
| { | |||
| private Long numVillage; | |||
| private Long numBook; | |||
| private Long voucherCount; | |||
| private Long contracCount; | |||
| private Long otherCount; | |||
| private Long allCount; | |||
| private Long assetCount; | |||
| private String townName; | |||
| private String townCode; | |||
| private String orgName; | |||
| private String orgCode; | |||
| private String endAt; | |||
| private List<AgentTaskTownNumGroup> villageList; | |||
| public void calcOtherCount() | |||
| { | |||
| otherCount = allCount - voucherCount - contracCount - assetCount; | |||
| } | |||
| } | |||
| @@ -1,4 +1,4 @@ | |||
| package com.ruoyi.agentcenter.vo; | |||
| package com.ruoyi.agentcenter.dto; | |||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||
| import com.ruoyi.agentcenter.domain.TAgentTask; | |||
| @@ -23,10 +23,12 @@ public class AgentTaskVillageGroup | |||
| private String orgCode; | |||
| private Long bookId; | |||
| private String bookName; | |||
| private String distriDate; | |||
| private String handleDate; | |||
| private String distriDate; | |||
| private String handleDate; | |||
| private String endAt; | |||
| private String handleNick; | |||
| private Boolean approvalFinish; | |||
| private List<TAgentTask> taskList; | |||
| } | |||
| @@ -2,8 +2,9 @@ package com.ruoyi.agentcenter.mapper; | |||
| import java.util.List; | |||
| import com.ruoyi.agentcenter.domain.TAgentTask; | |||
| import com.ruoyi.agentcenter.vo.AgentTaskTownGroup; | |||
| import com.ruoyi.agentcenter.vo.AgentTaskVillageGroup; | |||
| import com.ruoyi.agentcenter.dto.AgentTaskTownGroup; | |||
| import com.ruoyi.agentcenter.dto.AgentTaskTownNumGroup; | |||
| import com.ruoyi.agentcenter.dto.AgentTaskVillageGroup; | |||
| /** | |||
| * 任务清单Mapper接口 | |||
| @@ -106,7 +107,11 @@ public interface TAgentTaskMapper | |||
| public List<AgentTaskTownGroup> getAgentTaskGroupByTown(TAgentTask tAgentTask); | |||
| public List<AgentTaskVillageGroup> getAgentTaskGroupByVillage(TAgentTask tAgentTask); | |||
| public AgentTaskVillageGroup getAgentTaskVillageSummary(TAgentTask tAgentTask); | |||
| public List<AgentTaskVillageGroup> getProcessedAgentTaskGroupByVillage(TAgentTask tAgentTask); | |||
| public Long getAgentTaskOverdueFinishVillageCount(TAgentTask tAgentTask); | |||
| public List<TAgentTask> getTAgentTaskProcessedList(TAgentTask tAgentTask); | |||
| public List<TAgentTask> getTaskHandleUserListGroup(TAgentTask tAgentTask); | |||
| public List<AgentTaskTownNumGroup> getAgentTaskNumTownGroup(TAgentTask tAgentTask); | |||
| public List<AgentTaskTownNumGroup> getAgentTaskNumVillageGroup(TAgentTask tAgentTask); | |||
| } | |||
| @@ -4,8 +4,11 @@ import java.util.List; | |||
| import java.util.function.Consumer; | |||
| import com.ruoyi.agentcenter.domain.TAgentTask; | |||
| import com.ruoyi.agentcenter.vo.AgentTaskTownGroup; | |||
| import com.ruoyi.agentcenter.vo.AgentTaskVillageGroup; | |||
| import com.ruoyi.agentcenter.dto.AgentTaskTownGroup; | |||
| import com.ruoyi.agentcenter.dto.AgentTaskTownNumGroup; | |||
| import com.ruoyi.agentcenter.dto.AgentTaskVillageGroup; | |||
| import com.ruoyi.agentcenter.vo.AgentTaskUser; | |||
| import com.ruoyi.agentcenter.vo.CountyTaskSummary; | |||
| /** | |||
| * 任务清单Service接口 | |||
| @@ -119,4 +122,12 @@ public interface ITAgentTaskService | |||
| public List<TAgentTask> getTodoTaskList(TAgentTask tAgentTask); | |||
| public List<AgentTaskVillageGroup> getProcessedTaskList(TAgentTask tAgentTask); | |||
| public Long getAgentTaskOverdueFinishVillageCount(TAgentTask tAgentTask); | |||
| public int distrib(TAgentTask task); | |||
| public int revoke(TAgentTask task); | |||
| public int audit(TAgentTask task); | |||
| public List<AgentTaskUser> distribUserList(AgentTaskUser user); | |||
| public List<AgentTaskTownNumGroup> getUndistribTaskList(TAgentTask tAgentTask, AgentTaskTownNumGroup summary); | |||
| public CountyTaskSummary countyTaskSummary(TAgentTask task); | |||
| } | |||
| @@ -5,22 +5,25 @@ import java.util.Arrays; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.function.Consumer; | |||
| import java.util.stream.Collectors; | |||
| import cn.hutool.core.collection.CollectionUtil; | |||
| import cn.hutool.core.lang.Assert; | |||
| import com.ruoyi.agentcenter.domain.TAgentContraction; | |||
| import com.ruoyi.agentcenter.mapper.TAgentContractionMapper; | |||
| import com.ruoyi.agentcenter.vo.AgentTaskTownGroup; | |||
| import com.ruoyi.agentcenter.vo.AgentTaskVillageGroup; | |||
| import com.github.pagehelper.Page; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.ruoyi.agentcenter.dto.AgentTaskTownGroup; | |||
| import com.ruoyi.agentcenter.dto.AgentTaskTownNumGroup; | |||
| import com.ruoyi.agentcenter.dto.AgentTaskVillageGroup; | |||
| import com.ruoyi.agentcenter.vo.AgentTaskUser; | |||
| import com.ruoyi.agentcenter.vo.CountyTaskSummary; | |||
| import com.ruoyi.common.core.domain.entity.SysDept; | |||
| import com.ruoyi.common.enums.Enums; | |||
| import com.ruoyi.common.core.domain.entity.SysUser; | |||
| import com.ruoyi.common.exception.ASSERT; | |||
| 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 com.ruoyi.system.mapper.SysUserMapper; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| @@ -41,7 +44,9 @@ public class TAgentTaskServiceImpl implements ITAgentTaskService | |||
| @Autowired | |||
| private TAgentTaskMapper tAgentTaskMapper; | |||
| @Autowired | |||
| private SysDeptMapper sysDeptMapper; | |||
| private SysDeptMapper sysDeptMapper; | |||
| @Autowired | |||
| private SysUserMapper sysUserMapper; | |||
| /** | |||
| * 查询任务清单 | |||
| @@ -306,8 +311,14 @@ public class TAgentTaskServiceImpl implements ITAgentTaskService | |||
| Map<String, List<TAgentTask>> bookGroup = ContainerUtils.groupingBy(tAgentTasks, TAgentTask::getOrgCode); | |||
| agentTaskGroupByTown.forEach((town) -> { | |||
| town.setVillageList(villageMap.getOrDefault(town.getTownCode(), new ArrayList<>())); | |||
| town.getVillageList().forEach((village) -> { | |||
| List<AgentTaskVillageGroup> villageList = villageMap.getOrDefault(town.getTownCode(), new ArrayList<>()); | |||
| long numApprovalFinish = villageList.stream().filter((x) -> x.getNum().equals(x.getNumApprovalFinish())).count(); | |||
| long numProcessFinish = villageList.stream().filter((x) -> x.getNum().equals(x.getNumProcessFinish())).count(); | |||
| town.setNumApprovalFinish(numApprovalFinish); | |||
| town.setNumProcessFinish(numProcessFinish); | |||
| town.setVillageList(villageList); | |||
| villageList.forEach((village) -> { | |||
| village.setApprovalFinish(village.getNum().equals(village.getNumApprovalFinish())); | |||
| village.setTaskList(bookGroup.getOrDefault(village.getOrgCode(), new ArrayList<>())); | |||
| }); | |||
| }); | |||
| @@ -352,4 +363,123 @@ public class TAgentTaskServiceImpl implements ITAgentTaskService | |||
| tAgentTask.putParam("agentStatusList", Arrays.asList(TAgentTask.AGENT_STATUS_FINISHED, TAgentTask.AGENT_STATUS_AUDITED)); | |||
| return tAgentTaskMapper.getAgentTaskOverdueFinishVillageCount(tAgentTask); | |||
| } | |||
| @Override | |||
| public int distrib(TAgentTask task) | |||
| { | |||
| TAgentTask dbTask = tAgentTaskMapper.selectTAgentTaskById(task.getId()); | |||
| ASSERT.EXP(TAgentTask.AGENT_STATUS_READY.equals(dbTask.getAgentStatus())); | |||
| dbTask.setAgentStatus(TAgentTask.AGENT_STATUS_PROCESSING) | |||
| .setDistriDate(DateUtils.getNowDate()) | |||
| .setDistriUser(sysUserMapper.selectUserByUserName(task.getDistriUser()).getNickName()) | |||
| .setEndAt(task.getEndAt()) | |||
| ; | |||
| return tAgentTaskMapper.updateTAgentTask(dbTask); | |||
| } | |||
| @Override | |||
| public int revoke(TAgentTask task) | |||
| { | |||
| return 1; | |||
| } | |||
| @Override | |||
| public int audit(TAgentTask task) | |||
| { | |||
| TAgentTask dbTask = tAgentTaskMapper.selectTAgentTaskById(task.getId()); | |||
| ASSERT.EXP(TAgentTask.AGENT_STATUS_FINISHED.equals(dbTask.getAgentStatus())); | |||
| dbTask.setAgentStatus(TAgentTask.AGENT_STATUS_AUDITED) | |||
| .setIsAudit("Y") | |||
| .setAuditDate(DateUtils.getNowDate()) | |||
| .setAuditUser(task.getAuditUser()) | |||
| .setAuditNick(sysUserMapper.selectUserByUserName(task.getAuditUser()).getNickName()) | |||
| ; | |||
| return tAgentTaskMapper.updateTAgentTask(dbTask); | |||
| } | |||
| @Override | |||
| public List<AgentTaskUser> distribUserList(AgentTaskUser agentTaskUser) | |||
| { | |||
| SysUser user = new SysUser(); | |||
| user.setAgentCenter(agentTaskUser.getAgentCenter()); | |||
| Long deptId = sysDeptMapper.getDeptIdByOrgCode(agentTaskUser.getOrgCode()); | |||
| user.setDeptId(deptId); | |||
| List<SysUser> users = sysUserMapper.selectUserList(user); | |||
| if(CollectionUtil.isNotEmpty(users)) | |||
| { | |||
| TAgentTask taskCond = new TAgentTask(); | |||
| taskCond.putParam("handleUserList", ContainerUtils.mapToList(users, SysUser::getUserName)); | |||
| List<TAgentTask> taskHandleUserListGroup = tAgentTaskMapper.getTaskHandleUserListGroup(taskCond); | |||
| Map<String, Long> map = ContainerUtils.toMap(taskHandleUserListGroup, TAgentTask::getHandleUser, TAgentTask::getId); | |||
| Page<AgentTaskUser> tAgentTasks = new Page<>(); | |||
| users.forEach((x) -> { | |||
| AgentTaskUser u = new AgentTaskUser(); | |||
| u.setNum(map.getOrDefault(x.getUserName(), 0L)) | |||
| .setUserName(x.getUserName()) | |||
| ; | |||
| tAgentTasks.add(u); | |||
| }); | |||
| tAgentTasks.setTotal(new PageInfo(users).getTotal()); | |||
| return tAgentTasks; | |||
| } | |||
| else | |||
| return new ArrayList<>(); | |||
| } | |||
| @Override | |||
| public List<AgentTaskTownNumGroup> getUndistribTaskList(TAgentTask tAgentTask, AgentTaskTownNumGroup summary) | |||
| { | |||
| List<AgentTaskTownNumGroup> agentTaskNumTownGroup = tAgentTaskMapper.getAgentTaskNumTownGroup(tAgentTask); | |||
| summary.setNumVillage(0L) | |||
| .setNumBook(0L) | |||
| .setAllCount(0L) | |||
| ; | |||
| if(CollectionUtil.isNotEmpty(agentTaskNumTownGroup)) | |||
| { | |||
| summary.setNumBook(agentTaskNumTownGroup.stream().map(AgentTaskTownNumGroup::getNumBook).reduce(0L, Long::sum)); | |||
| summary.setNumVillage(agentTaskNumTownGroup.stream().map(AgentTaskTownNumGroup::getNumVillage).reduce(0L, Long::sum)); | |||
| summary.setAllCount(agentTaskNumTownGroup.stream().map(AgentTaskTownNumGroup::getAllCount).reduce(0L, Long::sum)); | |||
| List<AgentTaskTownNumGroup> agentTaskNumVillageGroup = tAgentTaskMapper.getAgentTaskNumVillageGroup(tAgentTask); | |||
| Map<String, List<AgentTaskTownNumGroup>> group = ContainerUtils.groupingBy(agentTaskNumVillageGroup, AgentTaskTownNumGroup::getTownCode); | |||
| agentTaskNumTownGroup.forEach((x) -> { | |||
| x.calcOtherCount(); | |||
| x.setVillageList(group.getOrDefault(x.getTownCode(), new ArrayList<>())); | |||
| x.getVillageList().forEach(AgentTaskTownNumGroup::calcOtherCount); | |||
| }); | |||
| } | |||
| return agentTaskNumTownGroup; | |||
| } | |||
| @Override | |||
| public CountyTaskSummary countyTaskSummary(TAgentTask task) | |||
| { | |||
| CountyTaskSummary res = new CountyTaskSummary(); | |||
| List<AgentTaskTownGroup> agentTaskNumTownGroup = tAgentTaskMapper.getAgentTaskGroupByTown(task); | |||
| res.setNumTown((long)agentTaskNumTownGroup.size()); | |||
| res.setNumBook(agentTaskNumTownGroup.stream().map(AgentTaskTownGroup::getNum).reduce(0L, Long::sum)); | |||
| res.setNumTownProcessedTask(agentTaskNumTownGroup.stream().map(AgentTaskTownGroup::getNumProcessFinish).reduce(0L, Long::sum)); | |||
| res.setNumTownApprovalTask(agentTaskNumTownGroup.stream().map(AgentTaskTownGroup::getNumApprovalFinish).reduce(0L, Long::sum)); | |||
| AgentTaskVillageGroup agentTaskVillageSummary = tAgentTaskMapper.getAgentTaskVillageSummary(task); | |||
| res.setNumBookProcessedTask(agentTaskVillageSummary.getNumProcessFinish()) | |||
| .setNumBookApprovalTask(agentTaskVillageSummary.getNumApprovalFinish()) | |||
| .setAbnormalCount(agentTaskVillageSummary.getNumExcept()) | |||
| ; | |||
| return res; | |||
| } | |||
| } | |||
| @@ -0,0 +1,14 @@ | |||
| package com.ruoyi.agentcenter.vo; | |||
| import lombok.Data; | |||
| import lombok.experimental.Accessors; | |||
| @Data | |||
| @Accessors(chain = true) | |||
| public class AgentTaskUser | |||
| { | |||
| private String userName; | |||
| private String orgCode; | |||
| private String agentCenter; | |||
| private Long num; | |||
| } | |||
| @@ -0,0 +1,17 @@ | |||
| package com.ruoyi.agentcenter.vo; | |||
| import lombok.Data; | |||
| import lombok.experimental.Accessors; | |||
| @Data | |||
| @Accessors(chain = true) | |||
| public class CountyTaskSummary | |||
| { | |||
| private Long numTown; | |||
| private Long numBook; | |||
| private Long abnormalCount; | |||
| private Long numTownProcessedTask; | |||
| private Long numTownApprovalTask; | |||
| private Long numBookProcessedTask; | |||
| private Long numBookApprovalTask; | |||
| } | |||
| @@ -0,0 +1,17 @@ | |||
| package com.ruoyi.agentcenter.vo; | |||
| import cn.hutool.core.bean.BeanUtil; | |||
| import com.ruoyi.agentcenter.domain.TAgentTask; | |||
| import javax.validation.constraints.NotBlank; | |||
| public class TaskDistrib | |||
| { | |||
| @NotBlank(message = "处理人不能为空") | |||
| public String handleUser; | |||
| public TAgentTask toAgentTask() | |||
| { | |||
| return BeanUtil.toBean(this, TAgentTask.class); | |||
| } | |||
| } | |||
| @@ -534,7 +534,7 @@ | |||
| where id = #{id} | |||
| </update> | |||
| <resultMap id="AgentTaskTownGroupResultMap" type="com.ruoyi.agentcenter.vo.AgentTaskTownGroup"> | |||
| <resultMap id="AgentTaskTownGroupResultMap" type="com.ruoyi.agentcenter.dto.AgentTaskTownGroup"> | |||
| <result property="num" column="num"/> | |||
| <result property="numProcessFinish" column="num_process_finish"/> | |||
| <result property="numApprovalFinish" column="num_approval_finish"/> | |||
| @@ -543,16 +543,18 @@ | |||
| <result property="townCode" column="town_code"/> | |||
| <result property="orderYear" column="order_year"/> | |||
| <result property="orderMonth" column="order_month"/> | |||
| <result property="numVillage" column="num_village"/> | |||
| </resultMap> | |||
| <select id="getAgentTaskGroupByTown" parameterType="TAgentTask" resultMap="AgentTaskTownGroupResultMap"> | |||
| SELECT | |||
| COUNT(*) as num, | |||
| 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, | |||
| COUNT(DISTINCT org_code) as num_village, | |||
| COUNT(*) = SUM(IF(agent_status = '3' OR agent_status = '4', 1, 0)) as num_process_finish, | |||
| COUNT(*) = SUM(IF(is_audit = 'Y', 1, 0)) as num_approval_finish, | |||
| town_name, town_code, | |||
| order_year, order_month, | |||
| IFNULL(SUM(abnormal_count), 0) as num_except | |||
| IFNULL(SUM(IF(abnormal_count > 0, 1, 0)), 0) as num_except | |||
| FROM | |||
| t_agent_task | |||
| <where> | |||
| @@ -566,7 +568,7 @@ | |||
| ORDER BY town_code | |||
| </select> | |||
| <resultMap id="AgentTaskVillageGroupResultMap" type="com.ruoyi.agentcenter.vo.AgentTaskVillageGroup"> | |||
| <resultMap id="AgentTaskVillageGroupResultMap" type="com.ruoyi.agentcenter.dto.AgentTaskVillageGroup"> | |||
| <result property="num" column="num"/> | |||
| <result property="numProcessFinish" column="num_process_finish"/> | |||
| <result property="numApprovalFinish" column="num_approval_finish"/> | |||
| @@ -586,7 +588,7 @@ | |||
| <select id="getAgentTaskGroupByVillage" parameterType="TAgentTask" resultMap="AgentTaskVillageGroupResultMap"> | |||
| SELECT | |||
| COUNT(*) as num, | |||
| IFNULL(SUM(IF(agent_status = '3', 1, 0)), 0) as num_process_finish, | |||
| IFNULL(SUM(IF(agent_status = '3' OR agent_status = '4', 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(distri_date) as distri_date, handle_nick, | |||
| @@ -608,6 +610,29 @@ | |||
| ORDER BY org_code | |||
| </select> | |||
| <select id="getAgentTaskVillageSummary" parameterType="TAgentTask" resultMap="AgentTaskVillageGroupResultMap"> | |||
| SELECT | |||
| COUNT(*) as num, | |||
| IFNULL(SUM(IF(agent_status = '3' OR agent_status = '4', 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, | |||
| IFNULL(SUM(abnormal_count), 0) as num_except | |||
| FROM | |||
| t_agent_task | |||
| <where> | |||
| <if test="countyCode != null and countyCode != ''"> and county_code = #{countyCode}</if> | |||
| <if test="agentCenter != null and agentCenter != ''"> and agent_center = #{agentCenter}</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> | |||
| <select id="getProcessedAgentTaskGroupByVillage" parameterType="TAgentTask" resultMap="AgentTaskVillageGroupResultMap"> | |||
| SELECT | |||
| COUNT(*) as num, | |||
| @@ -676,4 +701,89 @@ | |||
| </if> | |||
| </where> | |||
| </select> | |||
| <select id="getTaskHandleUserListGroup" parameterType="TAgentTask" resultMap="TAgentTaskResult"> | |||
| select | |||
| COUNT(*) as id, handle_user | |||
| from t_agent_task | |||
| <where> | |||
| AND agent_status = '2' | |||
| <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="orgCode != null and orgCode != ''"> and org_code = #{orgCode}</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.handleUserList != null"> | |||
| AND handle_user IN (null <foreach collection="params.handleUserList" item="i">,#{i}</foreach> ) | |||
| </if> | |||
| </if> | |||
| </where> | |||
| GROUP BY handle_user | |||
| </select> | |||
| <resultMap id="AgentTaskTownNumGroupResultMap" type="com.ruoyi.agentcenter.dto.AgentTaskTownNumGroup"> | |||
| <result property="numVillage" column="num_village"/> | |||
| <result property="numBook" column="num_book"/> | |||
| <result property="voucherCount" column="voucher_count"/> | |||
| <result property="contracCount" column="contrac_count"/> | |||
| <result property="otherCount" column="other_count"/> | |||
| <result property="allCount" column="all_count"/> | |||
| <result property="assetCount" column="asset_count"/> | |||
| <result property="townName" column="town_name"/> | |||
| <result property="townCode" column="town_code"/> | |||
| <result property="orgName" column="org_name"/> | |||
| <result property="orgCode" column="org_code"/> | |||
| <result property="endAt" column="end_at"/> | |||
| </resultMap> | |||
| <select id="getAgentTaskNumTownGroup" parameterType="TAgentTask" resultMap="AgentTaskTownNumGroupResultMap"> | |||
| SELECT | |||
| COUNT(*) as num_book, | |||
| COUNT(DISTINCT org_code) as num_village, | |||
| IFNULL(SUM(voucher_count), 0) as voucher_count, | |||
| IFNULL(SUM(contrac_count), 0) as contrac_count, | |||
| IFNULL(SUM(all_count), 0) as all_count, | |||
| IFNULL(SUM(asset_count), 0) as asset_count, | |||
| town_name, town_code | |||
| FROM | |||
| t_agent_task | |||
| <where> | |||
| <if test="agentStatus != null and agentStatus != ''"> and agent_status = #{agentStatus}</if> | |||
| <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> | |||
| </where> | |||
| GROUP BY town_code | |||
| ORDER BY town_code | |||
| </select> | |||
| <select id="getAgentTaskNumVillageGroup" parameterType="TAgentTask" resultMap="AgentTaskTownNumGroupResultMap"> | |||
| SELECT | |||
| COUNT(*) as num_book, | |||
| COUNT(DISTINCT org_code) as num_village, | |||
| IFNULL(SUM(voucher_count), 0) as voucher_count, | |||
| IFNULL(SUM(contrac_count), 0) as contrac_count, | |||
| IFNULL(SUM(all_count), 0) as all_count, | |||
| IFNULL(SUM(asset_count), 0) as asset_count, | |||
| MAX(end_at) as end_at, | |||
| org_name, org_code, | |||
| town_name, town_code | |||
| FROM | |||
| t_agent_task | |||
| <where> | |||
| <if test="agentStatus != null and agentStatus != ''"> and agent_status = #{agentStatus}</if> | |||
| <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> | |||
| </where> | |||
| GROUP BY org_code | |||
| ORDER BY org_code | |||
| </select> | |||
| </mapper> | |||
| @@ -117,6 +117,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter | |||
| .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() | |||
| // 外部上报通道 | |||
| .antMatchers("/agentcenter/api/**").permitAll() | |||
| .antMatchers("/open/**").permitAll() | |||
| // 除上面外的所有请求全部需要鉴权认证 | |||
| .anyRequest().authenticated() | |||
| .and() | |||
| @@ -125,4 +125,9 @@ public interface SysDeptMapper | |||
| public SysDept selectSysDeptByOrgCode(String orgCode); | |||
| public List<SysDept> getDeptList(SysDept cond); | |||
| public String getDeptNameByDeptId(Long deptId); | |||
| public String getOrgCodeByDeptId(Long deptId); | |||
| public Long getDeptIdByOrgCode(String orgCode); | |||
| public String getRemoteUrlByOrgCode(String orgCode); | |||
| } | |||
| @@ -140,4 +140,8 @@ public interface ISysDeptService | |||
| public List<SysDept> getDeptTree(SysDept dept); | |||
| public List<SysDept> getCityTree(SysDept dept); | |||
| public SysDept selectSysDeptByOrgCode(String orgCode); | |||
| public String getDeptNameByDeptId(Long deptId); | |||
| public String getOrgCodeByDeptId(Long deptId); | |||
| public Long getDeptIdByOrgCode(String orgCode); | |||
| public String getRemoteUrlByOrgCode(String orgCode); | |||
| } | |||
| @@ -388,4 +388,28 @@ public class SysDeptServiceImpl implements ISysDeptService | |||
| { | |||
| return deptMapper.selectSysDeptByOrgCode(orgCode); | |||
| } | |||
| @Override | |||
| public String getDeptNameByDeptId(Long deptId) | |||
| { | |||
| return deptMapper.getDeptNameByDeptId(deptId); | |||
| } | |||
| @Override | |||
| public String getOrgCodeByDeptId(Long deptId) | |||
| { | |||
| return deptMapper.getOrgCodeByDeptId(deptId); | |||
| } | |||
| @Override | |||
| public Long getDeptIdByOrgCode(String orgCode) | |||
| { | |||
| return deptMapper.getDeptIdByOrgCode(orgCode); | |||
| } | |||
| @Override | |||
| public String getRemoteUrlByOrgCode(String orgCode) | |||
| { | |||
| return deptMapper.getRemoteUrlByOrgCode(orgCode); | |||
| } | |||
| } | |||
| @@ -211,4 +211,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
| </if> | |||
| order by d.parent_id, d.order_num | |||
| </select> | |||
| <select id="getDeptNameByDeptId" parameterType="Long" resultType="String"> | |||
| SELECT dept_name FROM sys_dept WHERE dept_id = #{deptId} | |||
| </select> | |||
| <select id="getOrgCodeByDeptId" parameterType="Long" resultType="String"> | |||
| SELECT org_code FROM sys_dept WHERE dept_id = #{deptId} | |||
| </select> | |||
| <select id="getDeptIdByOrgCode" parameterType="String" resultType="Long"> | |||
| SELECT dept_id FROM sys_dept WHERE org_code = #{orgCode} | |||
| </select> | |||
| <select id="getRemoteUrlByOrgCode" parameterType="String" resultType="String"> | |||
| SELECT remote_url FROM sys_dept WHERE org_code = LEFT(#{orgCode}, 6) | |||
| </select> | |||
| </mapper> | |||