This commit is contained in:
parent
bb3d25d62f
commit
4d8f0c63ae
|
@ -5,7 +5,6 @@ import io.renren.common.annotation.ActivitiNoticeOperation;
|
|||
import io.renren.modules.notice.dto.SysNoticeDTO;
|
||||
import io.renren.modules.notice.enums.NoticeStatusEnum;
|
||||
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.sys.dto.SysDeptDTO;
|
||||
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) {
|
||||
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())) {
|
||||
LOGGER.error("------------出现重放------------");
|
||||
return;
|
||||
|
@ -146,7 +145,7 @@ public class ActivitiNoticeAspect {
|
|||
String result;
|
||||
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()); // 被拒绝
|
||||
if (termination) {
|
||||
if (Boolean.TRUE.equals(termination)) {
|
||||
result = "终止被拒";
|
||||
} else if (reject) {
|
||||
result = "被拒";
|
||||
|
@ -157,13 +156,6 @@ public class ActivitiNoticeAspect {
|
|||
String finalResult = result;
|
||||
CompletableFuture.runAsync(() -> { // 发起人
|
||||
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("id");
|
||||
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) {
|
||||
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())) {
|
||||
LOGGER.error("------------出现重放------------");
|
||||
return;
|
||||
|
@ -224,24 +216,15 @@ public class ActivitiNoticeAspect {
|
|||
String result;
|
||||
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()); // 被拒绝
|
||||
if (termination) {
|
||||
if (Boolean.TRUE.equals(termination)) {
|
||||
result = "终止被拒";
|
||||
} else if (reject) {
|
||||
} else if (Boolean.TRUE.equals(reject)) {
|
||||
result = "被拒";
|
||||
} else {
|
||||
result = "通过";
|
||||
}
|
||||
String finalCreator = creator;
|
||||
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(() -> { // 发起人
|
||||
SysUserDTO userDTO = sysUserService.get(Long.valueOf(finalCreator));
|
||||
kv.get("resourceId");
|
||||
|
@ -261,11 +244,11 @@ public class ActivitiNoticeAspect {
|
|||
dto.setFrom("通知");
|
||||
sysNoticeService.save(dto);
|
||||
}, EXECUTOR).thenRunAsync(() -> {
|
||||
LOGGER.error("大数据局名称:" + bigDateDeptName);
|
||||
LOGGER.error("大数据局名称:{}", bigDateDeptName);
|
||||
SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName);
|
||||
LOGGER.error("deptDTOId:" + deptDTO.getId());
|
||||
LOGGER.error("deptDTOId:{}", deptDTO.getId());
|
||||
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()));
|
||||
userDTO.ifPresent(user -> {
|
||||
SysUserDTO creatorDTO = sysUserService.get(Long.valueOf(finalCreator));
|
||||
|
@ -310,7 +293,7 @@ public class ActivitiNoticeAspect {
|
|||
*/
|
||||
private void assignment_notice(final DelegateTask delegateTask, final ActivitiNoticeOperation activitiNoticeOperation) {
|
||||
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())) {
|
||||
LOGGER.error("------------出现重放------------");
|
||||
return;
|
||||
|
@ -330,9 +313,9 @@ public class ActivitiNoticeAspect {
|
|||
CompletableFuture.runAsync(() -> { // 发起人
|
||||
try {
|
||||
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() + "\"";
|
||||
LOGGER.info("通知内容:" + content);
|
||||
LOGGER.info("通知内容:{}", content);
|
||||
SysNoticeDTO dto = new SysNoticeDTO();
|
||||
dto.setType(2);
|
||||
dto.setTitle("流程流转系统通知");
|
||||
|
|
|
@ -36,7 +36,7 @@ public class DataFilterAspect {
|
|||
@Before("dataFilterCut()")
|
||||
public void dataFilter(JoinPoint point) {
|
||||
Object params = point.getArgs()[0];
|
||||
if(params != null && params instanceof Map){
|
||||
if(params instanceof Map){
|
||||
UserDetail user = SecurityUser.getUser();
|
||||
|
||||
//如果是超级管理员,则不进行数据过滤
|
||||
|
|
|
@ -33,7 +33,6 @@ public class LogOperationAspect {
|
|||
|
||||
@Pointcut("@annotation(io.renren.common.annotation.LogOperation)")
|
||||
public void logPointCut() {
|
||||
|
||||
}
|
||||
|
||||
@Around("logPointCut()")
|
||||
|
|
|
@ -34,15 +34,5 @@ public class MybatisPlusConfig {
|
|||
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;
|
||||
// }
|
||||
|
||||
}
|
|
@ -31,10 +31,6 @@ public class RestTemplateConfig {
|
|||
factory.setReadTimeout(30 * 000);//单位为ms
|
||||
factory.setConnectTimeout(5 * 1000);//单位为ms
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,12 +62,12 @@ public class AbilityCenterController {
|
|||
|
||||
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("key", key); // 限定
|
||||
put("key", KEY); // 限定
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -87,7 +87,6 @@ public class AbilityCenterController {
|
|||
if (page.getTotal() <= 0) { //
|
||||
return new Result().error("联系管理员添加流程");
|
||||
}
|
||||
// String applyNumber = codeGenerationUtils.getApplyNumber("NLSY");
|
||||
return new Result().ok(abilityBatchApplicationDTO.getSystem().stream().map(index -> {
|
||||
if (index.get("resourceId") == null) {
|
||||
logger.error("未携带资源id");
|
||||
|
@ -98,7 +97,6 @@ public class AbilityCenterController {
|
|||
return null;
|
||||
}
|
||||
TAbilityApplicationDTO tAbilityApplicationDTO = new TAbilityApplicationDTO();
|
||||
// tAbilityApplicationDTO.setApplyNumber(applyNumber);
|
||||
tAbilityApplicationDTO.setArea(abilityBatchApplicationDTO.getArea());
|
||||
tAbilityApplicationDTO.setAttachment(abilityBatchApplicationDTO.getAttachment());
|
||||
tAbilityApplicationDTO.setBasis(abilityBatchApplicationDTO.getBasis());
|
||||
|
@ -121,13 +119,13 @@ public class AbilityCenterController {
|
|||
if (tAbilityApplicationDTO.getId() == null) {
|
||||
return null;
|
||||
}
|
||||
codeGenerationUtils.setApplyNumber("NLSY", Arrays.asList(tAbilityApplicationDTO.getId()), jdbcTemplate);
|
||||
codeGenerationUtils.setApplyNumber("NLSY", Collections.singletonList(tAbilityApplicationDTO.getId()), jdbcTemplate);
|
||||
tAbilityApplicationDTO.setCompleteEntry(Boolean.TRUE);
|
||||
|
||||
// 仿照请求接口 /act/running/startOfBusinessKey
|
||||
ProcessStartDTO processStartDTO = new ProcessStartDTO();
|
||||
processStartDTO.setBusinessKey(tAbilityApplicationDTO.getId().toString());
|
||||
processStartDTO.setProcessDefinitionKey(key); //限定
|
||||
processStartDTO.setProcessDefinitionKey(KEY); //限定
|
||||
Map<String, Object> variables = oMapper.convertValue(tAbilityApplicationDTO, Map.class);
|
||||
processStartDTO.setVariables(variables);
|
||||
ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO);
|
||||
|
@ -139,7 +137,7 @@ public class AbilityCenterController {
|
|||
}
|
||||
}, executor);
|
||||
return dto;
|
||||
}).filter(index -> ObjectUtil.isNotNull(index)).collect(Collectors.toList()));
|
||||
}).filter(ObjectUtil::isNotNull).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -75,12 +75,12 @@ public class AbilityCenterControllerV2 {
|
|||
|
||||
@Value("${big_date.name}")
|
||||
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("key", key); // 限定
|
||||
put("key", KEY); // 限定
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -184,7 +184,7 @@ public class AbilityCenterControllerV2 {
|
|||
codeGenerationUtils.setApplyNumber("NLSY", tAbilityApplicationDTOList.stream().map(TAbilityApplicationDTO::getId).collect(Collectors.toList()), jdbcTemplate);
|
||||
|
||||
Map<Long, List<TAbilityApplicationDTO>> temp = tAbilityApplicationDTOList.stream()
|
||||
.filter(index -> index != null)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(index -> StringUtils.isNotEmpty(index.getResourceId()))
|
||||
.collect(Collectors.groupingBy(t -> {
|
||||
ResourceDTO resourceDTO = resourceService.get(Long.valueOf(t.getResourceId()));
|
||||
|
@ -207,12 +207,12 @@ public class AbilityCenterControllerV2 {
|
|||
List<TAbilityApplicationDTO> dtoList = temp.get(deptId);
|
||||
|
||||
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()]);
|
||||
jdbcTemplate.batchUpdate(sqls_); // 批量更新资源所属部门信息
|
||||
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); // 批量更新资源所属部门信息
|
||||
logger.info("批量更新申请的资源的部门信息完成");
|
||||
}, 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())));
|
||||
if (!resourceDTOOptional.isPresent()) { // 从本库内查不到 视为其它平台的基础设施资源
|
||||
return true;
|
||||
|
@ -222,14 +222,14 @@ public class AbilityCenterControllerV2 {
|
|||
}
|
||||
return 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
|
||||
// 仿照请求接口 /act/running/startOfBusinessKey
|
||||
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) :
|
||||
JSON.toJSONString(ids.stream().limit(5).collect(Collectors.toList()))); // 申请的id列表 json字符 做businesskey
|
||||
processStartDTO.setProcessDefinitionKey(key); //限定
|
||||
processStartDTO.setProcessDefinitionKey(KEY); //限定
|
||||
AuditingBaseDTO auditingBaseDTO = new AuditingBaseDTO();
|
||||
auditingBaseDTO.setCompleteEntry(Boolean.TRUE); // 首次录入
|
||||
|
||||
|
@ -244,7 +244,7 @@ public class AbilityCenterControllerV2 {
|
|||
put("id", applyFlag); //申请id
|
||||
put("creator", user == null ? null : user.getId().toString()); // 创建人
|
||||
put("userId", user == null ? null : user.getId().toString()); // 创建人
|
||||
put("basic_facilities", basic_facilities); // 是否为基础设施
|
||||
put("basic_facilities", basicFacilities); // 是否为基础设施
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ import java.util.stream.Collectors;
|
|||
@RequestMapping("/census/center")
|
||||
public class CensusController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CensusController.class);
|
||||
private static Integer cpuNUm = Runtime.getRuntime().availableProcessors();
|
||||
private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm);
|
||||
private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors();
|
||||
private static final ExecutorService executor = Executors.newFixedThreadPool(CPUNUM);
|
||||
|
||||
@Autowired
|
||||
private ResourceService resourceService;
|
||||
|
@ -80,7 +80,7 @@ public class CensusController {
|
|||
};
|
||||
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>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
|
@ -100,59 +100,48 @@ public class CensusController {
|
|||
CompletableFuture<Void> resourceAmount = CompletableFuture.supplyAsync(() -> { // 获取资源汇聚总量
|
||||
Map map = (Map) resourceService.selectTotal();
|
||||
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 sum;
|
||||
}, executor).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "资源汇聚总量");
|
||||
}
|
||||
});
|
||||
});
|
||||
return dbAmount.stream().mapToLong(index -> Long.parseLong(index.get("count").toString())).sum();
|
||||
}, executor).thenAccept(sum -> result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "资源汇聚总量");
|
||||
}
|
||||
}));
|
||||
CompletableFuture<Void> userAmount = CompletableFuture.supplyAsync(() -> { // 获取平台用户总数
|
||||
return sysUserService.countAllUser();
|
||||
}, executor).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "用户量");
|
||||
}
|
||||
});
|
||||
});
|
||||
}, executor).thenAccept(sum -> result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "用户量");
|
||||
}
|
||||
}));
|
||||
|
||||
CompletableFuture<Void> applyAmount = CompletableFuture.supplyAsync(() -> { // 资源申请量
|
||||
return tAbilityApplicationService.countApplyAll();
|
||||
}, executor).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "资源申请量");
|
||||
}
|
||||
});
|
||||
});
|
||||
}, executor).thenAccept(sum -> result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "资源申请量");
|
||||
}
|
||||
}));
|
||||
|
||||
CompletableFuture<Void> deptAmount = CompletableFuture.supplyAsync(() -> { // 覆盖部门量
|
||||
return resourceService.countAllDept();
|
||||
}, executor).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "覆盖部门量");
|
||||
}
|
||||
});
|
||||
});
|
||||
}, executor).thenAccept(sum -> result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "覆盖部门量");
|
||||
}
|
||||
}));
|
||||
|
||||
CompletableFuture<Void> pvAmount = CompletableFuture.supplyAsync(() -> { // 平台访问量
|
||||
return resourceService.countAllVisits();
|
||||
}, executor).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "平台访问量");
|
||||
}
|
||||
});
|
||||
});
|
||||
}, executor).thenAccept(sum -> result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "平台访问量");
|
||||
}
|
||||
}));
|
||||
CompletableFuture<Void> all = CompletableFuture.allOf(resourceAmount, userAmount, applyAmount, deptAmount, pvAmount);
|
||||
all.join();
|
||||
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<String, Object>> result = Collections.synchronizedList(new ArrayList<>());
|
||||
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.supplyAsync(() -> { // 获取部门提供能力
|
||||
List<String> db = resourceService.selectDeptProvide(deptId);
|
||||
|
@ -240,7 +229,7 @@ public class CensusController {
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
).reversed().thenComparing(i -> i.toString()));
|
||||
).reversed().thenComparing(Object::toString));
|
||||
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<String, Object>> result = Collections.synchronizedList(new ArrayList<>());
|
||||
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.supplyAsync(() -> { // 获取资源汇聚总量
|
||||
List<String> db = tAbilityApplicationService.selectDeptApply(deptId);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package io.renren.common.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
@ -37,7 +36,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* 2022.6.19 版本
|
||||
*/
|
||||
|
@ -46,11 +44,11 @@ import java.util.stream.Collectors;
|
|||
@RequestMapping("/census/center/v2")
|
||||
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()
|
||||
.connectTimeout(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)
|
||||
.build();
|
||||
|
||||
|
@ -88,25 +86,21 @@ public class CensusControllerV2 {
|
|||
|
||||
CompletableFuture<Void> userAmount = CompletableFuture.supplyAsync(() -> { // 获取平台用户总数
|
||||
return sysUserService.countAllUser();
|
||||
}).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "用户量");
|
||||
}
|
||||
});
|
||||
});
|
||||
}).thenAccept(sum -> result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "用户量");
|
||||
}
|
||||
}));
|
||||
|
||||
CompletableFuture<Void> pvAmount = CompletableFuture.supplyAsync(() -> { // 平台访问量
|
||||
return resourceService.countAllVisits();
|
||||
}).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "平台访问量");
|
||||
}
|
||||
});
|
||||
});
|
||||
}).thenAccept(sum -> result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "平台访问量");
|
||||
}
|
||||
}));
|
||||
CompletableFuture<Void> all = CompletableFuture.allOf(userAmount, pvAmount);
|
||||
all.join();
|
||||
result.sort(Comparator.comparing(x -> x.get("type").toString()));
|
||||
|
@ -135,14 +129,12 @@ public class CensusControllerV2 {
|
|||
|
||||
CompletableFuture<Void> allApplicationAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总应用数目
|
||||
return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='应用资源' AND del_flag = 0;", Long.class);
|
||||
}).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "总应用数");
|
||||
}
|
||||
});
|
||||
});
|
||||
}).thenAccept(sum -> result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "总应用数");
|
||||
}
|
||||
}));
|
||||
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);
|
||||
}).thenAccept(sum -> {
|
||||
|
@ -155,14 +147,12 @@ public class CensusControllerV2 {
|
|||
});
|
||||
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);
|
||||
}).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "停用应用数");
|
||||
}
|
||||
});
|
||||
});
|
||||
}).thenAccept(sum -> result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "停用应用数");
|
||||
}
|
||||
}));
|
||||
CompletableFuture<Void> all = CompletableFuture.allOf(allApplicationAmount, buildingApplicationAmount, endApplicationAmount);
|
||||
all.join();
|
||||
return new Result().ok(result);
|
||||
|
@ -213,7 +203,7 @@ public class CensusControllerV2 {
|
|||
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());
|
||||
return re;
|
||||
}).filter(index -> ObjectUtils.allNotNull(index)).collect(Collectors.toList());
|
||||
}).filter(ObjectUtils::allNotNull).collect(Collectors.toList());
|
||||
result.sort(Comparator.comparing(x -> {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
try {
|
||||
|
@ -235,58 +225,48 @@ public class CensusControllerV2 {
|
|||
List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
|
||||
CompletableFuture<Void> allAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总组件服务数目
|
||||
return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='组件服务' AND del_flag = 0;", Long.class);
|
||||
}).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "上架总数");
|
||||
}
|
||||
});
|
||||
});
|
||||
}).thenAccept(sum -> result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
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;";
|
||||
|
||||
CompletableFuture<Void> aiAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台智能算法组件服务数目
|
||||
return jdbcTemplate.queryForObject(String.format(sqlFormat, "智能算法"), Long.class);
|
||||
}).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "智能算法");
|
||||
}
|
||||
});
|
||||
});
|
||||
}).thenAccept(sum -> result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "智能算法");
|
||||
}
|
||||
}));
|
||||
CompletableFuture<Void> gisAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台图层服务组件服务数目
|
||||
return jdbcTemplate.queryForObject(String.format(sqlFormat, "图层服务"), Long.class);
|
||||
}).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "图层服务");
|
||||
}
|
||||
});
|
||||
});
|
||||
}).thenAccept(sum -> result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "图层服务");
|
||||
}
|
||||
}));
|
||||
CompletableFuture<Void> busAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台业务组件组件服务数目
|
||||
return jdbcTemplate.queryForObject(String.format(sqlFormat, "业务组件"), Long.class);
|
||||
}).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "业务组件");
|
||||
}
|
||||
});
|
||||
});
|
||||
}).thenAccept(sum -> result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "业务组件");
|
||||
}
|
||||
}));
|
||||
CompletableFuture<Void> devAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台业务组件组件服务数目
|
||||
return jdbcTemplate.queryForObject(String.format(sqlFormat, "开发组件"), Long.class);
|
||||
}).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "开发组件");
|
||||
}
|
||||
});
|
||||
});
|
||||
}).thenAccept(sum -> result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "开发组件");
|
||||
}
|
||||
}));
|
||||
CompletableFuture<Void> all = CompletableFuture.allOf(allAssemblyAmount, aiAssemblyAmount, gisAssemblyAmount, busAssemblyAmount, devAssemblyAmount);
|
||||
all.join();
|
||||
return new Result().ok(result);
|
||||
|
@ -299,24 +279,20 @@ public class CensusControllerV2 {
|
|||
List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
|
||||
CompletableFuture<Void> allKnowledgeAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总知识库数目
|
||||
return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='知识库' AND del_flag = 0;", Long.class);
|
||||
}).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "知识库上架总量");
|
||||
}
|
||||
});
|
||||
});
|
||||
}).thenAccept(sum -> result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "知识库上架总量");
|
||||
}
|
||||
}));
|
||||
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);
|
||||
}).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum == null ? 0L : sum);
|
||||
put("type", "知识库总浏览量");
|
||||
}
|
||||
});
|
||||
});
|
||||
}).thenAccept(sum -> result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum == null ? 0L : sum);
|
||||
put("type", "知识库总浏览量");
|
||||
}
|
||||
}));
|
||||
CompletableFuture<Void> all = CompletableFuture.allOf(allKnowledgeAmount, allKnowledgeVisitsAmount);
|
||||
all.join();
|
||||
return new Result().ok(result);
|
||||
|
@ -400,8 +376,6 @@ public class CensusControllerV2 {
|
|||
@LogOperation("能力云图-数据资源简况")
|
||||
public Result<List<Map<String, Object>>> dataResourceInfo() {
|
||||
List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
|
||||
CompletableFuture<Void> allAmount = null;
|
||||
CompletableFuture<Void> applyInfo = null; // 申请情况
|
||||
switch (Constant.ProjectPlace.getByFlag(projectPlace)) {
|
||||
case BAOTOU: { // TODO 包头
|
||||
result.add(new HashMap<String, Object>() {
|
||||
|
|
|
@ -77,7 +77,6 @@ public class CensusControllerV3 {
|
|||
}
|
||||
|
||||
String type = params.get("resourceType").toString();
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
|
||||
switch (type) {
|
||||
case "组件服务":
|
||||
|
@ -124,22 +123,15 @@ public class CensusControllerV3 {
|
|||
}
|
||||
|
||||
String type = params.get("resourceType").toString();
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
|
||||
switch (type) {
|
||||
case "组件服务":
|
||||
PageData<Map<String, Object>> pageData = resourceService.resourceBusinessUseDetails(params);
|
||||
return new Result<PageData<Map<String, Object>>>().ok(pageData);
|
||||
case "应用资源":
|
||||
return null;
|
||||
case "基础设施":
|
||||
case "数据资源":
|
||||
PageData<Map<String, Object>> pageData1 = resourceService.resourceDatasUseDetails(params);
|
||||
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:
|
||||
return null;
|
||||
}
|
||||
|
@ -429,7 +421,7 @@ public class CensusControllerV3 {
|
|||
@LogOperation("知识库分布情况")
|
||||
@ApiImplicitParam(name = "id", value = "行政部门编号", paramType = "query", dataType = "Long")
|
||||
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};
|
||||
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" +
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package io.renren.common.controller;
|
||||
|
||||
|
||||
import io.renren.common.annotation.LogOperation;
|
||||
import io.renren.common.page.PageData;
|
||||
import io.renren.common.utils.CodeGenerationUtils;
|
||||
|
@ -35,8 +34,8 @@ import java.util.concurrent.Executors;
|
|||
@RestController
|
||||
@RequestMapping("/comment/center")
|
||||
public class CommentController {
|
||||
private static Integer cpuNUm = Runtime.getRuntime().availableProcessors();
|
||||
private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm);
|
||||
private static final Integer CPUNUM = Runtime.getRuntime().availableProcessors();
|
||||
private static final ExecutorService executor = Executors.newFixedThreadPool(CPUNUM);
|
||||
private static final ObjectMapper oMapper = new ObjectMapper();
|
||||
|
||||
@Autowired
|
||||
|
@ -54,12 +53,12 @@ public class CommentController {
|
|||
|
||||
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>() {
|
||||
{
|
||||
put("isLatestVersion", true); // 取最新版本
|
||||
put("key", key); // 限定
|
||||
put("key", KEY); // 限定
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -85,7 +84,6 @@ public class CommentController {
|
|||
if (tDemandCommentDTO.getId() == null) {
|
||||
return new Result().error("该评论不存在");
|
||||
}
|
||||
// tDemandCommentDTO.setApplyNumber(codeGenerationUtils.getApplyNumber("XQPL"));
|
||||
tDemandCommentDTO.setDelFlag(2); // 待审核
|
||||
tDemandCommentDTO.setCompleteEntry(Boolean.TRUE);
|
||||
tDemandCommentService.update(tDemandCommentDTO);
|
||||
|
@ -94,7 +92,7 @@ public class CommentController {
|
|||
// 仿照请求接口 /act/running/startOfBusinessKey
|
||||
ProcessStartDTO processStartDTO = new ProcessStartDTO();
|
||||
processStartDTO.setBusinessKey(tDemandCommentDTO.getId().toString());
|
||||
processStartDTO.setProcessDefinitionKey(key); //限定
|
||||
processStartDTO.setProcessDefinitionKey(KEY); //限定
|
||||
|
||||
Map<String, Object> variables = oMapper.convertValue(tDemandCommentDTO, Map.class);
|
||||
processStartDTO.setVariables(variables);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.renren.common.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.renren.common.annotation.LogOperation;
|
||||
import io.renren.common.page.PageData;
|
||||
|
@ -51,12 +51,12 @@ public class DemandDataController {
|
|||
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>() {
|
||||
{
|
||||
put("isLatestVersion", true); // 取最新版本
|
||||
put("key", key); // 限定 能力资源上架
|
||||
put("key", KEY); // 限定 能力资源上架
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -67,13 +67,12 @@ public class DemandDataController {
|
|||
// 仿照请求接口 /act/process/lastestPage
|
||||
PageData<Map<String, Object>> page = actProcessService.page(params);
|
||||
if (page.getTotal() <= 0) { //
|
||||
return new Result().error("联系管理员添加流程:" + key);
|
||||
return new Result().error("联系管理员添加流程:" + KEY);
|
||||
}
|
||||
logger.info("---------------------------------------------------");
|
||||
logger.info(JSONObject.toJSONString(tDemandDataDTO));
|
||||
logger.info(JSON.toJSONString(tDemandDataDTO));
|
||||
logger.info("####################################################");
|
||||
tDemandDataDTO.setFlag(TDemandDataEntityFlag.UNDER_REVIEW.getFlag());
|
||||
// tDemandDataDTO.setApplyNumber(codeGenerationUtils.getApplyNumber("NLXQ"));
|
||||
|
||||
ValidatorUtils.validateEntity(tDemandDataDTO, AddGroup.class, DefaultGroup.class);
|
||||
tDemandDataService.save(tDemandDataDTO);
|
||||
|
@ -86,18 +85,18 @@ public class DemandDataController {
|
|||
// 仿照请求接口 /act/running/startOfBusinessKey
|
||||
ProcessStartDTO processStartDTO = new ProcessStartDTO();
|
||||
processStartDTO.setBusinessKey(tDemandDataDTO.getId().toString());
|
||||
processStartDTO.setProcessDefinitionKey(key); // 限定资源上架
|
||||
processStartDTO.setProcessDefinitionKey(KEY); // 限定资源上架
|
||||
|
||||
Map<String, Object> variables = oMapper.convertValue(tDemandDataDTO, Map.class);
|
||||
processStartDTO.setVariables(variables);
|
||||
ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO);
|
||||
logger.info("-------------------2.启动流程成功--------------------------");
|
||||
logger.info("ProcessInstanceDTO.getBusinessKey:" + dto.getBusinessKey());
|
||||
logger.info("ProcessInstanceDTO.getBusinessKey:{}", dto.getBusinessKey());
|
||||
if (Long.valueOf(dto.getBusinessKey()) != null) {
|
||||
// 仿照请求接口 /processForm/tabilityapplication/updateInstanceId
|
||||
tDemandDataService.updateInstanceId(dto.getProcessInstanceId(), Long.valueOf(dto.getBusinessKey()));
|
||||
logger.info("-------------------更新updateInstanceId.成功--------------------------");
|
||||
logger.info("ProcessInstanceDTO.getProcessInstanceId:" + dto.getProcessInstanceId());
|
||||
logger.info("ProcessInstanceDTO.getProcessInstanceId:{}", dto.getProcessInstanceId());
|
||||
}
|
||||
|
||||
return new Result<ProcessInstanceDTO>().ok(dto);
|
||||
|
|
|
@ -27,13 +27,13 @@ public class FileUploadController {
|
|||
@Value("${resource.path}")
|
||||
private String uploadPath;
|
||||
@Value("${resource.root_url}")
|
||||
private String root_url;
|
||||
private String rootUrl;
|
||||
@Value("${server.servlet.context-path}")
|
||||
private String context_path;
|
||||
private String contextPath;
|
||||
|
||||
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")
|
||||
@ApiOperation("文件上传")
|
||||
|
@ -43,8 +43,8 @@ public class FileUploadController {
|
|||
})
|
||||
public Result<String> upload(@RequestParam("file") MultipartFile uploadFile,
|
||||
HttpServletRequest request) {
|
||||
logger.info("上传文件:" + uploadFile.getOriginalFilename());
|
||||
String format = sdf.format(new Date());
|
||||
logger.info("上传文件:{}", uploadFile.getOriginalFilename());
|
||||
String format = SIMPLE_DATE_FORMAT.format(new Date());
|
||||
File folder = new File(uploadPath + "upload" + File.separator + format);
|
||||
logger.info(uploadPath + format);
|
||||
if (!folder.isDirectory()) {
|
||||
|
@ -52,15 +52,15 @@ public class FileUploadController {
|
|||
}
|
||||
// 对上传的文件重命名,避免文件重名
|
||||
String oldName = uploadFile.getOriginalFilename();
|
||||
String newName = UUID.randomUUID().toString()
|
||||
+ oldName.substring(oldName.lastIndexOf("."), oldName.length());
|
||||
String newName = UUID.randomUUID()
|
||||
+ oldName.substring(oldName.lastIndexOf("."));
|
||||
try {
|
||||
// 文件保存
|
||||
uploadFile.transferTo(new File(folder, newName));
|
||||
|
||||
// 返回上传文件的访问路径
|
||||
String filePath = request.getScheme() + "://" + root_url
|
||||
+ ":" + request.getServerPort() + context_path + "/upload/" + format + newName;
|
||||
String filePath = request.getScheme() + "://" + rootUrl
|
||||
+ ":" + request.getServerPort() + contextPath + "/upload/" + format + newName;
|
||||
return new Result<String>().ok(filePath);
|
||||
} catch (IOException e) {
|
||||
return new Result<String>().error(e.getMessage());
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
|||
@RestController
|
||||
@RequestMapping("/reject/center")
|
||||
public class RejectController {
|
||||
private static Logger logger = LoggerFactory.getLogger(RejectController.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(RejectController.class);
|
||||
@Autowired
|
||||
protected TaskService taskService;
|
||||
@Autowired
|
||||
|
@ -45,7 +45,6 @@ public class RejectController {
|
|||
Optional<Task> taskOptional = Optional.ofNullable(taskService.createTaskQuery().taskId(taskId).includeProcessVariables().singleResult());
|
||||
taskOptional.ifPresent(task -> {
|
||||
Map<String, Object> combineResultMap = new LinkedHashMap<>();
|
||||
// combineResultMap.putAll(task.getProcessVariables());
|
||||
combineResultMap.putAll(params);
|
||||
if (combineResultMap.containsKey("parameterContent")) { // 上架申请特殊处理
|
||||
combineResultMap.remove("parameterContent");
|
||||
|
@ -55,7 +54,7 @@ public class RejectController {
|
|||
taskService.removeVariable(task.getId(), "parameterContent");
|
||||
taskService.removeVariable(task.getId(), "resourceDTO");
|
||||
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(), "completeEntry", Boolean.FALSE); // 标志为非首次录入
|
||||
taskService.setVariable(task.getId(), "reject", Boolean.FALSE); // 标识流程中是否存在拒绝false
|
||||
|
@ -65,7 +64,7 @@ public class RejectController {
|
|||
String name = userDTOOptional.isPresent() ? userDTOOptional.get().getRealName() : "";
|
||||
actTaskService.completeTask(task.getId(), name + "重新发起审核");
|
||||
result.set(new Result().ok(name + "重新发起审核成功"));
|
||||
logger.error(name + "重新发起审核成功");
|
||||
logger.error("{}重新发起审核成功", name);
|
||||
});
|
||||
return result.get();
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package io.renren.common.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.renren.common.annotation.LogOperation;
|
||||
import io.renren.common.page.PageData;
|
||||
|
@ -75,21 +75,21 @@ public class ResourceMountController {
|
|||
@Value("${big_date.name}")
|
||||
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>() {
|
||||
{
|
||||
put("isLatestVersion", true); // 取最新版本
|
||||
put("key", apply_key); // 限定 能力资源上架
|
||||
put("key", APPLY_KEY); // 限定 能力资源上架
|
||||
}
|
||||
};
|
||||
|
||||
private static final Map<String, Object> undercarriage_params = new HashMap<String, Object>() {
|
||||
{
|
||||
put("isLatestVersion", true); // 取最新版本
|
||||
put("key", undercarriage_key); // 限定 资源下架
|
||||
put("key", UNDERCARRIAGE_KEY); // 限定 资源下架
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -112,11 +112,10 @@ public class ResourceMountController {
|
|||
tResourceMountApplyDTO.setDeptId(tResourceBatchMountApplyDTO.getDeptId());
|
||||
tResourceMountApplyDTO.setUserId(tResourceBatchMountApplyDTO.getUserId());
|
||||
tResourceMountApplyDTO.setUserName(tResourceBatchMountApplyDTO.getUserName());
|
||||
tResourceMountApplyDTO.setParameterContent(JSONObject.toJSONString(index));
|
||||
tResourceMountApplyDTO.setParameterContentMd5(SecureUtil.md5(JSONObject.toJSONString(index)));
|
||||
tResourceMountApplyDTO.setParameterContent(JSON.toJSONString(index));
|
||||
tResourceMountApplyDTO.setParameterContentMd5(SecureUtil.md5(JSON.toJSONString(index)));
|
||||
tResourceMountApplyDTO.setResourceDTO(index);
|
||||
tResourceMountApplyDTO.setEnclosure(index.getEnclosure());
|
||||
// tResourceMountApplyDTO.setApplyNumber(codeGenerationUtils.getApplyNumber("NLSJ"));
|
||||
try {
|
||||
tResourceMountApplyDTO.setResourceId(tResourceMountApplyDTO.getResourceDTO().getId());
|
||||
} catch (Exception e) {
|
||||
|
@ -151,22 +150,22 @@ public class ResourceMountController {
|
|||
// 仿照请求接口 /act/running/startOfBusinessKey
|
||||
ProcessStartDTO processStartDTO = new ProcessStartDTO();
|
||||
processStartDTO.setBusinessKey(tResourceMountApplyDTO.getId().toString());
|
||||
processStartDTO.setProcessDefinitionKey(apply_key); // 限定资源上架
|
||||
processStartDTO.setProcessDefinitionKey(APPLY_KEY); // 限定资源上架
|
||||
|
||||
Map<String, Object> variables = oMapper.convertValue(tResourceMountApplyDTO, Map.class);
|
||||
processStartDTO.setVariables(variables);
|
||||
ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO);
|
||||
logger.info("-------------------2.启动流程成功--------------------------");
|
||||
logger.info("ProcessInstanceDTO.getBusinessKey:" + dto.getBusinessKey());
|
||||
logger.info("ProcessInstanceDTO.getBusinessKey:{}", dto.getBusinessKey());
|
||||
|
||||
if (Long.valueOf(dto.getBusinessKey()) != null) {
|
||||
// 仿照请求接口 /processForm/tabilityapplication/updateInstanceId
|
||||
tResourceMountApplyService.updateInstanceId(dto.getProcessInstanceId(), Long.valueOf(dto.getBusinessKey()));
|
||||
logger.info("-------------------更新updateInstanceId.成功--------------------------");
|
||||
logger.info("ProcessInstanceDTO.getProcessInstanceId:" + dto.getProcessInstanceId());
|
||||
logger.info("ProcessInstanceDTO.getProcessInstanceId:{}", dto.getProcessInstanceId());
|
||||
}
|
||||
return dto;
|
||||
}).filter(index -> ObjectUtil.isNotNull(index)).collect(Collectors.toList()));
|
||||
}).filter(ObjectUtil::isNotNull).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/undercarriage")
|
||||
|
@ -187,7 +186,7 @@ public class ResourceMountController {
|
|||
Optional<ResourceDTO> resourceDTO = Optional.ofNullable(resourceService.get(resourceId));
|
||||
if (resourceDTO.isPresent()) {
|
||||
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;
|
||||
} else {
|
||||
return true;
|
||||
|
@ -199,11 +198,10 @@ public class ResourceMountController {
|
|||
return new Result().ok(tResourceUndercarriageApplyDTO.getResource().stream().map(index -> {
|
||||
List<ProcessInstanceDTO> dtoList = new ArrayList<>();
|
||||
Long resourceId = Long.valueOf(index.get("resourceId"));
|
||||
// String resourceName = index.get("resourceName");
|
||||
Optional<ResourceDTO> resourceDTO = Optional.ofNullable(resourceService.get(resourceId));
|
||||
resourceDTO.ifPresent(dto -> {
|
||||
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) {
|
||||
logger.error("该资源已发起下架");
|
||||
throw new RuntimeException("该资源已发起下架");
|
||||
|
@ -226,13 +224,13 @@ public class ResourceMountController {
|
|||
// 仿照请求接口 /act/running/startOfBusinessKey
|
||||
ProcessStartDTO processStartDTO = new ProcessStartDTO();
|
||||
processStartDTO.setBusinessKey(resourceId.toString());
|
||||
processStartDTO.setProcessDefinitionKey(undercarriage_key); // 限定资源下架
|
||||
processStartDTO.setProcessDefinitionKey(UNDERCARRIAGE_KEY); // 限定资源下架
|
||||
|
||||
Map<String, Object> variables = oMapper.convertValue(dto, Map.class);
|
||||
processStartDTO.setVariables(variables);
|
||||
ProcessInstanceDTO index_ = actRunningService.startOfBusinessKey(processStartDTO);
|
||||
logger.info("-------------------2.启动流程成功--------------------------");
|
||||
logger.info("ProcessInstanceDTO.getBusinessKey:" + index_.getBusinessKey());
|
||||
logger.info("ProcessInstanceDTO.getBusinessKey:{}", index_.getBusinessKey());
|
||||
dtoList.add(index_);
|
||||
});
|
||||
return dtoList.stream().findAny().orElse(null);
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package io.renren.common.domain;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
/**
|
||||
* 包头区域配置项
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package io.renren.common.domain;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
|
|
@ -14,11 +14,11 @@ import java.util.Date;
|
|||
*/
|
||||
@Component
|
||||
public class FieldMetaObjectHandler implements MetaObjectHandler {
|
||||
private final static String CREATE_DATE = "createDate";
|
||||
private final static String CREATOR = "creator";
|
||||
private final static String UPDATE_DATE = "updateDate";
|
||||
private final static String UPDATER = "updater";
|
||||
private final static String DEPT_ID = "deptId";
|
||||
private static final String CREATE_DATE = "createDate";
|
||||
private static final String CREATOR = "creator";
|
||||
private static final String UPDATE_DATE = "updateDate";
|
||||
private static final String UPDATER = "updater";
|
||||
private static final String DEPT_ID = "deptId";
|
||||
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
|
|
|
@ -30,18 +30,16 @@ public class InitiatorDataEntryListener implements TaskListener {
|
|||
@Override
|
||||
public void notify(DelegateTask delegateTask) {
|
||||
logger.error("----------------------流程发起人录入表单节点---------------------------");
|
||||
logger.error("事件类型:" + delegateTask.getEventName());
|
||||
logger.error("事件类型:{}", delegateTask.getEventName());
|
||||
final String eventName = delegateTask.getEventName();
|
||||
switch (eventName) {
|
||||
case EVENTNAME_CREATE:
|
||||
create(delegateTask);
|
||||
break;
|
||||
if (EVENTNAME_CREATE.equals(eventName)) {
|
||||
create(delegateTask);
|
||||
}
|
||||
}
|
||||
|
||||
private void create(DelegateTask delegateTask) {
|
||||
Map<String, Object> kv = delegateTask.getVariables();
|
||||
logger.error("录入表单:" + kv.toString());
|
||||
logger.error("录入表单:{}", kv.toString());
|
||||
if (kv.containsKey("creator")) { // 表单存在创建者
|
||||
taskService.setAssignee(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()) {
|
||||
logger.error("被驳回,需修改后重新提交");
|
||||
} else {
|
||||
if (auditingBaseDTO.getCompleteEntry()) {
|
||||
if (Boolean.TRUE.equals(auditingBaseDTO.getCompleteEntry())) {
|
||||
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "完成申请提交");
|
||||
taskService.complete(delegateTask.getId(), delegateTask.getVariables());
|
||||
logger.error("首次录入,自动审核通过!");
|
||||
}
|
||||
}
|
||||
logger.error("----------完成录入表单-----------");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public class CodeGenerationUtils {
|
|||
*/
|
||||
enum CodeGenerationUtilsEnum {
|
||||
INSTANCE;
|
||||
private CodeGenerationUtils codeGenerationUtils;
|
||||
private final CodeGenerationUtils codeGenerationUtils;
|
||||
|
||||
CodeGenerationUtilsEnum() {
|
||||
codeGenerationUtils = new CodeGenerationUtils();
|
||||
|
@ -86,6 +86,8 @@ public class CodeGenerationUtils {
|
|||
case "NLXJ":
|
||||
tableName = "tb_data_resource";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
lock.lock();
|
||||
String sql = "SELECT SUBSTR(apply_number, 5) FROM " + tableName +
|
||||
|
@ -99,7 +101,6 @@ public class CodeGenerationUtils {
|
|||
String s = jdbcTemplate.queryForObject(sql, String.class);
|
||||
no = applyNumberPattern.substring(0, 4) + (Long.parseLong(s) + 1);
|
||||
} catch (Exception e) {
|
||||
logger.error("流水号生成失败", e);
|
||||
no = applyNumberPattern + "0001";
|
||||
} finally {
|
||||
try {
|
||||
|
|
|
@ -20,7 +20,5 @@ public class ProcessEngineConfig implements ProcessEngineConfigurationConfigurer
|
|||
processEngineConfiguration.setJobExecutorActivate(false);
|
||||
processEngineConfiguration.setAsyncExecutorEnabled(false);
|
||||
|
||||
//自定义流程图样式
|
||||
//processEngineConfiguration.setProcessDiagramGenerator(customProcessDiagramGenerator);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,9 +145,9 @@ public class ActProcessController {
|
|||
InputStream resourceAsStream = actProcessService.getResourceAsStream(deploymentId, resourceName);
|
||||
String[] fileNames = resourceName.split("\\.");
|
||||
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");
|
||||
} 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-Disposition", "attachment; filename=" + java.net.URLEncoder.encode(resourceName, "UTF-8"));
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|||
import io.renren.common.constant.Constant;
|
||||
import io.renren.common.page.PageData;
|
||||
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.TbFuseDao;
|
||||
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.security.user.SecurityUser;
|
||||
import io.renren.modules.sys.service.SysDeptService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
|
|
@ -15,7 +15,6 @@ import io.renren.common.validator.group.DefaultGroup;
|
|||
import io.renren.common.validator.group.UpdateGroup;
|
||||
import io.renren.modules.activiti.dto.HistoryDetailDTO;
|
||||
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.processForm.dao.TAbilityApplicationDao;
|
||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
||||
|
@ -43,10 +42,7 @@ import springfox.documentation.annotations.ApiIgnore;
|
|||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -148,7 +144,7 @@ public class TAbilityApplicationController {
|
|||
} 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());
|
||||
Boolean ended = jdbcTemplate.queryForObject(sql, Boolean.class);
|
||||
index.setEnded(Boolean.valueOf(ended));
|
||||
index.setEnded(ended);
|
||||
}
|
||||
return index;
|
||||
}).collect(Collectors.toList());
|
||||
|
@ -197,7 +193,7 @@ public class TAbilityApplicationController {
|
|||
return new Result<TAbilityApplicationV2DTO>().ok(null);
|
||||
}
|
||||
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 (applicationDTOS.size() > 1) {
|
||||
tAbilityApplicationV2DTO.setSystem("视频资源申请:(" + dto.getSystem() + " 等" + applicationDTOS.size() + "个摄像头)");
|
||||
|
@ -235,7 +231,7 @@ public class TAbilityApplicationController {
|
|||
camera = cameraList;
|
||||
|
||||
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("resourceOwnerDept", tAbilityApplicationDTOList.get(0).getResourceOwnerDept()); // 资源所属部门信息
|
||||
|
@ -252,8 +248,7 @@ public class TAbilityApplicationController {
|
|||
}
|
||||
}
|
||||
};
|
||||
return resourceApplication;
|
||||
}).filter(index -> index != null).collect(Collectors.groupingBy(t -> {
|
||||
}).filter(Objects::nonNull).collect(Collectors.groupingBy(t -> {
|
||||
SysDeptDTO sysDeptDTO = (SysDeptDTO) t.get("resourceOwnerDept");
|
||||
if (sysDeptDTO == null) {
|
||||
return "未知部门"; // 无部门信息
|
||||
|
|
|
@ -25,21 +25,6 @@ import java.util.Map;
|
|||
@Configuration
|
||||
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
|
||||
public DefaultWebSessionManager sessionManager() {
|
||||
ShiroSessionManager sessionManager = new ShiroSessionManager();
|
||||
|
|
|
@ -67,17 +67,16 @@ public class Oauth2Realm extends AuthorizingRealm {
|
|||
//转换成UserDetail对象
|
||||
UserDetail userDetail = ConvertUtils.sourceToTarget(userEntity, UserDetail.class);
|
||||
|
||||
//获取用户对应的部门数据权限
|
||||
List<Long> deptIdList = shiroService.getDataScopeList(userDetail.getId());
|
||||
userDetail.setDeptIdList(deptIdList);
|
||||
|
||||
//账号锁定
|
||||
if(userDetail.getStatus() == 0){
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,32 +1,22 @@
|
|||
package io.renren.modules.security.oauth2;
|
||||
|
||||
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.session.mgt.DefaultWebSessionManager;
|
||||
import org.apache.shiro.web.util.WebUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.Serializable;
|
||||
|
||||
//@Component
|
||||
public class ShiroSessionManager extends DefaultWebSessionManager {
|
||||
/**
|
||||
* 返回客户端的,
|
||||
*/
|
||||
public final String TOKEN_NAME = "token";
|
||||
/**
|
||||
* 这个是客户端请求给服务端带的header
|
||||
*/
|
||||
public final static String HEADER_TOKEN_NAME = "token";
|
||||
public final static Logger log = LoggerFactory.getLogger(ShiroSessionManager.class);
|
||||
public static final String HEADER_TOKEN_NAME = "token";
|
||||
public static final Logger log = LoggerFactory.getLogger(ShiroSessionManager.class);
|
||||
private static final String REFERENCED_SESSION_ID_SOURCE = "Stateless request";
|
||||
|
||||
/**
|
||||
|
@ -35,7 +25,7 @@ public class ShiroSessionManager extends DefaultWebSessionManager {
|
|||
@Override
|
||||
protected Serializable getSessionId(ServletRequest request, ServletResponse response) {
|
||||
String sessionId = WebUtils.toHttp(request).getHeader(HEADER_TOKEN_NAME);
|
||||
log.info("获取的sessionId为" + sessionId);
|
||||
log.error("获取的sessionId为------>{}", sessionId);
|
||||
if (StringUtils.isEmpty(sessionId)) {
|
||||
return super.getSessionId(request, response);
|
||||
} 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);
|
||||
}
|
||||
}*/
|
||||
}
|
Loading…
Reference in New Issue