|
|
@@ -17,6 +17,7 @@ import com.xunmei.core.resumption.vo.appPlan.AppPlanVo;
|
|
|
import com.xunmei.core.resumption.vo.appPlan.RuleItemVo;
|
|
|
import com.xunmei.core.resumption.vo.appPlan.RuleRequestVo;
|
|
|
import com.xunmei.system.api.RemoteOrgService;
|
|
|
+import com.xunmei.system.api.domain.SysDept;
|
|
|
import com.xunmei.system.api.domain.SysOrg;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
@@ -69,11 +70,75 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
|
|
|
|
|
|
@Override
|
|
|
public Page<AppPlan> selectPage(CoreResumptionPlanPageDto info) {
|
|
|
- Page<AppPlan> page = info.getPageDto();
|
|
|
- Page<AppPlan> result = baseMapper.selectPage(page, info);
|
|
|
+ //获取选择机构id
|
|
|
+ Long orgid = info.getOrgId();
|
|
|
+ //下穿计算
|
|
|
+// if (info.isCheckSub()) {
|
|
|
+// List<Long> ids = orgService.selectCheckSubOrgIdList(info.getOrgId(), SecurityConstants.INNER);
|
|
|
+// info.setIds(ids);
|
|
|
+// info.setOrgId(null);
|
|
|
+//
|
|
|
+// }
|
|
|
+ //获取前段对应的数据库页数
|
|
|
+ int current = Math.toIntExact(info.getPageNum() - 1);
|
|
|
+ int size = Math.toIntExact(info.getPageSize());
|
|
|
+ Page<AppPlan> result = new Page<>();
|
|
|
+ //查询所有数据
|
|
|
+ List<AppPlan> sel = baseMapper.selectAll(info);
|
|
|
+ //list转树结构
|
|
|
+ List<AppPlan> appPlans = recursionDept(sel,orgid);
|
|
|
+ //计算分页所需数组起始位置
|
|
|
+ int start = current * size;
|
|
|
+ int end = Math.min(start + size, appPlans.size());
|
|
|
+ //封装前端需要的分页数据
|
|
|
+ result.setRecords(appPlans.subList(start, end));
|
|
|
+
|
|
|
+ //计算最外层数量
|
|
|
+ long total = appPlans.size();
|
|
|
+ result.setTotal(total);
|
|
|
+ result.setPages(total / info.getPageSize());
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * dept递归方法转换成树形结构
|
|
|
+ *
|
|
|
+ * @param treeList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static List<AppPlan> recursionDept(List<AppPlan> treeList,Long orgid) {
|
|
|
+ List<AppPlan> trees = new ArrayList<>();
|
|
|
+ for (AppPlan tree : treeList) {
|
|
|
+ // 找出父节点
|
|
|
+ if (-1 == tree.getParentId()) {
|
|
|
+ // 调用递归方法填充子节点列表
|
|
|
+ trees.add(findChildren(tree, treeList));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return trees;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * dept递归方法
|
|
|
+ *
|
|
|
+ * @param tree 父节点对象
|
|
|
+ * @param treeList 所有的List
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static AppPlan findChildren(AppPlan tree, List<AppPlan> treeList) {
|
|
|
+ for (AppPlan node : treeList) {
|
|
|
+ if (tree.getId().equals(node.getParentId())) {
|
|
|
+ if (tree.getChildren() == null) {
|
|
|
+ tree.setChildren(new ArrayList<>());
|
|
|
+ }
|
|
|
+ // 递归 调用自身
|
|
|
+ tree.getChildren().add(findChildren(node, treeList));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return tree;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public List<Long> findExecOrgByPlan(Long plan_id) {
|
|
|
return baseMapper.findExecOrgByPlan(plan_id);
|
|
|
@@ -91,6 +156,7 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
|
|
|
|
|
|
AppPlan plan = baseMapper.selectById(dto.getId());
|
|
|
plan.setOrgId(d.getOrgId().toString());
|
|
|
+ plan.setDistributeStatus("1");
|
|
|
plan.setPlanOfOrgId(d.getOrgId().toString());
|
|
|
plan.setPlanStatus(d.getStatus());
|
|
|
plan.setDistributePlanStatus(d.getStatus().toString());
|
|
|
@@ -162,6 +228,8 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
|
|
|
public void saveOrUpdatePlan(AppPlanVo app) throws Exception {
|
|
|
AppPlan plan = convertToAppPlan(app);
|
|
|
if (app.getId() == null) {
|
|
|
+ plan.setParentId(-1L);
|
|
|
+ plan.setDeleted(0);
|
|
|
//新增
|
|
|
plan.setPlanOfOrgId(app.getPlanCreateOrgId());
|
|
|
plan.setPlanOfOrgName(app.getPlanCreateOrgName());
|
|
|
@@ -224,7 +292,7 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
|
|
|
//
|
|
|
// }
|
|
|
} else {
|
|
|
- if(app.getRoleList()==null){
|
|
|
+ if (app.getRoleList() == null) {
|
|
|
app.setRoleList(new ArrayList<>());
|
|
|
}
|
|
|
//修改
|
|
|
@@ -242,7 +310,7 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
|
|
|
baseMapper.updateById(plan);
|
|
|
|
|
|
Long id = plan.getId();
|
|
|
- if(app.getRoleList().size()>0){
|
|
|
+ if (app.getRoleList().size() > 0) {
|
|
|
QueryWrapper<AppPlanToRole> apr = new QueryWrapper<>();
|
|
|
apr.lambda().eq(AppPlanToRole::getPlanId, id);
|
|
|
appPlanToRoleMapper.delete(apr);
|