feat(bpm): 调整流程实例抄送服务中的日期时间处理
- 引入 LocalDateTimeUtil 工具类优化日期处理 - 将 ReceiveCCRequestDTO 和 ReceiveTodoRequestDTO 中的时间字段类型从 LocalDateTime 改为 Date - 添加 JsonFormat 注解以统一前后端日期格式化 - 修正 BpmProcessInstanceCopyServiceImpl 中日期转换逻辑,确保时区一致性 - 在 DemoController 中增加获取当前时间接口用于测试时间序列功能 - 更新相关导入包及调整代码格式提升可读性
This commit is contained in:
@@ -1,18 +1,15 @@
|
||||
|
||||
package com.jeelowcode.module.biz.controller;
|
||||
|
||||
import com.jeelowcode.core.framework.utils.Func;
|
||||
import com.jeelowcode.core.framework.utils.FuncWeb;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import com.jeelowcode.framework.exception.JeeLowCodeException;
|
||||
import com.jeelowcode.framework.global.JeeLowCodeBaseConstant;
|
||||
import com.jeelowcode.framework.tenant.annotation.JeeLowCodeTenantIgnore;
|
||||
import com.jeelowcode.framework.utils.model.global.BaseWebResult;
|
||||
import com.jeelowcode.module.biz.dto.RequestDTO;
|
||||
import com.jeelowcode.module.biz.service.IDemoService;
|
||||
import com.jeelowcode.framework.utils.model.global.BaseWebResult;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import com.jeelowcode.service.infra.entity.ConfigDO;
|
||||
import com.jeelowcode.service.infra.service.IConfigService;
|
||||
import com.jeelowcode.tool.framework.common.model.ContentModel;
|
||||
import com.jeelowcode.tool.framework.common.model.PartModel;
|
||||
import com.jeelowcode.tool.framework.common.pojo.CommonResult;
|
||||
import com.jeelowcode.tool.framework.common.util.http.HttpUtils;
|
||||
@@ -23,12 +20,9 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.jeelowcode.tool.framework.common.pojo.CommonResult.error;
|
||||
import static com.jeelowcode.tool.framework.common.pojo.CommonResult.success;
|
||||
@@ -42,15 +36,20 @@ import static com.jeelowcode.tool.framework.common.pojo.CommonResult.success;
|
||||
@Tag(name = "低代码框架 - 个性化接口")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping(JeeLowCodeBaseConstant.REQUEST_URL_START +"/demo")
|
||||
@RequestMapping(JeeLowCodeBaseConstant.REQUEST_URL_START + "/demo")
|
||||
public class DemoController {
|
||||
|
||||
private final IDemoService demoService;
|
||||
|
||||
@Operation(summary = "获取当前时间")
|
||||
@GetMapping({"/getJsonLocalDateTime"})
|
||||
public CommonResult<Boolean> getJsonLocalDateTime() {
|
||||
return success(demoService.testLocalDateTime());
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private IConfigService configService;
|
||||
|
||||
|
||||
@GetMapping({"/getData"})
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "获取demo数据")
|
||||
@@ -63,18 +62,18 @@ public class DemoController {
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "取阿里平台Token")
|
||||
public CommonResult<String> getAliToken() {
|
||||
try{
|
||||
try {
|
||||
ConfigDO configUrl = configService.getConfigByKey("aliUrl");
|
||||
ConfigDO configKey = configService.getConfigByKey("aliAppkey");
|
||||
ConfigDO configSecret = configService.getConfigByKey("aliAppSecret");
|
||||
if(Objects.isNull(configUrl) || Objects.isNull(configKey) || Objects.isNull(configSecret)
|
||||
|| StringUtils.isEmpty(configUrl.getValue()) || StringUtils.isEmpty(configKey.getValue()) || StringUtils.isEmpty(configSecret.getValue())){
|
||||
if (Objects.isNull(configUrl) || Objects.isNull(configKey) || Objects.isNull(configSecret)
|
||||
|| StringUtils.isEmpty(configUrl.getValue()) || StringUtils.isEmpty(configKey.getValue()) || StringUtils.isEmpty(configSecret.getValue())) {
|
||||
throw new JeeLowCodeException("缺少阿里平台必要参数配置");
|
||||
}
|
||||
String token = HttpUtils.getToken(configUrl.getValue()+"/_campus/open/accessToken.json",configKey.getValue(),configSecret.getValue());
|
||||
String token = HttpUtils.getToken(configUrl.getValue() + "/_campus/open/accessToken.json", configKey.getValue(), configSecret.getValue());
|
||||
return success(token);
|
||||
}catch (Exception e){
|
||||
return error(500,e.getMessage());
|
||||
} catch (Exception e) {
|
||||
return error(500, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +91,7 @@ public class DemoController {
|
||||
" }\n" +
|
||||
" ]\n" +
|
||||
"}";
|
||||
List<PartModel> contentModels = HttpUtils.getTokenDate(configUrl.getValue()+"/_campus/open/api/invoked.json?access_token="+token,bodyString);
|
||||
List<PartModel> contentModels = HttpUtils.getTokenDate(configUrl.getValue() + "/_campus/open/api/invoked.json?access_token=" + token, bodyString);
|
||||
return success(contentModels);
|
||||
}
|
||||
|
||||
@@ -101,11 +100,11 @@ public class DemoController {
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "取阿里平台通用接口取数")
|
||||
public CommonResult<String> getCustomerInterface(@RequestBody RequestDTO params) {
|
||||
try{
|
||||
String result = HttpUtils.getInterfaceData(params.getUrl(),params.getParams(),params.getBody(),params.getMethod(),params.getAuthorization());
|
||||
try {
|
||||
String result = HttpUtils.getInterfaceData(params.getUrl(), params.getParams(), params.getBody(), params.getMethod(), params.getAuthorization());
|
||||
return success(result);
|
||||
}catch (Exception e){
|
||||
return error(500,e.getMessage());
|
||||
} catch (Exception e) {
|
||||
return error(500, e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,4 +12,7 @@ public interface IDemoService {
|
||||
List<Map<String, Object>> getDemoData();
|
||||
|
||||
void testAsync();
|
||||
|
||||
boolean testLocalDateTime();
|
||||
|
||||
}
|
||||
|
||||
@@ -6,11 +6,14 @@ import com.jeelowcode.framework.plus.SqlHelper;
|
||||
import com.jeelowcode.framework.plus.build.buildmodel.wrapper.SqlInfoQueryWrapper;
|
||||
import com.jeelowcode.module.biz.mapper.DemoMapper;
|
||||
import com.jeelowcode.module.biz.service.IDemoService;
|
||||
import com.jeelowcode.service.bpm.config.framework.portal.core.dto.ReceiveCCRequestDTO;
|
||||
import com.jeelowcode.tool.framework.common.util.json.JsonUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -30,7 +33,7 @@ public class DemoServiceImpl implements IDemoService {
|
||||
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getDemoData(){
|
||||
public List<Map<String, Object>> getDemoData() {
|
||||
SqlInfoQueryWrapper.Wrapper wrapper = SqlHelper.getQueryWrapper();
|
||||
wrapper.setTableName("tbl_lin_class");
|
||||
List<Map<String, Object>> dataMapList = sqlService.getDataListByPlus(wrapper);
|
||||
@@ -39,7 +42,17 @@ public class DemoServiceImpl implements IDemoService {
|
||||
|
||||
@Async("asyncPoolTaskExecutor")
|
||||
@Override
|
||||
public void testAsync(){
|
||||
public void testAsync() {
|
||||
log.info("哈哈哈");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testLocalDateTime() {
|
||||
ReceiveCCRequestDTO request = new ReceiveCCRequestDTO()
|
||||
.setReceiveDateTime(new Date())
|
||||
.setCreateDateTime(new Date());
|
||||
log.info("request: {}", JsonUtils.toJsonString(request));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user