@@ -0,0 +1,52 @@ | |||
package com.ruoyi.web.controller.agentcenter; | |||
import com.ruoyi.agentcenter.dto.AbnormalTask; | |||
import com.ruoyi.agentcenter.service.IAbnormalTaskService; | |||
import com.ruoyi.common.core.controller.BaseController; | |||
import com.ruoyi.common.core.domain.AjaxResult; | |||
import com.ruoyi.common.core.page.TableDataInfo; | |||
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.RestController; | |||
/** | |||
* 会计异常任务Controller | |||
* | |||
* @author zhao | |||
* @date 2023-05-06 | |||
*/ | |||
@RestController | |||
@RequestMapping("/accounting/task") | |||
public class AccountingAbnormalTaskController extends BaseController | |||
{ | |||
@Autowired | |||
private IAbnormalTaskService abnormalTaskService; | |||
/** | |||
* 异常任务列表 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('agentcenter:task:list')") | |||
@GetMapping(value = "/abnormalTaskList") | |||
public TableDataInfo abnormalTaskList(AbnormalTask task) | |||
{ | |||
startPage(); | |||
task.setAgentCenter(getUserAgentCenter()); | |||
task.setHandleUser(getUsername()); | |||
return getDataTable(abnormalTaskService.getAbnormalTaskList(task)); | |||
} | |||
/** | |||
* 异常任务统计 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('agentcenter:task:query')") | |||
@GetMapping(value = "/abnormalTaskSummary") | |||
public AjaxResult abnormalTaskSummary(AbnormalTask task) | |||
{ | |||
task.setAgentCenter(getUserAgentCenter()); | |||
task.setHandleUser(getUsername()); | |||
return AjaxResult.success(abnormalTaskService.abnormalTaskSummary(task)); | |||
} | |||
} |
@@ -3,7 +3,6 @@ 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; | |||
@@ -1,25 +1,15 @@ | |||
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 | |||
* | |||
@@ -0,0 +1,66 @@ | |||
package com.ruoyi.web.controller.agentcenter; | |||
import com.ruoyi.agentcenter.dto.AbnormalTask; | |||
import com.ruoyi.agentcenter.service.IAbnormalTaskService; | |||
import com.ruoyi.common.core.controller.BaseController; | |||
import com.ruoyi.common.core.domain.AjaxResult; | |||
import com.ruoyi.common.core.page.TableDataInfo; | |||
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.PathVariable; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
/** | |||
* 主管异常任务Controller | |||
* | |||
* @author zhao | |||
* @date 2023-05-06 | |||
*/ | |||
@RestController | |||
@RequestMapping("/manager/task") | |||
public class ManagerAbnormalTaskController extends BaseController | |||
{ | |||
@Autowired | |||
private IAbnormalTaskService abnormalTaskService; | |||
/** | |||
* 异常任务列表 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('agentcenter:task:list')") | |||
@GetMapping(value = "/abnormalTaskList") | |||
public TableDataInfo abnormalTaskList(AbnormalTask task) | |||
{ | |||
startPage(); | |||
task.setAgentCenter(getUserAgentCenter()); | |||
return getDataTable(abnormalTaskService.getAbnormalTaskList(task)); | |||
} | |||
/** | |||
* 异常任务统计 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('agentcenter:task:query')") | |||
@GetMapping(value = "/abnormalTaskSummary") | |||
public AjaxResult abnormalTaskSummary(AbnormalTask task) | |||
{ | |||
task.setAgentCenter(getUserAgentCenter()); | |||
return AjaxResult.success(abnormalTaskService.abnormalTaskSummary(task)); | |||
} | |||
/** | |||
* 异常任务统计 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('agentcenter:task:remove')") | |||
@PostMapping(value = "/removeAbnormalTask/{type}/{id}") | |||
public AjaxResult removeAbnormalTask(@PathVariable String type, @PathVariable Long id) | |||
{ | |||
AbnormalTask task = new AbnormalTask(); | |||
task.setType(type) | |||
.setId(id); | |||
task.setAgentCenter(getUserAgentCenter()); | |||
return AjaxResult.success(abnormalTaskService.removeAbnormalTask(task)); | |||
} | |||
} |
@@ -10,7 +10,6 @@ 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.PostMapping; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
@@ -38,7 +37,7 @@ public class ManagerAgentTaskController extends BaseController | |||
/** | |||
* 县级全部任务统计 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('agentcenter:task:list')") | |||
@PreAuthorize("@ss.hasPermi('agentcenter:task:query')") | |||
@GetMapping(value = "/countyTaskSummary") | |||
public AjaxResult countyTaskSummary(TAgentTask task) | |||
{ | |||
@@ -142,7 +141,7 @@ public class ManagerAgentTaskController extends BaseController | |||
/** | |||
* 县级处理中统计 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('agentcenter:task:list')") | |||
@PreAuthorize("@ss.hasPermi('agentcenter:task:query')") | |||
@GetMapping(value = "/countyProcessingTaskSummary") | |||
public AjaxResult countyProcessingTaskSummary(TAgentTask task) | |||
{ | |||
@@ -166,7 +165,7 @@ public class ManagerAgentTaskController extends BaseController | |||
/** | |||
* 镇级待审核统计 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('agentcenter:task:list')") | |||
@PreAuthorize("@ss.hasPermi('agentcenter:task:query')") | |||
@GetMapping(value = "/auditTaskSummary") | |||
public AjaxResult auditTaskSummary(TAgentTask task) | |||
{ | |||
@@ -0,0 +1,36 @@ | |||
package com.ruoyi.agentcenter.dto; | |||
import lombok.Data; | |||
import lombok.experimental.Accessors; | |||
@Data | |||
@Accessors(chain = true) | |||
public class AbnormalTask | |||
{ | |||
public static final String TYPE_CONTRACTION = "contraction"; | |||
public static final String TYPE_VOUCHER = "voucher"; | |||
private String agentCenter; | |||
private String countyCode; | |||
private String townCode; | |||
private String orgCode; | |||
private String type; | |||
private String orderYear; | |||
private String orderMonth; | |||
private String countyName; | |||
private String townName; | |||
private String orgName; | |||
private String bookName; | |||
private String handleNick; | |||
private String handleUser; | |||
private String orderAt; | |||
private String remark; | |||
private Long id; | |||
private Long taskId; | |||
private String name; | |||
private String region; | |||
private String address; | |||
private String tel; | |||
private String applyUser; | |||
} |
@@ -1,6 +1,5 @@ | |||
package com.ruoyi.agentcenter.dto; | |||
import cn.hutool.core.date.DateUtil; | |||
import com.ruoyi.agentcenter.domain.TAgentTask; | |||
import com.ruoyi.common.utils.DateUtils; | |||
import com.ruoyi.common.utils.StringUtils; | |||
@@ -1,11 +1,9 @@ | |||
package com.ruoyi.agentcenter.dto; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.ruoyi.agentcenter.domain.TAgentTask; | |||
import lombok.Data; | |||
import lombok.experimental.Accessors; | |||
import java.util.Date; | |||
import java.util.List; | |||
@Data | |||
@@ -2,6 +2,7 @@ package com.ruoyi.agentcenter.mapper; | |||
import java.util.List; | |||
import com.ruoyi.agentcenter.domain.TAgentContraction; | |||
import com.ruoyi.agentcenter.dto.AbnormalTask; | |||
/** | |||
* 合同任务Mapper接口 | |||
@@ -101,4 +102,7 @@ public interface TAgentContractionMapper | |||
public int selectTAgentContractionExists(TAgentContraction tAgentContraction); | |||
public List<TAgentContraction> getAgentContractionGroupByDept(TAgentContraction tAgentContraction); | |||
public List<AbnormalTask> getAbnormalContractionList(AbnormalTask cond); | |||
public Long getAbnormalContractionCount(AbnormalTask cond); | |||
} |
@@ -0,0 +1,13 @@ | |||
package com.ruoyi.agentcenter.service; | |||
import com.ruoyi.agentcenter.dto.AbnormalTask; | |||
import com.ruoyi.agentcenter.vo.AbnormalTaskSummary; | |||
import java.util.List; | |||
public interface IAbnormalTaskService | |||
{ | |||
public List<AbnormalTask> getAbnormalTaskList(AbnormalTask query); | |||
public AbnormalTaskSummary abnormalTaskSummary(AbnormalTask query); | |||
public int removeAbnormalTask(AbnormalTask query); | |||
} |
@@ -0,0 +1,89 @@ | |||
package com.ruoyi.agentcenter.service.impl; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.ruoyi.agentcenter.domain.TAgentContraction; | |||
import com.ruoyi.agentcenter.dto.AbnormalTask; | |||
import com.ruoyi.agentcenter.mapper.TAgentContractionMapper; | |||
import com.ruoyi.agentcenter.service.IAbnormalTaskService; | |||
import com.ruoyi.agentcenter.vo.AbnormalTaskSummary; | |||
import com.ruoyi.common.core.domain.entity.SysDept; | |||
import com.ruoyi.common.utils.DateUtils; | |||
import com.ruoyi.common.utils.DeptUtils; | |||
import com.ruoyi.system.mapper.SysDeptMapper; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
@Service | |||
public class AbnormalTaskServiceImpl implements IAbnormalTaskService | |||
{ | |||
@Autowired | |||
private TAgentContractionMapper tAgentContractionMapper; | |||
@Autowired | |||
private SysDeptMapper sysDeptMapper; | |||
@Override | |||
public List<AbnormalTask> getAbnormalTaskList(AbnormalTask query) | |||
{ | |||
switch(query.getType()) | |||
{ | |||
case AbnormalTask.TYPE_CONTRACTION: | |||
return getAbnormalContractionTaskList(query); | |||
default: | |||
return new ArrayList<>(); | |||
} | |||
} | |||
private List<AbnormalTask> getAbnormalContractionTaskList(AbnormalTask query) | |||
{ | |||
List<AbnormalTask> abnormalContractionList = tAgentContractionMapper.getAbnormalContractionList(query); | |||
if(CollectionUtil.isNotEmpty(abnormalContractionList)) | |||
{ | |||
List<SysDept> deptList = sysDeptMapper.getDeptList(new SysDept()); | |||
Map<String, String> fullNameCache = new HashMap<>(); | |||
abnormalContractionList.forEach((x) -> { | |||
String fullName = fullNameCache.computeIfAbsent(x.getOrgCode(), k -> DeptUtils.getFullNameByOrgCode(x.getOrgCode(), deptList, "/", false)); | |||
x.setRegion(fullName); | |||
x.setAddress(fullName); | |||
x.setApplyUser("申请人XXX") | |||
.setTel("联系电话1xxxxxxxxxxx") | |||
; | |||
x.setOrderAt(DateUtils.stdRemoveTime(x.getOrderAt())); | |||
}); | |||
} | |||
return abnormalContractionList; | |||
} | |||
@Override | |||
public AbnormalTaskSummary abnormalTaskSummary(AbnormalTask query) | |||
{ | |||
AbnormalTaskSummary res = new AbnormalTaskSummary(); | |||
res.setNumAbnormalContraction(getAbnormalContractionTaskCount(query)); | |||
res.setNumAbnormalOther(0L) | |||
.setNumAbnormalVoucher(0L) | |||
; | |||
res.setNum(res.getNumAbnormalContraction()); | |||
return res; | |||
} | |||
private Long getAbnormalContractionTaskCount(AbnormalTask query) | |||
{ | |||
return tAgentContractionMapper.getAbnormalContractionCount(query); | |||
} | |||
@Override | |||
public int removeAbnormalTask(AbnormalTask query) | |||
{ | |||
switch(query.getType()) | |||
{ | |||
case AbnormalTask.TYPE_CONTRACTION: | |||
return tAgentContractionMapper.deleteTAgentContractionById(query.getId()); | |||
default: | |||
return 0; | |||
} | |||
} | |||
} |
@@ -30,7 +30,6 @@ 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; | |||
@@ -0,0 +1,14 @@ | |||
package com.ruoyi.agentcenter.vo; | |||
import lombok.Data; | |||
import lombok.experimental.Accessors; | |||
@Data | |||
@Accessors(chain = true) | |||
public class AbnormalTaskSummary | |||
{ | |||
private Long numAbnormalContraction; | |||
private Long numAbnormalVoucher; | |||
private Long numAbnormalOther; | |||
private Long num; | |||
} |
@@ -305,4 +305,62 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
</where> | |||
GROUP BY org_code | |||
</select> | |||
<resultMap id="AbnormalTaskResultMap" type="com.ruoyi.agentcenter.dto.AbnormalTask"> | |||
<result property="agentCenter" column="agent_center"/> | |||
<result property="countyCode" column="county_code"/> | |||
<result property="orgCode" column="org_code"/> | |||
<result property="townCode" column="town_code"/> | |||
<result property="type" column="type"/> | |||
<result property="orderYear" column="order_year"/> | |||
<result property="orderMonth" column="order_month"/> | |||
<result property="bookName" column="book_name"/> | |||
<result property="handleNick" column="handle_nick"/> | |||
<result property="orderAt" column="order_at"/> | |||
<result property="remark" column="remark"/> | |||
<result property="id" column="id"/> | |||
<result property="taskId" column="task_id"/> | |||
<result property="name" column="name"/> | |||
<result property="countyName" column="county_name"/> | |||
<result property="townName" column="town_name"/> | |||
<result property="orgName" column="org_name"/> | |||
<result property="handleUser" column="handle_user"/> | |||
</resultMap> | |||
<select id="getAbnormalContractionList" parameterType="com.ruoyi.agentcenter.dto.AbnormalTask" resultMap="AbnormalTaskResultMap"> | |||
select | |||
c.id, c.task_id, c.name, c.remark, c.order_at, c.order_year, c.order_month, c.order_at, | |||
t.org_code, t.town_code, t.county_code, t.book_name, t.handle_nick, t.agent_center, t.county_name, t.town_name, t.org_name, t.handle_user, | |||
'contraction' as type | |||
from t_agent_contraction c | |||
INNER JOIN t_agent_task t ON c.task_id = t.id | |||
<where> | |||
<if test="agentCenter != null and agentCenter != ''"> and t.agent_center = #{agentCenter}</if> | |||
<if test="countyCode != null and countyCode != ''"> and t.county_code = #{countyCode}</if> | |||
<if test="townCode != null and townCode != ''"> and t.town_code = #{townCode}</if> | |||
<if test="orgCode != null and orgCode != ''"> and t.org_code = #{orgCode}</if> | |||
<if test="orderYear != null and orderYear != ''"> and c.order_year = #{orderYear}</if> | |||
<if test="orderMonth != null and orderMonth != ''"> and c.order_month = #{orderMonth}</if> | |||
<if test="handleUser != null and handleUser != ''"> and t.handle_user = #{handleUser}</if> | |||
and order_status = '4' | |||
</where> | |||
</select> | |||
<select id="getAbnormalContractionCount" parameterType="com.ruoyi.agentcenter.dto.AbnormalTask" resultType="Long"> | |||
select | |||
COUNT(*) | |||
from t_agent_contraction c | |||
INNER JOIN t_agent_task t ON c.task_id = t.id | |||
<where> | |||
<if test="agentCenter != null and agentCenter != ''"> and t.agent_center = #{agentCenter}</if> | |||
<if test="countyCode != null and countyCode != ''"> and t.county_code = #{countyCode}</if> | |||
<if test="townCode != null and townCode != ''"> and t.town_code = #{townCode}</if> | |||
<if test="orgCode != null and orgCode != ''"> and t.org_code = #{orgCode}</if> | |||
<if test="orderYear != null and orderYear != ''"> and c.order_year = #{orderYear}</if> | |||
<if test="orderMonth != null and orderMonth != ''"> and c.order_month = #{orderMonth}</if> | |||
<if test="handleUser != null and handleUser != ''"> and t.handle_user = #{handleUser}</if> | |||
and order_status = '4' | |||
</where> | |||
</select> | |||
</mapper> |
@@ -8,9 +8,11 @@ import java.util.Collections; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.Optional; | |||
import java.util.function.Function; | |||
import java.util.stream.Collector; | |||
import java.util.stream.Collectors; | |||
import java.util.stream.Stream; | |||
public final class DeptUtils | |||
{ | |||
@@ -209,5 +211,27 @@ public final class DeptUtils | |||
return collect; | |||
} | |||
public static String getFullNameByOrgCode(String orgCode, List<SysDept> depts, String splitChar, boolean all) | |||
{ | |||
Optional<SysDept> first = depts.stream().filter((x) -> orgCode.equals(x.getOrgCode())).findFirst(); | |||
if(!first.isPresent()) | |||
return ""; | |||
List<String> names = getDeptNameList(first.get(), depts, all); | |||
return String.join(splitChar, names); | |||
} | |||
private static List<String> getDeptNameList(SysDept dept, List<SysDept> depts, boolean all) | |||
{ | |||
List<String> names = new ArrayList<>(); | |||
Map<Long, SysDept> deptMap = ContainerUtils.toMap(depts, SysDept::getDeptId); | |||
while(null != dept && (all || dept.getDeptId() != SysDept.ROOT_DEPT_ID)) | |||
{ | |||
names.add(0, dept.getDeptName()); | |||
Long parentId = dept.getParentId(); | |||
dept = deptMap.get(parentId); | |||
} | |||
return names; | |||
} | |||
private DeptUtils() {} | |||
} |