Commit 80e3ad9e by 袁伟铭

添加职责办事项目录绑定

parent afe47988
......@@ -127,7 +127,7 @@ public class DeptDutyController {
return ResultVo.success();
}
@ApiOperation("获取机构职责列表")
@ApiOperation("获取职责办事项列表")
@PostMapping(value = "/getDeptLiabilityList")
public ResultVo<PageVo<DeptLiability>> getDeptLiabilityList(@RequestBody KeywordFindVo vo) {
return ResultVo.success(deptDutyService.getDeptLiabilityList(vo));
......@@ -220,6 +220,15 @@ public class DeptDutyController {
return ResultVo.success();
}
@ApiOperation("删除事项-资源目录表")
@DeleteMapping(value = "/deleteDeptLiabilityCategory/{id}")
public ResultVo deleteDeptLiabilityCategory(@PathVariable String id) {
AssertUtils.hasText(id, "ID不能为空");
deptDutyService.deleteDeptLiabilityCategory(id);
return ResultVo.success();
}
@ApiOperation("获取事项-资源目录表列表")
@PostMapping(value = "/getDeptLiabilityCategoryList")
public ResultVo<PageVo<DeptLiabilityCategoryVo>> getDeptLiabilityCategoryList(@RequestBody DeptLiabilityCategoryFindVo vo) {
......
......@@ -3,6 +3,7 @@ package com.zq.resource.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zq.common.utils.AssertUtils;
......@@ -21,10 +22,7 @@ import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -40,6 +38,7 @@ public class DeptDutyService {
private final DeptLiabilityCategoryDao deptLiabilityCategoryDao;
private final DeptLiabilityLabelDao deptLiabilityLabelDao;
private final OrgDeptDao orgDeptDao;
private final DataCategoryDao dataCategoryDao;
public PageVo<DeptDuty> getDeptDutyList(DeptDutyFindVo vo) {
LambdaQueryWrapper<DeptDuty> lambdaQuery = Wrappers.lambdaQuery(DeptDuty.class);
......@@ -153,6 +152,11 @@ public class DeptDutyService {
}
public void addDeptLiabilityCategory(DeptLiabilityCategory vo) {
DataCategory dataCategory = dataCategoryDao.selectById(vo.getCategoryId());
AssertUtils.notNull(dataCategory, "目录不存在");
DeptLiability deptLiability = deptLiabilityDao.selectById(vo.getDeptLiabilityId());
AssertUtils.notNull(deptLiability, "办事项不存在");
vo.setCreateTime(DateUtil.date());
vo.setUpdateTime(DateUtil.date());
......@@ -171,11 +175,47 @@ public class DeptDutyService {
}
public PageVo<DeptLiabilityCategoryVo> getDeptLiabilityCategoryList(DeptLiabilityCategoryFindVo vo) {
return PagingUtils.paging(vo, deptLiabilityCategoryDao::getDeptLiabilityCategoryList);
LambdaQueryWrapper<DeptLiabilityCategory> lambdaQuery = Wrappers.lambdaQuery(DeptLiabilityCategory.class);
lambdaQuery.orderByDesc(DeptLiabilityCategory::getCreateTime);
List<DeptLiabilityCategoryVo> list = new ArrayList<>();
PageVo<DeptLiabilityCategory> paging = PagingUtils.paging(vo, deptLiabilityCategoryDao, DeptLiabilityCategory.class, lambdaQuery);
for (DeptLiabilityCategory row : paging.getRows()) {
DataCategory dataCategory = dataCategoryDao.selectById(row.getCategoryId());
DeptLiability deptLiability = deptLiabilityDao.selectById(row.getDeptLiabilityId());
DeptLiabilityCategoryVo build = DeptLiabilityCategoryVo.builder()
.id(row.getId())
.categoryId(dataCategory.getId())
.deptLiabilityId(deptLiability.getId())
.categoryName(dataCategory.getCataTitle())
.deptLiabilityName(deptLiability.getBusinessName())
.createTime(row.getCreateTime())
.updateTime(row.getUpdateTime())
.build();
list.add(build);
}
return PageVo.ofReqVo(vo, list, paging.getTotal());
}
public DeptLiabilityCategoryVo getDeptLiabilityCategoryInfo(String liabilityCategoryId) {
return deptLiabilityCategoryDao.getDeptLiabilityCategoryById(liabilityCategoryId);
DeptLiabilityCategory deptLiabilityCategory = deptLiabilityCategoryDao.selectById(liabilityCategoryId);
AssertUtils.notNull(deptLiabilityCategory, "办事项目录不存在");
DataCategory dataCategory = dataCategoryDao.selectById(deptLiabilityCategory.getCategoryId());
DeptLiability deptLiability = deptLiabilityDao.selectById(deptLiabilityCategory.getDeptLiabilityId());
DeptLiabilityCategoryVo build = DeptLiabilityCategoryVo.builder()
.id(deptLiabilityCategory.getId())
.categoryId(dataCategory.getId())
.deptLiabilityId(deptLiability.getId())
.categoryName(dataCategory.getCataTitle())
.deptLiabilityName(deptLiability.getBusinessName())
.createTime(deptLiabilityCategory.getCreateTime())
.updateTime(deptLiabilityCategory.getUpdateTime())
.build();
return build;
}
public void addDeptLiabilityLabel(DeptLiabilityLabel vo) {
......@@ -261,7 +301,18 @@ public class DeptDutyService {
String label = deptLiabilityLabelList.stream().map(DeptLiabilityLabel::getLabel).collect(Collectors.joining(";"));
params.put("label", label);
params.put("cataId", "");
List<DeptLiabilityCategory> liabilityCategoryList = deptLiabilityCategoryDao.selectList(Wrappers.lambdaQuery(DeptLiabilityCategory.builder().deptLiabilityId(deptLiability.getId()).build()));
List<DataCategory> list = new ArrayList<>();
for (DeptLiabilityCategory deptLiabilityCategory : liabilityCategoryList) {
DataCategory dataCategory = dataCategoryDao.selectById(deptLiabilityCategory.getCategoryId());
if (dataCategory != null) {
AssertUtils.hasText(dataCategory.getCascadeguid(), dataCategory.getCataTitle() + "目录未注册");
list.add(dataCategory);
}
}
String cataId = list.stream().map(DataCategory::getCascadeguid).filter(StrUtil::isNotBlank).collect(Collectors.joining(";"));
params.put("cataId", cataId);
ShareApiResponse shareApiResponse = ShareApiUtils.doPost(params, ShareApiEnum.RESPONSIBILITY_ADD_UPDATE);
if (shareApiResponse.isSuccess()) {
deptLiability.setCascadeguid(shareApiResponse.getString("cascadeguid"));
......@@ -318,4 +369,8 @@ public class DeptDutyService {
public void deleteDeptLiabilityLabel(String id) {
deptLiabilityLabelDao.deleteById(id);
}
public void deleteDeptLiabilityCategory(String id) {
deptLiabilityCategoryDao.deleteById(id);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment