|
@@ -0,0 +1,250 @@
|
|
|
|
|
+package org.jeecg.modules.smscheck.controller;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
+import cn.hutool.core.lang.Dict;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.apache.shiro.SecurityUtils;
|
|
|
|
|
+import org.jeecg.common.api.vo.Result;
|
|
|
|
|
+import org.jeecg.common.system.api.ISysBaseAPI;
|
|
|
|
|
+import org.jeecg.common.system.query.QueryGenerator;
|
|
|
|
|
+import org.jeecg.common.system.vo.LoginUser;
|
|
|
|
|
+import org.jeecg.modules.smscheck.entity.SmsCheckCustomerInfo;
|
|
|
|
|
+import org.jeecg.modules.smscheck.entity.SmsCheckCustomerInfoLog;
|
|
|
|
|
+import org.jeecg.modules.smscheck.entity.SmsCheckTask;
|
|
|
|
|
+import org.jeecg.modules.smscheck.service.ISmsCheckCustomerInfoLogService;
|
|
|
|
|
+import org.jeecg.modules.smscheck.service.ISmsCheckCustomerInfoService;
|
|
|
|
|
+import org.jeecg.modules.smscheck.service.ISmsCheckTaskService;
|
|
|
|
|
+import org.jeecg.modules.smscheck.vo.SmsCheckCustomerInfoSubTaskVo;
|
|
|
|
|
+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.RequestParam;
|
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
+
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
+import java.util.Arrays;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+@Api(tags="首页-工作台")
|
|
|
|
|
+@RestController
|
|
|
|
|
+@RequestMapping("/smsCheck/index")
|
|
|
|
|
+@Slf4j
|
|
|
|
|
+public class SmsCheckIndexController {
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ISmsCheckTaskService taskService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ISmsCheckCustomerInfoLogService infoLogService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ISmsCheckCustomerInfoService infoService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ISysBaseAPI sysBaseAPI;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 分页列表查询
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param smsCheckTask 对象
|
|
|
|
|
+ * @param pageNo 页码
|
|
|
|
|
+ * @param pageSize 每页条数
|
|
|
|
|
+ * @param request 请求
|
|
|
|
|
+ * @return 结果
|
|
|
|
|
+ */
|
|
|
|
|
+ //@AutoLog(value = "稽核任务-分页列表查询")
|
|
|
|
|
+ @ApiOperation(value="稽核任务-分页列表查询", notes="稽核任务-分页列表查询")
|
|
|
|
|
+ @GetMapping(value = "/taskList")
|
|
|
|
|
+ public Result<Dict> taskList(SmsCheckTask smsCheckTask,
|
|
|
|
|
+ @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
|
|
+ @RequestParam(name="pageSize", defaultValue="5") Integer pageSize,
|
|
|
|
|
+ HttpServletRequest request) {
|
|
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
|
+ boolean isManager = false;
|
|
|
|
|
+ List<String> roles = sysBaseAPI.getRolesByUsername(sysUser.getUsername());
|
|
|
|
|
+ if (CollUtil.isNotEmpty(roles)) {
|
|
|
|
|
+ isManager = roles.stream().anyMatch(role -> role.equals("leader") || role.equals("admin"));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ QueryWrapper<SmsCheckTask> queryWrapper = QueryGenerator.initQueryWrapper(smsCheckTask, request.getParameterMap());
|
|
|
|
|
+ Page<SmsCheckTask> page = new Page<>(pageNo, pageSize);
|
|
|
|
|
+ IPage<SmsCheckTask> pageList = taskService.page(page, queryWrapper);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ Dict result = Dict.create();
|
|
|
|
|
+ result.put("isManager", isManager);
|
|
|
|
|
+ result.put("records", pageList.getRecords());
|
|
|
|
|
+
|
|
|
|
|
+ return Result.OK(result);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询领导角色的 最新动态、我的任务、本月目标
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param taskId 对象
|
|
|
|
|
+ * @param pageNo 页码
|
|
|
|
|
+ * @param pageSize 每页条数
|
|
|
|
|
+ * @param request 请求
|
|
|
|
|
+ * @return 结果
|
|
|
|
|
+ */
|
|
|
|
|
+ @ApiOperation(value="完善客户资料日志-分页列表查询", notes="客户资料完善记录-分页列表查询")
|
|
|
|
|
+ @GetMapping(value = "/typeWork")
|
|
|
|
|
+ public Result<Dict> typeWork(String taskId,
|
|
|
|
|
+ @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
|
|
+ @RequestParam(name="pageSize", defaultValue="5") Integer pageSize,
|
|
|
|
|
+ HttpServletRequest request) {
|
|
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
|
+ // 最新动态
|
|
|
|
|
+ SmsCheckCustomerInfoLog infoLog = new SmsCheckCustomerInfoLog();
|
|
|
|
|
+ infoLog.setTaskId(taskId);
|
|
|
|
|
+ infoLog.setStaffId(sysUser.getId());
|
|
|
|
|
+ QueryWrapper<SmsCheckCustomerInfoLog> infoLogQuery = QueryGenerator.initQueryWrapper(infoLog, request.getParameterMap());
|
|
|
|
|
+ infoLogQuery.lambda().orderByDesc(SmsCheckCustomerInfoLog::getCreateTime);
|
|
|
|
|
+ IPage<SmsCheckCustomerInfoLog> infoLogPage = infoLogService.page(new Page<>(pageNo, pageSize), infoLogQuery);
|
|
|
|
|
+
|
|
|
|
|
+ // 我的任务
|
|
|
|
|
+ SmsCheckCustomerInfo info = new SmsCheckCustomerInfo();
|
|
|
|
|
+ info.setTaskId(taskId);
|
|
|
|
|
+ info.setCreateBy(sysUser.getUsername());
|
|
|
|
|
+ QueryWrapper<SmsCheckCustomerInfo> infoQuery = QueryGenerator.initQueryWrapper(info, request.getParameterMap());
|
|
|
|
|
+ infoQuery.lambda().in(SmsCheckCustomerInfo::getCheckState, Arrays.asList(2, 3));
|
|
|
|
|
+ infoQuery.lambda().orderByDesc(SmsCheckCustomerInfo::getCreateTime);
|
|
|
|
|
+ IPage<SmsCheckCustomerInfo> infoPage = infoService.page(new Page<>(pageNo, pageSize), infoQuery);
|
|
|
|
|
+
|
|
|
|
|
+ IPage<SmsCheckCustomerInfoSubTaskVo> infoVoPage = infoPage.convert(infoObj -> {
|
|
|
|
|
+ SmsCheckCustomerInfoSubTaskVo voObj = new SmsCheckCustomerInfoSubTaskVo();
|
|
|
|
|
+ BeanUtil.copyProperties(infoObj, voObj);
|
|
|
|
|
+ voObj.setOperateType("work");
|
|
|
|
|
+ return voObj;
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // 本月目标
|
|
|
|
|
+ SmsCheckCustomerInfo target = new SmsCheckCustomerInfo();
|
|
|
|
|
+ target.setTaskId(taskId);
|
|
|
|
|
+ target.setCreateBy(sysUser.getUsername());
|
|
|
|
|
+ // 全部
|
|
|
|
|
+ QueryWrapper<SmsCheckCustomerInfo> allTargetQuery = QueryGenerator.initQueryWrapper(target, request.getParameterMap());
|
|
|
|
|
+ long allCount = infoService.count(allTargetQuery);
|
|
|
|
|
+ // 未完善
|
|
|
|
|
+ QueryWrapper<SmsCheckCustomerInfo> undoTargetQuery = QueryGenerator.initQueryWrapper(target, request.getParameterMap());
|
|
|
|
|
+ undoTargetQuery.lambda().in(SmsCheckCustomerInfo::getCheckState, Arrays.asList(0,1));
|
|
|
|
|
+ long undoCount = infoService.count(undoTargetQuery);
|
|
|
|
|
+ // 待稽核
|
|
|
|
|
+ QueryWrapper<SmsCheckCustomerInfo> uncheckTargetQuery = QueryGenerator.initQueryWrapper(target, request.getParameterMap());
|
|
|
|
|
+ uncheckTargetQuery.lambda().in(SmsCheckCustomerInfo::getCheckState, Arrays.asList(2,3));
|
|
|
|
|
+ long uncheckCount = infoService.count(uncheckTargetQuery);
|
|
|
|
|
+ // 待整改
|
|
|
|
|
+ QueryWrapper<SmsCheckCustomerInfo> checkedTargetQuery = QueryGenerator.initQueryWrapper(target, request.getParameterMap());
|
|
|
|
|
+ checkedTargetQuery.lambda().in(SmsCheckCustomerInfo::getCheckState, Arrays.asList(4));
|
|
|
|
|
+ long checkedCount = infoService.count(checkedTargetQuery);
|
|
|
|
|
+ // 通过
|
|
|
|
|
+ QueryWrapper<SmsCheckCustomerInfo> doneTargetQuery = QueryGenerator.initQueryWrapper(target, request.getParameterMap());
|
|
|
|
|
+ doneTargetQuery.lambda().in(SmsCheckCustomerInfo::getCheckState, Arrays.asList(5));
|
|
|
|
|
+ long doneCount = infoService.count(doneTargetQuery);
|
|
|
|
|
+
|
|
|
|
|
+ Dict result = Dict.create();
|
|
|
|
|
+ // 最新动态
|
|
|
|
|
+ result.put("recentList", infoLogPage.getRecords());
|
|
|
|
|
+ // 我的任务
|
|
|
|
|
+ result.put("subTaskList", infoVoPage.getRecords());
|
|
|
|
|
+ // 本月目标
|
|
|
|
|
+ Dict targetObj = Dict.create();
|
|
|
|
|
+ targetObj.put("allCount", allCount);
|
|
|
|
|
+ targetObj.put("undoCount", undoCount);
|
|
|
|
|
+ targetObj.put("uncheckCount", uncheckCount);
|
|
|
|
|
+ targetObj.put("checkedCount", checkedCount);
|
|
|
|
|
+ targetObj.put("doneCount", doneCount);
|
|
|
|
|
+ result.put("targetObj", targetObj);
|
|
|
|
|
+
|
|
|
|
|
+ return Result.OK(result);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询领导角色的 最新动态、我的任务、本月目标
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param taskId 对象
|
|
|
|
|
+ * @param pageNo 页码
|
|
|
|
|
+ * @param pageSize 每页条数
|
|
|
|
|
+ * @param request 请求
|
|
|
|
|
+ * @return 结果
|
|
|
|
|
+ */
|
|
|
|
|
+ @ApiOperation(value="完善客户资料日志-分页列表查询", notes="客户资料完善记录-分页列表查询")
|
|
|
|
|
+ @GetMapping(value = "/typeInfo")
|
|
|
|
|
+ public Result<Dict> typeInfo(String taskId,
|
|
|
|
|
+ @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
|
|
+ @RequestParam(name="pageSize", defaultValue="5") Integer pageSize,
|
|
|
|
|
+ HttpServletRequest request) {
|
|
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
|
|
+ // 最新动态
|
|
|
|
|
+ SmsCheckCustomerInfoLog infoLog = new SmsCheckCustomerInfoLog();
|
|
|
|
|
+ infoLog.setTaskId(taskId);
|
|
|
|
|
+ infoLog.setStaffId(sysUser.getId());
|
|
|
|
|
+ QueryWrapper<SmsCheckCustomerInfoLog> infoLogQuery = QueryGenerator.initQueryWrapper(infoLog, request.getParameterMap());
|
|
|
|
|
+ infoLogQuery.lambda().orderByDesc(SmsCheckCustomerInfoLog::getCreateTime);
|
|
|
|
|
+ IPage<SmsCheckCustomerInfoLog> infoLogPage = infoLogService.page(new Page<>(pageNo, pageSize), infoLogQuery);
|
|
|
|
|
+
|
|
|
|
|
+ // 我的任务
|
|
|
|
|
+ SmsCheckCustomerInfo info = new SmsCheckCustomerInfo();
|
|
|
|
|
+ info.setTaskId(taskId);
|
|
|
|
|
+ info.setCreateBy(sysUser.getUsername());
|
|
|
|
|
+ QueryWrapper<SmsCheckCustomerInfo> infoQuery = QueryGenerator.initQueryWrapper(info, request.getParameterMap());
|
|
|
|
|
+ infoQuery.lambda().in(SmsCheckCustomerInfo::getCheckState, Arrays.asList(2, 3));
|
|
|
|
|
+ infoQuery.lambda().orderByDesc(SmsCheckCustomerInfo::getCreateTime);
|
|
|
|
|
+ IPage<SmsCheckCustomerInfo> infoPage = infoService.page(new Page<>(pageNo, pageSize), infoQuery);
|
|
|
|
|
+
|
|
|
|
|
+ List<SmsCheckCustomerInfoSubTaskVo> subTaskList = infoPage.convert(infoObj -> {
|
|
|
|
|
+ SmsCheckCustomerInfoSubTaskVo voObj = new SmsCheckCustomerInfoSubTaskVo();
|
|
|
|
|
+ BeanUtil.copyProperties(infoObj, voObj, false);
|
|
|
|
|
+ voObj.setOperateType("info");
|
|
|
|
|
+ return voObj;
|
|
|
|
|
+ }).getRecords();
|
|
|
|
|
+
|
|
|
|
|
+ // 本月目标
|
|
|
|
|
+ SmsCheckCustomerInfo target = new SmsCheckCustomerInfo();
|
|
|
|
|
+ target.setTaskId(taskId);
|
|
|
|
|
+ //target.setCreateBy(sysUser.getUsername());
|
|
|
|
|
+ // 全部
|
|
|
|
|
+ QueryWrapper<SmsCheckCustomerInfo> allTargetQuery = QueryGenerator.initQueryWrapper(target, request.getParameterMap());
|
|
|
|
|
+ long allCount = infoService.count(allTargetQuery);
|
|
|
|
|
+ // 未完善
|
|
|
|
|
+ QueryWrapper<SmsCheckCustomerInfo> undoTargetQuery = QueryGenerator.initQueryWrapper(target, request.getParameterMap());
|
|
|
|
|
+ undoTargetQuery.lambda().in(SmsCheckCustomerInfo::getCheckState, Arrays.asList(0,1));
|
|
|
|
|
+ long undoCount = infoService.count(undoTargetQuery);
|
|
|
|
|
+ // 待稽核
|
|
|
|
|
+ QueryWrapper<SmsCheckCustomerInfo> uncheckTargetQuery = QueryGenerator.initQueryWrapper(target, request.getParameterMap());
|
|
|
|
|
+ uncheckTargetQuery.lambda().in(SmsCheckCustomerInfo::getCheckState, Arrays.asList(2,3));
|
|
|
|
|
+ long uncheckCount = infoService.count(uncheckTargetQuery);
|
|
|
|
|
+ // 待整改
|
|
|
|
|
+ QueryWrapper<SmsCheckCustomerInfo> checkedTargetQuery = QueryGenerator.initQueryWrapper(target, request.getParameterMap());
|
|
|
|
|
+ checkedTargetQuery.lambda().in(SmsCheckCustomerInfo::getCheckState, Arrays.asList(4));
|
|
|
|
|
+ long checkedCount = infoService.count(checkedTargetQuery);
|
|
|
|
|
+ // 通过
|
|
|
|
|
+ QueryWrapper<SmsCheckCustomerInfo> doneTargetQuery = QueryGenerator.initQueryWrapper(target, request.getParameterMap());
|
|
|
|
|
+ doneTargetQuery.lambda().in(SmsCheckCustomerInfo::getCheckState, Arrays.asList(5));
|
|
|
|
|
+ long doneCount = infoService.count(doneTargetQuery);
|
|
|
|
|
+
|
|
|
|
|
+ Dict result = Dict.create();
|
|
|
|
|
+ // 最新动态
|
|
|
|
|
+ result.put("recentList", infoLogPage.getRecords());
|
|
|
|
|
+ // 我的任务
|
|
|
|
|
+ result.put("subTaskList", subTaskList);
|
|
|
|
|
+ // 本月目标
|
|
|
|
|
+ Dict targetObj = Dict.create();
|
|
|
|
|
+ targetObj.put("allCount", allCount);
|
|
|
|
|
+ targetObj.put("undoCount", undoCount);
|
|
|
|
|
+ targetObj.put("uncheckCount", uncheckCount);
|
|
|
|
|
+ targetObj.put("checkedCount", checkedCount);
|
|
|
|
|
+ targetObj.put("doneCount", doneCount);
|
|
|
|
|
+ result.put("targetObj", targetObj);
|
|
|
|
|
+
|
|
|
|
|
+ return Result.OK(result);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|