|
@@ -3,6 +3,9 @@ package com.yh.saas.plugin.yiliangyiyun.service.impl;
|
|
|
import cn.hutool.core.lang.UUID;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
|
+import com.baomidou.mybatisplus.plugins.Page;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+import com.google.common.collect.Sets;
|
|
|
import com.winsea.svc.base.base.entity.CommonDepartment;
|
|
|
import com.winsea.svc.base.base.entity.CommonStaff;
|
|
|
import com.winsea.svc.base.base.service.ICommonDepartmentService;
|
|
@@ -15,11 +18,18 @@ import com.winsea.svc.base.security.entity.Account;
|
|
|
import com.winsea.svc.base.security.service.IAccountLoginHistoryService;
|
|
|
import com.winsea.svc.base.security.service.IAccountService;
|
|
|
import com.winsea.svc.base.security.service.IVeriCodeService;
|
|
|
+import com.winsea.svc.base.security.util.AuthSecurityUtils;
|
|
|
+import com.winsea.svc.notice.entity.NoticeBusinessConstantInfo;
|
|
|
+import com.winsea.svc.notice.entity.NoticeTaskInfo;
|
|
|
+import com.winsea.svc.notice.entity.base.BaseNotice;
|
|
|
+import com.winsea.svc.notice.service.INoticeBusinessConstantService;
|
|
|
+import com.winsea.svc.notice.service.INoticeBusinessResourceService;
|
|
|
+import com.winsea.svc.notice.service.INoticeTaskService;
|
|
|
+import com.winsea.svc.notice.service.INoticeUtilService;
|
|
|
+import com.yh.saas.common.support.entity.BaseModel;
|
|
|
import com.yh.saas.common.support.event.SupportEventBus;
|
|
|
-import com.yh.saas.plugin.yiliangyiyun.entity.CacheComponent;
|
|
|
-import com.yh.saas.plugin.yiliangyiyun.entity.CommonUser;
|
|
|
-import com.yh.saas.plugin.yiliangyiyun.entity.DriverViewInfo;
|
|
|
-import com.yh.saas.plugin.yiliangyiyun.entity.IdentityAuthenticationInfo;
|
|
|
+import com.yh.saas.common.support.util.query.QueryUtils;
|
|
|
+import com.yh.saas.plugin.yiliangyiyun.entity.*;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.exception.AppServiceException;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.exception.ExceptionDefinition;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.exception.ServiceException;
|
|
@@ -42,7 +52,9 @@ import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import com.baomidou.mybatisplus.mapper.Wrapper;
|
|
|
-import java.util.List;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.*;
|
|
|
import java.sql.*;
|
|
|
|
|
|
/**
|
|
@@ -77,36 +89,30 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
@Autowired
|
|
|
private ICommonStaffService commonStaffService;
|
|
|
|
|
|
-
|
|
|
@Autowired
|
|
|
- private ShiroRealm shiroRealm;
|
|
|
+ private INoticeBusinessConstantService businessConstantService;
|
|
|
|
|
|
@Autowired
|
|
|
private SecurityProperties securityProperties;
|
|
|
|
|
|
@Autowired
|
|
|
- private ICommonTenantService tenantService;
|
|
|
+ private INoticeBusinessResourceService businessResourceService;
|
|
|
|
|
|
@Autowired
|
|
|
- private ICommonRoleService roleService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ICommonStaffService staffService;
|
|
|
+ private ICommonDepartmentService commonDepartmentService;
|
|
|
|
|
|
@Autowired
|
|
|
- private IVeriCodeService veriCodeService;
|
|
|
+ private IAccountService accountService;
|
|
|
|
|
|
@Autowired
|
|
|
- private IAccountLoginHistoryService loginHistoryService;
|
|
|
+ private INoticeUtilService noticeUtilService;
|
|
|
|
|
|
@Autowired
|
|
|
- private SupportEventBus supportEventBus;
|
|
|
+ private INoticeTaskService noticeTaskService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private ICommonDepartmentService commonDepartmentService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private IAccountService accountService;
|
|
|
+ //用来过滤权限的时候使用,当过滤的code已在其中的时候就不进行过滤;
|
|
|
+ private Set<String> businessCodes;
|
|
|
|
|
|
|
|
|
Connection coon = null;
|
|
@@ -578,7 +584,7 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
password = targetUser.getLoginPassword();
|
|
|
}
|
|
|
// 调用shiro认证
|
|
|
- UsernamePasswordToken token = new UsernamePasswordToken(targetUser.getUserId(), password);
|
|
|
+ UsernamePasswordToken token = new UsernamePasswordToken(targetUser.getUserId(), password);
|
|
|
if (null == user.getRememberMe()) {
|
|
|
token.setRememberMe(false);
|
|
|
} else {
|
|
@@ -636,4 +642,86 @@ public class CommonUserServiceImpl extends ServiceImpl<CommonUserMapper, CommonU
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**查询已完成任务
|
|
|
+ *
|
|
|
+ * @param noticeTask
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Page<NoticeTaskInfo> findHisPageNoticeTasks(NoticeTaskInfo noticeTask) {
|
|
|
+ Map<String, Object> pageView = new HashMap<>();
|
|
|
+ pageView.put("startRecord", (noticeTask.getCurrentPage() - 1)
|
|
|
+ * noticeTask.getPageSize());
|
|
|
+ // 公司ID
|
|
|
+ pageView.put("userId", AuthSecurityUtils.getCurrentUserId());
|
|
|
+ pageView.put("roleId", AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getMajorRoleId());
|
|
|
+ pageView.put("pageSize", noticeTask.getPageSize());
|
|
|
+ pageView.put("currentPage", noticeTask.getCurrentPage());
|
|
|
+
|
|
|
+ // 查询总数
|
|
|
+ Integer dataCount = baseMapper.getCountByCondition(pageView);
|
|
|
+ List<NoticeTaskInfo> dataList = baseMapper.getListByCondition(pageView);
|
|
|
+ Page<NoticeTaskInfo> page = new Page<>();
|
|
|
+ page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
|
|
|
+ page.setTotal(dataCount == null ? 0 : dataCount);
|
|
|
+ page.setCurrent(noticeTask.getCurrentPage());
|
|
|
+ page.setSize(noticeTask.getPageSize());
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 过滤没有这个权限的任务
|
|
|
+ *
|
|
|
+ * @param taskInfos 当前获取到的数据
|
|
|
+ * @param newTaskInfos 新容器
|
|
|
+ */
|
|
|
+ private void filterResource(List<NoticeTaskInfo> taskInfos, List<NoticeTaskInfo> newTaskInfos) {
|
|
|
+ businessCodes = new HashSet<>();
|
|
|
+
|
|
|
+ //已有权限
|
|
|
+ List<String> resourceIds = AuthSecurityUtils.getUserResources(AuthSecurityUtils.getCurrentUserId());
|
|
|
+
|
|
|
+ //摘除该用户没有权限的数据
|
|
|
+ for (NoticeTaskInfo taskInfo : taskInfos) {
|
|
|
+ //摘除该用户没有权限的数据
|
|
|
+ if (businessCodes.contains(taskInfo.getBusinessCode()) ||
|
|
|
+ businessResourceService.determineBusinessCodeResource(resourceIds, taskInfo.getBusinessCode())) {
|
|
|
+ businessCodes.add(taskInfo.getBusinessCode());
|
|
|
+ newTaskInfos.add(taskInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取当前登录人工作通知任务查询条件Wrapper
|
|
|
+ *
|
|
|
+ * @param noticeTask 工作通知
|
|
|
+ * @return 返回条件语句
|
|
|
+ */
|
|
|
+ private Wrapper<NoticeTaskInfo> getCurrentUserNoticeTaskWrapper(NoticeTaskInfo noticeTask) {
|
|
|
+ Wrapper<NoticeTaskInfo> wrapper;
|
|
|
+ boolean returnFlag = false;
|
|
|
+ if (null != noticeTask &&
|
|
|
+ NoticeTaskInfo.NoticeTaskStatus.TO_BE_PROCESSED.equals(noticeTask.getNoticeTaskStatus())) {
|
|
|
+ returnFlag = true;
|
|
|
+ noticeTask.setNoticeTaskStatus(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null == noticeTask) {
|
|
|
+ wrapper = new EntityWrapper<>();
|
|
|
+ } else {
|
|
|
+ wrapper = QueryUtils.convertExampleToWrapper(noticeTask);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (returnFlag) {
|
|
|
+ wrapper.in(NoticeTaskInfo.QueryFields.NOTICE_TASK_STATUS, Lists.newArrayList(NoticeTaskInfo.NoticeTaskStatus.TO_BE_PROCESSED, NoticeTaskInfo.NoticeTaskStatus.RETURN));
|
|
|
+ }
|
|
|
+
|
|
|
+ return (Wrapper<NoticeTaskInfo>) noticeUtilService.getCurrentUserNoticeTaskWrapper(wrapper, NoticeTaskInfo.class);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|