Compare commits

..

6 Commits

Author SHA1 Message Date
wangliwen 5b88c15aca Merge remote-tracking branch 'origin/master' 2022-06-27 10:38:03 +08:00
wangliwen ae3e7c80a1 ... 2022-06-27 10:37:56 +08:00
wangliwen 481b4a4fec TODO 批量申请流程 2022-06-27 10:35:59 +08:00
yitonglei c98f73b8ec Merge remote-tracking branch 'origin/master' 2022-06-27 10:34:08 +08:00
yitonglei 1be5641717 1、继续新增新能力统计页面部分后台代码 2022-06-27 10:33:59 +08:00
liyongbo2 1127c066ce 项目使用能力和贡献能力明细接口修改 2022-06-27 09:12:06 +08:00
27 changed files with 429 additions and 144 deletions

View File

@ -19,6 +19,7 @@ import io.renren.modules.processForm.service.TAbilityApplicationService;
import io.renren.modules.resource.dto.ResourceDTO;
import io.renren.modules.resource.service.ResourceService;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.sys.service.SysDeptService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
@ -32,6 +33,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -57,6 +59,8 @@ public class AbilityCenterControllerV2 {
private ResourceService resourceService;
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
private SysDeptService sysDeptService;
private static String key = "abilityprocess_v2";
private static Map<String, Object> params = new HashMap<String, Object>() {
@ -121,11 +125,14 @@ public class AbilityCenterControllerV2 {
return resourceDTO.getDeptId();
})); // 按部门分组
temp.keySet().stream().distinct().forEach(deptId -> {
if (deptId == 0L) { // 部门不存在时
if (deptId == 0L) { // 部门id不存在时
return;
}
if (sysDeptService.get(deptId) == null) { // 部门不存在
return;
}
List<TAbilityApplicationDTO> dtoList = temp.get(deptId);
List<Long> ids = dtoList.stream().map(index -> index.getId()).collect(Collectors.toList());
List<Long> ids = dtoList.stream().map(index -> index.getId()).collect(Collectors.toList()); // 发起申请的表单id
// 仿照请求接口 /act/running/startOfBusinessKey
ProcessStartDTO processStartDTO = new ProcessStartDTO();
processStartDTO.setBusinessKey(JSON.toJSONString(ids)); // 申请的id列表 json字符 做businesskey
@ -148,7 +155,7 @@ public class AbilityCenterControllerV2 {
// 仿照请求接口 /processForm/tabilityapplication/updateInstanceId
CompletableFuture.runAsync(() -> {
if (Long.valueOf(dto.getBusinessKey()) != null) {
if (dto.getBusinessKey() != null) {
String[] sqls =
dtoList.stream().map(i -> String.format("UPDATE t_ability_application SET instance_id = %s WHERE id = %s", dto.getProcessInstanceId(), i.getId()))
.collect(Collectors.toList()).toArray(new String[dtoList.size()]);
@ -157,6 +164,6 @@ public class AbilityCenterControllerV2 {
});
});
}
return new Result().ok("");
return new Result().ok(LocalDateTime.now().toString());
}
}

View File

@ -116,7 +116,7 @@ public class CensusControllerV3 {
//以下是组件服务发布情况点击详情
/**
* 组件评分情况 1 2 3 4 5评分分布
* 发布组件评分情况 1 2 3 4 5评分分布
* @param
* @return
*/
@ -152,6 +152,7 @@ public class CensusControllerV3 {
@LogOperation("TOP5被调用的组件和数量")
@ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long")
public Result<List<Map<String, Object>>> assemblerUsedTopInfo(Long id){
return null;
}
@ -187,12 +188,21 @@ public class CensusControllerV3 {
@GetMapping("/assemblerUsedInfo")
@ApiOperation("算法、图层、开发、业务发布量情况分布")
@LogOperation("算法、图层、开发、业务发布量情况分布")
@ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long")
public Result<List<Map<String, Object>>> assemblerUsedInfo(Long id){
return null;
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long"),
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
public Result<List<Map<String, Object>>> assemblerUsedInfo(@ApiIgnore @RequestParam Map<String, Object> params){
Object[] ps = {params.get("id"),params.get("resourceType")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT count(b.attr_value) as nums,b.attr_value FROM tb_data_resource a INNER JOIN tb_data_attr b ON a.id = b.data_resource_id\n" +
"WHERE a.dept_id = ? and a.type = ? and b.attr_type = '组件类型'\n" +
"GROUP BY b.attr_value", ps);
return new Result<List<Map<String,Object>>>().ok(maps);
}
//以下是组件使用情况点击详情
@GetMapping("/assemblerUseTopInfo")
@ -224,21 +234,6 @@ public class CensusControllerV3 {
return null;
}
@GetMapping("resourceAttrReleaseDetail")
@ApiOperation("算法、图层、开发、业务发布量情况分布")
@LogOperation("算法、图层、开发、业务发布量情况分布")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "部门id", paramType = "query", required = true, dataType = "long"),
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
public Result<List<Map<String, Object>>> resourceAttrReleaseDetail(@ApiIgnore @RequestParam Map<String, Object> params){
Object[] ps = {params.get("resourceType"),params.get("id")};
List<Map<String, Object>> result = jdbcTemplate.queryForList("SELECT b.attr_value,COUNT(b.id) AS num from tb_data_resource a inner join tb_data_attr b on a.id = b.data_resource_id\n" +
"where a.type = ? and a.dept_id = ? and (INSTR( b.attr_value , '算法' ) > 0 OR INSTR( b.attr_value , '图层' ) > 0\n" +
" OR INSTR( b.attr_value , '开发' ) > 0 OR INSTR( b.attr_value , '业务' ) > 0 )\n" +
"group by b.attr_value", ps);
return new Result<List<Map<String,Object>>>().ok(result);
}
@GetMapping("applicationAreaCapabilityList")
@ApiOperation("应用领域分布情况")
@ -362,12 +357,12 @@ public class CensusControllerV3 {
/**
* 测试获取部门树
* @param keywords
* @param deptId
* @param
* @return
*/
@GetMapping("treeList")
@ApiOperation("根据当前用户所在部门查询下属部门tree可以根据部门名称模糊查询")
public Result<List<SysDeptDTO>> treeList(@RequestParam(required = false,value = "模糊查询,部门名称") String keywords,Long deptId){
public Result<List<SysDeptDTO>> treeList(@RequestParam(required = false,value = "keywords") String keywords,Long deptId){
List<SysDeptDTO> result = new ArrayList<>();
SysDeptDTO sysDeptDTO = sysDeptService.get(deptId);
@ -375,16 +370,16 @@ public class CensusControllerV3 {
if(StringUtils.contains(sysDeptDTO.getName(),"青岛市大数据发展管理局")){//市大数据局
List<Map<String,Object>> deptMaps = jdbcTemplate.queryForList("SELECT id FROM sys_dept where pid = 0");
deptMaps.forEach(dept->{
List<SysDeptDTO> depts = sysDeptService.getDeptListByPid(Long.valueOf(dept.get("id").toString()));
result.addAll(depts);
SysDeptDTO depts = sysDeptService.getDeptListByPid(Long.valueOf(dept.get("id").toString()));
result.add(depts);
});
}else if(StringUtils.contains(sysDeptDTO.getName(),"大数据") && sysDeptDTO.getType() == 3){//各区大数据局
List<SysDeptDTO> depts = sysDeptService.getDeptListByPid(sysDeptDTO.getPid());
result.addAll(depts);
SysDeptDTO depts = sysDeptService.getDeptListByPid(sysDeptDTO.getPid());
result.add(depts);
}else{
List<SysDeptDTO> deptListByPid = sysDeptService.getDeptListByPid(deptId);
result.addAll(deptListByPid);
SysDeptDTO deptListByPid = sysDeptService.getDeptListByPid(deptId);
result.add(deptListByPid);
}
if(keywords != null){
treeMatch(result,keywords);
@ -393,6 +388,7 @@ public class CensusControllerV3 {
return new Result<List<SysDeptDTO>>().ok(result);
}
private void treeMatch(List<SysDeptDTO> anyLevelCategoryList, String keyword) {
Iterator<SysDeptDTO> iter = anyLevelCategoryList.iterator();
while (iter.hasNext()) {

View File

@ -1,15 +1,16 @@
package io.renren.modules.processForm.listener.v2;
import com.alibaba.fastjson.JSON;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import io.renren.common.annotation.ActivitiNoticeOperation;
import io.renren.common.dto.AuditingBaseDTO;
import io.renren.modules.activiti.service.ActTaskService;
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
import io.renren.modules.processForm.service.ApiGatewayService;
import io.renren.modules.processForm.service.TAbilityApplicationService;
import io.renren.modules.resource.dto.ResourceDTO;
import io.renren.modules.resource.entity.ResourceEntity;
import io.renren.modules.resource.service.ResourceService;
import io.renren.modules.sys.dto.SysDeptDTO;
@ -24,17 +25,13 @@ import org.activiti.engine.TaskService;
import org.activiti.engine.delegate.*;
import org.activiti.engine.delegate.event.ActivitiEvent;
import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import java.util.*;
/**
* 部门动态审批人 v2
@ -124,20 +121,37 @@ public class CorrectionListenerV2 implements TaskListener, ExecutionListener, Ac
Gson gson = builder.create();
JsonElement jsonElement = gson.toJsonTree(kv);
TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
if (abilityApplicationDTO != null) {
if (abilityApplicationDTO.getReject() != null && abilityApplicationDTO.getReject() == Boolean.TRUE) { // 存在被拒绝的节点
abilityApplicationDTO.setDelFlag(0);
abilityApplicationDTO.setApproveStatus("不通过");
tAbilityApplicationService.update(abilityApplicationDTO);
logger.error("审批不通过申请id:" + abilityApplicationDTO.getId());
AuditingBaseDTO auditingBaseDTO = gson.fromJson(jsonElement, AuditingBaseDTO.class);
if (auditingBaseDTO != null) {
List<TAbilityApplicationDTO> dtoList = new ArrayList<>();
if (kv.containsKey("tAbilityApplicationDTOList")) {
dtoList = (List<TAbilityApplicationDTO>) kv.get("tAbilityApplicationDTOList");
}
if (auditingBaseDTO.getReject() != null && auditingBaseDTO.getReject() == Boolean.TRUE) { // 存在被拒绝的节点
} else {
abilityApplicationDTO.setDelFlag(0);
abilityApplicationDTO.setApproveStatus("通过");
tAbilityApplicationService.update(abilityApplicationDTO);
logger.error("审批通过申请id:" + abilityApplicationDTO.getId());
}
}
// builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
//
// Gson gson = builder.create();
// JsonElement jsonElement = gson.toJsonTree(kv);
// TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
// if (abilityApplicationDTO != null) {
// if (abilityApplicationDTO.getReject() != null && abilityApplicationDTO.getReject() == Boolean.TRUE) { // 存在被拒绝的节点
// abilityApplicationDTO.setDelFlag(0);
// abilityApplicationDTO.setApproveStatus("不通过");
// tAbilityApplicationService.update(abilityApplicationDTO);
// logger.error("审批不通过申请id:" + abilityApplicationDTO.getId());
// } else {
// abilityApplicationDTO.setDelFlag(0);
// abilityApplicationDTO.setApproveStatus("通过");
// tAbilityApplicationService.update(abilityApplicationDTO);
// logger.error("审批通过申请id:" + abilityApplicationDTO.getId());
// }
// }
}
/**
@ -147,26 +161,13 @@ public class CorrectionListenerV2 implements TaskListener, ExecutionListener, Ac
*/
private void create(DelegateTask delegateTask) {
Map<String, Object> kv = delegateTask.getVariables();
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
Gson gson = builder.create();
JsonElement jsonElement = gson.toJsonTree(kv);
TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
logger.error("roleDTOId:" + roleDTO.getId());
ResourceDTO resourceEntityDto = null;
Long deptId = null;
if (abilityApplicationDTO != null) {
logger.error("abilityApplicationDTO:" + abilityApplicationDTO.toString());
resourceEntityDto = resourceService.get(Long.valueOf(abilityApplicationDTO.getResourceId()));
}
if (resourceEntityDto != null && resourceEntityDto.getDeptId() != null) {
deptId = resourceEntityDto.getDeptId();
SysDeptDTO deptDTO =
sysDeptService.get(resourceEntityDto.getDeptId());
if (deptDTO != null && deptDTO.getName().equals(bigDateDeptName)) {
if (kv.containsKey("deptId")) { // 存在部门id
deptId = Long.valueOf(kv.get("deptId").toString());
SysDeptDTO deptDTO = sysDeptService.get(deptId);
if (deptDTO != null && deptDTO.getName().equals(bigDateDeptName)) { // 二级审批依然为大数据局,默认审核通过
logger.error("第二级别审批仍然为 " + bigDateDeptName);
SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(deptId, roleDTO.getId()); // 搜出审批人
if (userDTO != null) {
@ -175,39 +176,38 @@ public class CorrectionListenerV2 implements TaskListener, ExecutionListener, Ac
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "默认通过");
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
return;
}
} else {
logger.error("表单内单位名称:" + abilityApplicationDTO.getUnit());
SysDeptDTO deptDTO = sysDeptService.getByName(abilityApplicationDTO.getUnit());
if (deptDTO != null) {
logger.error("deptDTOId:" + deptDTO.getId());
deptId = deptDTO.getId();
}
} // 二级审批依然为大数据局
}
SysUserDTO userDTO = null;
if (deptId != null) {
userDTO = sysUserService.getByDeptIdAndRoleId(deptId, roleDTO.getId()); // 搜出审批人
}
if (userDTO != null) {
logger.error("审批人id:" + userDTO.getId());
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
SysUserDTO userDTO = null;
if (deptId != null) {
userDTO = sysUserService.getByDeptIdAndRoleId(deptId, roleDTO.getId()); // 搜出审批人
}
if (userDTO != null) {
logger.error("审批人id:" + userDTO.getId());
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
delegateTask.setAssignee(userDTO.getId().toString());
} else {
logger.error("未查到该部门 {} 对应的 " + roleName, deptId);
taskService.setAssignee(delegateTask.getId(), "1516728698224427010");
delegateTask.setAssignee("1516728698224427010");
}
if (kv.containsKey("tAbilityApplicationDTOList")) {
List<TAbilityApplicationDTO> dtoList = (List<TAbilityApplicationDTO>) kv.get("tAbilityApplicationDTOList");
mpComplete(dtoList, delegateTask);
}
} else {
logger.error("未查到该部门对应的 " + roleName);
taskService.setAssignee(delegateTask.getId(), "1516728698224427010");
try {
logger.error("流程参数异常" + JSON.toJSONString(kv));
} catch (Exception exception) {
logger.error("", exception);
}
}
mpComplete(abilityApplicationDTO, delegateTask);
}
private void mpComplete(TAbilityApplicationDTO abilityApplicationDTO, DelegateTask delegateTask) {
Optional<ResourceDTO> resourceDTOOptional = Optional.ofNullable(resourceService.get(Long.valueOf(abilityApplicationDTO.getResourceId())));
resourceDTOOptional.ifPresent(resource -> {
if (StringUtils.contains(resource.getShareCondition(), "免批")) { // 针对免批资源申请
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "免批资源申请默认通过");
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
return;
}
if (abilityApplicationDTO.getUserId().equals(delegateTask.getAssignee())) {
private void mpComplete(List<TAbilityApplicationDTO> abilityApplicationDTO, DelegateTask delegateTask) { // 处理免批或申请人为资源提供方部门审批人
Optional<TAbilityApplicationDTO> abilityApplicationDTOOptional = abilityApplicationDTO.stream().findAny();
abilityApplicationDTOOptional.ifPresent(index -> {
if (abilityApplicationDTOOptional.get().getUserId().equals(delegateTask.getAssignee())) {
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "申请人为资源提供方部门审批人,默认通过");
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
return;

View File

@ -1,9 +1,5 @@
package io.renren.modules.processForm.listener.v2;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import io.renren.common.annotation.ActivitiNoticeOperation;
import io.renren.modules.resource.service.ResourceService;
import io.renren.modules.sys.dto.SysDeptDTO;
@ -23,9 +19,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.Map;
/**
* 大数据局动态审批人 v2
*/
@ -105,16 +98,16 @@ public class DataCenterListenerV2 implements TaskListener, ExecutionListener, Ac
logger.error("审批人id:" + userDTO.getId());
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
} else {
delegateTask.setAssignee("1516728698224427010");
logger.error("未查到该部门对应 " + roleName);
logger.error("未查到 {} 对应 " + roleName, bigDateDeptName);
}
// TODO 批量里存在免批或全为免批的情况?
Map<String, Object> kv = delegateTask.getVariables();
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
Gson gson = builder.create();
JsonElement jsonElement = gson.toJsonTree(kv);
// Map<String, Object> kv = delegateTask.getVariables();
// GsonBuilder builder = new GsonBuilder();
// builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
//
// Gson gson = builder.create();
// JsonElement jsonElement = gson.toJsonTree(kv);
// TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
// Optional<ResourceDTO> resourceDTOOptional = Optional.ofNullable(resourceService.get(Long.valueOf(abilityApplicationDTO.getResourceId())));
// resourceDTOOptional.ifPresent(resource -> {

View File

@ -52,8 +52,8 @@ public class TbProjectContribController {
})
// @RequiresPermissions("project:tbprojectcontrib:page")
public Result<PageData<TbProjectContribDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<TbProjectContribDTO> page = tbProjectContribService.page(params);
// PageData<TbProjectContribDTO> page = tbProjectContribService.page(params);
PageData<TbProjectContribDTO> page = tbProjectContribService.queryList(params);
return new Result<PageData<TbProjectContribDTO>>().ok(page);
}

View File

@ -52,8 +52,8 @@ public class TbProjectUseController {
})
// @RequiresPermissions("project:tbprojectuse:page")
public Result<PageData<TbProjectUseDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<TbProjectUseDTO> page = tbProjectUseService.page(params);
// PageData<TbProjectUseDTO> page = tbProjectUseService.page(params);
PageData<TbProjectUseDTO> page = tbProjectUseService.queryList(params);
return new Result<PageData<TbProjectUseDTO>>().ok(page);
}

View File

@ -1,8 +1,13 @@
package io.renren.modules.project.dao;
import io.renren.common.dao.BaseDao;
import io.renren.modules.project.dto.TbProjectContribDTO;
import io.renren.modules.project.entity.TbProjectContribEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.security.core.parameters.P;
import java.util.List;
/**
* 项目贡献表
@ -12,5 +17,12 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface TbProjectContribDao extends BaseDao<TbProjectContribEntity> {
int queryCount(@Param("projectName")String projectName,
@Param("resourceName")String resourceName);
List<TbProjectContribDTO> queryList(@Param("currentNum") int currentNum,
@Param("pageSize")int pageSize,
@Param("projectName")String projectName,
@Param("resourceName")String resourceName);
}

View File

@ -1,8 +1,12 @@
package io.renren.modules.project.dao;
import io.renren.common.dao.BaseDao;
import io.renren.modules.project.dto.TbProjectUseDTO;
import io.renren.modules.project.entity.TbProjectUseEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 项目使用表
@ -12,5 +16,12 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface TbProjectUseDao extends BaseDao<TbProjectUseEntity> {
int queryCount(@Param("projectName")String projectName,
@Param("resourceName")String resourceName);
List<TbProjectUseDTO> queryList(@Param("currentNum") int currentNum,
@Param("pageSize")int pageSize,
@Param("projectName")String projectName,
@Param("resourceName")String resourceName);
}

View File

@ -42,9 +42,9 @@ public class TbProjectContribDTO implements Serializable {
private Long updater;
@ApiModelProperty(value = "修改时间")
private Date updateDate;
@ApiModelProperty(value = "备用字段")
@ApiModelProperty(value = "项目id")
private String note1;
@ApiModelProperty(value = "备用字段")
@ApiModelProperty(value = "应用资源id")
private String note2;
@ApiModelProperty(value = "备用字段")
private String note3;

View File

@ -42,9 +42,9 @@ public class TbProjectUseDTO implements Serializable {
private Long updater;
@ApiModelProperty(value = "修改时间")
private Date updateDate;
@ApiModelProperty(value = "备用字段")
@ApiModelProperty(value = "项目id")
private String note1;
@ApiModelProperty(value = "备用字段")
@ApiModelProperty(value = "应用资源id")
private String note2;
@ApiModelProperty(value = "备用字段")
private String note3;

View File

@ -57,11 +57,11 @@ public class TbProjectContribEntity extends BaseEntity {
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
/**
* 备用字段
* 项目id
*/
private String note1;
/**
* 备用字段
* 应用资源id
*/
private String note2;
/**

View File

@ -57,11 +57,11 @@ public class TbProjectUseEntity extends BaseEntity {
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
/**
* 备用字段
* 项目id
*/
private String note1;
/**
* 备用字段
* 应用资源id
*/
private String note2;
/**

View File

@ -42,9 +42,9 @@ public class TbProjectContribExcel {
private Long updater;
@ExcelProperty(value = "修改时间", index = 11)
private Date updateDate;
@ExcelProperty(value = "备用字段", index = 12)
@ExcelProperty(value = "项目id", index = 12)
private String note1;
@ExcelProperty(value = "备用字段", index = 13)
@ExcelProperty(value = "应用资源id", index = 13)
private String note2;
@ExcelProperty(value = "备用字段", index = 14)
private String note3;

View File

@ -42,9 +42,9 @@ public class TbProjectUseExcel {
private Long updater;
@ExcelProperty(value = "修改时间", index = 11)
private Date updateDate;
@ExcelProperty(value = "备用字段", index = 12)
@ExcelProperty(value = "项目id", index = 12)
private String note1;
@ExcelProperty(value = "备用字段", index = 13)
@ExcelProperty(value = "应用资源id", index = 13)
private String note2;
@ExcelProperty(value = "备用字段", index = 14)
private String note3;

View File

@ -1,9 +1,12 @@
package io.renren.modules.project.service;
import io.renren.common.page.PageData;
import io.renren.common.service.CrudService;
import io.renren.modules.project.dto.TbProjectContribDTO;
import io.renren.modules.project.entity.TbProjectContribEntity;
import java.util.Map;
/**
* 项目贡献表
*
@ -12,4 +15,5 @@ import io.renren.modules.project.entity.TbProjectContribEntity;
*/
public interface TbProjectContribService extends CrudService<TbProjectContribEntity, TbProjectContribDTO> {
PageData<TbProjectContribDTO> queryList(Map<String, Object> params);
}

View File

@ -1,9 +1,12 @@
package io.renren.modules.project.service;
import io.renren.common.page.PageData;
import io.renren.common.service.CrudService;
import io.renren.modules.project.dto.TbProjectUseDTO;
import io.renren.modules.project.entity.TbProjectUseEntity;
import java.util.Map;
/**
* 项目使用表
*
@ -12,4 +15,5 @@ import io.renren.modules.project.entity.TbProjectUseEntity;
*/
public interface TbProjectUseService extends CrudService<TbProjectUseEntity, TbProjectUseDTO> {
PageData<TbProjectUseDTO> queryList(Map<String, Object> params);
}

View File

@ -1,6 +1,7 @@
package io.renren.modules.project.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.page.PageData;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.constant.Constant;
import io.renren.modules.project.dao.TbProjectContribDao;
@ -9,8 +10,10 @@ import io.renren.modules.project.entity.TbProjectContribEntity;
import io.renren.modules.project.service.TbProjectContribService;
import io.renren.modules.security.user.SecurityUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
@ -22,6 +25,9 @@ import java.util.Map;
@Service
public class TbProjectContribServiceImpl extends CrudServiceImpl<TbProjectContribDao, TbProjectContribEntity, TbProjectContribDTO> implements TbProjectContribService {
@Autowired
private TbProjectContribDao tbProjectContribDao;
@Override
public QueryWrapper<TbProjectContribEntity> getWrapper(Map<String, Object> params){
QueryWrapper<TbProjectContribEntity> wrapper = new QueryWrapper<>();
@ -36,5 +42,32 @@ public class TbProjectContribServiceImpl extends CrudServiceImpl<TbProjectContri
return wrapper;
}
@Override
public PageData<TbProjectContribDTO> queryList(Map<String, Object> params) {
//分页参数
int page = 1;
int pageSize = 10;
if(params.containsKey("limit") && StringUtils.isNotBlank(params.get("limit").toString())){
pageSize = Integer.valueOf(params.get("limit").toString());
}
if(params.containsKey("page") && StringUtils.isNotBlank(params.get("page").toString())){
page = Integer.valueOf(params.get("page").toString());
}
int currentNum = (page-1)*pageSize;
//查询参数
String projectName = null;
String resourceName = null;
if(params.containsKey("projectName") && StringUtils.isNotBlank(params.get("projectName").toString())){
projectName = params.get("projectName").toString();
}
if(params.containsKey("resourceName") && StringUtils.isNotBlank(params.get("resourceName").toString())){
resourceName = params.get("resourceName").toString();
}
int count = tbProjectContribDao.queryCount(projectName,resourceName);
List<TbProjectContribDTO> list = tbProjectContribDao.queryList(currentNum,pageSize,projectName,resourceName);
return new PageData<>(list,count);
}
}

View File

@ -1,6 +1,7 @@
package io.renren.modules.project.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.page.PageData;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.constant.Constant;
import io.renren.modules.project.dao.TbProjectUseDao;
@ -9,8 +10,10 @@ import io.renren.modules.project.entity.TbProjectUseEntity;
import io.renren.modules.project.service.TbProjectUseService;
import io.renren.modules.security.user.SecurityUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
@ -22,6 +25,9 @@ import java.util.Map;
@Service
public class TbProjectUseServiceImpl extends CrudServiceImpl<TbProjectUseDao, TbProjectUseEntity, TbProjectUseDTO> implements TbProjectUseService {
@Autowired
private TbProjectUseDao tbProjectUseDao;
@Override
public QueryWrapper<TbProjectUseEntity> getWrapper(Map<String, Object> params){
QueryWrapper<TbProjectUseEntity> wrapper = new QueryWrapper<>();
@ -37,4 +43,32 @@ public class TbProjectUseServiceImpl extends CrudServiceImpl<TbProjectUseDao, Tb
}
@Override
public PageData<TbProjectUseDTO> queryList(Map<String, Object> params) {
//分页参数
int page = 1;
int pageSize = 10;
if(params.containsKey("limit") && StringUtils.isNotBlank(params.get("limit").toString())){
pageSize = Integer.valueOf(params.get("limit").toString());
}
if(params.containsKey("page") && StringUtils.isNotBlank(params.get("page").toString())){
page = Integer.valueOf(params.get("page").toString());
}
int currentNum = (page-1)*pageSize;
//查询参数
String projectName = null;
String resourceName = null;
if(params.containsKey("projectName") && StringUtils.isNotBlank(params.get("projectName").toString())){
projectName = params.get("projectName").toString();
}
if(params.containsKey("resourceName") && StringUtils.isNotBlank(params.get("resourceName").toString())){
resourceName = params.get("resourceName").toString();
}
int count = tbProjectUseDao.queryCount(projectName,resourceName);
List<TbProjectUseDTO> list = tbProjectUseDao.queryList(currentNum,pageSize,projectName,resourceName);
return new PageData<>(list,count);
}
}

View File

@ -33,6 +33,7 @@ import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.bytedeco.opencv.presets.opencv_core;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
@ -1190,4 +1191,5 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
return result;
}
}

View File

@ -20,10 +20,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
/**
@ -42,12 +39,31 @@ public class SysDeptController {
/** ytl 2022-06-23 新增 start **/
@GetMapping("treeList")
@ApiOperation("根据当前用户所在部门查询下属部门tree可以根据部门名称模糊查询")
public Result<List<SysDeptDTO>> treeList(@RequestParam(required = false,value = "模糊查询,部门名称") String keywords){
public Result<List<SysDeptDTO>> treeList(@RequestParam(required = false,value = "keywords") String keywords){
Long deptId = SecurityUser.getDeptId();
List<SysDeptDTO> deptListByPid = sysDeptService.getDeptListByPid(deptId);
treeMatch(deptListByPid,keywords);
List<SysDeptDTO> result = new ArrayList<>();
SysDeptDTO sysDeptDTO = sysDeptService.get(deptId);
return new Result<List<SysDeptDTO>>().ok(deptListByPid);
//市大数据局展示全部部门区大数据局展示本区所有部门委办局展示自己部门及下级部门
if(StringUtils.contains(sysDeptDTO.getName(),"青岛市大数据发展管理局")){//市大数据局
List<Map<String,Object>> deptMaps = jdbcTemplate.queryForList("SELECT id FROM sys_dept where pid = 0");
deptMaps.forEach(dept->{
SysDeptDTO depts = sysDeptService.getDeptListByPid(Long.valueOf(dept.get("id").toString()));
result.add(depts);
});
}else if(StringUtils.contains(sysDeptDTO.getName(),"大数据") && sysDeptDTO.getType() == 3){//各区大数据局
SysDeptDTO depts = sysDeptService.getDeptListByPid(sysDeptDTO.getPid());
result.add(depts);
}else{
SysDeptDTO deptListByPid = sysDeptService.getDeptListByPid(deptId);
result.add(deptListByPid);
}
if(keywords != null){
treeMatch(result,keywords);
}
System.out.println("部门树--》"+result.size());
return new Result<List<SysDeptDTO>>().ok(result);
}
/** ytl 2022-06-23 新增 end **/
@GetMapping("list")

View File

@ -31,5 +31,6 @@ public interface SysDeptService extends BaseService<SysDeptEntity> {
SysDeptDTO getByName(String name);
List<SysDeptDTO> getDeptListByPid(Long id);
//List<SysDeptDTO> getDeptListByPid(Long id);
SysDeptDTO getDeptListByPid(Long id);
}

View File

@ -165,7 +165,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
}
@Override
public List<SysDeptDTO> getDeptListByPid(Long id) {
public SysDeptDTO getDeptListByPid(Long id) {
SysDeptEntity sysDeptEntity = baseDao.getById(id);//当前部门
SysDeptDTO sysDeptDTO = ConvertUtils.sourceToTarget(sysDeptEntity, SysDeptDTO.class);//转换为DTO
@ -175,16 +175,18 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptDao, SysDeptEntit
if(sysDeptList.size() > 0){
sysDeptList.forEach(dept->sysDeptDTOList.add(ConvertUtils.sourceToTarget(dept, SysDeptDTO.class)));
for(int i = 0; i<sysDeptList.size(); i++){
List<SysDeptDTO> list = getDeptListByPid(sysDeptList.get(i).getId());
sysDeptDTOList.get(i).setChildren(list);
SysDeptDTO list = getDeptListByPid(sysDeptList.get(i).getId());
//sysDeptDTOList.get(i).setChildren(list);
}
sysDeptDTO.setChildren(sysDeptDTOList);
sysDeptDTOList.add(sysDeptDTO);
}else{
sysDeptDTOList.add(sysDeptDTO);
//sysDeptDTOList.add(sysDeptDTO);
}
// else{
// sysDeptDTOList.add(sysDeptDTO);
// }
return sysDeptDTOList;
//return sysDeptDTOList;
return sysDeptDTO;
}

View File

@ -0,0 +1,7 @@
ALTER TABLE `tb_project_contrib`
MODIFY COLUMN `note1` bigint(20) DEFAULT NULL COMMENT '项目idtb_project主键',
MODIFY COLUMN `note2` bigint(20) DEFAULT NULL COMMENT '应用idtb_data_resource中类型为应用资源的主键id';
ALTER TABLE `tb_project_use`
MODIFY COLUMN `note1` bigint(20) DEFAULT NULL COMMENT '项目idtb_project主键',
MODIFY COLUMN `note2` bigint(20) DEFAULT NULL COMMENT '应用idtb_data_resource中类型为应用资源的主键id';

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.renren.modules.project.dao.TbProjectContribDao">
<resultMap type="io.renren.modules.project.entity.TbProjectContribEntity" id="tbProjectContribMap">
<result property="id" column="id"/>
<result property="projectName" column="project_name"/>
<result property="resourceName" column="resource_name"/>
<result property="abilityName" column="ability_name"/>
<result property="abilityType" column="ability_type"/>
<result property="applyTime" column="apply_time"/>
<result property="applyNum" column="apply_num"/>
<result property="browseNum" column="browse_num"/>
<result property="creator" column="creator"/>
<result property="createDate" column="create_date"/>
<result property="updater" column="updater"/>
<result property="updateDate" column="update_date"/>
<result property="note1" column="note1"/>
<result property="note2" column="note2"/>
<result property="note3" column="note3"/>
<result property="note4" column="note4"/>
<result property="note5" column="note5"/>
</resultMap>
<select id="queryCount" resultType="java.lang.Integer">
SELECT
count(*)
FROM tb_project_contrib tpc
left join tb_project tp on tpc.note1 = tp.id
left join tb_data_resource tdrapp on tpc.note2 = tdrapp.id
left join tb_data_resource_rel tdrr on tpc.note2 = tdrr.key_id
left join tb_data_resource tdrother on tdrr.reference_id = tdrother.id
left join (select resource_id,count(*) as num from t_ability_application GROUP BY resource_id) applynum on applynum.resource_id = tdrr.reference_id
where tdrother.name is not null and tdrr.del_flag = 0
<if test="projectName != null and projectName != ''">
and tp.project_name like CONCAT('%',#{projectName},'%')
</if>
<if test="resourceName != null and resourceName != ''">
and tdrapp.name like CONCAT('%',#{resourceName},'%')
</if>
</select>
<select id="queryList" resultMap="tbProjectContribMap">
SELECT
tp.project_name,
tdrapp.name as resource_name,
tdrother.name as ability_name,
tdrother.type as ability_type,
tdrother.create_date as apply_time,
IFNULL(applynum.num,0)as apply_num,
tdrother.visits as browse_num
FROM tb_project_contrib tpc
left join tb_project tp on tpc.note1 = tp.id
left join tb_data_resource tdrapp on tpc.note2 = tdrapp.id
left join tb_data_resource_rel tdrr on tpc.note2 = tdrr.key_id
left join tb_data_resource tdrother on tdrr.reference_id = tdrother.id
left join (select resource_id,count(*) as num from t_ability_application GROUP BY resource_id) applynum on applynum.resource_id = tdrr.reference_id
where tdrother.name is not null and tdrr.del_flag = 0
<if test="projectName != null and projectName != ''">
and tp.project_name like CONCAT('%',#{projectName},'%')
</if>
<if test="resourceName != null and resourceName != ''">
and tdrapp.name like CONCAT('%',#{resourceName},'%')
</if>
ORDER BY tdrother.create_date desc
limit #{currentNum},#{pageSize}
</select>
</mapper>

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.renren.modules.project.dao.TbProjectDao">
<resultMap type="io.renren.modules.project.entity.TbProjectEntity" id="tbProjectMap">
<result property="id" column="id"/>
<result property="projectName" column="project_name"/>
<result property="applyDep" column="apply_dep"/>
<result property="applyUser" column="apply_user"/>
<result property="applyTime" column="apply_time"/>
<result property="regionName" column="region_name"/>
<result property="respDep" column="resp_dep"/>
<result property="businessUser" column="business_user"/>
<result property="businessPhone" column="business_phone"/>
<result property="techUser" column="tech_user"/>
<result property="techPhone" column="tech_phone"/>
<result property="creator" column="creator"/>
<result property="createDate" column="create_date"/>
<result property="updater" column="updater"/>
<result property="updateDate" column="update_date"/>
<result property="note1" column="note1"/>
<result property="note2" column="note2"/>
<result property="note3" column="note3"/>
<result property="note4" column="note4"/>
<result property="note5" column="note5"/>
</resultMap>
</mapper>

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.renren.modules.project.dao.TbProjectUseDao">
<resultMap type="io.renren.modules.project.entity.TbProjectUseEntity" id="tbProjectUseMap">
<result property="id" column="id"/>
<result property="projectName" column="project_name"/>
<result property="resourceName" column="resource_name"/>
<result property="abilityName" column="ability_name"/>
<result property="abilityType" column="ability_type"/>
<result property="applyTime" column="apply_time"/>
<result property="applyNum" column="apply_num"/>
<result property="browseNum" column="browse_num"/>
<result property="creator" column="creator"/>
<result property="createDate" column="create_date"/>
<result property="updater" column="updater"/>
<result property="updateDate" column="update_date"/>
<result property="note1" column="note1"/>
<result property="note2" column="note2"/>
<result property="note3" column="note3"/>
<result property="note4" column="note4"/>
<result property="note5" column="note5"/>
</resultMap>
<select id="queryCount" resultType="java.lang.Integer">
SELECT
count(*)
FROM tb_project_use tpu
left join tb_project tp on tpu.note1 = tp.id
left join tb_data_resource tdrapp on tpu.note2 = tdrapp.id
left join tb_data_resource_rel tdrr on tpu.note2 = tdrr.key_id
left join tb_data_resource tdrother on tdrr.reference_id = tdrother.id
left join (select resource_id,count(*) as num from t_ability_application GROUP BY resource_id) applynum on applynum.resource_id = tdrr.reference_id
where tdrother.name is not null and tdrr.del_flag = 0
<if test="projectName != null and projectName != ''">
and tp.project_name like CONCAT('%',#{projectName},'%')
</if>
<if test="resourceName != null and resourceName != ''">
and tdrapp.name like CONCAT('%',#{resourceName},'%')
</if>
</select>
<select id="queryList" resultMap="tbProjectUseMap">
SELECT
tp.project_name,
tdrapp.name as resource_name,
tdrother.name as ability_name,
tdrother.type as ability_type,
tdrother.create_date as apply_time,
IFNULL(applynum.num,0)as apply_num,
tdrother.visits as browse_num
FROM tb_project_use tpu
left join tb_project tp on tpu.note1 = tp.id
left join tb_data_resource tdrapp on tpu.note2 = tdrapp.id
left join tb_data_resource_rel tdrr on tpu.note2 = tdrr.key_id
left join tb_data_resource tdrother on tdrr.reference_id = tdrother.id
left join (select resource_id,count(*) as num from t_ability_application GROUP BY resource_id) applynum on applynum.resource_id = tdrr.reference_id
where tdrother.name is not null and tdrr.del_flag = 0
<if test="projectName != null and projectName != ''">
and tp.project_name like CONCAT('%',#{projectName},'%')
</if>
<if test="resourceName != null and resourceName != ''">
and tdrapp.name like CONCAT('%',#{resourceName},'%')
</if>
ORDER BY tdrother.create_date desc
limit #{currentNum},#{pageSize}
</select>
</mapper>

View File

@ -930,9 +930,7 @@
GROUP BY
type
</select>
<select id="applicationUsedAreaCapabilityList" parameterType="java.util.Map" resultType="java.util.Map">
</select>
<select id="selectTopFiveComponentServiceApplications" resultType="java.util.Map">
SELECT