This commit is contained in:
dinggang 2022-08-01 16:11:59 +08:00
parent bb3d25d62f
commit 4d8f0c63ae
27 changed files with 205 additions and 362 deletions

View File

@ -5,7 +5,6 @@ import io.renren.common.annotation.ActivitiNoticeOperation;
import io.renren.modules.notice.dto.SysNoticeDTO; import io.renren.modules.notice.dto.SysNoticeDTO;
import io.renren.modules.notice.enums.NoticeStatusEnum; import io.renren.modules.notice.enums.NoticeStatusEnum;
import io.renren.modules.notice.service.SysNoticeService; import io.renren.modules.notice.service.SysNoticeService;
import io.renren.modules.resource.dto.ResourceDTO;
import io.renren.modules.resource.service.ResourceService; import io.renren.modules.resource.service.ResourceService;
import io.renren.modules.sys.dto.SysDeptDTO; import io.renren.modules.sys.dto.SysDeptDTO;
import io.renren.modules.sys.dto.SysRoleDTO; import io.renren.modules.sys.dto.SysRoleDTO;
@ -127,7 +126,7 @@ public class ActivitiNoticeAspect {
*/ */
private void task_complete_notice(final DelegateTask delegateTask, final ActivitiNoticeOperation activitiNoticeOperation) { private void task_complete_notice(final DelegateTask delegateTask, final ActivitiNoticeOperation activitiNoticeOperation) {
Map<String, Object> kv = delegateTask.getVariables(); Map<String, Object> kv = delegateTask.getVariables();
LOGGER.error("表单:" + JSON.toJSONString(kv)); LOGGER.error("表单:{}", JSON.toJSONString(kv));
if (work.contains(TaskListener.EVENTNAME_COMPLETE + kv.get("id").toString())) { if (work.contains(TaskListener.EVENTNAME_COMPLETE + kv.get("id").toString())) {
LOGGER.error("------------出现重放------------"); LOGGER.error("------------出现重放------------");
return; return;
@ -146,7 +145,7 @@ public class ActivitiNoticeAspect {
String result; String result;
Boolean termination = Boolean.valueOf(kv.get("termination") != null ? kv.get("termination").toString() : Boolean.FALSE.toString()); // 直接终结 Boolean termination = Boolean.valueOf(kv.get("termination") != null ? kv.get("termination").toString() : Boolean.FALSE.toString()); // 直接终结
Boolean reject = Boolean.valueOf(kv.get("reject") != null ? kv.get("reject").toString() : Boolean.FALSE.toString()); // 被拒绝 Boolean reject = Boolean.valueOf(kv.get("reject") != null ? kv.get("reject").toString() : Boolean.FALSE.toString()); // 被拒绝
if (termination) { if (Boolean.TRUE.equals(termination)) {
result = "终止被拒"; result = "终止被拒";
} else if (reject) { } else if (reject) {
result = "被拒"; result = "被拒";
@ -157,13 +156,6 @@ public class ActivitiNoticeAspect {
String finalResult = result; String finalResult = result;
CompletableFuture.runAsync(() -> { // 发起人 CompletableFuture.runAsync(() -> { // 发起人
SysUserDTO userDTO = sysUserService.get(Long.valueOf(finalCreator)); SysUserDTO userDTO = sysUserService.get(Long.valueOf(finalCreator));
Long resourceId = null;
if (kv.containsKey("resourceId")) {
resourceId = Long.valueOf(kv.get("resourceId").toString());
} else if (kv.containsKey("id")) {
resourceId = Long.valueOf(kv.get("id").toString());
}
Optional<ResourceDTO> resourceDTO = Optional.ofNullable(resourceService.get(resourceId));
kv.get("resourceId"); kv.get("resourceId");
kv.get("id"); kv.get("id");
String content = "【通知】" + userDTO.getRealName() + ",您发起的" + activitiNoticeOperation.process() + " " + activitiNoticeOperation.value() + "节点" + finalResult; String content = "【通知】" + userDTO.getRealName() + ",您发起的" + activitiNoticeOperation.process() + " " + activitiNoticeOperation.value() + "节点" + finalResult;
@ -205,7 +197,7 @@ public class ActivitiNoticeAspect {
*/ */
private void end_notice(final DelegateExecution execution, final ActivitiNoticeOperation activitiNoticeOperation) { private void end_notice(final DelegateExecution execution, final ActivitiNoticeOperation activitiNoticeOperation) {
Map<String, Object> kv = execution.getVariables(); Map<String, Object> kv = execution.getVariables();
LOGGER.error("表单:" + JSON.toJSONString(kv)); LOGGER.error("表单:{}", JSON.toJSONString(kv));
if (work.contains(ExecutionListener.EVENTNAME_END + kv.get("id").toString())) { if (work.contains(ExecutionListener.EVENTNAME_END + kv.get("id").toString())) {
LOGGER.error("------------出现重放------------"); LOGGER.error("------------出现重放------------");
return; return;
@ -224,24 +216,15 @@ public class ActivitiNoticeAspect {
String result; String result;
Boolean termination = Boolean.valueOf(kv.get("termination") != null ? kv.get("termination").toString() : Boolean.FALSE.toString()); // 直接终结 Boolean termination = Boolean.valueOf(kv.get("termination") != null ? kv.get("termination").toString() : Boolean.FALSE.toString()); // 直接终结
Boolean reject = Boolean.valueOf(kv.get("reject") != null ? kv.get("reject").toString() : Boolean.FALSE.toString()); // 被拒绝 Boolean reject = Boolean.valueOf(kv.get("reject") != null ? kv.get("reject").toString() : Boolean.FALSE.toString()); // 被拒绝
if (termination) { if (Boolean.TRUE.equals(termination)) {
result = "终止被拒"; result = "终止被拒";
} else if (reject) { } else if (Boolean.TRUE.equals(reject)) {
result = "被拒"; result = "被拒";
} else { } else {
result = "通过"; result = "通过";
} }
String finalCreator = creator; String finalCreator = creator;
String finalResult = result; String finalResult = result;
Long resourceId = null;
if (kv.containsKey("resourceId") && kv.get("resourceId") != null) {
resourceId = Long.valueOf(kv.get("resourceId").toString());
} else if (kv.containsKey("id") && kv.get("id") != null && !kv.get("id").toString().contains("-")) {
resourceId = Long.valueOf(kv.get("id").toString());
} else {
resourceId = 0L;
}
Optional<ResourceDTO> resourceDTO = Optional.ofNullable(resourceService.get(resourceId));
CompletableFuture.runAsync(() -> { // 发起人 CompletableFuture.runAsync(() -> { // 发起人
SysUserDTO userDTO = sysUserService.get(Long.valueOf(finalCreator)); SysUserDTO userDTO = sysUserService.get(Long.valueOf(finalCreator));
kv.get("resourceId"); kv.get("resourceId");
@ -261,11 +244,11 @@ public class ActivitiNoticeAspect {
dto.setFrom("通知"); dto.setFrom("通知");
sysNoticeService.save(dto); sysNoticeService.save(dto);
}, EXECUTOR).thenRunAsync(() -> { }, EXECUTOR).thenRunAsync(() -> {
LOGGER.error("大数据局名称:" + bigDateDeptName); LOGGER.error("大数据局名称:{}", bigDateDeptName);
SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName); SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName);
LOGGER.error("deptDTOId:" + deptDTO.getId()); LOGGER.error("deptDTOId:{}", deptDTO.getId());
SysRoleDTO roleDTO = sysRoleService.getByName(roleName); SysRoleDTO roleDTO = sysRoleService.getByName(roleName);
LOGGER.error("roleDTOId:" + roleDTO.getId()); LOGGER.error("roleDTOId:{}", roleDTO.getId());
Optional<SysUserDTO> userDTO = Optional.ofNullable(sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId())); Optional<SysUserDTO> userDTO = Optional.ofNullable(sysUserService.getByDeptIdAndRoleId(deptDTO.getId(), roleDTO.getId()));
userDTO.ifPresent(user -> { userDTO.ifPresent(user -> {
SysUserDTO creatorDTO = sysUserService.get(Long.valueOf(finalCreator)); SysUserDTO creatorDTO = sysUserService.get(Long.valueOf(finalCreator));
@ -310,7 +293,7 @@ public class ActivitiNoticeAspect {
*/ */
private void assignment_notice(final DelegateTask delegateTask, final ActivitiNoticeOperation activitiNoticeOperation) { private void assignment_notice(final DelegateTask delegateTask, final ActivitiNoticeOperation activitiNoticeOperation) {
Map<String, Object> kv = delegateTask.getVariables(); Map<String, Object> kv = delegateTask.getVariables();
LOGGER.error("表单:" + JSON.toJSONString(kv)); LOGGER.error("表单:{}", JSON.toJSONString(kv));
if (work.contains(TaskListener.EVENTNAME_ASSIGNMENT + kv.get("id").toString())) { if (work.contains(TaskListener.EVENTNAME_ASSIGNMENT + kv.get("id").toString())) {
LOGGER.error("------------出现重放------------"); LOGGER.error("------------出现重放------------");
return; return;
@ -330,9 +313,9 @@ public class ActivitiNoticeAspect {
CompletableFuture.runAsync(() -> { // 发起人 CompletableFuture.runAsync(() -> { // 发起人
try { try {
SysUserDTO assignee = sysUserService.get(Long.valueOf(delegateTask.getAssignee())); SysUserDTO assignee = sysUserService.get(Long.valueOf(delegateTask.getAssignee()));
LOGGER.error("审核人:" + assignee.getId()); LOGGER.error("审核人:{}", assignee.getId());
String content = "【通知】您发起的流程 " + activitiNoticeOperation.process() + " 当前审核节点为:" + activitiNoticeOperation.value() + ";当前审核人为:\"" + assignee.getDeptName() + "\"审核负责人\"" + assignee.getRealName() + "\""; String content = "【通知】您发起的流程 " + activitiNoticeOperation.process() + " 当前审核节点为:" + activitiNoticeOperation.value() + ";当前审核人为:\"" + assignee.getDeptName() + "\"审核负责人\"" + assignee.getRealName() + "\"";
LOGGER.info("通知内容:" + content); LOGGER.info("通知内容:{}", content);
SysNoticeDTO dto = new SysNoticeDTO(); SysNoticeDTO dto = new SysNoticeDTO();
dto.setType(2); dto.setType(2);
dto.setTitle("流程流转系统通知"); dto.setTitle("流程流转系统通知");

View File

@ -36,7 +36,7 @@ public class DataFilterAspect {
@Before("dataFilterCut()") @Before("dataFilterCut()")
public void dataFilter(JoinPoint point) { public void dataFilter(JoinPoint point) {
Object params = point.getArgs()[0]; Object params = point.getArgs()[0];
if(params != null && params instanceof Map){ if(params instanceof Map){
UserDetail user = SecurityUser.getUser(); UserDetail user = SecurityUser.getUser();
//如果是超级管理员则不进行数据过滤 //如果是超级管理员则不进行数据过滤

View File

@ -33,7 +33,6 @@ public class LogOperationAspect {
@Pointcut("@annotation(io.renren.common.annotation.LogOperation)") @Pointcut("@annotation(io.renren.common.annotation.LogOperation)")
public void logPointCut() { public void logPointCut() {
} }
@Around("logPointCut()") @Around("logPointCut()")

View File

@ -34,15 +34,5 @@ public class MybatisPlusConfig {
return new PaginationInterceptor(); return new PaginationInterceptor();
} }
// @Bean
// @Order(0)
// public MybatisPlusInterceptor mybatisPlusInterceptor(){
// MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// //添加分页插件
// interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
// //添加乐观锁插件
// interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
// return interceptor;
// }
} }

View File

@ -31,10 +31,6 @@ public class RestTemplateConfig {
factory.setReadTimeout(30 * 000);//单位为ms factory.setReadTimeout(30 * 000);//单位为ms
factory.setConnectTimeout(5 * 1000);//单位为ms factory.setConnectTimeout(5 * 1000);//单位为ms
factory.setOutputStreaming(false); factory.setOutputStreaming(false);
// SocketAddress address = new InetSocketAddress("127.0.0.1", 8888);
// Proxy proxy = new Proxy(Proxy.Type.HTTP, address);
// factory.setProxy(proxy);
return factory; return factory;
} }
} }

View File

@ -62,12 +62,12 @@ public class AbilityCenterController {
private final CodeGenerationUtils codeGenerationUtils = CodeGenerationUtils.getInstance(); private final CodeGenerationUtils codeGenerationUtils = CodeGenerationUtils.getInstance();
private static final String key = "abilityprocess"; private static final String KEY = "abilityprocess";
private static Map<String, Object> params = new HashMap<String, Object>() { private static final Map<String, Object> params = new HashMap<String, Object>() {
{ {
put("isLatestVersion", true); // 取最新版本 put("isLatestVersion", true); // 取最新版本
put("key", key); // 限定 put("key", KEY); // 限定
} }
}; };
@ -87,7 +87,6 @@ public class AbilityCenterController {
if (page.getTotal() <= 0) { // if (page.getTotal() <= 0) { //
return new Result().error("联系管理员添加流程"); return new Result().error("联系管理员添加流程");
} }
// String applyNumber = codeGenerationUtils.getApplyNumber("NLSY");
return new Result().ok(abilityBatchApplicationDTO.getSystem().stream().map(index -> { return new Result().ok(abilityBatchApplicationDTO.getSystem().stream().map(index -> {
if (index.get("resourceId") == null) { if (index.get("resourceId") == null) {
logger.error("未携带资源id"); logger.error("未携带资源id");
@ -98,7 +97,6 @@ public class AbilityCenterController {
return null; return null;
} }
TAbilityApplicationDTO tAbilityApplicationDTO = new TAbilityApplicationDTO(); TAbilityApplicationDTO tAbilityApplicationDTO = new TAbilityApplicationDTO();
// tAbilityApplicationDTO.setApplyNumber(applyNumber);
tAbilityApplicationDTO.setArea(abilityBatchApplicationDTO.getArea()); tAbilityApplicationDTO.setArea(abilityBatchApplicationDTO.getArea());
tAbilityApplicationDTO.setAttachment(abilityBatchApplicationDTO.getAttachment()); tAbilityApplicationDTO.setAttachment(abilityBatchApplicationDTO.getAttachment());
tAbilityApplicationDTO.setBasis(abilityBatchApplicationDTO.getBasis()); tAbilityApplicationDTO.setBasis(abilityBatchApplicationDTO.getBasis());
@ -121,13 +119,13 @@ public class AbilityCenterController {
if (tAbilityApplicationDTO.getId() == null) { if (tAbilityApplicationDTO.getId() == null) {
return null; return null;
} }
codeGenerationUtils.setApplyNumber("NLSY", Arrays.asList(tAbilityApplicationDTO.getId()), jdbcTemplate); codeGenerationUtils.setApplyNumber("NLSY", Collections.singletonList(tAbilityApplicationDTO.getId()), jdbcTemplate);
tAbilityApplicationDTO.setCompleteEntry(Boolean.TRUE); tAbilityApplicationDTO.setCompleteEntry(Boolean.TRUE);
// 仿照请求接口 /act/running/startOfBusinessKey // 仿照请求接口 /act/running/startOfBusinessKey
ProcessStartDTO processStartDTO = new ProcessStartDTO(); ProcessStartDTO processStartDTO = new ProcessStartDTO();
processStartDTO.setBusinessKey(tAbilityApplicationDTO.getId().toString()); processStartDTO.setBusinessKey(tAbilityApplicationDTO.getId().toString());
processStartDTO.setProcessDefinitionKey(key); //限定 processStartDTO.setProcessDefinitionKey(KEY); //限定
Map<String, Object> variables = oMapper.convertValue(tAbilityApplicationDTO, Map.class); Map<String, Object> variables = oMapper.convertValue(tAbilityApplicationDTO, Map.class);
processStartDTO.setVariables(variables); processStartDTO.setVariables(variables);
ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO); ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO);
@ -139,7 +137,7 @@ public class AbilityCenterController {
} }
}, executor); }, executor);
return dto; return dto;
}).filter(index -> ObjectUtil.isNotNull(index)).collect(Collectors.toList())); }).filter(ObjectUtil::isNotNull).collect(Collectors.toList()));
} }

View File

@ -75,12 +75,12 @@ public class AbilityCenterControllerV2 {
@Value("${big_date.name}") @Value("${big_date.name}")
private String bigDateDeptName; // 大数据局名称 private String bigDateDeptName; // 大数据局名称
private static final String key = "abilityprocess_v2"; private static final String KEY = "abilityprocess_v2";
private static Map<String, Object> params = new HashMap<String, Object>() { private static final Map<String, Object> params = new HashMap<String, Object>() {
{ {
put("isLatestVersion", true); // 取最新版本 put("isLatestVersion", true); // 取最新版本
put("key", key); // 限定 put("key", KEY); // 限定
} }
}; };
@ -184,7 +184,7 @@ public class AbilityCenterControllerV2 {
codeGenerationUtils.setApplyNumber("NLSY", tAbilityApplicationDTOList.stream().map(TAbilityApplicationDTO::getId).collect(Collectors.toList()), jdbcTemplate); codeGenerationUtils.setApplyNumber("NLSY", tAbilityApplicationDTOList.stream().map(TAbilityApplicationDTO::getId).collect(Collectors.toList()), jdbcTemplate);
Map<Long, List<TAbilityApplicationDTO>> temp = tAbilityApplicationDTOList.stream() Map<Long, List<TAbilityApplicationDTO>> temp = tAbilityApplicationDTOList.stream()
.filter(index -> index != null) .filter(Objects::nonNull)
.filter(index -> StringUtils.isNotEmpty(index.getResourceId())) .filter(index -> StringUtils.isNotEmpty(index.getResourceId()))
.collect(Collectors.groupingBy(t -> { .collect(Collectors.groupingBy(t -> {
ResourceDTO resourceDTO = resourceService.get(Long.valueOf(t.getResourceId())); ResourceDTO resourceDTO = resourceService.get(Long.valueOf(t.getResourceId()));
@ -207,12 +207,12 @@ public class AbilityCenterControllerV2 {
List<TAbilityApplicationDTO> dtoList = temp.get(deptId); List<TAbilityApplicationDTO> dtoList = temp.get(deptId);
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
String[] sqls_ = dtoList.stream().map(index -> String.format("UPDATE t_ability_application SET resource_owner_dept = '%s' WHERE id = %s", JSON.toJSONString(sysDeptDTO), index.getId())).collect(Collectors.toList()).toArray(new String[dtoList.size()]); String[] sqls = dtoList.stream().map(index -> String.format("UPDATE t_ability_application SET resource_owner_dept = '%s' WHERE id = %s", JSON.toJSONString(sysDeptDTO), index.getId())).collect(Collectors.toList()).toArray(new String[dtoList.size()]);
jdbcTemplate.batchUpdate(sqls_); // 批量更新资源所属部门信息 jdbcTemplate.batchUpdate(sqls); // 批量更新资源所属部门信息
logger.info("批量更新申请的资源的部门信息完成"); logger.info("批量更新申请的资源的部门信息完成");
}, executor); }, executor);
Boolean basic_facilities = dtoList.stream().map(index -> { Boolean basicFacilities = dtoList.stream().map(index -> {
Optional<ResourceDTO> resourceDTOOptional = Optional.ofNullable(resourceService.get(Long.valueOf(index.getResourceId()))); Optional<ResourceDTO> resourceDTOOptional = Optional.ofNullable(resourceService.get(Long.valueOf(index.getResourceId())));
if (!resourceDTOOptional.isPresent()) { // 从本库内查不到 视为其它平台的基础设施资源 if (!resourceDTOOptional.isPresent()) { // 从本库内查不到 视为其它平台的基础设施资源
return true; return true;
@ -222,14 +222,14 @@ public class AbilityCenterControllerV2 {
} }
return false; return false;
}).filter(index -> index).findAny().orElse(Boolean.FALSE); }).filter(index -> index).findAny().orElse(Boolean.FALSE);
logger.error("--------------------是否全是基础设施{}----------------------------------------------", basic_facilities); logger.error("--------------------是否全是基础设施{}----------------------------------------------", basicFacilities);
final List<Long> ids = dtoList.stream().map(TAbilityApplicationDTO::getId).collect(Collectors.toList()); // 发起申请的表单id final List<Long> ids = dtoList.stream().map(TAbilityApplicationDTO::getId).collect(Collectors.toList()); // 发起申请的表单id
// 仿照请求接口 /act/running/startOfBusinessKey // 仿照请求接口 /act/running/startOfBusinessKey
ProcessStartDTO processStartDTO = new ProcessStartDTO(); ProcessStartDTO processStartDTO = new ProcessStartDTO();
processStartDTO.setBusinessKey(basic_facilities ? tAbilityApplicationDTOList.stream().filter(index -> StringUtils.isNotEmpty(index.getResourceId())) processStartDTO.setBusinessKey(Boolean.TRUE.equals(basicFacilities) ? tAbilityApplicationDTOList.stream().filter(index -> StringUtils.isNotEmpty(index.getResourceId()))
.map(TAbilityApplicationDTO::getResourceId).findFirst().orElse(null) : .map(TAbilityApplicationDTO::getResourceId).findFirst().orElse(null) :
JSON.toJSONString(ids.stream().limit(5).collect(Collectors.toList()))); // 申请的id列表 json字符 做businesskey JSON.toJSONString(ids.stream().limit(5).collect(Collectors.toList()))); // 申请的id列表 json字符 做businesskey
processStartDTO.setProcessDefinitionKey(key); //限定 processStartDTO.setProcessDefinitionKey(KEY); //限定
AuditingBaseDTO auditingBaseDTO = new AuditingBaseDTO(); AuditingBaseDTO auditingBaseDTO = new AuditingBaseDTO();
auditingBaseDTO.setCompleteEntry(Boolean.TRUE); // 首次录入 auditingBaseDTO.setCompleteEntry(Boolean.TRUE); // 首次录入
@ -244,7 +244,7 @@ public class AbilityCenterControllerV2 {
put("id", applyFlag); //申请id put("id", applyFlag); //申请id
put("creator", user == null ? null : user.getId().toString()); // 创建人 put("creator", user == null ? null : user.getId().toString()); // 创建人
put("userId", user == null ? null : user.getId().toString()); // 创建人 put("userId", user == null ? null : user.getId().toString()); // 创建人
put("basic_facilities", basic_facilities); // 是否为基础设施 put("basic_facilities", basicFacilities); // 是否为基础设施
} }
}); });

View File

@ -35,8 +35,8 @@ import java.util.stream.Collectors;
@RequestMapping("/census/center") @RequestMapping("/census/center")
public class CensusController { public class CensusController {
private static final Logger logger = LoggerFactory.getLogger(CensusController.class); private static final Logger logger = LoggerFactory.getLogger(CensusController.class);
private static Integer cpuNUm = Runtime.getRuntime().availableProcessors(); private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm); private static final ExecutorService executor = Executors.newFixedThreadPool(CPUNUM);
@Autowired @Autowired
private ResourceService resourceService; private ResourceService resourceService;
@ -80,7 +80,7 @@ public class CensusController {
}; };
finalDbAmount.add(nullMap); finalDbAmount.add(nullMap);
}); });
Long sum = finalDbAmount.stream().mapToLong(index -> Long.valueOf(index.get("amount").toString())).sum(); Long sum = finalDbAmount.stream().mapToLong(index -> Long.parseLong(index.get("amount").toString())).sum();
Map<String, Object> sumMap = new HashMap<String, Object>() { Map<String, Object> sumMap = new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
@ -100,59 +100,48 @@ public class CensusController {
CompletableFuture<Void> resourceAmount = CompletableFuture.supplyAsync(() -> { // 获取资源汇聚总量 CompletableFuture<Void> resourceAmount = CompletableFuture.supplyAsync(() -> { // 获取资源汇聚总量
Map map = (Map) resourceService.selectTotal(); Map map = (Map) resourceService.selectTotal();
List<Map<String, Object>> dbAmount = (List<Map<String, Object>>) map.get("total"); List<Map<String, Object>> dbAmount = (List<Map<String, Object>>) map.get("total");
Long sum = dbAmount.stream().mapToLong(index -> Long.parseLong(index.get("count").toString())).sum(); return dbAmount.stream().mapToLong(index -> Long.parseLong(index.get("count").toString())).sum();
return sum; }, executor).thenAccept(sum -> result.add(new HashMap<String, Object>() {
}, executor).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
put("type", "资源汇聚总量"); put("type", "资源汇聚总量");
} }
}); }));
});
CompletableFuture<Void> userAmount = CompletableFuture.supplyAsync(() -> { // 获取平台用户总数 CompletableFuture<Void> userAmount = CompletableFuture.supplyAsync(() -> { // 获取平台用户总数
return sysUserService.countAllUser(); return sysUserService.countAllUser();
}, executor).thenAccept(sum -> { }, executor).thenAccept(sum -> result.add(new HashMap<String, Object>() {
result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
put("type", "用户量"); put("type", "用户量");
} }
}); }));
});
CompletableFuture<Void> applyAmount = CompletableFuture.supplyAsync(() -> { // 资源申请量 CompletableFuture<Void> applyAmount = CompletableFuture.supplyAsync(() -> { // 资源申请量
return tAbilityApplicationService.countApplyAll(); return tAbilityApplicationService.countApplyAll();
}, executor).thenAccept(sum -> { }, executor).thenAccept(sum -> result.add(new HashMap<String, Object>() {
result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
put("type", "资源申请量"); put("type", "资源申请量");
} }
}); }));
});
CompletableFuture<Void> deptAmount = CompletableFuture.supplyAsync(() -> { // 覆盖部门量 CompletableFuture<Void> deptAmount = CompletableFuture.supplyAsync(() -> { // 覆盖部门量
return resourceService.countAllDept(); return resourceService.countAllDept();
}, executor).thenAccept(sum -> { }, executor).thenAccept(sum -> result.add(new HashMap<String, Object>() {
result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
put("type", "覆盖部门量"); put("type", "覆盖部门量");
} }
}); }));
});
CompletableFuture<Void> pvAmount = CompletableFuture.supplyAsync(() -> { // 平台访问量 CompletableFuture<Void> pvAmount = CompletableFuture.supplyAsync(() -> { // 平台访问量
return resourceService.countAllVisits(); return resourceService.countAllVisits();
}, executor).thenAccept(sum -> { }, executor).thenAccept(sum -> result.add(new HashMap<String, Object>() {
result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
put("type", "平台访问量"); put("type", "平台访问量");
} }
}); }));
});
CompletableFuture<Void> all = CompletableFuture.allOf(resourceAmount, userAmount, applyAmount, deptAmount, pvAmount); CompletableFuture<Void> all = CompletableFuture.allOf(resourceAmount, userAmount, applyAmount, deptAmount, pvAmount);
all.join(); all.join();
result.sort(Comparator.comparing(x -> x.get("type").toString())); result.sort(Comparator.comparing(x -> x.get("type").toString()));
@ -204,7 +193,7 @@ public class CensusController {
List<Map> temp = resourceService.selectDeptProvideCount(n == null ? 24 : n); List<Map> temp = resourceService.selectDeptProvideCount(n == null ? 24 : n);
List<Map<String, Object>> result = Collections.synchronizedList(new ArrayList<>()); List<Map<String, Object>> result = Collections.synchronizedList(new ArrayList<>());
List<CompletableFuture> completableFutures = List<CompletableFuture> completableFutures =
temp.stream().mapToLong(index -> Long.valueOf(index.get("dept_id").toString())).mapToObj(deptId -> { temp.stream().mapToLong(index -> Long.parseLong(index.get("dept_id").toString())).mapToObj(deptId -> {
CompletableFuture<Void> task = CompletableFuture<Void> task =
CompletableFuture.supplyAsync(() -> { // 获取部门提供能力 CompletableFuture.supplyAsync(() -> { // 获取部门提供能力
List<String> db = resourceService.selectDeptProvide(deptId); List<String> db = resourceService.selectDeptProvide(deptId);
@ -240,7 +229,7 @@ public class CensusController {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
).reversed().thenComparing(i -> i.toString())); ).reversed().thenComparing(Object::toString));
return new Result<List<Map<String, Object>>>().ok(result); return new Result<List<Map<String, Object>>>().ok(result);
} }
@ -279,7 +268,7 @@ public class CensusController {
List<Map> temp = tAbilityApplicationService.selectDeptApplyCount(n == null ? 24 : n); List<Map> temp = tAbilityApplicationService.selectDeptApplyCount(n == null ? 24 : n);
List<Map<String, Object>> result = Collections.synchronizedList(new ArrayList<>()); List<Map<String, Object>> result = Collections.synchronizedList(new ArrayList<>());
List<CompletableFuture> completableFutures = List<CompletableFuture> completableFutures =
temp.stream().mapToLong(index -> Long.valueOf(index.get("dept_id").toString())).mapToObj(deptId -> { temp.stream().mapToLong(index -> Long.parseLong(index.get("dept_id").toString())).mapToObj(deptId -> {
CompletableFuture<Void> task = CompletableFuture<Void> task =
CompletableFuture.supplyAsync(() -> { // 获取资源汇聚总量 CompletableFuture.supplyAsync(() -> { // 获取资源汇聚总量
List<String> db = tAbilityApplicationService.selectDeptApply(deptId); List<String> db = tAbilityApplicationService.selectDeptApply(deptId);

View File

@ -1,6 +1,5 @@
package io.renren.common.controller; package io.renren.common.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
@ -37,7 +36,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* 2022.6.19 版本 * 2022.6.19 版本
*/ */
@ -46,11 +44,11 @@ import java.util.stream.Collectors;
@RequestMapping("/census/center/v2") @RequestMapping("/census/center/v2")
public class CensusControllerV2 { public class CensusControllerV2 {
private static final Integer cpuNUm = Runtime.getRuntime().availableProcessors(); private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors();
private static final OkHttpClient client = new OkHttpClient().newBuilder() private static final OkHttpClient client = new OkHttpClient().newBuilder()
.connectTimeout(1, TimeUnit.MINUTES) .connectTimeout(1, TimeUnit.MINUTES)
.readTimeout(1, TimeUnit.MINUTES) .readTimeout(1, TimeUnit.MINUTES)
.connectionPool(new ConnectionPool(cpuNUm * 2, 2, TimeUnit.MINUTES)) .connectionPool(new ConnectionPool(CPUNUM * 2, 2, TimeUnit.MINUTES))
.retryOnConnectionFailure(false) .retryOnConnectionFailure(false)
.build(); .build();
@ -88,25 +86,21 @@ public class CensusControllerV2 {
CompletableFuture<Void> userAmount = CompletableFuture.supplyAsync(() -> { // 获取平台用户总数 CompletableFuture<Void> userAmount = CompletableFuture.supplyAsync(() -> { // 获取平台用户总数
return sysUserService.countAllUser(); return sysUserService.countAllUser();
}).thenAccept(sum -> { }).thenAccept(sum -> result.add(new HashMap<String, Object>() {
result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
put("type", "用户量"); put("type", "用户量");
} }
}); }));
});
CompletableFuture<Void> pvAmount = CompletableFuture.supplyAsync(() -> { // 平台访问量 CompletableFuture<Void> pvAmount = CompletableFuture.supplyAsync(() -> { // 平台访问量
return resourceService.countAllVisits(); return resourceService.countAllVisits();
}).thenAccept(sum -> { }).thenAccept(sum -> result.add(new HashMap<String, Object>() {
result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
put("type", "平台访问量"); put("type", "平台访问量");
} }
}); }));
});
CompletableFuture<Void> all = CompletableFuture.allOf(userAmount, pvAmount); CompletableFuture<Void> all = CompletableFuture.allOf(userAmount, pvAmount);
all.join(); all.join();
result.sort(Comparator.comparing(x -> x.get("type").toString())); result.sort(Comparator.comparing(x -> x.get("type").toString()));
@ -135,14 +129,12 @@ public class CensusControllerV2 {
CompletableFuture<Void> allApplicationAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总应用数目 CompletableFuture<Void> allApplicationAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总应用数目
return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='应用资源' AND del_flag = 0;", Long.class); return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='应用资源' AND del_flag = 0;", Long.class);
}).thenAccept(sum -> { }).thenAccept(sum -> result.add(new HashMap<String, Object>() {
result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
put("type", "总应用数"); put("type", "总应用数");
} }
}); }));
});
CompletableFuture<Void> buildingApplicationAmount = CompletableFuture.supplyAsync(() -> { // 获取平台建设中数目 CompletableFuture<Void> buildingApplicationAmount = CompletableFuture.supplyAsync(() -> { // 获取平台建设中数目
return jdbcTemplate.queryForObject("SELECT COUNT(DISTINCT data_resource_id) FROM tb_data_attr WHERE EXISTS ( SELECT id FROM tb_data_resource WHERE tb_data_resource.id = tb_data_attr.data_resource_id AND tb_data_resource.del_flag = 0 ) AND attr_type = '应用状态' AND attr_value = '建设中';", Long.class); return jdbcTemplate.queryForObject("SELECT COUNT(DISTINCT data_resource_id) FROM tb_data_attr WHERE EXISTS ( SELECT id FROM tb_data_resource WHERE tb_data_resource.id = tb_data_attr.data_resource_id AND tb_data_resource.del_flag = 0 ) AND attr_type = '应用状态' AND attr_value = '建设中';", Long.class);
}).thenAccept(sum -> { }).thenAccept(sum -> {
@ -155,14 +147,12 @@ public class CensusControllerV2 {
}); });
CompletableFuture<Void> endApplicationAmount = CompletableFuture.supplyAsync(() -> { // 获取平台建设中数目 CompletableFuture<Void> endApplicationAmount = CompletableFuture.supplyAsync(() -> { // 获取平台建设中数目
return jdbcTemplate.queryForObject("SELECT COUNT(DISTINCT data_resource_id) FROM tb_data_attr WHERE EXISTS ( SELECT id FROM tb_data_resource WHERE tb_data_resource.id = tb_data_attr.data_resource_id AND tb_data_resource.del_flag = 0 ) AND attr_type = '应用状态' AND attr_value = '停用';", Long.class); return jdbcTemplate.queryForObject("SELECT COUNT(DISTINCT data_resource_id) FROM tb_data_attr WHERE EXISTS ( SELECT id FROM tb_data_resource WHERE tb_data_resource.id = tb_data_attr.data_resource_id AND tb_data_resource.del_flag = 0 ) AND attr_type = '应用状态' AND attr_value = '停用';", Long.class);
}).thenAccept(sum -> { }).thenAccept(sum -> result.add(new HashMap<String, Object>() {
result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
put("type", "停用应用数"); put("type", "停用应用数");
} }
}); }));
});
CompletableFuture<Void> all = CompletableFuture.allOf(allApplicationAmount, buildingApplicationAmount, endApplicationAmount); CompletableFuture<Void> all = CompletableFuture.allOf(allApplicationAmount, buildingApplicationAmount, endApplicationAmount);
all.join(); all.join();
return new Result().ok(result); return new Result().ok(result);
@ -213,7 +203,7 @@ public class CensusControllerV2 {
re.put("deptName", sysDeptService.get(Long.valueOf(index)).getName()); re.put("deptName", sysDeptService.get(Long.valueOf(index)).getName());
re.put("count", i.get(index).stream().mapToLong(index_ -> index_.values().stream().mapToLong(count_ -> count_).sum()).sum()); re.put("count", i.get(index).stream().mapToLong(index_ -> index_.values().stream().mapToLong(count_ -> count_).sum()).sum());
return re; return re;
}).filter(index -> ObjectUtils.allNotNull(index)).collect(Collectors.toList()); }).filter(ObjectUtils::allNotNull).collect(Collectors.toList());
result.sort(Comparator.comparing(x -> { result.sort(Comparator.comparing(x -> {
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
try { try {
@ -235,58 +225,48 @@ public class CensusControllerV2 {
List<Map<String, Object>> result = new CopyOnWriteArrayList<>(); List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
CompletableFuture<Void> allAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总组件服务数目 CompletableFuture<Void> allAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总组件服务数目
return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='组件服务' AND del_flag = 0;", Long.class); return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='组件服务' AND del_flag = 0;", Long.class);
}).thenAccept(sum -> { }).thenAccept(sum -> result.add(new HashMap<String, Object>() {
result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
put("type", "上架总数"); put("type", "上架总数");
} }
}); }));
});
String sqlFormat = "SELECT COUNT( tda.data_resource_id ) FROM tb_data_attr tda JOIN tb_data_resource tdr ON tda.data_resource_id = tdr.id AND MATCH ( tda.attr_value) AGAINST ( '%s' IN BOOLEAN MODE) AND tda.attr_type = '组件类型' AND tda.del_flag = 0 AND tdr.del_flag = 0;"; String sqlFormat = "SELECT COUNT( tda.data_resource_id ) FROM tb_data_attr tda JOIN tb_data_resource tdr ON tda.data_resource_id = tdr.id AND MATCH ( tda.attr_value) AGAINST ( '%s' IN BOOLEAN MODE) AND tda.attr_type = '组件类型' AND tda.del_flag = 0 AND tdr.del_flag = 0;";
CompletableFuture<Void> aiAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台智能算法组件服务数目 CompletableFuture<Void> aiAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台智能算法组件服务数目
return jdbcTemplate.queryForObject(String.format(sqlFormat, "智能算法"), Long.class); return jdbcTemplate.queryForObject(String.format(sqlFormat, "智能算法"), Long.class);
}).thenAccept(sum -> { }).thenAccept(sum -> result.add(new HashMap<String, Object>() {
result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
put("type", "智能算法"); put("type", "智能算法");
} }
}); }));
});
CompletableFuture<Void> gisAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台图层服务组件服务数目 CompletableFuture<Void> gisAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台图层服务组件服务数目
return jdbcTemplate.queryForObject(String.format(sqlFormat, "图层服务"), Long.class); return jdbcTemplate.queryForObject(String.format(sqlFormat, "图层服务"), Long.class);
}).thenAccept(sum -> { }).thenAccept(sum -> result.add(new HashMap<String, Object>() {
result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
put("type", "图层服务"); put("type", "图层服务");
} }
}); }));
});
CompletableFuture<Void> busAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台业务组件组件服务数目 CompletableFuture<Void> busAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台业务组件组件服务数目
return jdbcTemplate.queryForObject(String.format(sqlFormat, "业务组件"), Long.class); return jdbcTemplate.queryForObject(String.format(sqlFormat, "业务组件"), Long.class);
}).thenAccept(sum -> { }).thenAccept(sum -> result.add(new HashMap<String, Object>() {
result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
put("type", "业务组件"); put("type", "业务组件");
} }
}); }));
});
CompletableFuture<Void> devAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台业务组件组件服务数目 CompletableFuture<Void> devAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台业务组件组件服务数目
return jdbcTemplate.queryForObject(String.format(sqlFormat, "开发组件"), Long.class); return jdbcTemplate.queryForObject(String.format(sqlFormat, "开发组件"), Long.class);
}).thenAccept(sum -> { }).thenAccept(sum -> result.add(new HashMap<String, Object>() {
result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
put("type", "开发组件"); put("type", "开发组件");
} }
}); }));
});
CompletableFuture<Void> all = CompletableFuture.allOf(allAssemblyAmount, aiAssemblyAmount, gisAssemblyAmount, busAssemblyAmount, devAssemblyAmount); CompletableFuture<Void> all = CompletableFuture.allOf(allAssemblyAmount, aiAssemblyAmount, gisAssemblyAmount, busAssemblyAmount, devAssemblyAmount);
all.join(); all.join();
return new Result().ok(result); return new Result().ok(result);
@ -299,24 +279,20 @@ public class CensusControllerV2 {
List<Map<String, Object>> result = new CopyOnWriteArrayList<>(); List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
CompletableFuture<Void> allKnowledgeAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总知识库数目 CompletableFuture<Void> allKnowledgeAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总知识库数目
return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='知识库' AND del_flag = 0;", Long.class); return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='知识库' AND del_flag = 0;", Long.class);
}).thenAccept(sum -> { }).thenAccept(sum -> result.add(new HashMap<String, Object>() {
result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
put("type", "知识库上架总量"); put("type", "知识库上架总量");
} }
}); }));
});
CompletableFuture<Void> allKnowledgeVisitsAmount = CompletableFuture.supplyAsync(() -> { // 获取平台知识库浏览量 CompletableFuture<Void> allKnowledgeVisitsAmount = CompletableFuture.supplyAsync(() -> { // 获取平台知识库浏览量
return jdbcTemplate.queryForObject("SELECT IFNULL(SUM(visits),0) visits FROM tb_data_resource WHERE type ='知识库' AND del_flag = 0;", Long.class); return jdbcTemplate.queryForObject("SELECT IFNULL(SUM(visits),0) visits FROM tb_data_resource WHERE type ='知识库' AND del_flag = 0;", Long.class);
}).thenAccept(sum -> { }).thenAccept(sum -> result.add(new HashMap<String, Object>() {
result.add(new HashMap<String, Object>() {
{ {
put("amount", sum == null ? 0L : sum); put("amount", sum == null ? 0L : sum);
put("type", "知识库总浏览量"); put("type", "知识库总浏览量");
} }
}); }));
});
CompletableFuture<Void> all = CompletableFuture.allOf(allKnowledgeAmount, allKnowledgeVisitsAmount); CompletableFuture<Void> all = CompletableFuture.allOf(allKnowledgeAmount, allKnowledgeVisitsAmount);
all.join(); all.join();
return new Result().ok(result); return new Result().ok(result);
@ -400,8 +376,6 @@ public class CensusControllerV2 {
@LogOperation("能力云图-数据资源简况") @LogOperation("能力云图-数据资源简况")
public Result<List<Map<String, Object>>> dataResourceInfo() { public Result<List<Map<String, Object>>> dataResourceInfo() {
List<Map<String, Object>> result = new CopyOnWriteArrayList<>(); List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
CompletableFuture<Void> allAmount = null;
CompletableFuture<Void> applyInfo = null; // 申请情况
switch (Constant.ProjectPlace.getByFlag(projectPlace)) { switch (Constant.ProjectPlace.getByFlag(projectPlace)) {
case BAOTOU: { // TODO 包头 case BAOTOU: { // TODO 包头
result.add(new HashMap<String, Object>() { result.add(new HashMap<String, Object>() {

View File

@ -77,7 +77,6 @@ public class CensusControllerV3 {
} }
String type = params.get("resourceType").toString(); String type = params.get("resourceType").toString();
List<Map<String, Object>> list = new ArrayList<>();
switch (type) { switch (type) {
case "组件服务": case "组件服务":
@ -124,22 +123,15 @@ public class CensusControllerV3 {
} }
String type = params.get("resourceType").toString(); String type = params.get("resourceType").toString();
List<Map<String, Object>> list = new ArrayList<>();
switch (type) { switch (type) {
case "组件服务": case "组件服务":
PageData<Map<String, Object>> pageData = resourceService.resourceBusinessUseDetails(params); PageData<Map<String, Object>> pageData = resourceService.resourceBusinessUseDetails(params);
return new Result<PageData<Map<String, Object>>>().ok(pageData); return new Result<PageData<Map<String, Object>>>().ok(pageData);
case "应用资源":
return null;
case "基础设施": case "基础设施":
case "数据资源":
PageData<Map<String, Object>> pageData1 = resourceService.resourceDatasUseDetails(params); PageData<Map<String, Object>> pageData1 = resourceService.resourceDatasUseDetails(params);
return new Result<PageData<Map<String, Object>>>().ok(pageData1); return new Result<PageData<Map<String, Object>>>().ok(pageData1);
case "数据资源":
PageData<Map<String, Object>> pageData2 = resourceService.resourceDatasUseDetails(params);
return new Result<PageData<Map<String, Object>>>().ok(pageData2);
case "知识库":
return null;
default: default:
return null; return null;
} }
@ -429,7 +421,7 @@ public class CensusControllerV3 {
@LogOperation("知识库分布情况") @LogOperation("知识库分布情况")
@ApiImplicitParam(name = "id", value = "行政部门编号", paramType = "query", dataType = "Long") @ApiImplicitParam(name = "id", value = "行政部门编号", paramType = "query", dataType = "Long")
public Result<List<Map<String, Object>>> knowledgeBaseDistriDetail(Long id) { public Result<List<Map<String, Object>>> knowledgeBaseDistriDetail(Long id) {
List<Map<String, Object>> result = new ArrayList<>(); List<Map<String, Object>> result;
Object[] ps = {id, id}; Object[] ps = {id, id};
result = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS num,a.attr_value FROM tb_data_attr a INNER JOIN tb_data_resource b ON a.data_resource_id = b.id\n" + result = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS num,a.attr_value FROM tb_data_attr a INNER JOIN tb_data_resource b ON a.data_resource_id = b.id\n" +
"INNER JOIN sys_dept c on b.dept_id = c.id WHERE a.attr_type = '文件类型' AND a.del_flag = 0 AND b.type = '知识库' AND b.del_flag = 0 AND \n" + "INNER JOIN sys_dept c on b.dept_id = c.id WHERE a.attr_type = '文件类型' AND a.del_flag = 0 AND b.type = '知识库' AND b.del_flag = 0 AND \n" +

View File

@ -1,6 +1,5 @@
package io.renren.common.controller; package io.renren.common.controller;
import io.renren.common.annotation.LogOperation; import io.renren.common.annotation.LogOperation;
import io.renren.common.page.PageData; import io.renren.common.page.PageData;
import io.renren.common.utils.CodeGenerationUtils; import io.renren.common.utils.CodeGenerationUtils;
@ -35,8 +34,8 @@ import java.util.concurrent.Executors;
@RestController @RestController
@RequestMapping("/comment/center") @RequestMapping("/comment/center")
public class CommentController { public class CommentController {
private static Integer cpuNUm = Runtime.getRuntime().availableProcessors(); private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm); private static final ExecutorService executor = Executors.newFixedThreadPool(CPUNUM);
private static final ObjectMapper oMapper = new ObjectMapper(); private static final ObjectMapper oMapper = new ObjectMapper();
@Autowired @Autowired
@ -54,12 +53,12 @@ public class CommentController {
private static final Logger logger = LoggerFactory.getLogger(CommentController.class); private static final Logger logger = LoggerFactory.getLogger(CommentController.class);
private static final String key = "comment_review"; private static final String KEY = "comment_review";
private static Map<String, Object> params = new HashMap<String, Object>() { private static Map<String, Object> params = new HashMap<String, Object>() {
{ {
put("isLatestVersion", true); // 取最新版本 put("isLatestVersion", true); // 取最新版本
put("key", key); // 限定 put("key", KEY); // 限定
} }
}; };
@ -85,7 +84,6 @@ public class CommentController {
if (tDemandCommentDTO.getId() == null) { if (tDemandCommentDTO.getId() == null) {
return new Result().error("该评论不存在"); return new Result().error("该评论不存在");
} }
// tDemandCommentDTO.setApplyNumber(codeGenerationUtils.getApplyNumber("XQPL"));
tDemandCommentDTO.setDelFlag(2); // 待审核 tDemandCommentDTO.setDelFlag(2); // 待审核
tDemandCommentDTO.setCompleteEntry(Boolean.TRUE); tDemandCommentDTO.setCompleteEntry(Boolean.TRUE);
tDemandCommentService.update(tDemandCommentDTO); tDemandCommentService.update(tDemandCommentDTO);
@ -94,7 +92,7 @@ public class CommentController {
// 仿照请求接口 /act/running/startOfBusinessKey // 仿照请求接口 /act/running/startOfBusinessKey
ProcessStartDTO processStartDTO = new ProcessStartDTO(); ProcessStartDTO processStartDTO = new ProcessStartDTO();
processStartDTO.setBusinessKey(tDemandCommentDTO.getId().toString()); processStartDTO.setBusinessKey(tDemandCommentDTO.getId().toString());
processStartDTO.setProcessDefinitionKey(key); //限定 processStartDTO.setProcessDefinitionKey(KEY); //限定
Map<String, Object> variables = oMapper.convertValue(tDemandCommentDTO, Map.class); Map<String, Object> variables = oMapper.convertValue(tDemandCommentDTO, Map.class);
processStartDTO.setVariables(variables); processStartDTO.setVariables(variables);

View File

@ -1,6 +1,6 @@
package io.renren.common.controller; package io.renren.common.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import io.renren.common.annotation.LogOperation; import io.renren.common.annotation.LogOperation;
import io.renren.common.page.PageData; import io.renren.common.page.PageData;
@ -51,12 +51,12 @@ public class DemandDataController {
private final CodeGenerationUtils codeGenerationUtils = CodeGenerationUtils.getInstance(); private final CodeGenerationUtils codeGenerationUtils = CodeGenerationUtils.getInstance();
private static final String key = "abilitydemandapply"; private static final String KEY = "abilitydemandapply";
private static Map<String, Object> params = new HashMap<String, Object>() { private static Map<String, Object> params = new HashMap<String, Object>() {
{ {
put("isLatestVersion", true); // 取最新版本 put("isLatestVersion", true); // 取最新版本
put("key", key); // 限定 能力资源上架 put("key", KEY); // 限定 能力资源上架
} }
}; };
@ -67,13 +67,12 @@ public class DemandDataController {
// 仿照请求接口 /act/process/lastestPage // 仿照请求接口 /act/process/lastestPage
PageData<Map<String, Object>> page = actProcessService.page(params); PageData<Map<String, Object>> page = actProcessService.page(params);
if (page.getTotal() <= 0) { // if (page.getTotal() <= 0) { //
return new Result().error("联系管理员添加流程:" + key); return new Result().error("联系管理员添加流程:" + KEY);
} }
logger.info("---------------------------------------------------"); logger.info("---------------------------------------------------");
logger.info(JSONObject.toJSONString(tDemandDataDTO)); logger.info(JSON.toJSONString(tDemandDataDTO));
logger.info("####################################################"); logger.info("####################################################");
tDemandDataDTO.setFlag(TDemandDataEntityFlag.UNDER_REVIEW.getFlag()); tDemandDataDTO.setFlag(TDemandDataEntityFlag.UNDER_REVIEW.getFlag());
// tDemandDataDTO.setApplyNumber(codeGenerationUtils.getApplyNumber("NLXQ"));
ValidatorUtils.validateEntity(tDemandDataDTO, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(tDemandDataDTO, AddGroup.class, DefaultGroup.class);
tDemandDataService.save(tDemandDataDTO); tDemandDataService.save(tDemandDataDTO);
@ -86,18 +85,18 @@ public class DemandDataController {
// 仿照请求接口 /act/running/startOfBusinessKey // 仿照请求接口 /act/running/startOfBusinessKey
ProcessStartDTO processStartDTO = new ProcessStartDTO(); ProcessStartDTO processStartDTO = new ProcessStartDTO();
processStartDTO.setBusinessKey(tDemandDataDTO.getId().toString()); processStartDTO.setBusinessKey(tDemandDataDTO.getId().toString());
processStartDTO.setProcessDefinitionKey(key); // 限定资源上架 processStartDTO.setProcessDefinitionKey(KEY); // 限定资源上架
Map<String, Object> variables = oMapper.convertValue(tDemandDataDTO, Map.class); Map<String, Object> variables = oMapper.convertValue(tDemandDataDTO, Map.class);
processStartDTO.setVariables(variables); processStartDTO.setVariables(variables);
ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO); ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO);
logger.info("-------------------2.启动流程成功--------------------------"); logger.info("-------------------2.启动流程成功--------------------------");
logger.info("ProcessInstanceDTO.getBusinessKey:" + dto.getBusinessKey()); logger.info("ProcessInstanceDTO.getBusinessKey:{}", dto.getBusinessKey());
if (Long.valueOf(dto.getBusinessKey()) != null) { if (Long.valueOf(dto.getBusinessKey()) != null) {
// 仿照请求接口 /processForm/tabilityapplication/updateInstanceId // 仿照请求接口 /processForm/tabilityapplication/updateInstanceId
tDemandDataService.updateInstanceId(dto.getProcessInstanceId(), Long.valueOf(dto.getBusinessKey())); tDemandDataService.updateInstanceId(dto.getProcessInstanceId(), Long.valueOf(dto.getBusinessKey()));
logger.info("-------------------更新updateInstanceId.成功--------------------------"); logger.info("-------------------更新updateInstanceId.成功--------------------------");
logger.info("ProcessInstanceDTO.getProcessInstanceId:" + dto.getProcessInstanceId()); logger.info("ProcessInstanceDTO.getProcessInstanceId:{}", dto.getProcessInstanceId());
} }
return new Result<ProcessInstanceDTO>().ok(dto); return new Result<ProcessInstanceDTO>().ok(dto);

View File

@ -27,13 +27,13 @@ public class FileUploadController {
@Value("${resource.path}") @Value("${resource.path}")
private String uploadPath; private String uploadPath;
@Value("${resource.root_url}") @Value("${resource.root_url}")
private String root_url; private String rootUrl;
@Value("${server.servlet.context-path}") @Value("${server.servlet.context-path}")
private String context_path; private String contextPath;
private static final Logger logger = LoggerFactory.getLogger(FileUploadController.class); private static final Logger logger = LoggerFactory.getLogger(FileUploadController.class);
private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd/"); private static final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy/MM/dd/");
@PostMapping("/upload") @PostMapping("/upload")
@ApiOperation("文件上传") @ApiOperation("文件上传")
@ -43,8 +43,8 @@ public class FileUploadController {
}) })
public Result<String> upload(@RequestParam("file") MultipartFile uploadFile, public Result<String> upload(@RequestParam("file") MultipartFile uploadFile,
HttpServletRequest request) { HttpServletRequest request) {
logger.info("上传文件:" + uploadFile.getOriginalFilename()); logger.info("上传文件:{}", uploadFile.getOriginalFilename());
String format = sdf.format(new Date()); String format = SIMPLE_DATE_FORMAT.format(new Date());
File folder = new File(uploadPath + "upload" + File.separator + format); File folder = new File(uploadPath + "upload" + File.separator + format);
logger.info(uploadPath + format); logger.info(uploadPath + format);
if (!folder.isDirectory()) { if (!folder.isDirectory()) {
@ -52,15 +52,15 @@ public class FileUploadController {
} }
// 对上传的文件重命名避免文件重名 // 对上传的文件重命名避免文件重名
String oldName = uploadFile.getOriginalFilename(); String oldName = uploadFile.getOriginalFilename();
String newName = UUID.randomUUID().toString() String newName = UUID.randomUUID()
+ oldName.substring(oldName.lastIndexOf("."), oldName.length()); + oldName.substring(oldName.lastIndexOf("."));
try { try {
// 文件保存 // 文件保存
uploadFile.transferTo(new File(folder, newName)); uploadFile.transferTo(new File(folder, newName));
// 返回上传文件的访问路径 // 返回上传文件的访问路径
String filePath = request.getScheme() + "://" + root_url String filePath = request.getScheme() + "://" + rootUrl
+ ":" + request.getServerPort() + context_path + "/upload/" + format + newName; + ":" + request.getServerPort() + contextPath + "/upload/" + format + newName;
return new Result<String>().ok(filePath); return new Result<String>().ok(filePath);
} catch (IOException e) { } catch (IOException e) {
return new Result<String>().error(e.getMessage()); return new Result<String>().error(e.getMessage());

View File

@ -25,7 +25,7 @@ import java.util.concurrent.atomic.AtomicReference;
@RestController @RestController
@RequestMapping("/reject/center") @RequestMapping("/reject/center")
public class RejectController { public class RejectController {
private static Logger logger = LoggerFactory.getLogger(RejectController.class); private static final Logger logger = LoggerFactory.getLogger(RejectController.class);
@Autowired @Autowired
protected TaskService taskService; protected TaskService taskService;
@Autowired @Autowired
@ -45,7 +45,6 @@ public class RejectController {
Optional<Task> taskOptional = Optional.ofNullable(taskService.createTaskQuery().taskId(taskId).includeProcessVariables().singleResult()); Optional<Task> taskOptional = Optional.ofNullable(taskService.createTaskQuery().taskId(taskId).includeProcessVariables().singleResult());
taskOptional.ifPresent(task -> { taskOptional.ifPresent(task -> {
Map<String, Object> combineResultMap = new LinkedHashMap<>(); Map<String, Object> combineResultMap = new LinkedHashMap<>();
// combineResultMap.putAll(task.getProcessVariables());
combineResultMap.putAll(params); combineResultMap.putAll(params);
if (combineResultMap.containsKey("parameterContent")) { // 上架申请特殊处理 if (combineResultMap.containsKey("parameterContent")) { // 上架申请特殊处理
combineResultMap.remove("parameterContent"); combineResultMap.remove("parameterContent");
@ -55,7 +54,7 @@ public class RejectController {
taskService.removeVariable(task.getId(), "parameterContent"); taskService.removeVariable(task.getId(), "parameterContent");
taskService.removeVariable(task.getId(), "resourceDTO"); taskService.removeVariable(task.getId(), "resourceDTO");
taskService.setVariables(task.getId(), combineResultMap); // 更新 taskService.setVariables(task.getId(), combineResultMap); // 更新
logger.error("-----------" + JSON.toJSONString(combineResultMap)); logger.error("-----------{}", JSON.toJSONString(combineResultMap));
taskService.setVariable(task.getId(), "backToFirst", Boolean.FALSE); // 标识驳回标签false taskService.setVariable(task.getId(), "backToFirst", Boolean.FALSE); // 标识驳回标签false
taskService.setVariable(task.getId(), "completeEntry", Boolean.FALSE); // 标志为非首次录入 taskService.setVariable(task.getId(), "completeEntry", Boolean.FALSE); // 标志为非首次录入
taskService.setVariable(task.getId(), "reject", Boolean.FALSE); // 标识流程中是否存在拒绝false taskService.setVariable(task.getId(), "reject", Boolean.FALSE); // 标识流程中是否存在拒绝false
@ -65,7 +64,7 @@ public class RejectController {
String name = userDTOOptional.isPresent() ? userDTOOptional.get().getRealName() : ""; String name = userDTOOptional.isPresent() ? userDTOOptional.get().getRealName() : "";
actTaskService.completeTask(task.getId(), name + "重新发起审核"); actTaskService.completeTask(task.getId(), name + "重新发起审核");
result.set(new Result().ok(name + "重新发起审核成功")); result.set(new Result().ok(name + "重新发起审核成功"));
logger.error(name + "重新发起审核成功"); logger.error("{}重新发起审核成功", name);
}); });
return result.get(); return result.get();
} }

View File

@ -1,8 +1,8 @@
package io.renren.common.controller; package io.renren.common.controller;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.crypto.SecureUtil; import cn.hutool.crypto.SecureUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import io.renren.common.annotation.LogOperation; import io.renren.common.annotation.LogOperation;
import io.renren.common.page.PageData; import io.renren.common.page.PageData;
@ -75,21 +75,21 @@ public class ResourceMountController {
@Value("${big_date.name}") @Value("${big_date.name}")
private String bigDateDeptName; // 大数据局名称 private String bigDateDeptName; // 大数据局名称
private static final String apply_key = "resourcemountapply"; // 资源上架 private static final String APPLY_KEY = "resourcemountapply"; // 资源上架
private static final String undercarriage_key = "resourcundercarriageapply"; // 资源下架 private static final String UNDERCARRIAGE_KEY = "resourcundercarriageapply"; // 资源下架
private static final Map<String, Object> apply_params = new HashMap<String, Object>() { private static final Map<String, Object> apply_params = new HashMap<String, Object>() {
{ {
put("isLatestVersion", true); // 取最新版本 put("isLatestVersion", true); // 取最新版本
put("key", apply_key); // 限定 能力资源上架 put("key", APPLY_KEY); // 限定 能力资源上架
} }
}; };
private static final Map<String, Object> undercarriage_params = new HashMap<String, Object>() { private static final Map<String, Object> undercarriage_params = new HashMap<String, Object>() {
{ {
put("isLatestVersion", true); // 取最新版本 put("isLatestVersion", true); // 取最新版本
put("key", undercarriage_key); // 限定 资源下架 put("key", UNDERCARRIAGE_KEY); // 限定 资源下架
} }
}; };
@ -112,11 +112,10 @@ public class ResourceMountController {
tResourceMountApplyDTO.setDeptId(tResourceBatchMountApplyDTO.getDeptId()); tResourceMountApplyDTO.setDeptId(tResourceBatchMountApplyDTO.getDeptId());
tResourceMountApplyDTO.setUserId(tResourceBatchMountApplyDTO.getUserId()); tResourceMountApplyDTO.setUserId(tResourceBatchMountApplyDTO.getUserId());
tResourceMountApplyDTO.setUserName(tResourceBatchMountApplyDTO.getUserName()); tResourceMountApplyDTO.setUserName(tResourceBatchMountApplyDTO.getUserName());
tResourceMountApplyDTO.setParameterContent(JSONObject.toJSONString(index)); tResourceMountApplyDTO.setParameterContent(JSON.toJSONString(index));
tResourceMountApplyDTO.setParameterContentMd5(SecureUtil.md5(JSONObject.toJSONString(index))); tResourceMountApplyDTO.setParameterContentMd5(SecureUtil.md5(JSON.toJSONString(index)));
tResourceMountApplyDTO.setResourceDTO(index); tResourceMountApplyDTO.setResourceDTO(index);
tResourceMountApplyDTO.setEnclosure(index.getEnclosure()); tResourceMountApplyDTO.setEnclosure(index.getEnclosure());
// tResourceMountApplyDTO.setApplyNumber(codeGenerationUtils.getApplyNumber("NLSJ"));
try { try {
tResourceMountApplyDTO.setResourceId(tResourceMountApplyDTO.getResourceDTO().getId()); tResourceMountApplyDTO.setResourceId(tResourceMountApplyDTO.getResourceDTO().getId());
} catch (Exception e) { } catch (Exception e) {
@ -151,22 +150,22 @@ public class ResourceMountController {
// 仿照请求接口 /act/running/startOfBusinessKey // 仿照请求接口 /act/running/startOfBusinessKey
ProcessStartDTO processStartDTO = new ProcessStartDTO(); ProcessStartDTO processStartDTO = new ProcessStartDTO();
processStartDTO.setBusinessKey(tResourceMountApplyDTO.getId().toString()); processStartDTO.setBusinessKey(tResourceMountApplyDTO.getId().toString());
processStartDTO.setProcessDefinitionKey(apply_key); // 限定资源上架 processStartDTO.setProcessDefinitionKey(APPLY_KEY); // 限定资源上架
Map<String, Object> variables = oMapper.convertValue(tResourceMountApplyDTO, Map.class); Map<String, Object> variables = oMapper.convertValue(tResourceMountApplyDTO, Map.class);
processStartDTO.setVariables(variables); processStartDTO.setVariables(variables);
ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO); ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO);
logger.info("-------------------2.启动流程成功--------------------------"); logger.info("-------------------2.启动流程成功--------------------------");
logger.info("ProcessInstanceDTO.getBusinessKey:" + dto.getBusinessKey()); logger.info("ProcessInstanceDTO.getBusinessKey:{}", dto.getBusinessKey());
if (Long.valueOf(dto.getBusinessKey()) != null) { if (Long.valueOf(dto.getBusinessKey()) != null) {
// 仿照请求接口 /processForm/tabilityapplication/updateInstanceId // 仿照请求接口 /processForm/tabilityapplication/updateInstanceId
tResourceMountApplyService.updateInstanceId(dto.getProcessInstanceId(), Long.valueOf(dto.getBusinessKey())); tResourceMountApplyService.updateInstanceId(dto.getProcessInstanceId(), Long.valueOf(dto.getBusinessKey()));
logger.info("-------------------更新updateInstanceId.成功--------------------------"); logger.info("-------------------更新updateInstanceId.成功--------------------------");
logger.info("ProcessInstanceDTO.getProcessInstanceId:" + dto.getProcessInstanceId()); logger.info("ProcessInstanceDTO.getProcessInstanceId:{}", dto.getProcessInstanceId());
} }
return dto; return dto;
}).filter(index -> ObjectUtil.isNotNull(index)).collect(Collectors.toList())); }).filter(ObjectUtil::isNotNull).collect(Collectors.toList()));
} }
@PostMapping(value = "/undercarriage") @PostMapping(value = "/undercarriage")
@ -187,7 +186,7 @@ public class ResourceMountController {
Optional<ResourceDTO> resourceDTO = Optional.ofNullable(resourceService.get(resourceId)); Optional<ResourceDTO> resourceDTO = Optional.ofNullable(resourceService.get(resourceId));
if (resourceDTO.isPresent()) { if (resourceDTO.isPresent()) {
TaskQuery taskQuery = taskService.createTaskQuery(); TaskQuery taskQuery = taskService.createTaskQuery();
long task = taskQuery.active().processDefinitionKey(undercarriage_key).processInstanceBusinessKey(resourceId.toString()).count(); long task = taskQuery.active().processDefinitionKey(UNDERCARRIAGE_KEY).processInstanceBusinessKey(resourceId.toString()).count();
return task > 0; return task > 0;
} else { } else {
return true; return true;
@ -199,11 +198,10 @@ public class ResourceMountController {
return new Result().ok(tResourceUndercarriageApplyDTO.getResource().stream().map(index -> { return new Result().ok(tResourceUndercarriageApplyDTO.getResource().stream().map(index -> {
List<ProcessInstanceDTO> dtoList = new ArrayList<>(); List<ProcessInstanceDTO> dtoList = new ArrayList<>();
Long resourceId = Long.valueOf(index.get("resourceId")); Long resourceId = Long.valueOf(index.get("resourceId"));
// String resourceName = index.get("resourceName");
Optional<ResourceDTO> resourceDTO = Optional.ofNullable(resourceService.get(resourceId)); Optional<ResourceDTO> resourceDTO = Optional.ofNullable(resourceService.get(resourceId));
resourceDTO.ifPresent(dto -> { resourceDTO.ifPresent(dto -> {
TaskQuery taskQuery = taskService.createTaskQuery(); TaskQuery taskQuery = taskService.createTaskQuery();
long task = taskQuery.active().processDefinitionKey(undercarriage_key).processInstanceBusinessKey(resourceId.toString()).count(); long task = taskQuery.active().processDefinitionKey(UNDERCARRIAGE_KEY).processInstanceBusinessKey(resourceId.toString()).count();
if (task > 0) { if (task > 0) {
logger.error("该资源已发起下架"); logger.error("该资源已发起下架");
throw new RuntimeException("该资源已发起下架"); throw new RuntimeException("该资源已发起下架");
@ -226,13 +224,13 @@ public class ResourceMountController {
// 仿照请求接口 /act/running/startOfBusinessKey // 仿照请求接口 /act/running/startOfBusinessKey
ProcessStartDTO processStartDTO = new ProcessStartDTO(); ProcessStartDTO processStartDTO = new ProcessStartDTO();
processStartDTO.setBusinessKey(resourceId.toString()); processStartDTO.setBusinessKey(resourceId.toString());
processStartDTO.setProcessDefinitionKey(undercarriage_key); // 限定资源下架 processStartDTO.setProcessDefinitionKey(UNDERCARRIAGE_KEY); // 限定资源下架
Map<String, Object> variables = oMapper.convertValue(dto, Map.class); Map<String, Object> variables = oMapper.convertValue(dto, Map.class);
processStartDTO.setVariables(variables); processStartDTO.setVariables(variables);
ProcessInstanceDTO index_ = actRunningService.startOfBusinessKey(processStartDTO); ProcessInstanceDTO index_ = actRunningService.startOfBusinessKey(processStartDTO);
logger.info("-------------------2.启动流程成功--------------------------"); logger.info("-------------------2.启动流程成功--------------------------");
logger.info("ProcessInstanceDTO.getBusinessKey:" + index_.getBusinessKey()); logger.info("ProcessInstanceDTO.getBusinessKey:{}", index_.getBusinessKey());
dtoList.add(index_); dtoList.add(index_);
}); });
return dtoList.stream().findAny().orElse(null); return dtoList.stream().findAny().orElse(null);

View File

@ -1,12 +1,10 @@
package io.renren.common.domain; package io.renren.common.domain;
import lombok.Data; import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource; import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* 包头区域配置项 * 包头区域配置项
*/ */

View File

@ -1,6 +1,5 @@
package io.renren.common.domain; package io.renren.common.domain;
import lombok.Data; import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource; import org.springframework.context.annotation.PropertySource;

View File

@ -14,11 +14,11 @@ import java.util.Date;
*/ */
@Component @Component
public class FieldMetaObjectHandler implements MetaObjectHandler { public class FieldMetaObjectHandler implements MetaObjectHandler {
private final static String CREATE_DATE = "createDate"; private static final String CREATE_DATE = "createDate";
private final static String CREATOR = "creator"; private static final String CREATOR = "creator";
private final static String UPDATE_DATE = "updateDate"; private static final String UPDATE_DATE = "updateDate";
private final static String UPDATER = "updater"; private static final String UPDATER = "updater";
private final static String DEPT_ID = "deptId"; private static final String DEPT_ID = "deptId";
@Override @Override
public void insertFill(MetaObject metaObject) { public void insertFill(MetaObject metaObject) {

View File

@ -30,18 +30,16 @@ public class InitiatorDataEntryListener implements TaskListener {
@Override @Override
public void notify(DelegateTask delegateTask) { public void notify(DelegateTask delegateTask) {
logger.error("----------------------流程发起人录入表单节点---------------------------"); logger.error("----------------------流程发起人录入表单节点---------------------------");
logger.error("事件类型:" + delegateTask.getEventName()); logger.error("事件类型:{}", delegateTask.getEventName());
final String eventName = delegateTask.getEventName(); final String eventName = delegateTask.getEventName();
switch (eventName) { if (EVENTNAME_CREATE.equals(eventName)) {
case EVENTNAME_CREATE:
create(delegateTask); create(delegateTask);
break;
} }
} }
private void create(DelegateTask delegateTask) { private void create(DelegateTask delegateTask) {
Map<String, Object> kv = delegateTask.getVariables(); Map<String, Object> kv = delegateTask.getVariables();
logger.error("录入表单:" + kv.toString()); logger.error("录入表单:{}", kv.toString());
if (kv.containsKey("creator")) { // 表单存在创建者 if (kv.containsKey("creator")) { // 表单存在创建者
taskService.setAssignee(delegateTask.getId(), kv.get("creator").toString()); taskService.setAssignee(delegateTask.getId(), kv.get("creator").toString());
taskService.setOwner(delegateTask.getId(), kv.get("creator").toString()); // 指定流程所有人 taskService.setOwner(delegateTask.getId(), kv.get("creator").toString()); // 指定流程所有人
@ -58,13 +56,12 @@ public class InitiatorDataEntryListener implements TaskListener {
if (auditingBaseDTO.getBackToFirst() != null && auditingBaseDTO.getBackToFirst()) { if (auditingBaseDTO.getBackToFirst() != null && auditingBaseDTO.getBackToFirst()) {
logger.error("被驳回,需修改后重新提交"); logger.error("被驳回,需修改后重新提交");
} else { } else {
if (auditingBaseDTO.getCompleteEntry()) { if (Boolean.TRUE.equals(auditingBaseDTO.getCompleteEntry())) {
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "完成申请提交"); taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "完成申请提交");
taskService.complete(delegateTask.getId(), delegateTask.getVariables()); taskService.complete(delegateTask.getId(), delegateTask.getVariables());
logger.error("首次录入,自动审核通过!"); logger.error("首次录入,自动审核通过!");
} }
} }
logger.error("----------完成录入表单-----------"); logger.error("----------完成录入表单-----------");
return;
} }
} }

View File

@ -31,7 +31,7 @@ public class CodeGenerationUtils {
*/ */
enum CodeGenerationUtilsEnum { enum CodeGenerationUtilsEnum {
INSTANCE; INSTANCE;
private CodeGenerationUtils codeGenerationUtils; private final CodeGenerationUtils codeGenerationUtils;
CodeGenerationUtilsEnum() { CodeGenerationUtilsEnum() {
codeGenerationUtils = new CodeGenerationUtils(); codeGenerationUtils = new CodeGenerationUtils();
@ -86,6 +86,8 @@ public class CodeGenerationUtils {
case "NLXJ": case "NLXJ":
tableName = "tb_data_resource"; tableName = "tb_data_resource";
break; break;
default:
break;
} }
lock.lock(); lock.lock();
String sql = "SELECT SUBSTR(apply_number, 5) FROM " + tableName + String sql = "SELECT SUBSTR(apply_number, 5) FROM " + tableName +
@ -99,7 +101,6 @@ public class CodeGenerationUtils {
String s = jdbcTemplate.queryForObject(sql, String.class); String s = jdbcTemplate.queryForObject(sql, String.class);
no = applyNumberPattern.substring(0, 4) + (Long.parseLong(s) + 1); no = applyNumberPattern.substring(0, 4) + (Long.parseLong(s) + 1);
} catch (Exception e) { } catch (Exception e) {
logger.error("流水号生成失败", e);
no = applyNumberPattern + "0001"; no = applyNumberPattern + "0001";
} finally { } finally {
try { try {

View File

@ -20,7 +20,5 @@ public class ProcessEngineConfig implements ProcessEngineConfigurationConfigurer
processEngineConfiguration.setJobExecutorActivate(false); processEngineConfiguration.setJobExecutorActivate(false);
processEngineConfiguration.setAsyncExecutorEnabled(false); processEngineConfiguration.setAsyncExecutorEnabled(false);
//自定义流程图样式
//processEngineConfiguration.setProcessDiagramGenerator(customProcessDiagramGenerator);
} }
} }

View File

@ -145,9 +145,9 @@ public class ActProcessController {
InputStream resourceAsStream = actProcessService.getResourceAsStream(deploymentId, resourceName); InputStream resourceAsStream = actProcessService.getResourceAsStream(deploymentId, resourceName);
String[] fileNames = resourceName.split("\\."); String[] fileNames = resourceName.split("\\.");
if(fileNames.length>1){ if(fileNames.length>1){
if(fileNames[fileNames.length-1].toLowerCase().equals("png")){ if(fileNames[fileNames.length-1].equalsIgnoreCase("png")){
response.setHeader("Content-Type","image/png"); response.setHeader("Content-Type","image/png");
} else if(fileNames[fileNames.length-1].toLowerCase().equals("xml")){ } else if(fileNames[fileNames.length-1].equalsIgnoreCase("xml")){
response.setHeader("Content-Type", "text/xml"); response.setHeader("Content-Type", "text/xml");
response.setHeader("Content-Disposition", "attachment; filename=" + java.net.URLEncoder.encode(resourceName, "UTF-8")); response.setHeader("Content-Disposition", "attachment; filename=" + java.net.URLEncoder.encode(resourceName, "UTF-8"));
} }

View File

@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import io.renren.common.constant.Constant; import io.renren.common.constant.Constant;
import io.renren.common.page.PageData; import io.renren.common.page.PageData;
import io.renren.common.service.impl.CrudServiceImpl; import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.utils.Result;
import io.renren.modules.fuse.dao.TbFuseAttrDao; import io.renren.modules.fuse.dao.TbFuseAttrDao;
import io.renren.modules.fuse.dao.TbFuseDao; import io.renren.modules.fuse.dao.TbFuseDao;
import io.renren.modules.fuse.dao.TbFuseResourceDao; import io.renren.modules.fuse.dao.TbFuseResourceDao;
@ -27,7 +26,6 @@ import io.renren.modules.resource.service.impl.ResourceServiceImpl;
import io.renren.modules.resourceCollection.dao.ResourceCollectionDao; import io.renren.modules.resourceCollection.dao.ResourceCollectionDao;
import io.renren.modules.security.user.SecurityUser; import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.sys.service.SysDeptService; import io.renren.modules.sys.service.SysDeptService;
import org.apache.commons.lang3.ObjectUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;

View File

@ -15,7 +15,6 @@ import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup; import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.activiti.dto.HistoryDetailDTO; import io.renren.modules.activiti.dto.HistoryDetailDTO;
import io.renren.modules.activiti.service.ActivitiService; import io.renren.modules.activiti.service.ActivitiService;
import io.renren.modules.monitor.dto.CameraChannelDto1;
import io.renren.modules.monitor.mapper.CameraChannelMapper; import io.renren.modules.monitor.mapper.CameraChannelMapper;
import io.renren.modules.processForm.dao.TAbilityApplicationDao; import io.renren.modules.processForm.dao.TAbilityApplicationDao;
import io.renren.modules.processForm.dto.TAbilityApplicationDTO; import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
@ -43,10 +42,7 @@ import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -148,7 +144,7 @@ public class TAbilityApplicationController {
} else { } else {
String sql = String.format("SELECT IF(COUNT(id) >0 ,FALSE,TRUE) AS ended FROM t_ability_application WHERE apply_flag = '%s' AND EXISTS (SELECT 1 FROM t_ability_application t1 WHERE t1.apply_flag = t_ability_application.apply_flag AND approve_status = '审核中');", index.getApplyFlag()); String sql = String.format("SELECT IF(COUNT(id) >0 ,FALSE,TRUE) AS ended FROM t_ability_application WHERE apply_flag = '%s' AND EXISTS (SELECT 1 FROM t_ability_application t1 WHERE t1.apply_flag = t_ability_application.apply_flag AND approve_status = '审核中');", index.getApplyFlag());
Boolean ended = jdbcTemplate.queryForObject(sql, Boolean.class); Boolean ended = jdbcTemplate.queryForObject(sql, Boolean.class);
index.setEnded(Boolean.valueOf(ended)); index.setEnded(ended);
} }
return index; return index;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
@ -197,7 +193,7 @@ public class TAbilityApplicationController {
return new Result<TAbilityApplicationV2DTO>().ok(null); return new Result<TAbilityApplicationV2DTO>().ok(null);
} }
TAbilityApplicationV2DTO tAbilityApplicationV2DTO = ConvertUtils.sourceToTarget(applicationDTOS.get(0), TAbilityApplicationV2DTO.class); TAbilityApplicationV2DTO tAbilityApplicationV2DTO = ConvertUtils.sourceToTarget(applicationDTOS.get(0), TAbilityApplicationV2DTO.class);
applicationDTOS.stream().limit(1l).forEach(dto -> { applicationDTOS.stream().limit(1L).forEach(dto -> {
if (StringUtils.isNotEmpty(dto.getCameraList())) { if (StringUtils.isNotEmpty(dto.getCameraList())) {
if (applicationDTOS.size() > 1) { if (applicationDTOS.size() > 1) {
tAbilityApplicationV2DTO.setSystem("视频资源申请:(" + dto.getSystem() + "" + applicationDTOS.size() + "个摄像头)"); tAbilityApplicationV2DTO.setSystem("视频资源申请:(" + dto.getSystem() + "" + applicationDTOS.size() + "个摄像头)");
@ -235,7 +231,7 @@ public class TAbilityApplicationController {
camera = cameraList; camera = cameraList;
List<Object> finalCamera = camera; List<Object> finalCamera = camera;
Map<String, Object> resourceApplication = new HashMap<String, Object>() { return new HashMap<String, Object>() {
{ {
put("instanceId", tAbilityApplicationDTOList.get(0).getInstanceId()); // 流程id put("instanceId", tAbilityApplicationDTOList.get(0).getInstanceId()); // 流程id
put("resourceOwnerDept", tAbilityApplicationDTOList.get(0).getResourceOwnerDept()); // 资源所属部门信息 put("resourceOwnerDept", tAbilityApplicationDTOList.get(0).getResourceOwnerDept()); // 资源所属部门信息
@ -252,8 +248,7 @@ public class TAbilityApplicationController {
} }
} }
}; };
return resourceApplication; }).filter(Objects::nonNull).collect(Collectors.groupingBy(t -> {
}).filter(index -> index != null).collect(Collectors.groupingBy(t -> {
SysDeptDTO sysDeptDTO = (SysDeptDTO) t.get("resourceOwnerDept"); SysDeptDTO sysDeptDTO = (SysDeptDTO) t.get("resourceOwnerDept");
if (sysDeptDTO == null) { if (sysDeptDTO == null) {
return "未知部门"; // 无部门信息 return "未知部门"; // 无部门信息

View File

@ -25,21 +25,6 @@ import java.util.Map;
@Configuration @Configuration
public class ShiroConfig { public class ShiroConfig {
// @Autowired
// private Oauth2Filter oauth2Filter;
//@Autowired
//private ShiroSessionManager shiroSessionManager;
//@Bean
//public DefaultWebSessionManager sessionManager() {
// DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();
// sessionManager.setSessionValidationSchedulerEnabled(false);
// sessionManager.setSessionIdUrlRewritingEnabled(false);
// sessionManager.setGlobalSessionTimeout(-1000l);
// return sessionManager;
//}
@Bean @Bean
public DefaultWebSessionManager sessionManager() { public DefaultWebSessionManager sessionManager() {
ShiroSessionManager sessionManager = new ShiroSessionManager(); ShiroSessionManager sessionManager = new ShiroSessionManager();

View File

@ -67,17 +67,16 @@ public class Oauth2Realm extends AuthorizingRealm {
//转换成UserDetail对象 //转换成UserDetail对象
UserDetail userDetail = ConvertUtils.sourceToTarget(userEntity, UserDetail.class); UserDetail userDetail = ConvertUtils.sourceToTarget(userEntity, UserDetail.class);
//获取用户对应的部门数据权限
List<Long> deptIdList = shiroService.getDataScopeList(userDetail.getId());
userDetail.setDeptIdList(deptIdList);
//账号锁定 //账号锁定
if(userDetail.getStatus() == 0){ if(userDetail.getStatus() == 0){
throw new LockedAccountException(MessageUtils.getMessage(ErrorCode.ACCOUNT_LOCK)); throw new LockedAccountException(MessageUtils.getMessage(ErrorCode.ACCOUNT_LOCK));
} }
SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(userDetail, accessToken, getName()); //获取用户对应的部门数据权限
return info; List<Long> deptIdList = shiroService.getDataScopeList(userDetail.getId());
userDetail.setDeptIdList(deptIdList);
return new SimpleAuthenticationInfo(userDetail, accessToken, getName());
} }
} }

View File

@ -1,32 +1,22 @@
package io.renren.modules.security.oauth2; package io.renren.modules.security.oauth2;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.session.mgt.SessionContext;
import org.apache.shiro.web.servlet.ShiroHttpServletRequest; import org.apache.shiro.web.servlet.ShiroHttpServletRequest;
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager; import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
import org.apache.shiro.web.util.WebUtils; import org.apache.shiro.web.util.WebUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse; import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.Serializable; import java.io.Serializable;
//@Component
public class ShiroSessionManager extends DefaultWebSessionManager { public class ShiroSessionManager extends DefaultWebSessionManager {
/**
* 返回客户端的
*/
public final String TOKEN_NAME = "token";
/** /**
* 这个是客户端请求给服务端带的header * 这个是客户端请求给服务端带的header
*/ */
public final static String HEADER_TOKEN_NAME = "token"; public static final String HEADER_TOKEN_NAME = "token";
public final static Logger log = LoggerFactory.getLogger(ShiroSessionManager.class); public static final Logger log = LoggerFactory.getLogger(ShiroSessionManager.class);
private static final String REFERENCED_SESSION_ID_SOURCE = "Stateless request"; private static final String REFERENCED_SESSION_ID_SOURCE = "Stateless request";
/** /**
@ -35,7 +25,7 @@ public class ShiroSessionManager extends DefaultWebSessionManager {
@Override @Override
protected Serializable getSessionId(ServletRequest request, ServletResponse response) { protected Serializable getSessionId(ServletRequest request, ServletResponse response) {
String sessionId = WebUtils.toHttp(request).getHeader(HEADER_TOKEN_NAME); String sessionId = WebUtils.toHttp(request).getHeader(HEADER_TOKEN_NAME);
log.info("获取的sessionId为" + sessionId); log.error("获取的sessionId为------>{}", sessionId);
if (StringUtils.isEmpty(sessionId)) { if (StringUtils.isEmpty(sessionId)) {
return super.getSessionId(request, response); return super.getSessionId(request, response);
} else { } else {
@ -47,36 +37,4 @@ public class ShiroSessionManager extends DefaultWebSessionManager {
} }
} }
/*@Override
protected void onStart(Session session, SessionContext context) {
log.info("执行onStart");
if (!WebUtils.isHttp(context)) {
log.debug("SessionContext argument is not HTTP compatible or does not have an HTTP request/response pair. No session ID cookie will be set.");
} else {
HttpServletRequest request = WebUtils.getHttpRequest(context);
HttpServletResponse response = WebUtils.getHttpResponse(context);
Serializable sessionId = session.getId();
this.storeSessionId(sessionId, request, response);
request.removeAttribute(ShiroHttpServletRequest.REFERENCED_SESSION_ID_SOURCE);
request.setAttribute(ShiroHttpServletRequest.REFERENCED_SESSION_IS_NEW, Boolean.TRUE);
}
}
*//**
* 把sessionId 放入 response header
* onStart时调用
* 没有sessionid时 会产生sessionid 并放入 response header中
*//*
private void storeSessionId(Serializable currentId, HttpServletRequest ignored, HttpServletResponse response) {
if (currentId == null) {
String msg = "sessionId cannot be null when persisting for subsequent requests.";
throw new IllegalArgumentException(msg);
} else {
String idString = currentId.toString();
response.setHeader(this.TOKEN_NAME, idString);
log.info("Set session ID header for session with id {}", idString);
log.trace("Set session ID header for session with id {}", idString);
}
}*/
} }