Merge remote-tracking branch 'origin/master'

This commit is contained in:
yitonglei 2022-06-24 16:37:22 +08:00
commit 9e807ed118
61 changed files with 2477 additions and 383 deletions

View File

@ -322,6 +322,7 @@ public class ActivitiNoticeAspect {
SysUserDTO assignee = sysUserService.get(Long.valueOf(delegateTask.getAssignee()));
logger.error("审核人:" + assignee.getId());
String content = "【通知】您发起的流程 " + activitiNoticeOperation.process() + " 当前审核节点为:" + activitiNoticeOperation.value() + ";当前审核人为:\"" + assignee.getDeptName() + "\"审核负责人\"" + assignee.getRealName() + "\"";
logger.info("通知内容:" + content);
SysNoticeDTO dto = new SysNoticeDTO();
dto.setType(2);
dto.setTitle("流程流转系统通知");
@ -333,6 +334,7 @@ public class ActivitiNoticeAspect {
dto.setSenderDate(new Date());
dto.setCreator(sysUserService.getByUsername("admin").getId());
dto.setCreateDate(new Date());
dto.setFrom("通知");
sysNoticeService.save(dto);
}).thenRunAsync(() -> { // 审批者
SysUserDTO owner = sysUserService.get(Long.valueOf(finalCreator));
@ -348,6 +350,7 @@ public class ActivitiNoticeAspect {
dto.setSenderDate(new Date());
dto.setCreator(sysUserService.getByUsername("admin").getId());
dto.setCreateDate(new Date());
dto.setFrom("通知");
sysNoticeService.save(dto);
}).thenRunAsync(() -> { // 防止重放
new Thread(() -> {

View File

@ -42,24 +42,23 @@ public class LogOperationAspect {
try {
//执行方法
Object result = point.proceed();
//执行时长(毫秒)
long time = System.currentTimeMillis() - beginTime;
//保存日志
saveLog(point, time, OperationStatusEnum.SUCCESS.value());
saveLog(point, time, OperationStatusEnum.SUCCESS.value(), result);
return result;
}catch(Exception e) {
//执行时长(毫秒)
long time = System.currentTimeMillis() - beginTime;
//保存日志
saveLog(point, time, OperationStatusEnum.FAIL.value());
saveLog(point, time, OperationStatusEnum.FAIL.value(), null);
throw e;
}
}
private void saveLog(ProceedingJoinPoint joinPoint, long time, Integer status) throws Exception {
private void saveLog(ProceedingJoinPoint joinPoint, long time, Integer status, Object result) throws Exception {
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Method method = joinPoint.getTarget().getClass().getDeclaredMethod(signature.getName(), signature.getParameterTypes());
LogOperation annotation = method.getAnnotation(LogOperation.class);
@ -78,6 +77,7 @@ public class LogOperationAspect {
log.setStatus(status);
log.setRequestTime((int)time);
log.setResultData(JSON.toJSONString(result));
//请求相关信息
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();

View File

@ -29,6 +29,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
@ -109,10 +110,12 @@ public class AbilityCenterController {
processStartDTO.setVariables(variables);
ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO);
if (Long.valueOf(dto.getBusinessKey()) != null) {
// 仿照请求接口 /processForm/tabilityapplication/updateInstanceId
tAbilityApplicationService.updateInstanceId(dto.getProcessInstanceId(), Long.valueOf(dto.getBusinessKey()));
}
// 仿照请求接口 /processForm/tabilityapplication/updateInstanceId
CompletableFuture.runAsync(() -> {
if (Long.valueOf(dto.getBusinessKey()) != null) {
tAbilityApplicationService.updateInstanceId(dto.getProcessInstanceId(), Long.valueOf(dto.getBusinessKey()));
}
});
return dto;
}).filter(index -> ObjectUtil.isNotNull(index)).collect(Collectors.toList()));
}

View File

@ -59,35 +59,28 @@ public class CensusController {
@ApiOperation("各类资源数目")
public Result<List<Map<String, Object>>> resourceAmount() {
List<Map<String, Object>> dbAmount = resourceService.getAmountGroupByType();
List<String> temp = dbAmount.stream().map(index -> index.get("type").toString()).collect(Collectors.toList());
dbAmount = dbAmount.stream().filter(index -> Arrays.asList(censusTypes).contains(index.get("type").toString())).collect(Collectors.toList());
List<Map<String, Object>> finalDbAmount = dbAmount;
List<String> temp = finalDbAmount.stream().map(index -> index.get("type").toString()).collect(Collectors.toList());
Arrays.stream(censusTypes).filter(index -> !temp.contains(index)).forEach(index -> { // 数据库内不存在的资源类型
if (index.equals("数据资源")) {
Map<String, Object> nullMap = new HashMap<String, Object>() {
{
put("amount", 10413);
put("type", "数据资源");
}
};
dbAmount.add(nullMap);
} else {
Map<String, Object> nullMap = new HashMap<String, Object>() {
{
put("amount", 0);
put("type", index);
}
};
dbAmount.add(nullMap);
}
Map<String, Object> nullMap = new HashMap<String, Object>() {
{
put("amount", 0);
put("type", index);
}
};
finalDbAmount.add(nullMap);
});
Long sum = dbAmount.stream().mapToLong(index -> Long.valueOf(index.get("amount").toString())).sum();
Long sum = finalDbAmount.stream().mapToLong(index -> Long.valueOf(index.get("amount").toString())).sum();
Map<String, Object> sumMap = new HashMap<String, Object>() {
{
put("amount", sum);
put("type", "资源汇聚总量");
}
};
dbAmount.add(sumMap);
return new Result<List<Map<String, Object>>>().ok(dbAmount);
finalDbAmount.add(sumMap);
return new Result<List<Map<String, Object>>>().ok(finalDbAmount);
}
@GetMapping(value = "/whole_amount")
@ -102,7 +95,7 @@ public class CensusController {
}).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum + 10413 + 14);
put("amount", sum);
put("type", "资源汇聚总量");
}
});

View File

@ -69,7 +69,8 @@ public class CensusControllerV2 {
private String[] censusTypes; // 需要进行统计的资源类型
@GetMapping(value = "/whole_amount")
@ApiOperation("平台概览")
@ApiOperation("能力云图-平台概览")
@LogOperation("能力云图-平台概览")
public Result<List<Map<String, Object>>> wholeAmount() {
List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
@ -291,11 +292,11 @@ public class CensusControllerV2 {
});
});
CompletableFuture<Void> allKnowledgeVisitsAmount = CompletableFuture.supplyAsync(() -> { // 获取平台知识库浏览量
return jdbcTemplate.queryForObject("SELECT SUM(visits)visits FROM tb_data_resource WHERE type ='知识库' AND del_flag = 0;", Long.class);
return jdbcTemplate.queryForObject("SELECT SUM(visits) visits FROM tb_data_resource WHERE type ='知识库' AND del_flag = 0;", Long.class);
}).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
put("amount", sum == null ? 0L : sum);
put("type", "知识库总浏览量");
}
});
@ -336,45 +337,22 @@ public class CensusControllerV2 {
case TSINGTAO_XHA: { // 青岛西海岸
allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目
List<Long> result_ = new CopyOnWriteArrayList<>();
CompletableFuture cloud =
CompletableFuture.runAsync(() -> { // 云脑专网
OkHttpClient client = new OkHttpClient();
String url = String.format(tsingtao_xhaProperties.getCloudcam(), "", 1, 10);
logger.info(url);
Request request = new Request.Builder().url(url).build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
JSONObject jsonObject = JSON.parseObject(response.body().string());
if (jsonObject.containsKey("data")) {
result_.add(jsonObject.getJSONObject("data").getLongValue("total"));
}
} else {
logger.error("青岛西海岸获取失败");
}
} catch (Exception exception) {
logger.error("青岛西海岸失败", exception);
}
});
CompletableFuture local =
CompletableFuture.runAsync(() -> { // 金宏网
OkHttpClient client = new OkHttpClient();
String url = String.format(tsingtao_xhaProperties.getLocalcam(), "", 1, 10);
logger.info(url);
Request request = new Request.Builder().url(url).build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
JSONObject jsonObject = JSON.parseObject(response.body().string());
if (jsonObject.containsKey("data")) {
result_.add(jsonObject.getJSONObject("data").getLongValue("total"));
}
} else {
logger.error("青岛西海岸获取失败");
}
} catch (Exception exception) {
logger.error("青岛西海岸失败", exception);
}
});
CompletableFuture.allOf(cloud, local);
OkHttpClient client = new OkHttpClient();
String url = String.format(tsingtao_xhaProperties.getCloudcam(), "", 1, 10);
logger.info(url);
Request request = new Request.Builder().url(url).build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
JSONObject jsonObject = JSON.parseObject(response.body().string());
if (jsonObject.containsKey("data")) {
result_.add(jsonObject.getJSONObject("data").getLongValue("total"));
}
} else {
logger.error("青岛西海岸获取失败");
}
} catch (Exception exception) {
logger.error("青岛西海岸失败", exception);
}
return result_.stream().filter(index -> index != null).findAny().orElse(0l);
}).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
@ -429,11 +407,9 @@ public class CensusControllerV2 {
break;
case TSINGTAO: { // TODO 青岛大数据局
TsingtaoDataResourceService tsingtaoDataResourceService = new TsingtaoDataResourceService();
GetDataResourceListDto getDataResourceListDto = new GetDataResourceListDto();
getDataResourceListDto.setPageNum(1);
getDataResourceListDto.setPageSize(5);
JSONObject dataResource = (JSONObject) tsingtaoDataResourceService.getDataResource(getDataResourceListDto);
JSONObject data = dataResource.getJSONObject("data");
GetDataResourceListDto getDataResourceListDto = new GetDataResourceListDto().setPageNum(1).setPageSize(5);
HashMap dataResource = (HashMap) tsingtaoDataResourceService.getDataResource(getDataResourceListDto);
JSONObject data = JSON.parseObject(JSON.toJSONString(dataResource.get("data")));
result.add(new HashMap<String, Object>() {
{
put("amount", data.get("rows"));
@ -454,99 +430,84 @@ public class CensusControllerV2 {
});
result.add(new HashMap<String, Object>() {
{
put("resourceTop5", data.get("data"));
String ja = data.getString("data");
List<Map> lists = JSON.parseArray(ja, Map.class);
ArrayList<Map> list = new ArrayList<>();
lists.forEach(item -> {
list.add(new HashMap<String, Object>(){{
put("服务名称", item.get("zyname"));
put("申请次数", item.get("syqk"));
}});
});
put("resourceTop5", list);
}
});
}
break;
case TSINGTAO_XHA: { // 青岛西海岸
allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台数据资源总数目
OkHttpClient client = new OkHttpClient();
Long total = 0L;
Request request = new Request.Builder().url(tsingtao_xhaProperties.getResourcecount()).build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
JSONObject jsonObject = JSON.parseObject(response.body().string());
if (jsonObject.containsKey("data")) {
total = jsonObject.getJSONObject("data").getLongValue("total");
}
} else {
logger.error("青岛西海岸获取失败");
OkHttpClient client = new OkHttpClient();
Long total = 0L;
Request request = new Request.Builder().url(tsingtao_xhaProperties.getResourcecount()).build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
JSONObject jsonObject = JSON.parseObject(response.body().string());
if (jsonObject.containsKey("data")) {
total = jsonObject.getJSONObject("data").getLongValue("total");
Long finalTotal = total;
result.add(new HashMap<String, Object>() {
{
put("amount", finalTotal);
put("type", "总数据量");
}
});
}
} catch (Exception exception) {
logger.error("青岛西海岸失败", exception);
} else {
logger.error("青岛西海岸获取失败");
}
return total;
}).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
put("type", "总数据量");
}
});
}); // 处理总数目
} catch (Exception exception) {
logger.error("青岛西海岸失败", exception);
}
applyInfo = CompletableFuture.runAsync(() -> {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder().url(tsingtao_xhaProperties.getResourceapplyinfo()).build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
JSONObject jsonObject = JSON.parseObject(response.body().string());
if (jsonObject.containsKey("data")) {
result.add(new HashMap<String, Object>() {
{
put("amount", jsonObject.getJSONObject("data").getLongValue("requestCount"));
put("type", "总申请次数");
}
});
result.add(new HashMap<String, Object>() {
{
put("amount", jsonObject.getJSONObject("data").getIntValue("satisfactionRate"));
put("type", "满足率");
}
});
result.add(new HashMap<String, Object>() {
{
put("resourceTop5", jsonObject.getJSONObject("data").getJSONArray("resourceTop5").stream().map(index -> (JSONObject) JSON.toJSON(index)).map(index -> new HashMap<String, Object>() {
{
put("服务名称", index.getString("service_name"));
put("申请次数", index.getLongValue("count"));
}
}).collect(Collectors.toList()));
}
});
}
} else {
logger.error("青岛西海岸获取失败");
OkHttpClient client1 = new OkHttpClient();
Request request1 = new Request.Builder().url(tsingtao_xhaProperties.getResourceapplyinfo()).build();
try (Response response = client1.newCall(request1).execute()) {
if (response.isSuccessful()) {
JSONObject jsonObject = JSON.parseObject(response.body().string());
if (jsonObject.containsKey("data")) {
result.add(new HashMap<String, Object>() {
{
put("amount", jsonObject.getJSONObject("data").getLongValue("requestCount"));
put("type", "总申请次数");
}
});
result.add(new HashMap<String, Object>() {
{
put("amount", jsonObject.getJSONObject("data").getIntValue("satisfactionRate"));
put("type", "满足率");
}
});
result.add(new HashMap<String, Object>() {
{
put("resourceTop5", jsonObject.getJSONObject("data").getJSONArray("resourceTop5").stream().map(index -> (JSONObject) JSON.toJSON(index)).map(index -> new HashMap<String, Object>() {
{
put("服务名称", index.getString("service_name"));
put("申请次数", index.getLongValue("count"));
}
}).collect(Collectors.toList()));
}
});
}
} catch (Exception exception) {
logger.error("青岛西海岸失败", exception);
} else {
logger.error("青岛西海岸获取失败");
}
});
} catch (Exception exception) {
logger.error("青岛西海岸失败", exception);
}
}
break;
}
if (allAmount == null) {
allAmount = CompletableFuture.runAsync(() -> {
try {
Thread.sleep(100l);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
});
}
if (applyInfo == null) {
applyInfo = CompletableFuture.runAsync(() -> {
try {
Thread.sleep(100l);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
});
}
CompletableFuture<Void> all = CompletableFuture.allOf(allAmount, applyInfo);
all.join();
return new Result().ok(result);
}

View File

@ -0,0 +1,99 @@
package io.renren.common.controller;
import io.renren.common.page.PageData;
import io.renren.common.utils.Result;
import io.renren.modules.activiti.dto.ProcessInstanceDTO;
import io.renren.modules.activiti.dto.ProcessStartDTO;
import io.renren.modules.activiti.service.ActProcessService;
import io.renren.modules.activiti.service.ActRunningService;
import io.renren.modules.demandComment.dto.TDemandCommentDTO;
import io.renren.modules.demandComment.service.TDemandCommentService;
import io.renren.modules.processForm.service.TAbilityApplicationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
@Api(tags = "评论审核")
@RestController
@RequestMapping("/comment/center")
public class CommentController {
@Autowired
private ActProcessService actProcessService;
@Autowired
private TAbilityApplicationService tAbilityApplicationService;
@Autowired
private ActRunningService actRunningService;
@Autowired
private TDemandCommentService tDemandCommentService;
@Autowired
private JdbcTemplate jdbcTemplate;
private static Logger logger = LoggerFactory.getLogger(CommentController.class);
private static String key = "comment_review";
private static Map<String, Object> params = new HashMap<String, Object>() {
{
put("isLatestVersion", true); // 取最新版本
put("key", key); // 限定
}
};
/**
* 批量进行批量能力申请
*
* @param tDemandCommentDTO
* @return
*/
@PostMapping(value = "/apply")
@ApiOperation("批量进行评论审核申请")
public Result<ProcessInstanceDTO> apply(@RequestBody TDemandCommentDTO tDemandCommentDTO) {
// 仿照请求接口 /act/process/lastestPage
PageData<Map<String, Object>> page = actProcessService.page(params);
if (page.getTotal() <= 0) { //
return new Result().error("联系管理员添加流程");
}
if (tDemandCommentDTO.getId() == null) {
return new Result().error("参数异常");
}
tDemandCommentDTO = tDemandCommentService.get(tDemandCommentDTO.getId());
if (tDemandCommentDTO.getId() == null) {
return new Result().error("该评论不存在");
}
tDemandCommentDTO.setDelFlag(2); // 待审核
tDemandCommentDTO.setCompleteEntry(Boolean.TRUE);
tDemandCommentService.update(tDemandCommentDTO);
// 仿照请求接口 /act/running/startOfBusinessKey
ProcessStartDTO processStartDTO = new ProcessStartDTO();
processStartDTO.setBusinessKey(tDemandCommentDTO.getId().toString());
processStartDTO.setProcessDefinitionKey(key); //限定
ObjectMapper oMapper = new ObjectMapper();
Map<String, Object> variables = oMapper.convertValue(tDemandCommentDTO, Map.class);
processStartDTO.setVariables(variables);
ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO);
tDemandCommentDTO.setDelFlag(3); // 审核中
tDemandCommentService.update(tDemandCommentDTO);
CompletableFuture.runAsync(() -> {
if (Long.valueOf(dto.getBusinessKey()) != null) {
jdbcTemplate.update(String.format("UPDATE t_demand_comment SET instance_id = '%s' WHERE id = %s", dto.getProcessInstanceId(), dto.getBusinessKey()));
}
});
return new Result<ProcessInstanceDTO>().ok(dto);
}
}

View File

@ -10,6 +10,8 @@ import io.renren.common.utils.MessageUtils;
import io.renren.modules.activiti.dto.TaskDTO;
import io.renren.modules.demanData.dto.TDemandDataDTO;
import io.renren.modules.demanData.service.TDemandDataService;
import io.renren.modules.demandComment.dto.TDemandCommentDTO;
import io.renren.modules.demandComment.service.TDemandCommentService;
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
import io.renren.modules.processForm.service.TAbilityApplicationService;
import io.renren.modules.resource.dto.ResourceDTO;
@ -62,6 +64,9 @@ public class ActTaskService extends BaseServiceImpl {
public static String Task_HANDLE_STATE_BACK = "back"; //回退
public static String Task_HANDLE_STATE_STOP = "stop"; //终止
@Autowired
private TDemandCommentService tDemandCommentService;
@Autowired
protected TaskService taskService;
@Autowired
@ -166,6 +171,16 @@ public class ActTaskService extends BaseServiceImpl {
listDto.add(dto);
continue;
}
TDemandCommentDTO tDemandCommentDTO = tDemandCommentService.get(Long.valueOf(dto.getBusinessKey()));
if (tDemandCommentDTO != null) {
Map<String, Object> variables = oMapper.convertValue(tDemandCommentDTO, Map.class);
processVariable.putAll(variables);
processVariable.putAll(task.getProcessVariables());
dto.setParams(processVariable);
listDto.add(dto);
continue;
}
}
return new PageData<>(listDto, (int) taskQuery.count());
}

View File

@ -104,7 +104,7 @@ public class TDemandCommentController {
@ApiOperation("保存")
@LogOperation("保存")
// @RequiresPermissions("demandComment:tdemandcomment:save")
public Result save(@RequestBody TDemandCommentDTO dto) {
public Result<TDemandCommentDTO> save(@RequestBody TDemandCommentDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
TDemandDataDTO dto1 =
@ -115,9 +115,10 @@ public class TDemandCommentController {
if (dto1.getFlag() != 3) {
return new Result().error("该评论主题未审批通过!");
}
dto.setDelFlag(1);
tDemandCommentService.save(dto);
return new Result();
return new Result().ok(dto);
}
@PutMapping

View File

@ -1,5 +1,6 @@
package io.renren.modules.demandComment.dto;
import io.renren.common.dto.AuditingBaseDTO;
import io.renren.modules.demanData.dto.TDemandDataDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -16,7 +17,7 @@ import java.util.Date;
*/
@Data
@ApiModel(value = "需求评论")
public class TDemandCommentDTO implements Serializable {
public class TDemandCommentDTO extends AuditingBaseDTO implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
@ -42,6 +43,8 @@ public class TDemandCommentDTO implements Serializable {
private String note4;
@ApiModelProperty(value = "备用字段")
private String note5;
@ApiModelProperty(value = "删除标志0:正常1:已删除2:待审核3:审核中9其他")
private Integer delFlag;
@ApiModelProperty(value = "评论所属需求主题")
private TDemandDataDTO demandDataDTO;

View File

@ -1,10 +1,9 @@
package io.renren.modules.demandComment.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.renren.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.*;
import java.util.Date;
import io.renren.common.entity.BaseEntity;
/**
* 需求评论
@ -13,45 +12,50 @@ import io.renren.common.entity.BaseEntity;
* @since 1.0 2022-04-26
*/
@Data
@EqualsAndHashCode(callSuper=false)
@EqualsAndHashCode(callSuper = false)
@TableName("t_demand_comment")
public class TDemandCommentEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/**
* 评论人部门名称
*/
private String createDeptName;
/**
* 评论人姓名
*/
private String name;
/**
* 评论内容
*/
private String comment;
/**
* 评论主题id
*/
private Long targetId;
/**
* 备用字段
*/
private String note1;
/**
* 备用字段
*/
private String note2;
/**
* 备用字段
*/
private String note3;
/**
* 备用字段
*/
private String note4;
/**
* 备用字段
*/
private String note5;
/**
* 评论人部门名称
*/
private String createDeptName;
/**
* 评论人姓名
*/
private String name;
/**
* 评论内容
*/
private String comment;
/**
* 评论主题id
*/
private Long targetId;
/**
* 备用字段
*/
private String note1;
/**
* 备用字段
*/
private String note2;
/**
* 备用字段
*/
private String note3;
/**
* 备用字段
*/
private String note4;
/**
* 备用字段
*/
private String note5;
/**
* 删除标志0:正常1:已删除2:待审核3:审核中9其他
*/
private Integer delFlag;
}

View File

@ -0,0 +1,143 @@
package io.renren.modules.demandComment.listener;
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.demandComment.dto.TDemandCommentDTO;
import io.renren.modules.demandComment.service.TDemandCommentService;
import io.renren.modules.sys.dto.SysDeptDTO;
import io.renren.modules.sys.dto.SysRoleDTO;
import io.renren.modules.sys.dto.SysUserDTO;
import io.renren.modules.sys.service.SysDeptService;
import io.renren.modules.sys.service.SysRoleService;
import io.renren.modules.sys.service.SysRoleUserService;
import io.renren.modules.sys.service.SysUserService;
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.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;
/**
* 大数据局动态审批人
*/
@Component
public class CommentListener implements TaskListener, ExecutionListener, ActivitiEventListener, JavaDelegate {
private static Logger logger = LoggerFactory.getLogger(CommentListener.class);
@Value("${big_date.name}")
private String bigDateDeptName; // 大数据局名称
@Value("${big_date.assignee_role_name}")
private String roleName; // 具备审批的角色名称
@Autowired
private SysRoleService sysRoleService;
@Autowired
private TaskService taskService;
@Autowired
private SysUserService sysUserService;
@Autowired
private SysRoleUserService sysRoleUserService;
@Autowired
private SysDeptService sysDeptService;
@Autowired
private TDemandCommentService tDemandCommentService;
@Override
public void notify(DelegateExecution delegateExecution) throws Exception {
logger.error("----------------------进入审批结束节点---------------------------");
delegateExecution.getProcessBusinessKey();
final String eventName = delegateExecution.getEventName();
switch (eventName) {
case EVENTNAME_END:
endTake(delegateExecution.getVariables());
break;
}
}
/**
* 结束审批
*
* @param kv
*/
private void endTake(Map<String, Object> kv) { // 进入最后结束节点
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);
TDemandCommentDTO tDemandCommentDTO = gson.fromJson(jsonElement, TDemandCommentDTO.class);
if (tDemandCommentDTO != null) {
if (tDemandCommentDTO.getReject() != null && tDemandCommentDTO.getReject() == Boolean.TRUE) { // 存在被拒绝的节点
tDemandCommentDTO.setDelFlag(1);
tDemandCommentService.update(tDemandCommentDTO);
logger.error("评论审核不通过不通过申请id:" + tDemandCommentDTO.getId());
} else {
tDemandCommentDTO.setDelFlag(0);
tDemandCommentService.update(tDemandCommentDTO);
logger.error("审批通过评论id:" + tDemandCommentDTO.getId());
}
}
}
@Override
public void execute(DelegateExecution delegateExecution) throws Exception {
}
@Override
@ActivitiNoticeOperation(value = "评论审核", process = "评论审核流程")
public void notify(DelegateTask delegateTask) {
logger.error("事件类型:" + delegateTask.getEventName());
final String eventName = delegateTask.getEventName();
switch (eventName) {
case EVENTNAME_CREATE:
createEvent(delegateTask);
break;
default:
logger.error("未处理该事件:" + eventName);
}
}
@Override
public void onEvent(ActivitiEvent activitiEvent) {
}
@Override
public boolean isFailOnException() {
return false;
}
/**
* 节点创建时动态分配大数据局审批人
*
* @param delegateTask
*/
private void createEvent(DelegateTask delegateTask) {
logger.error("大数据局名称:" + bigDateDeptName);
SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName);
logger.error("deptDTOId:" + deptDTO.getId());
SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
logger.error("roleDTOId:" + roleDTO.getId());
SysUserDTO userDTO = sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId());
if (userDTO != null) {
logger.error("审批人id:" + userDTO.getId());
taskService.setAssignee(delegateTask.getId(), userDTO.getId().toString());
} else {
delegateTask.setAssignee("1516728698224427010");
logger.error("未查到该部门对应 " + roleName);
}
}
}

View File

@ -63,6 +63,9 @@ public class TDemandCommentServiceImpl extends CrudServiceImpl<TDemandCommentDao
break;
}
});
if (!params.containsKey("creator")) {
wrapper.eq("del_flag", 0);
}
wrapper.orderByDesc("create_date");
return wrapper;
}
@ -76,23 +79,30 @@ public class TDemandCommentServiceImpl extends CrudServiceImpl<TDemandCommentDao
@Override
public void save(TDemandCommentDTO tDemandCommentDTO) {
super.save(tDemandCommentDTO);
CompletableFuture.runAsync(() -> { // 发起人
Optional<TDemandDataDTO> tDemandDataDTO = Optional.ofNullable(tDemandDataService.get(tDemandCommentDTO.getTargetId()));
Optional<SysUserDTO> sysUserDTO = Optional.ofNullable(sysUserService.get(tDemandDataDTO.isPresent() ? tDemandDataDTO.get().getCreator() : null));
String content = "【评论】" + (sysUserDTO.isPresent() ? sysUserDTO.get().getRealName() : "") + "您发起的需求 " + tDemandDataDTO.orElse(new TDemandDataDTO()).getDemandSubject() + "有新的评论,请前往查看详情";
SysNoticeDTO dto = new SysNoticeDTO();
dto.setType(2);
dto.setTitle("需求评论系统通知");
dto.setContent(content); // 通知内容
dto.setReceiverType(1);
dto.setReceiverTypeIds(tDemandDataDTO.isPresent() ? tDemandDataDTO.get().getCreator().toString() : "");
dto.setStatus(NoticeStatusEnum.SEND.value());
dto.setSenderName("流程系统");
dto.setSenderDate(new Date());
dto.setCreator(sysUserService.getByUsername("admin").getId());
dto.setCreateDate(new Date());
dto.setFrom("评论");
sysNoticeService.save(dto);
});
}
@Override
public void update(TDemandCommentDTO tDemandCommentDTO) {
super.update(tDemandCommentDTO);
if (tDemandCommentDTO.getDelFlag() == 0) {
CompletableFuture.runAsync(() -> { // 发起人
Optional<TDemandDataDTO> tDemandDataDTO = Optional.ofNullable(tDemandDataService.get(tDemandCommentDTO.getTargetId()));
Optional<SysUserDTO> sysUserDTO = Optional.ofNullable(sysUserService.get(tDemandDataDTO.isPresent() ? tDemandDataDTO.get().getCreator() : null));
String content = "【评论】" + (sysUserDTO.isPresent() ? sysUserDTO.get().getRealName() : "") + "您发起的需求 " + tDemandDataDTO.orElse(new TDemandDataDTO()).getDemandSubject() + "有新的评论,请前往查看详情";
SysNoticeDTO dto = new SysNoticeDTO();
dto.setType(2);
dto.setTitle("需求评论系统通知");
dto.setContent(content); // 通知内容
dto.setReceiverType(1);
dto.setReceiverTypeIds(tDemandDataDTO.isPresent() ? tDemandDataDTO.get().getCreator().toString() : "");
dto.setStatus(NoticeStatusEnum.SEND.value());
dto.setSenderName("流程系统");
dto.setSenderDate(new Date());
dto.setCreator(sysUserService.getByUsername("admin").getId());
dto.setCreateDate(new Date());
dto.setFrom("评论");
sysNoticeService.save(dto);
});
}
}
}

View File

@ -12,7 +12,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -44,7 +43,11 @@ public class SysLogOperationController {
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = "status", value = "状态 0失败 1成功", paramType = "query", dataType="int")
@ApiImplicitParam(name = "status", value = "状态 0失败 1成功", paramType = "query", dataType="int"),
@ApiImplicitParam(name = "creatorName", value = "操作人", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "startDate", value = "开始时间", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "operation", value = "操作名称", paramType = "query", dataType="String")
})
// @RequiresPermissions("sys:log:operation")
public Result<PageData<SysLogOperationDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
@ -53,6 +56,19 @@ public class SysLogOperationController {
return new Result<PageData<SysLogOperationDTO>>().ok(page);
}
@GetMapping("/deleteByIds")
@ApiOperation("/删除操作记录")
@LogOperation("/删除操作记录")
public Result deleteByIds(List<Long> ids) {
try {
sysLogOperationService.deleteBatchIds(ids);
return new Result().ok(null);
} catch (Exception e) {
return new Result().error(e.getMessage());
}
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")

View File

@ -52,4 +52,8 @@ public class SysLogOperationEntity extends BaseEntity {
* 用户名
*/
private String creatorName;
/**
* 返回结果
*/
private String resultData;
}

View File

@ -45,9 +45,16 @@ public class SysLogOperationServiceImpl extends BaseServiceImpl<SysLogOperationD
private QueryWrapper<SysLogOperationEntity> getWrapper(Map<String, Object> params) {
String status = (String) params.get("status");
String creatorName = (String) params.get("creatorName");
String operation = (String) params.get("operation");
String startDate = (String) params.get("startDate");
String endDate = (String) params.get("endDate");
QueryWrapper<SysLogOperationEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(status), "status", status);
wrapper.eq(StringUtils.isNotBlank(status), "status", status)
.eq(StringUtils.isNotBlank(creatorName), "creator_name", creatorName)
.like(StringUtils.isNotBlank(operation), "operation", operation)
.between(StringUtils.isNotBlank(startDate), "", startDate, endDate);
return wrapper;
}

View File

@ -40,6 +40,7 @@ public class SysNoticeEntity extends BaseEntity {
/**
* 发送状态 0草稿 1已发布
*/
@TableField(value = "`status`")
private Integer status;
/**
* 发送者
@ -68,5 +69,6 @@ public class SysNoticeEntity extends BaseEntity {
/**
* 通知来源 (通知评论其他)
*/
@TableField(value = "`from`")
private String from;
}

View File

@ -83,10 +83,12 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
}
@Override
@Transactional(rollbackFor = Exception.class)
// @Transactional(rollbackFor = Exception.class)
public void save(SysNoticeDTO dto) {
SysNoticeEntity entity = ConvertUtils.sourceToTarget(dto, SysNoticeEntity.class);
entity.setFrom("其它"); // 站内信通知来源 (通知评论其它)
if (StringUtils.isEmpty(entity.getFrom())) {
entity.setFrom("其它"); // 站内信通知来源 (通知评论其它)
}
//更新发送者信息
if (dto.getStatus() == NoticeStatusEnum.SEND.value() && StringUtils.isEmpty(dto.getSenderName())) {

View File

@ -0,0 +1,118 @@
package io.renren.modules.project.controller;
import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
import io.renren.common.utils.ExcelUtils;
import io.renren.common.utils.Result;
import io.renren.common.validator.AssertUtils;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.project.dto.TbProjectContribDTO;
import io.renren.modules.project.excel.TbProjectContribExcel;
import io.renren.modules.project.service.TbProjectContribService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 项目贡献表
*
* @author qs
* @since 3.0 2022-06-22
*/
@RestController
@RequestMapping("projectcontrib")
@Api(tags="项目贡献表")
public class TbProjectContribController {
@Autowired
private TbProjectContribService tbProjectContribService;
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "projectName", value = "项目名称", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "resourceName", value = "应用名称", paramType = "query", dataType="String")
})
// @RequiresPermissions("project:tbprojectcontrib:page")
public Result<PageData<TbProjectContribDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<TbProjectContribDTO> page = tbProjectContribService.page(params);
return new Result<PageData<TbProjectContribDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
// @RequiresPermissions("project:tbprojectcontrib:info")
public Result<TbProjectContribDTO> get(@PathVariable("id") Long id){
TbProjectContribDTO data = tbProjectContribService.get(id);
return new Result<TbProjectContribDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
// @RequiresPermissions("project:tbprojectcontrib:save")
public Result save(@RequestBody TbProjectContribDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
tbProjectContribService.save(dto);
return new Result();
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
// @RequiresPermissions("project:tbprojectcontrib:update")
public Result update(@RequestBody TbProjectContribDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
tbProjectContribService.update(dto);
return new Result();
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
// @RequiresPermissions("project:tbprojectcontrib:delete")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
tbProjectContribService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
// @RequiresPermissions("project:tbprojectcontrib:export")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<TbProjectContribDTO> list = tbProjectContribService.list(params);
ExcelUtils.exportExcelToTarget(response, null, "项目贡献表", list, TbProjectContribExcel.class);
}
}

View File

@ -0,0 +1,120 @@
package io.renren.modules.project.controller;
import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
import io.renren.common.utils.ExcelUtils;
import io.renren.common.utils.Result;
import io.renren.common.validator.AssertUtils;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.project.dto.TbProjectDTO;
import io.renren.modules.project.excel.TbProjectExcel;
import io.renren.modules.project.service.TbProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 项目表
*
* @author qiaosen
* @since 3.0 2022-06-22
*/
@RestController
@RequestMapping("project")
@Api(tags="项目表")
public class TbProjectController {
@Autowired
private TbProjectService tbProjectService;
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "projectName", value = "项目名称", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "applyDep", value = "申请单位", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "respDep", value = "责任处室", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "applyTime", value = "申请日期", paramType = "query", dataType="String")
})
// @RequiresPermissions("project:tbproject:page")
public Result<PageData<TbProjectDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<TbProjectDTO> page = tbProjectService.page(params);
return new Result<PageData<TbProjectDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
// @RequiresPermissions("project:tbproject:info")
public Result<TbProjectDTO> get(@PathVariable("id") Long id){
TbProjectDTO data = tbProjectService.get(id);
return new Result<TbProjectDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
// @RequiresPermissions("project:tbproject:save")
public Result save(@RequestBody TbProjectDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
tbProjectService.save(dto);
return new Result();
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
// @RequiresPermissions("project:tbproject:update")
public Result update(@RequestBody TbProjectDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
tbProjectService.update(dto);
return new Result();
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
// @RequiresPermissions("project:tbproject:delete")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
tbProjectService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
// @RequiresPermissions("project:tbproject:export")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<TbProjectDTO> list = tbProjectService.list(params);
ExcelUtils.exportExcelToTarget(response, null, "项目表", list, TbProjectExcel.class);
}
}

View File

@ -0,0 +1,118 @@
package io.renren.modules.project.controller;
import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
import io.renren.common.utils.ExcelUtils;
import io.renren.common.utils.Result;
import io.renren.common.validator.AssertUtils;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.project.dto.TbProjectUseDTO;
import io.renren.modules.project.excel.TbProjectUseExcel;
import io.renren.modules.project.service.TbProjectUseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 项目使用表
*
* @author qs sunlightcs@gmail.com
* @since 3.0 2022-06-22
*/
@RestController
@RequestMapping("projectuse")
@Api(tags="项目使用表")
public class TbProjectUseController {
@Autowired
private TbProjectUseService tbProjectUseService;
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "projectName", value = "项目名称", paramType = "query", dataType="String"),
@ApiImplicitParam(name = "resourceName", value = "应用名称", paramType = "query", dataType="String")
})
// @RequiresPermissions("project:tbprojectuse:page")
public Result<PageData<TbProjectUseDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<TbProjectUseDTO> page = tbProjectUseService.page(params);
return new Result<PageData<TbProjectUseDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
// @RequiresPermissions("project:tbprojectuse:info")
public Result<TbProjectUseDTO> get(@PathVariable("id") Long id){
TbProjectUseDTO data = tbProjectUseService.get(id);
return new Result<TbProjectUseDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
// @RequiresPermissions("project:tbprojectuse:save")
public Result save(@RequestBody TbProjectUseDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
tbProjectUseService.save(dto);
return new Result();
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
// @RequiresPermissions("project:tbprojectuse:update")
public Result update(@RequestBody TbProjectUseDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
tbProjectUseService.update(dto);
return new Result();
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
// @RequiresPermissions("project:tbprojectuse:delete")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
tbProjectUseService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
// @RequiresPermissions("project:tbprojectuse:export")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<TbProjectUseDTO> list = tbProjectUseService.list(params);
ExcelUtils.exportExcelToTarget(response, null, "项目使用表", list, TbProjectUseExcel.class);
}
}

View File

@ -0,0 +1,16 @@
package io.renren.modules.project.dao;
import io.renren.common.dao.BaseDao;
import io.renren.modules.project.entity.TbProjectContribEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 项目贡献表
*
* @author qs
* @since 3.0 2022-06-22
*/
@Mapper
public interface TbProjectContribDao extends BaseDao<TbProjectContribEntity> {
}

View File

@ -0,0 +1,16 @@
package io.renren.modules.project.dao;
import io.renren.common.dao.BaseDao;
import io.renren.modules.project.entity.TbProjectEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 项目表
*
* @author qiaosen
* @since 3.0 2022-06-22
*/
@Mapper
public interface TbProjectDao extends BaseDao<TbProjectEntity> {
}

View File

@ -0,0 +1,16 @@
package io.renren.modules.project.dao;
import io.renren.common.dao.BaseDao;
import io.renren.modules.project.entity.TbProjectUseEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 项目使用表
*
* @author qs sunlightcs@gmail.com
* @since 3.0 2022-06-22
*/
@Mapper
public interface TbProjectUseDao extends BaseDao<TbProjectUseEntity> {
}

View File

@ -0,0 +1,56 @@
package io.renren.modules.project.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 项目贡献表
*
* @author qs
* @since 3.0 2022-06-22
*/
@Data
@ApiModel(value = "项目贡献表")
public class TbProjectContribDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "项目名称")
private String projectName;
@ApiModelProperty(value = "应用名称")
private String resourceName;
@ApiModelProperty(value = "能力名称")
private String abilityName;
@ApiModelProperty(value = "能力类型")
private String abilityType;
@ApiModelProperty(value = "上架时间")
private Date applyTime;
@ApiModelProperty(value = "申请次数")
private String applyNum;
@ApiModelProperty(value = "浏览次数")
private String browseNum;
@ApiModelProperty(value = "创建人")
private Long creator;
@ApiModelProperty(value = "创建时间")
private Date createDate;
@ApiModelProperty(value = "修改人")
private Long updater;
@ApiModelProperty(value = "修改时间")
private Date updateDate;
@ApiModelProperty(value = "备用字段")
private String note1;
@ApiModelProperty(value = "备用字段")
private String note2;
@ApiModelProperty(value = "备用字段")
private String note3;
@ApiModelProperty(value = "备用字段")
private String note4;
@ApiModelProperty(value = "备用字段")
private String note5;
}

View File

@ -0,0 +1,62 @@
package io.renren.modules.project.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 项目表
*
* @author qiaosen
* @since 3.0 2022-06-22
*/
@Data
@ApiModel(value = "项目表")
public class TbProjectDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "项目名称")
private String projectName;
@ApiModelProperty(value = "申请单位")
private String applyDep;
@ApiModelProperty(value = "申请人")
private String applyUser;
@ApiModelProperty(value = "申请时间")
private Date applyTime;
@ApiModelProperty(value = "所属区市")
private String regionName;
@ApiModelProperty(value = "责任处室")
private String respDep;
@ApiModelProperty(value = "业务联系人")
private String businessUser;
@ApiModelProperty(value = "业务联系电话")
private String businessPhone;
@ApiModelProperty(value = "技术联系人")
private String techUser;
@ApiModelProperty(value = "技术联系电话")
private String techPhone;
@ApiModelProperty(value = "创建人")
private Long creator;
@ApiModelProperty(value = "创建时间")
private Date createDate;
@ApiModelProperty(value = "修改人")
private Long updater;
@ApiModelProperty(value = "修改时间")
private Date updateDate;
@ApiModelProperty(value = "备用字段")
private String note1;
@ApiModelProperty(value = "备用字段")
private String note2;
@ApiModelProperty(value = "备用字段")
private String note3;
@ApiModelProperty(value = "备用字段")
private String note4;
@ApiModelProperty(value = "备用字段")
private String note5;
}

View File

@ -0,0 +1,56 @@
package io.renren.modules.project.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 项目使用表
*
* @author qs sunlightcs@gmail.com
* @since 3.0 2022-06-22
*/
@Data
@ApiModel(value = "项目使用表")
public class TbProjectUseDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "项目名称")
private String projectName;
@ApiModelProperty(value = "应用名称")
private String resourceName;
@ApiModelProperty(value = "能力名称")
private String abilityName;
@ApiModelProperty(value = "能力类型")
private String abilityType;
@ApiModelProperty(value = "上架时间")
private Date applyTime;
@ApiModelProperty(value = "申请次数")
private String applyNum;
@ApiModelProperty(value = "浏览次数")
private String browseNum;
@ApiModelProperty(value = "创建人")
private Long creator;
@ApiModelProperty(value = "创建时间")
private Date createDate;
@ApiModelProperty(value = "修改人")
private Long updater;
@ApiModelProperty(value = "修改时间")
private Date updateDate;
@ApiModelProperty(value = "备用字段")
private String note1;
@ApiModelProperty(value = "备用字段")
private String note2;
@ApiModelProperty(value = "备用字段")
private String note3;
@ApiModelProperty(value = "备用字段")
private String note4;
@ApiModelProperty(value = "备用字段")
private String note5;
}

View File

@ -0,0 +1,79 @@
package io.renren.modules.project.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.*;
import java.util.Date;
import io.renren.common.entity.BaseEntity;
/**
* 项目贡献表
*
* @author qs
* @since 3.0 2022-06-22
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("tb_project_contrib")
public class TbProjectContribEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 项目名称
*/
private String projectName;
/**
* 应用名称
*/
private String resourceName;
/**
* 能力名称
*/
private String abilityName;
/**
* 能力类型
*/
private String abilityType;
/**
* 上架时间
*/
private Date applyTime;
/**
* 申请次数
*/
private String applyNum;
/**
* 浏览次数
*/
private String browseNum;
/**
* 修改人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updater;
/**
* 修改时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
/**
* 备用字段
*/
private String note1;
/**
* 备用字段
*/
private String note2;
/**
* 备用字段
*/
private String note3;
/**
* 备用字段
*/
private String note4;
/**
* 备用字段
*/
private String note5;
}

View File

@ -0,0 +1,91 @@
package io.renren.modules.project.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.*;
import java.util.Date;
import io.renren.common.entity.BaseEntity;
/**
* 项目表
*
* @author qiaosen
* @since 3.0 2022-06-22
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("tb_project")
public class TbProjectEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 项目名称
*/
private String projectName;
/**
* 申请单位
*/
private String applyDep;
/**
* 申请人
*/
private String applyUser;
/**
* 申请时间
*/
private Date applyTime;
/**
* 所属区市
*/
private String regionName;
/**
* 责任处室
*/
private String respDep;
/**
* 业务联系人
*/
private String businessUser;
/**
* 业务联系电话
*/
private String businessPhone;
/**
* 技术联系人
*/
private String techUser;
/**
* 技术联系电话
*/
private String techPhone;
/**
* 修改人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updater;
/**
* 修改时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
/**
* 备用字段
*/
private String note1;
/**
* 备用字段
*/
private String note2;
/**
* 备用字段
*/
private String note3;
/**
* 备用字段
*/
private String note4;
/**
* 备用字段
*/
private String note5;
}

View File

@ -0,0 +1,79 @@
package io.renren.modules.project.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.*;
import java.util.Date;
import io.renren.common.entity.BaseEntity;
/**
* 项目使用表
*
* @author qs sunlightcs@gmail.com
* @since 3.0 2022-06-22
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("tb_project_use")
public class TbProjectUseEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 项目名称
*/
private String projectName;
/**
* 应用名称
*/
private String resourceName;
/**
* 能力名称
*/
private String abilityName;
/**
* 能力类型
*/
private String abilityType;
/**
* 上架时间
*/
private Date applyTime;
/**
* 申请次数
*/
private String applyNum;
/**
* 浏览次数
*/
private String browseNum;
/**
* 修改人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updater;
/**
* 修改时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
/**
* 备用字段
*/
private String note1;
/**
* 备用字段
*/
private String note2;
/**
* 备用字段
*/
private String note3;
/**
* 备用字段
*/
private String note4;
/**
* 备用字段
*/
private String note5;
}

View File

@ -0,0 +1,55 @@
package io.renren.modules.project.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.util.Date;
/**
* 项目贡献表
*
* @author qs
* @since 3.0 2022-06-22
*/
@Data
@ContentRowHeight(20)
@HeadRowHeight(20)
@ColumnWidth(25)
public class TbProjectContribExcel {
@ExcelProperty(value = "主键", index = 0)
private Long id;
@ExcelProperty(value = "项目名称", index = 1)
private String projectName;
@ExcelProperty(value = "应用名称", index = 2)
private String resourceName;
@ExcelProperty(value = "能力名称", index = 3)
private String abilityName;
@ExcelProperty(value = "能力类型", index = 4)
private String abilityType;
@ExcelProperty(value = "上架时间", index = 5)
private Date applyTime;
@ExcelProperty(value = "申请次数", index = 6)
private String applyNum;
@ExcelProperty(value = "浏览次数", index = 7)
private String browseNum;
@ExcelProperty(value = "创建人", index = 8)
private Long creator;
@ExcelProperty(value = "创建时间", index = 9)
private Date createDate;
@ExcelProperty(value = "修改人", index = 10)
private Long updater;
@ExcelProperty(value = "修改时间", index = 11)
private Date updateDate;
@ExcelProperty(value = "备用字段", index = 12)
private String note1;
@ExcelProperty(value = "备用字段", index = 13)
private String note2;
@ExcelProperty(value = "备用字段", index = 14)
private String note3;
@ExcelProperty(value = "备用字段", index = 15)
private String note4;
@ExcelProperty(value = "备用字段", index = 16)
private String note5;
}

View File

@ -0,0 +1,61 @@
package io.renren.modules.project.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.util.Date;
/**
* 项目表
*
* @author qiaosen
* @since 3.0 2022-06-22
*/
@Data
@ContentRowHeight(20)
@HeadRowHeight(20)
@ColumnWidth(25)
public class TbProjectExcel {
@ExcelProperty(value = "主键", index = 0)
private Long id;
@ExcelProperty(value = "项目名称", index = 1)
private String projectName;
@ExcelProperty(value = "申请单位", index = 2)
private String applyDep;
@ExcelProperty(value = "申请人", index = 3)
private String applyUser;
@ExcelProperty(value = "申请时间", index = 4)
private Date applyTime;
@ExcelProperty(value = "所属区市", index = 5)
private String regionName;
@ExcelProperty(value = "责任处室", index = 6)
private String respDep;
@ExcelProperty(value = "业务联系人", index = 7)
private String businessUser;
@ExcelProperty(value = "业务联系电话", index = 8)
private String businessPhone;
@ExcelProperty(value = "技术联系人", index = 9)
private String techUser;
@ExcelProperty(value = "技术联系电话", index = 10)
private String techPhone;
@ExcelProperty(value = "创建人", index = 11)
private Long creator;
@ExcelProperty(value = "创建时间", index = 12)
private Date createDate;
@ExcelProperty(value = "修改人", index = 13)
private Long updater;
@ExcelProperty(value = "修改时间", index = 14)
private Date updateDate;
@ExcelProperty(value = "备用字段", index = 15)
private String note1;
@ExcelProperty(value = "备用字段", index = 16)
private String note2;
@ExcelProperty(value = "备用字段", index = 17)
private String note3;
@ExcelProperty(value = "备用字段", index = 18)
private String note4;
@ExcelProperty(value = "备用字段", index = 19)
private String note5;
}

View File

@ -0,0 +1,55 @@
package io.renren.modules.project.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.util.Date;
/**
* 项目使用表
*
* @author qs sunlightcs@gmail.com
* @since 3.0 2022-06-22
*/
@Data
@ContentRowHeight(20)
@HeadRowHeight(20)
@ColumnWidth(25)
public class TbProjectUseExcel {
@ExcelProperty(value = "主键", index = 0)
private Long id;
@ExcelProperty(value = "项目名称", index = 1)
private String projectName;
@ExcelProperty(value = "应用名称", index = 2)
private String resourceName;
@ExcelProperty(value = "能力名称", index = 3)
private String abilityName;
@ExcelProperty(value = "能力类型", index = 4)
private String abilityType;
@ExcelProperty(value = "上架时间", index = 5)
private Date applyTime;
@ExcelProperty(value = "申请次数", index = 6)
private String applyNum;
@ExcelProperty(value = "浏览次数", index = 7)
private String browseNum;
@ExcelProperty(value = "创建人", index = 8)
private Long creator;
@ExcelProperty(value = "创建时间", index = 9)
private Date createDate;
@ExcelProperty(value = "修改人", index = 10)
private Long updater;
@ExcelProperty(value = "修改时间", index = 11)
private Date updateDate;
@ExcelProperty(value = "备用字段", index = 12)
private String note1;
@ExcelProperty(value = "备用字段", index = 13)
private String note2;
@ExcelProperty(value = "备用字段", index = 14)
private String note3;
@ExcelProperty(value = "备用字段", index = 15)
private String note4;
@ExcelProperty(value = "备用字段", index = 16)
private String note5;
}

View File

@ -0,0 +1,15 @@
package io.renren.modules.project.service;
import io.renren.common.service.CrudService;
import io.renren.modules.project.dto.TbProjectContribDTO;
import io.renren.modules.project.entity.TbProjectContribEntity;
/**
* 项目贡献表
*
* @author qs
* @since 3.0 2022-06-22
*/
public interface TbProjectContribService extends CrudService<TbProjectContribEntity, TbProjectContribDTO> {
}

View File

@ -0,0 +1,15 @@
package io.renren.modules.project.service;
import io.renren.common.service.CrudService;
import io.renren.modules.project.dto.TbProjectDTO;
import io.renren.modules.project.entity.TbProjectEntity;
/**
* 项目表
*
* @author qiaosen
* @since 3.0 2022-06-22
*/
public interface TbProjectService extends CrudService<TbProjectEntity, TbProjectDTO> {
}

View File

@ -0,0 +1,15 @@
package io.renren.modules.project.service;
import io.renren.common.service.CrudService;
import io.renren.modules.project.dto.TbProjectUseDTO;
import io.renren.modules.project.entity.TbProjectUseEntity;
/**
* 项目使用表
*
* @author qs sunlightcs@gmail.com
* @since 3.0 2022-06-22
*/
public interface TbProjectUseService extends CrudService<TbProjectUseEntity, TbProjectUseDTO> {
}

View File

@ -0,0 +1,40 @@
package io.renren.modules.project.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.constant.Constant;
import io.renren.modules.project.dao.TbProjectContribDao;
import io.renren.modules.project.dto.TbProjectContribDTO;
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.stereotype.Service;
import java.util.Map;
/**
* 项目贡献表
*
* @author qs
* @since 3.0 2022-06-22
*/
@Service
public class TbProjectContribServiceImpl extends CrudServiceImpl<TbProjectContribDao, TbProjectContribEntity, TbProjectContribDTO> implements TbProjectContribService {
@Override
public QueryWrapper<TbProjectContribEntity> getWrapper(Map<String, Object> params){
QueryWrapper<TbProjectContribEntity> wrapper = new QueryWrapper<>();
if(params.containsKey("projectName") && StringUtils.isNotBlank(params.get("projectName").toString())){
wrapper.like("project_name",params.get("projectName"));
}
if(params.containsKey("resourceName") && StringUtils.isNotBlank(params.get("resourceName").toString())){
wrapper.like("resource_name",params.get("resourceName"));
}
return wrapper;
}
}

View File

@ -0,0 +1,46 @@
package io.renren.modules.project.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.constant.Constant;
import io.renren.modules.project.dao.TbProjectDao;
import io.renren.modules.project.dto.TbProjectDTO;
import io.renren.modules.project.entity.TbProjectEntity;
import io.renren.modules.project.service.TbProjectService;
import io.renren.modules.security.user.SecurityUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* 项目表
*
* @author qiaosen
* @since 3.0 2022-06-22
*/
@Service
public class TbProjectServiceImpl extends CrudServiceImpl<TbProjectDao, TbProjectEntity, TbProjectDTO> implements TbProjectService {
@Override
public QueryWrapper<TbProjectEntity> getWrapper(Map<String, Object> params){
QueryWrapper<TbProjectEntity> wrapper = new QueryWrapper<>();
if(params.containsKey("projectName") && StringUtils.isNotBlank(params.get("projectName").toString())){
wrapper.like("project_name",params.get("projectName"));
}
if(params.containsKey("applyDep") && StringUtils.isNotBlank(params.get("applyDep").toString())){
wrapper.like("apply_dep",params.get("applyDep"));
}
if(params.containsKey("respDep") && StringUtils.isNotBlank(params.get("respDep").toString())){
wrapper.like("resp_dep",params.get("respDep"));
}
if(params.containsKey("applyTime") && StringUtils.isNotBlank(params.get("applyTime").toString())){
wrapper.apply("DATE_FORMAT(apply_time,'%Y-%m-%d') = {0}",params.get("applyTime").toString());
}
return wrapper;
}
}

View File

@ -0,0 +1,40 @@
package io.renren.modules.project.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.constant.Constant;
import io.renren.modules.project.dao.TbProjectUseDao;
import io.renren.modules.project.dto.TbProjectUseDTO;
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.stereotype.Service;
import java.util.Map;
/**
* 项目使用表
*
* @author qs sunlightcs@gmail.com
* @since 3.0 2022-06-22
*/
@Service
public class TbProjectUseServiceImpl extends CrudServiceImpl<TbProjectUseDao, TbProjectUseEntity, TbProjectUseDTO> implements TbProjectUseService {
@Override
public QueryWrapper<TbProjectUseEntity> getWrapper(Map<String, Object> params){
QueryWrapper<TbProjectUseEntity> wrapper = new QueryWrapper<>();
if(params.containsKey("projectName") && StringUtils.isNotBlank(params.get("projectName").toString())){
wrapper.like("project_name",params.get("projectName"));
}
if(params.containsKey("resourceName") && StringUtils.isNotBlank(params.get("resourceName").toString())){
wrapper.like("resource_name",params.get("resourceName"));
}
return wrapper;
}
}

View File

@ -105,6 +105,7 @@ public class ResourceController {
@GetMapping("/page")
@ApiOperation("分页查询资源信息")
@LogOperation("分页查询资源信息")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ -129,7 +130,8 @@ public class ResourceController {
}
@GetMapping("/{id}")
@ApiOperation("信息")
@ApiOperation("查询能力资源详细信息")
@LogOperation("查询能力资源详细信息")
public Result<ResourceDTO> get(@PathVariable("id") Long id) {
ResourceDTO data = resourceService.get(id);
return new Result<ResourceDTO>().ok(data);
@ -275,6 +277,7 @@ public class ResourceController {
@GetMapping("ZywMessage")
@ApiOperation("资源转发")
@LogOperation("资源转发")
public Result ZywMessage() {
String url = "http://15.72.158.81/zyjk/ZywMessage.asmx";
String parame = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
@ -302,6 +305,7 @@ public class ResourceController {
@GetMapping("ZywMessage/list")
@ApiOperation("资源列表转发")
@LogOperation("资源列表转发")
public Result ZywMessageList(@ApiParam("页数") Integer page,
@ApiParam("页大小") Integer size,
@ApiParam("排序字段fbrq发布日期syqk申请数量") String pxcol,
@ -354,6 +358,7 @@ public class ResourceController {
@GetMapping("qdyjjWeather")
@ApiOperation("青岛应急局-查询青岛市地区天气信息")
@LogOperation("青岛应急局-查询青岛市地区天气信息")
public Result qdyjjWeather(String cityName) {
String loginUrl = "http://" + ipAndPort + "/service-oauth/login";
String weatherUrl = "http://" + ipAndPort + "/service-map/qxWeather/getTodayWeatherInfo";
@ -383,6 +388,7 @@ public class ResourceController {
@GetMapping("knowledgeBase")
@ApiOperation("对接知识库数据")
@LogOperation("对接知识库数据")
public Result<String> knowledgeBase() {
resourceService.KnowledgeBase();
return new Result().ok("任务开启成功!");
@ -416,6 +422,8 @@ public class ResourceController {
*/
@GetMapping("/hls/getHls")
@ApiOperation("获取hls地址")
@LogOperation("获取hls地址")
public Result<String> getHls(String key) {
Optional<AbstractVideoPreviewService> factory = VideoPreviewFactory.build();
if (factory.isPresent()) {

View File

@ -0,0 +1,146 @@
package io.renren.modules.resource.controller;
import com.alibaba.fastjson.JSONObject;
import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
import io.renren.common.utils.ExcelUtils;
import io.renren.common.utils.Result;
import io.renren.common.validator.AssertUtils;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.resource.dto.TbDataResourceRelDTO;
import io.renren.modules.resource.excel.TbDataResourceRelExcel;
import io.renren.modules.resource.service.TbDataResourceRelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 组件-应用资源关系表
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-06-21
*/
@RestController
@RequestMapping("/dataResourceRel")
@Api(tags="组件-应用资源关系表")
public class TbDataResourceRelController {
@Autowired
private TbDataResourceRelService tbDataResourceRelService;
@GetMapping("/page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
})
// @RequiresPermissions("dataResourceRel:tbdataresourcerel:page")
public Result<PageData<TbDataResourceRelDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<TbDataResourceRelDTO> page = tbDataResourceRelService.page(params);
return new Result<PageData<TbDataResourceRelDTO>>().ok(page);
}
@GetMapping("/select/{id}")
@ApiOperation("信息")
// @RequiresPermissions("dataResourceRel:tbdataresourcerel:info")
public Result<TbDataResourceRelDTO> get(@PathVariable("id") Long id){
TbDataResourceRelDTO data = tbDataResourceRelService.get(id);
return new Result<TbDataResourceRelDTO>().ok(data);
}
@PostMapping("/insert")
@ApiOperation("保存")
@LogOperation("保存")
// @RequiresPermissions("dataResourceRel:tbdataresourcerel:save")
public Result save(@RequestBody TbDataResourceRelDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
tbDataResourceRelService.save(dto);
return new Result();
}
@PutMapping("/ubdate")
@ApiOperation("修改")
@LogOperation("修改")
// @RequiresPermissions("dataResourceRel:tbdataresourcerel:update")
public Result update(@RequestBody TbDataResourceRelDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
tbDataResourceRelService.update(dto);
return new Result();
}
@DeleteMapping("/delete")
@ApiOperation("删除")
@LogOperation("删除")
// @RequiresPermissions("dataResourceRel:tbdataresourcerel:delete")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
tbDataResourceRelService.delete(ids);
return new Result();
}
@GetMapping("/export")
@ApiOperation("导出")
@LogOperation("导出")
// @RequiresPermissions("dataResourceRel:tbdataresourcerel:export")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<TbDataResourceRelDTO> list = tbDataResourceRelService.list(params);
ExcelUtils.exportExcelToTarget(response, null, "组件-应用资源关系表", list, TbDataResourceRelExcel.class);
}
@GetMapping("/queryApplicationRelByResourceId")
@ApiOperation("根据资源id查询应用关联情况")
@LogOperation("根据资源id查询应用关联情况")
public Result queryApplicationRelByResourceId(@RequestParam("referenceId") Long referenceId,
@RequestParam(value = "keyName",required = false) String keyName){
Object data = tbDataResourceRelService.queryApplicationRelByResourceId(referenceId,keyName);
return new Result().ok(data);
}
@GetMapping("/queryResourceRelByKeyId")
@ApiOperation("根据应用id和资源类型查询资源管理情况")
@LogOperation("根据应用id和资源类型查询资源管理情况")
public Result queryResourceRelByKeyId(@RequestParam("keyId") Long keyId,
@RequestParam("type") String type,
@RequestParam(value = "referenceName" ,required = false) String referenceName){
Object data = tbDataResourceRelService.queryResourceRelByKeyId(keyId,type,referenceName);
return new Result().ok(data);
}
@PostMapping("/saveDataResourceRel")
@ApiOperation("保存应用与组件的关联关系")
@LogOperation("保存应用与组件的关联关系")
public Result saveDataResourceRel(@RequestBody JSONObject param){
Object data = tbDataResourceRelService.saveDataResourceRel(param);
return new Result().ok(data);
}
}

View File

@ -0,0 +1,36 @@
package io.renren.modules.resource.dao;
import io.renren.common.dao.BaseDao;
import io.renren.modules.resource.entity.TbDataResourceRelEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 组件-应用资源关系表
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-06-21
*/
@Mapper
public interface TbDataResourceRelDao extends BaseDao<TbDataResourceRelEntity> {
List<Map> getAlreadLinkedApplication(@Param("referenceId") Long referenceId,@Param("keyName") String keyName);
List<Map> getNotLinkedApplication(@Param("referenceId")Long referenceId,@Param("keyName") String keyName);
List<Map> getAlreadLinkedResource(@Param("keyId")Long keyId,@Param("type") String type,@Param("referenceName") String referenceName);
List<Map> getNotLinkedResource(@Param("keyId")Long keyId,@Param("type") String type,@Param("referenceName") String referenceName);
void deleteAllByKeyId(@Param("keyId")Long id, @Param("userId") Long userId,@Param("updateDate") Date updateDate);
void deleteAllByreferenceId(@Param("referenceId")Long id, @Param("userId")Long userId,@Param("updateDate")Date updateDate);
List<Map> getAlreadLinkedProject(@Param("keyId")Long keyId,@Param("projectName") String projectName);
List<Map> getNotLinkedProject(@Param("keyId")Long keyId,@Param("projectName") String projectName);
}

View File

@ -1,11 +1,13 @@
package io.renren.modules.resource.dto;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 数据资源查询参数对象
*/
@Data
@Accessors(chain=true)
public class GetDataResourceListDto {
//名称模糊查询

View File

@ -0,0 +1,44 @@
package io.renren.modules.resource.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 组件-应用资源关系表
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-06-21
*/
@Data
@ApiModel(value = "组件-应用资源关系表")
public class TbDataResourceRelDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "应用资源id")
private Long keyId;
@ApiModelProperty(value = "关联id")
private Long referenceId;
@ApiModelProperty(value = "删除标志0:正常1:已删除2:待审核3:审核中9其他")
private Integer delFlag;
@ApiModelProperty(value = "创建人")
private Long creator;
@ApiModelProperty(value = "创建时间")
private Date createDate;
@ApiModelProperty(value = "修改人")
private Long updater;
@ApiModelProperty(value = "修改时间")
private Date updateDate;
@ApiModelProperty(value = "id")
private Long id;
//新增展示字段
@ApiModelProperty(value = "应用资源名称")
private String keyName;
@ApiModelProperty(value = "关联资源名称")
private String referenceName;
}

View File

@ -87,7 +87,6 @@ public class ResourceEntity extends BaseEntity {
* 删除标志0:正常1:已删除9其他
*/
private Integer delFlag;
/**
* 修改人
*/

View File

@ -0,0 +1,62 @@
package io.renren.modules.resource.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.*;
import java.util.Date;
/**
* 组件-应用资源关系表
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-06-21
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("tb_data_resource_rel")
public class TbDataResourceRelEntity {
private static final long serialVersionUID = 1L;
/**
* 应用资源id
*/
private Long keyId;
/**
* 关联id
*/
private Long referenceId;
/**
* 删除标志
0:正常
1:已删除
2:待审核
3:审核中
9其他
*/
private Integer delFlag;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
private Long creator;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
private Date createDate;
/**
* 修改人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Long updater;
/**
* 修改时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
/**
* id
*/
@TableId
private Long id;
}

View File

@ -0,0 +1,37 @@
package io.renren.modules.resource.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.util.Date;
/**
* 组件-应用资源关系表
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-06-21
*/
@Data
@ContentRowHeight(20)
@HeadRowHeight(20)
@ColumnWidth(25)
public class TbDataResourceRelExcel {
@ExcelProperty(value = "应用资源id", index = 0)
private Long keyId;
@ExcelProperty(value = "关联id", index = 1)
private Long referenceId;
@ExcelProperty(value = "删除标志0:正常1:已删除2:待审核3:审核中9其他", index = 2)
private Integer delFlag;
@ExcelProperty(value = "创建人", index = 3)
private Long creator;
@ExcelProperty(value = "创建时间", index = 4)
private Date createDate;
@ExcelProperty(value = "修改人", index = 5)
private Long updater;
@ExcelProperty(value = "修改时间", index = 6)
private Date updateDate;
@ExcelProperty(value = "id", index = 7)
private Long id;
}

View File

@ -0,0 +1,23 @@
package io.renren.modules.resource.service;
import com.alibaba.fastjson.JSONObject;
import io.renren.common.service.CrudService;
import io.renren.modules.resource.dto.TbDataResourceRelDTO;
import io.renren.modules.resource.entity.TbDataResourceRelEntity;
import java.util.List;
/**
* 组件-应用资源关系表
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-06-21
*/
public interface TbDataResourceRelService extends CrudService<TbDataResourceRelEntity, TbDataResourceRelDTO> {
Object queryApplicationRelByResourceId(Long referenceId, String keyName);
Object queryResourceRelByKeyId(Long keyId, String type, String referenceName);
Object saveDataResourceRel(JSONObject param);
}

View File

@ -147,8 +147,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
wrapper.in(true, "del_flag", 0, 5);
}
}
wrapper.orderByAsc("del_flag")
.orderByDesc("create_date");
wrapper.orderByAsc("del_flag").orderByDesc("create_date");
return wrapper;
}
@ -213,8 +212,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
return null;
}
QueryWrapper<AttrEntity> wrapper = new QueryWrapper<>();
wrapper.eq("data_resource_id", id)
.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag());
wrapper.eq("data_resource_id", id).eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag());
List<AttrEntity> attrEntities = attrDao.selectList(wrapper);
resourceDTO.setInfoList(attrEntities == null ? new ArrayList<>() : attrEntities); // npe?
return resourceDTO;
@ -259,89 +257,45 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
if ("基础设施".equals(resourceDTO.getType())) { // 基础设施
logger.info("西海岸基础设施");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
CompletableFuture cloud =
CompletableFuture.runAsync(() -> { // 云脑专网
OkHttpClient client = new OkHttpClient();
String url = String.format(tsingtao_xhaProperties.getCloudcam(), resourceDTO.getName(), pageNum, pageSize);
logger.info(url);
Request request = new Request.Builder().url(url).build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
JSONObject jsonObject_ = JSON.parseObject(response.body().string());
if (jsonObject_.containsKey("data")) {
if (jsonObject_.getJSONObject("data").containsKey("list")) {
resultPage.setTotal(jsonObject_.getJSONObject("data").getLongValue("total"));
resultPage.setRecords(jsonObject_.getJSONObject("data").getJSONArray("list").stream().map(index -> (JSONObject) JSON.toJSON(index))
.map(index -> {
ResourceDTO resourceDTO1 = new ResourceDTO();
resourceDTO1.setId(Long.valueOf(index.getString("id")));
resourceDTO1.setDelFlag(index.getIntValue("delFlag"));
resourceDTO1.setLink(index.getString("cameraIndexCode"));
resourceDTO1.setName(index.getString("name"));
resourceDTO1.setType("基础设施");
try {
resourceDTO1.setCreateDate(sdf.parse(index.getString("createdTime")));
} catch (ParseException e) {
logger.error("时间异常");
resourceDTO1.setCreateDate(new Date());
}
return resourceDTO1;
}).collect(Collectors.toList()));
} else {
resultPage.setRecords(null);
resultPage.setTotal(0);
}
OkHttpClient client = new OkHttpClient();
String url = String.format(tsingtao_xhaProperties.getCloudcam(), org.apache.commons.lang3.StringUtils.isNotEmpty(resourceDTO.getName()) ? resourceDTO.getName() : "", pageNum, pageSize);
logger.info(url);
Request request = new Request.Builder().url(url).build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
String body = response.body().string();
JSONObject jsonObject_ = JSON.parseObject(body);
logger.info("西海岸接口返回:{}" + body, url);
if (jsonObject_.containsKey("data")) {
if (jsonObject_.getJSONObject("data").containsKey("list")) {
resultPage.setTotal(jsonObject_.getJSONObject("data").getLongValue("total"));
resultPage.setRecords(jsonObject_.getJSONObject("data").getJSONArray("list").stream().map(index -> (JSONObject) JSON.toJSON(index)).map(index -> {
ResourceDTO resourceDTO1 = new ResourceDTO();
resourceDTO1.setId(Long.valueOf(index.getString("id")));
resourceDTO1.setDelFlag(index.getIntValue("delFlag"));
resourceDTO1.setLink(index.getString("cameraIndexCode"));
resourceDTO1.setName(index.getString("name"));
resourceDTO1.setType("基础设施");
try {
resourceDTO1.setCreateDate(sdf.parse(index.getString("createdTime")));
} catch (ParseException e) {
logger.error("时间异常");
resourceDTO1.setCreateDate(new Date());
}
} else {
logger.error("获取失败");
}
} catch (Exception exception) {
logger.error("失败", exception);
return resourceDTO1;
}).collect(Collectors.toList()));
} else {
resultPage.setRecords(new ArrayList<>());
resultPage.setTotal(0);
}
});
CompletableFuture local =
CompletableFuture.runAsync(() -> { // 金宏网
OkHttpClient client = new OkHttpClient();
String url = String.format(tsingtao_xhaProperties.getLocalcam(), resourceDTO.getName(), pageNum, pageSize);
logger.info(url);
Request request = new Request.Builder().url(url).build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
JSONObject jsonObject_ = JSON.parseObject(response.body().string());
if (jsonObject_.containsKey("data")) {
if (jsonObject_.getJSONObject("data").containsKey("list")) {
resultPage.setTotal(jsonObject_.getJSONObject("data").getLongValue("total"));
resultPage.setRecords(jsonObject_.getJSONObject("data").getJSONArray("list").stream().map(index -> (JSONObject) JSON.toJSON(index))
.map(index -> {
ResourceDTO resourceDTO1 = new ResourceDTO();
resourceDTO1.setId(Long.valueOf(index.getString("id")));
resourceDTO1.setDelFlag(index.getIntValue("delFlag"));
resourceDTO1.setLink(index.getString("cameraIndexCode"));
resourceDTO1.setName(index.getString("name"));
resourceDTO1.setType("基础设施");
try {
resourceDTO1.setCreateDate(sdf.parse(index.getString("createdTime")));
} catch (ParseException e) {
logger.error("时间异常");
resourceDTO1.setCreateDate(new Date());
}
return resourceDTO1;
}).collect(Collectors.toList()));
} else {
resultPage.setRecords(null);
resultPage.setTotal(0);
}
}
} else {
logger.error("获取失败");
}
} catch (Exception exception) {
logger.error("失败", exception);
}
});
CompletableFuture.allOf(cloud, local);
}
} else {
logger.error("获取失败");
}
} catch (Exception exception) {
logger.error("失败", exception);
}
} else {
logger.info("西海岸基普通");
if (resourceDTO.getInfoList().isEmpty()) {
@ -373,16 +327,70 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
public List<AttrEntity> selectAttrsByResourceId(Long resourceId) {
QueryWrapper<AttrEntity> wrapper = new QueryWrapper<>();
wrapper.eq("data_resource_id", resourceId)
.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag())
.orderByDesc("attr_type");
wrapper.eq("data_resource_id", resourceId).eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()).orderByDesc("attr_type");
return attrDao.selectList(wrapper);
}
@Override
public Object selectTotal() {
HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("total", resourceDao.selectTypeCount(null));
List<Map> re = resourceDao.selectTypeCount(null);
switch (Constant.ProjectPlace.getByFlag(projectPlace)) {
case TSINGTAO_XHA: { // 青岛西海岸
CompletableFuture allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目
List<Long> result_ = new CopyOnWriteArrayList<>();
CompletableFuture cloud =
CompletableFuture.runAsync(() -> { // 云脑专网
OkHttpClient client = new OkHttpClient();
String url = String.format(tsingtao_xhaProperties.getCloudcam(), "", 1, 10);
logger.info(url);
Request request = new Request.Builder().url(url).build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
JSONObject jsonObject = JSON.parseObject(response.body().string());
if (jsonObject.containsKey("data")) {
result_.add(jsonObject.getJSONObject("data").getLongValue("total"));
}
} else {
logger.error("青岛西海岸获取失败");
}
} catch (Exception exception) {
logger.error("青岛西海岸失败", exception);
}
});
CompletableFuture local =
CompletableFuture.runAsync(() -> { // 金宏网
OkHttpClient client = new OkHttpClient();
String url = String.format(tsingtao_xhaProperties.getLocalcam(), "", 1, 10);
logger.info(url);
Request request = new Request.Builder().url(url).build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
JSONObject jsonObject = JSON.parseObject(response.body().string());
if (jsonObject.containsKey("data")) {
result_.add(jsonObject.getJSONObject("data").getLongValue("total"));
}
} else {
logger.error("青岛西海岸获取失败");
}
} catch (Exception exception) {
logger.error("青岛西海岸失败", exception);
}
});
CompletableFuture.allOf(cloud, local);
return result_.stream().filter(index -> index != null).findAny().orElse(0l);
}).thenAccept(sum -> {
re.add(new HashMap<String, Object>() {
{
put("count", sum + "");
put("type", "基础设施");
}
});
});
allAmount.join();
}
}
resultMap.put("total", re);
return resultMap;
}
@ -391,9 +399,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
public Object selectNewest(JSONObject jsonObject) {
IPage<ResourceEntity> page = new Page<>(jsonObject.getIntValue("pageNum"), jsonObject.getIntValue("pageSize"));
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type"))
.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag())
.orderByDesc("create_date");
queryWrapper.eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type")).eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()).orderByDesc("create_date");
return resourceDao.selectPage(page, queryWrapper);
}
@ -405,8 +411,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
List<ResourceDTO> resourceDTOS = resourceDao.selectMostPopular(selectMap);
page.setRecords(resourceDTOS);
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag())
.eq("type", jsonObject.getString("type"));
queryWrapper.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()).eq("type", jsonObject.getString("type"));
Integer count = resourceDao.selectCount(queryWrapper);
page.setTotal(count);
return page;
@ -419,9 +424,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
ResourceEntity entity = new ResourceEntity();
entity.setVisits((resourceEntity.getVisits() == null ? 0 : resourceEntity.getVisits()) + 1);
UpdateWrapper<ResourceEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.lambda()
.eq(ResourceEntity::getId, resourceEntity.getId())
.eq(ResourceEntity::getDelFlag, ResourceEntityDelFlag.NORMAL.getFlag());
updateWrapper.lambda().eq(ResourceEntity::getId, resourceEntity.getId()).eq(ResourceEntity::getDelFlag, ResourceEntityDelFlag.NORMAL.getFlag());
resourceDao.update(entity, updateWrapper);
ResourceBrowseEntity browseEntity = new ResourceBrowseEntity();
browseEntity.setResourceId(id);
@ -489,16 +492,14 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
HashMap<String, Object> resourceMap = new HashMap<>();
resourceMap.put("type", "全部能力目录");
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("del_flag", 0)
.eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type"));
queryWrapper.eq("del_flag", 0).eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type"));
resourceMap.put("total", resourceDao.selectCount(queryWrapper));
resultList.add(resourceMap);
List<Map<String, Object>> typeMapList = resourceDao.selectGroupByDeptId(jsonObject.getString("type"));
if (typeMapList.isEmpty()) {
return resultList;
}
Map<String, List<Map<String, Object>>> listMap = typeMapList.stream()
.collect(Collectors.groupingBy(m -> m.get("type").toString()));
Map<String, List<Map<String, Object>>> listMap = typeMapList.stream().collect(Collectors.groupingBy(m -> m.get("type").toString()));
//区级要根据行政区划多加一层结构
listMap.entrySet().stream().filter(index -> !"区级".equals(index.getKey())).forEach(item -> {
HashMap<String, Object> map = new HashMap<>();
@ -512,8 +513,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
}
});
Optional<List<Map<String, Object>>> areaList = Optional.ofNullable(listMap.get("区级"));
Optional<Map<String, List<Map<String, Object>>>> areaTypeList = Optional.ofNullable(areaList.orElse(new ArrayList<>()).stream()
.collect(Collectors.groupingBy(m -> m.get("districtName").toString())));
Optional<Map<String, List<Map<String, Object>>>> areaTypeList = Optional.ofNullable(areaList.orElse(new ArrayList<>()).stream().collect(Collectors.groupingBy(m -> m.get("districtName").toString())));
HashMap<Object, Object> areaMap = new HashMap<>();
areaMap.put("type", "区级");
Integer integer = resourceDao.selectTypeCountByDept("区级", jsonObject.getString("type"));
@ -709,9 +709,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
*/
@Override
public void KnowledgeBase() {
final List<String> knowledgeUUID =
jdbcTemplate.queryForList("SELECT note1 FROM tb_data_resource WHERE type ='知识库' AND note1 IS NOT NULL FOR UPDATE;", String.class)
.stream().distinct().collect(Collectors.toList());
final List<String> knowledgeUUID = jdbcTemplate.queryForList("SELECT note1 FROM tb_data_resource WHERE type ='知识库' AND note1 IS NOT NULL FOR UPDATE;", String.class).stream().distinct().collect(Collectors.toList());
final int pageSize = 100;
final OkHttpClient client = new OkHttpClient();
Arrays.stream(catalogIds).map(index -> {
@ -735,19 +733,11 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
String bizContent_ = bizContentParam.toJSONString();
logger.info("biz_content参数{}", bizContent_);
// 通过FormBody对象构建Builder来添加表单参数
FormBody.Builder signFormBody = new FormBody.Builder()
.add("app_id", appId)
.add("interface_id", methodId)
.add("version", version)
.add("timestamp", String.valueOf(timestamp))
.add("origin", origin)
.add("charset", charset)
.add("biz_content", bizContent_);
FormBody.Builder signFormBody = new FormBody.Builder().add("app_id", appId).add("interface_id", methodId).add("version", version).add("timestamp", String.valueOf(timestamp)).add("origin", origin).add("charset", charset).add("biz_content", bizContent_);
logger.info(index + "分页{}对接知识库数据请求参数:" + signFormBody.build().contentType().toString(), page);
Request signRequest = new Request.Builder().url(sign).post(signFormBody.build()).build();
Response signResponse =
client.newCall(signRequest).execute();
Response signResponse = client.newCall(signRequest).execute();
String signResult = signResponse.body().string();
logger.info("{}分页signResult数据" + signResult, page);
JSONObject signJsonObject = JSON.parseObject(signResult);

View File

@ -0,0 +1,129 @@
package io.renren.modules.resource.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.constant.Constant;
import io.renren.modules.resource.dao.TbDataResourceRelDao;
import io.renren.modules.resource.dto.TbDataResourceRelDTO;
import io.renren.modules.resource.entity.TbDataResourceRelEntity;
import io.renren.modules.resource.service.TbDataResourceRelService;
import io.renren.modules.security.user.SecurityUser;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
/**
* 组件-应用资源关系表
*
* @author Mark sunlightcs@gmail.com
* @since 3.0 2022-06-21
*/
@Service
public class TbDataResourceRelServiceImpl extends CrudServiceImpl<TbDataResourceRelDao, TbDataResourceRelEntity, TbDataResourceRelDTO> implements TbDataResourceRelService {
@Autowired
private TbDataResourceRelDao tbDataResourceRelDao;
@Override
public QueryWrapper<TbDataResourceRelEntity> getWrapper(Map<String, Object> params){
QueryWrapper<TbDataResourceRelEntity> wrapper = new QueryWrapper<>();
return wrapper;
}
@Override
public Object queryApplicationRelByResourceId(Long referenceId, String keyName) {
Map<String,Object> result = new HashMap<>();
//查询已关联的应用
List<Map> alreadLinked = tbDataResourceRelDao.getAlreadLinkedApplication(referenceId,keyName);
//查询未关联的应用
List<Map> notLinked = tbDataResourceRelDao.getNotLinkedApplication(referenceId,keyName);
result.put("alreadLinked",alreadLinked);
result.put("notLinked",notLinked);
return result;
}
@Override
public Object queryResourceRelByKeyId(Long keyId, String type, String referenceName) {
Map<String,Object> result = new HashMap<>();
//查询已关联的应用
List<Map> alreadLinked = new ArrayList<>();
//查询未关联的应用
List<Map> notLinked = new ArrayList<>();
switch (type){
case "项目":
alreadLinked = tbDataResourceRelDao.getAlreadLinkedProject(keyId,referenceName);
notLinked = tbDataResourceRelDao.getNotLinkedProject(keyId,referenceName);
break;
default:
alreadLinked = tbDataResourceRelDao.getAlreadLinkedResource(keyId,type,referenceName);
notLinked = tbDataResourceRelDao.getNotLinkedResource(keyId,type,referenceName);
break;
}
result.put("alreadLinked",alreadLinked);
result.put("notLinked",notLinked);
return result;
}
@Override
@Transactional
public Object saveDataResourceRel(JSONObject param) {
//关联类型1应用资源关联其他资源2其他资源关联应用资源
String linkType = param.getString("linkType");
Long id = param.getLong("id");
List<Long> referenceIds = JSONArray.parseArray(param.getString("referenceIds"),Long.class);
Long userId = SecurityUser.getUser().getId();
switch (linkType){
case "1":
//应用资源关联其他资源
//id为应用资源id即表中的key_idreferenceIds中为表中的reference_id
//先删除所有已关联的内容
tbDataResourceRelDao.deleteAllByKeyId(id,userId,new Date());
//新增关联关系
if(CollectionUtils.isNotEmpty(referenceIds)){
List<TbDataResourceRelEntity> resourceRels = new ArrayList<>();
for(Long referenceId:referenceIds){
TbDataResourceRelEntity resourceRel = new TbDataResourceRelEntity();
resourceRel.setKeyId(id);
resourceRel.setReferenceId(referenceId);
tbDataResourceRelDao.insert(resourceRel);
}
}
break;
case "2":
//其他资源关联应用资源
//id为其他资源id即表中的reference_idreferenceIds中为表中的key_id
//先删除所有已关联的内容
tbDataResourceRelDao.deleteAllByreferenceId(id,userId,new Date());
//新增关联关系
if(CollectionUtils.isNotEmpty(referenceIds)){
List<TbDataResourceRelEntity> resourceRels = new ArrayList<>();
for(Long referenceId:referenceIds){
TbDataResourceRelEntity resourceRel = new TbDataResourceRelEntity();
resourceRel.setKeyId(referenceId);
resourceRel.setReferenceId(id);
tbDataResourceRelDao.insert(resourceRel);
}
}
break;
default:
return "关联类型参数错误,请检查关联类型参数";
}
return null;
}
}

View File

@ -12,7 +12,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CopyOnWriteArrayList;
@ -36,41 +35,21 @@ public class TsingtaoXHAVideoPreviewService extends AbstractVideoPreviewService
@Override
public String getHls(String key) {
List<String> result = new CopyOnWriteArrayList<>();
CompletableFuture cloud =
CompletableFuture.runAsync(() -> { // 云脑专网
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder().url(String.format(tsingtao_xhaProperties.getCloudhls(), key)).build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
JSONObject jsonObject = JSON.parseObject(response.body().string());
if (jsonObject.containsKey("data")) {
result.add(jsonObject.getString("data"));
}
} else {
logger.error("西海岸预览地址获取失败");
}
} catch (Exception exception) {
logger.error("西海岸预览地址获取失败", exception);
}
});
CompletableFuture local =
CompletableFuture.runAsync(() -> { // 金宏网
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder().url(String.format(tsingtao_xhaProperties.getLocalhls(), key)).build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
JSONObject jsonObject = JSON.parseObject(response.body().string());
if (jsonObject.containsKey("data")) {
result.add(jsonObject.getString("data"));
}
} else {
logger.error("西海岸预览地址获取失败");
}
} catch (Exception exception) {
logger.error("西海案预览地址获取失败", exception);
}
});
CompletableFuture.allOf(cloud, local);
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder().url(String.format(tsingtao_xhaProperties.getCloudhls(), key)).build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful()) {
JSONObject jsonObject = JSON.parseObject(response.body().string());
if (jsonObject.containsKey("data")) {
result.add(jsonObject.getString("data"));
}
} else {
logger.error("西海岸预览地址获取失败");
}
} catch (Exception exception) {
logger.error("西海岸预览地址获取失败", exception);
}
return result.stream().filter(index -> StringUtils.isNotEmpty(index)).findAny().orElse(null);
}
}

View File

@ -1,5 +1,6 @@
package io.renren.modules.security.controller;
import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant;
import io.renren.common.exception.ErrorCode;
import io.renren.common.exception.RenException;
@ -74,6 +75,7 @@ public class LoginController {
@GetMapping("login")
@ApiOperation(value = "登录")
@LogOperation("登录")
@ApiImplicitParams({
@ApiImplicitParam(name = "username", value = "登录名称", paramType = "query", required = true, dataType = "String"),
@ApiImplicitParam(name = "password", value = "密码", paramType = "query", required = true, dataType = "String"),
@ -150,6 +152,7 @@ public class LoginController {
@PostMapping("logout")
@ApiOperation(value = "退出")
@LogOperation("/退出")
public Result logout(HttpServletRequest request, HttpServletResponse response) {
UserDetail user = SecurityUser.getUser();

View File

@ -51,7 +51,11 @@ spring:
wall:
config:
multi-statement-allow: true
flyway:
enabled: true
validate-on-migrate: false
# 允许乱序执行
out-of-order: true
#上传的静态资源配置
resource:
root_url: 15.2.21.238

View File

@ -61,6 +61,7 @@ spring:
locations: filesystem:config/db
baseline-on-migrate: true
baseline-version: 0
validate-on-migrate: true
fdfs:

View File

@ -0,0 +1,77 @@
CREATE TABLE `tb_project` (
`id` bigint(20) NOT NULL COMMENT '主键',
`project_name` varchar(128) DEFAULT NULL COMMENT '项目名称',
`apply_dep` varchar(128) DEFAULT NULL COMMENT '申请单位',
`apply_user` varchar(128) DEFAULT NULL COMMENT '申请人',
`apply_time` datetime DEFAULT NULL COMMENT '申请时间',
`region_name` varchar(128) DEFAULT NULL COMMENT '所属区市',
`resp_dep` varchar(128) DEFAULT NULL COMMENT '责任处室',
`business_user` varchar(128) DEFAULT NULL COMMENT '业务联系人',
`business_phone` varchar(32) DEFAULT NULL COMMENT '业务联系电话',
`tech_user` varchar(128) DEFAULT NULL COMMENT '技术联系人',
`tech_phone` varchar(32) DEFAULT NULL COMMENT '技术联系电话',
`creator` bigint(20) DEFAULT NULL COMMENT '创建人',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`updater` bigint(20) DEFAULT NULL COMMENT '修改人',
`update_date` datetime DEFAULT NULL COMMENT '修改时间',
`note1` longtext COMMENT '备用字段',
`note2` varchar(200) DEFAULT NULL COMMENT '备用字段',
`note3` varchar(500) DEFAULT NULL COMMENT '备用字段',
`note4` varchar(1000) DEFAULT NULL COMMENT '备用字段',
`note5` varchar(2000) DEFAULT NULL COMMENT '备用字段',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='项目表';
CREATE TABLE `tb_project_contrib` (
`id` bigint(20) NOT NULL COMMENT '主键',
`project_name` varchar(128) DEFAULT NULL COMMENT '项目名称',
`resource_name` varchar(128) DEFAULT NULL COMMENT '应用名称',
`ability_name` varchar(128) DEFAULT NULL COMMENT '能力名称',
`ability_type` varchar(64) DEFAULT NULL COMMENT '能力类型',
`apply_time` datetime DEFAULT NULL COMMENT '上架时间',
`apply_num` varchar(10) DEFAULT NULL COMMENT '申请次数',
`browse_num` varchar(10) DEFAULT NULL COMMENT '浏览次数',
`creator` bigint(20) DEFAULT NULL COMMENT '创建人',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`updater` bigint(20) DEFAULT NULL COMMENT '修改人',
`update_date` datetime DEFAULT NULL COMMENT '修改时间',
`note1` longtext COMMENT '备用字段',
`note2` varchar(200) DEFAULT NULL COMMENT '备用字段',
`note3` varchar(500) DEFAULT NULL COMMENT '备用字段',
`note4` varchar(1000) DEFAULT NULL COMMENT '备用字段',
`note5` varchar(2000) DEFAULT NULL COMMENT '备用字段',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='项目贡献表';
CREATE TABLE `tb_project_use` (
`id` bigint(20) NOT NULL COMMENT '主键',
`project_name` varchar(128) DEFAULT NULL COMMENT '项目名称',
`resource_name` varchar(128) DEFAULT NULL COMMENT '应用名称',
`ability_name` varchar(128) DEFAULT NULL COMMENT '能力名称',
`ability_type` varchar(64) DEFAULT NULL COMMENT '能力类型',
`apply_time` datetime DEFAULT NULL COMMENT '上架时间',
`apply_num` varchar(10) DEFAULT NULL COMMENT '申请次数',
`browse_num` varchar(10) DEFAULT NULL COMMENT '浏览次数',
`creator` bigint(20) DEFAULT NULL COMMENT '创建人',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`updater` bigint(20) DEFAULT NULL COMMENT '修改人',
`update_date` datetime DEFAULT NULL COMMENT '修改时间',
`note1` longtext COMMENT '备用字段',
`note2` varchar(200) DEFAULT NULL COMMENT '备用字段',
`note3` varchar(500) DEFAULT NULL COMMENT '备用字段',
`note4` varchar(1000) DEFAULT NULL COMMENT '备用字段',
`note5` varchar(2000) DEFAULT NULL COMMENT '备用字段',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='项目使用表';
CREATE TABLE `tb_data_resource_rel` (
`key_id` bigint(20) DEFAULT NULL COMMENT '应用资源id',
`reference_id` bigint(20) DEFAULT NULL COMMENT '关联id',
`del_flag` int(11) DEFAULT '0' COMMENT '删除标志:\r\n0:正常;\r\n1:已删除;\r\n2:待审核;\r\n3:审核中;\r\n9其他',
`creator` bigint(20) DEFAULT NULL COMMENT '创建人',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`updater` bigint(20) DEFAULT NULL COMMENT '修改人',
`update_date` datetime DEFAULT NULL COMMENT '修改时间',
`id` bigint(20) NOT NULL COMMENT 'id',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='组件-应用资源关系表';

View File

@ -0,0 +1 @@
ALTER TABLE `t_demand_comment` ADD COLUMN `del_flag` int(11) NULL COMMENT '删除标志:\r\n0:正常;\r\n1:已删除;\r\n2:待审核;\r\n3:审核中;\r\n9其他';

View File

@ -0,0 +1 @@
ALTER TABLE `t_demand_comment` ADD COLUMN `instance_id` varchar(64) NULL COMMENT '流程实例ID';

View File

@ -0,0 +1 @@
ALTER TABLE sys_log_operation ADD COLUMN result_data text NULL COMMENT '返回结果';

View File

@ -2,6 +2,6 @@ tsingtao-xha.cloudhls=http://10.10.30.9:8001/hx-weatherwarning/camera/getCameraL
tsingtao-xha.localhls=http://10.134.135.9:8001/hx-weatherwarning/camera/getCameraLiveStreamByCode?cameraCode=%s&protocol=hls
tsingtao-xha.cloudcam=http://10.10.30.9:8001/hx-weather-warning/camera/getCameraListByName?name=%s&pageNo=%d&pageSize=%d
tsingtao-xha.localcam=http://10.134.135.9:8001/hx-weather-warning/camera/getCameraListByName?name=%s&pageNo=%d&pageSize=%d
tsingtao-xha.resourcecount=http://10.16.3.224:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=&type=&orderField=requestNum&orderType=desc&pageNum=1&pageSize=10&serviceType=data&rq=1655106309671.43
tsingtao-xha.resourceapplyinfo=http://10.134.135.24:30058/shareportal/platform/index/abilityMarket/count
tsingtao-xha.sjzy=http://10.16.3.224:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=%s&type=&orderField=%s&orderType=%s&pageNum=%s&pageSize=%s&serviceType=data&rq=1655106309671.43
tsingtao-xha.resourcecount=http://10.10.30.24:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=&type=&orderField=requestNum&orderType=desc&pageNum=1&pageSize=10&serviceType=data&rq=1655106309671.43
tsingtao-xha.resourceapplyinfo=http://10.10.30.24:30058/share-portal/platform/index/abilityMarket/count
tsingtao-xha.sjzy=http://10.10.30.24:30090/api/share-portal/platform/catalogue/query?catalogueId=&departmentId=&serviceName=%s&type=&orderField=%s&orderType=%s&pageNum=%s&pageSize=%s&serviceType=data&rq=1655106309671.43

View File

@ -19,11 +19,12 @@
</resultMap>
<select id="commentCount" resultType="java.lang.Long">
SELECT
COUNT( id )
COUNT( id )
FROM
t_demand_comment
t_demand_comment
WHERE
target_id = #{dataId};
del_flag = 0
AND target_id = #{dataId};
</select>
</mapper>

View File

@ -0,0 +1,106 @@
<?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.resource.dao.TbDataResourceRelDao">
<resultMap type="io.renren.modules.resource.entity.TbDataResourceRelEntity" id="tbDataResourceRelMap">
<result property="keyId" column="key_id"/>
<result property="referenceId" column="reference_id"/>
<result property="delFlag" column="del_flag"/>
<result property="creator" column="creator"/>
<result property="createDate" column="create_date"/>
<result property="updater" column="updater"/>
<result property="updateDate" column="update_date"/>
<result property="id" column="id"/>
</resultMap>
<select id="getAlreadLinkedApplication" resultType="java.util.Map">
SELECT
tdrr.key_id as id,
tdr.name
FROM tb_data_resource_rel tdrr
left join tb_data_resource tdr on tdrr.key_id = tdr.id
where tdrr.del_flag = 0 and tdr.del_flag = 0
and tdrr.reference_id = #{referenceId}
<if test="keyName != null and keyName != ''">
and tdr.name like CONCAT('%',#{keyName},'%')
</if>
</select>
<select id="getNotLinkedApplication" resultType="java.util.Map">
SELECT
id,
name
FROM tb_data_resource
where del_flag = 0 and type = '应用资源'
and id not in (SELECT key_id FROM tb_data_resource_rel where reference_id = #{referenceId})
<if test="keyName != null and keyName != ''">
and name like CONCAT('%',#{keyName},'%')
</if>
</select>
<select id="getAlreadLinkedResource" resultType="java.util.Map">
SELECT
tdrr.reference_id AS id,
tdr.name
FROM
tb_data_resource_rel tdrr
LEFT JOIN tb_data_resource tdr ON tdrr.reference_id = tdr.id
WHERE
tdrr.del_flag = 0
AND tdr.del_flag = 0
AND tdrr.key_id = #{keyId}
<if test="referenceName != null and referenceName != ''">
AND tdr.name LIKE CONCAT('%',#{referenceName},'%')
</if>
and tdr.type = #{type}
</select>
<select id="getNotLinkedResource" resultType="java.util.Map">
SELECT
id,
name
FROM tb_data_resource
where del_flag = 0 and type = #{type}
and id not in (SELECT reference_id FROM tb_data_resource_rel where key_id = #{keyId})
<if test="referenceName != null and referenceName != ''">
and name like CONCAT('%',#{referenceName},'%')
</if>
</select>
<update id="deleteAllByKeyId">
update tb_data_resource_rel set del_flag = 1,updater = #{userId},update_date = #{updateDate}
where key_id = #{keyId} and del_flag = 0
</update>
<update id="deleteAllByreferenceId">
update tb_data_resource_rel set del_flag = 1,updater = #{userId},update_date = #{updateDate}
where reference_id = #{referenceId} and del_flag = 0
</update>
<select id="getAlreadLinkedProject" resultType="java.util.Map">
SELECT
tdrr.reference_id AS id,
tp.project_name as name
FROM
tb_data_resource_rel tdrr
LEFT JOIN tb_project tp ON tdrr.reference_id = tp.id
WHERE tp.id is not null
and tdrr.del_flag = 0
AND tdrr.key_id = #{keyId}
<if test="projectName != null and projectName != ''">
AND tp.project_name LIKE CONCAT('%',#{projectName},'%')
</if>
</select>
<select id="getNotLinkedProject" resultType="java.util.Map">
SELECT
id,
project_name as name
FROM tb_project
where id not in (SELECT reference_id FROM tb_data_resource_rel where key_id = #{keyId})
<if test="projectName != null and projectName != ''">
and project_name like CONCAT('%',#{projectName},'%')
</if>
</select>
</mapper>

View File

@ -86,4 +86,13 @@ public class Result<T> implements Serializable {
public void setData(T data) {
this.data = data;
}
@Override
public String toString() {
return "Result{" +
"code=" + code +
", msg='" + msg + '\'' +
", data=" + data +
'}';
}
}