Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-07-12 14:03:46 +08:00
commit 60d3505364
1 changed files with 73 additions and 70 deletions

View File

@ -1,5 +1,6 @@
package io.renren.modules.processForm.controller;
import com.alibaba.fastjson.JSON;
import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
@ -22,6 +23,7 @@ import io.renren.modules.resource.service.ResourceService;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.security.user.UserDetail;
import io.renren.modules.sys.dto.SysDeptDTO;
import io.renren.modules.sys.service.SysDeptService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@ -34,6 +36,7 @@ import org.springframework.web.bind.annotation.*;
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;
@ -59,6 +62,8 @@ public class TAbilityApplicationController {
private ActivitiService activitiService;
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
private SysDeptService sysDeptService;
@Value("${project.place}")
private Integer projectPlace;
@ -70,14 +75,8 @@ public class TAbilityApplicationController {
* @return
*/
@GetMapping("my_page")
@ApiOperation("我的申请分页")
@LogOperation("我的申请分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String")
})
@ApiImplicitParams({@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"), @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"), @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"), @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String")})
public Result<PageData<TAbilityApplicationDTO>> myPage(@ApiIgnore @RequestParam Map<String, Object> params) {
final UserDetail user = SecurityUser.getUser();
params.put("abilityprocess_v2", Boolean.TRUE); // 是否根据流程 abilityprocess_v2 来分页
@ -86,6 +85,24 @@ public class TAbilityApplicationController {
return new Result<PageData<TAbilityApplicationDTO>>().ok(page);
}
/**
* 更新旧数据无申请能力所属部门
*
* @return
*/
@GetMapping("deal")
public Result<String> test() {
List<Map<String, Object>> re = jdbcTemplate.queryForList("SELECT t_ability_application.id,t_ability_application.resource_id,tb_data_resource.dept_id from t_ability_application JOIN tb_data_resource ON t_ability_application.resource_id = tb_data_resource.id WHERE resource_owner_dept IS NULL;");
re.stream().forEach(index -> {
SysDeptDTO sysDeptDTO = sysDeptService.get(Long.valueOf(index.get("dept_id").toString()));
if (sysDeptDTO != null) {
jdbcTemplate.update(String.format("UPDATE t_ability_application SET resource_owner_dept = '%s' WHERE id = %s", JSON.toJSONString(sysDeptDTO), index.get("id").toString()));
}
});
return new Result<String>().ok(LocalDateTime.now().toString());
}
@GetMapping("getByApplyFlag/{applyFlag}")
@ApiOperation("根据申请标识获取能力申请信息")
@LogOperation("根据申请标识获取能力申请信息")
@ -98,8 +115,7 @@ public class TAbilityApplicationController {
}
};
List<TAbilityApplicationDTO> applicationDTOS = tAbilityApplicationService.list(params);
Map<String, List<TAbilityApplicationDTO>> result =
applicationDTOS.stream().collect(Collectors.groupingBy(t -> {
Map<String, List<TAbilityApplicationDTO>> result = applicationDTOS.stream().collect(Collectors.groupingBy(t -> {
SysDeptDTO sysDeptDTO = t.getResourceOwnerDept();
if (sysDeptDTO == null) {
return "无部门信息"; // 无部门信息
@ -111,24 +127,19 @@ public class TAbilityApplicationController {
return new Result<TAbilityApplicationV2DTO>().ok(null);
}
TAbilityApplicationV2DTO tAbilityApplicationV2DTO = ConvertUtils.sourceToTarget(applicationDTOS.get(0), TAbilityApplicationV2DTO.class);
Map<String, List<Map<String, Object>>> re =
result.keySet().stream().map(index -> {
Map<String, List<Map<String, Object>>> re = result.keySet().stream().map(index -> {
final List<TAbilityApplicationDTO> tAbilityApplicationDTOList = result.get(index);
List<ResourceDTO> resourceDTOS =
tAbilityApplicationDTOList.stream()
.filter(tAbilityApplicationDTO -> StringUtils.isEmpty(tAbilityApplicationDTO.getCameraList())) // 过滤非摄像头申请
List<ResourceDTO> resourceDTOS = tAbilityApplicationDTOList.stream().filter(tAbilityApplicationDTO -> StringUtils.isEmpty(tAbilityApplicationDTO.getCameraList())) // 过滤非摄像头申请
.map(tAbilityApplicationDTO -> resourceService.get(Long.valueOf(tAbilityApplicationDTO.getResourceId()))).collect(Collectors.toList());
List<HistoryDetailDTO> taskHandleDetailInfo = activitiService.getTaskHandleDetailInfo(tAbilityApplicationDTOList.get(0).getInstanceId());
List<Map> camera = new ArrayList<>();
List<Object> camera = new ArrayList<>();
switch (Constant.ProjectPlace.getByFlag(projectPlace)) { // 处理基础设施
case TSINGTAO_XHA:
break;
case TSINGTAO: { // 大数据局
camera = tAbilityApplicationDTOList.stream()
.filter(tAbilityApplicationDTO -> StringUtils.isNotEmpty(tAbilityApplicationDTO.getCameraList()))
.map(index_ -> jdbcTemplate.queryForObject("SELECT * FROM t_camera_channel WHERE idt_camera_channel = " + index_.getResourceId(), Map.class))
.filter(index_ -> !index_.isEmpty()).collect(Collectors.toList());
camera = (List<Object>) resourceService.getApplyCameraList(Long.valueOf(tAbilityApplicationDTOList.get(0).getInstanceId()));
// camera = tAbilityApplicationDTOList.stream().filter(tAbilityApplicationDTO -> StringUtils.isNotEmpty(tAbilityApplicationDTO.getCameraList())).map(index_ -> jdbcTemplate.queryForObject("SELECT * FROM t_camera_channel WHERE idt_camera_channel = " + index_.getResourceId(), Map.class)).filter(index_ -> !index_.isEmpty()).collect(Collectors.toList());
}
break;
case BAOTOU:
@ -136,7 +147,7 @@ public class TAbilityApplicationController {
default:
}
List<Map> finalCamera = camera;
List<Object> finalCamera = camera;
Map<String, Object> resourceApplication = new HashMap<String, Object>() {
{
put("instanceId", tAbilityApplicationDTOList.get(0).getInstanceId()); // 流程id
@ -164,12 +175,7 @@ public class TAbilityApplicationController {
@GetMapping("page")
@ApiOperation("分页")
@LogOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String")
})
@ApiImplicitParams({@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"), @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"), @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"), @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String")})
public Result<PageData<TAbilityApplicationDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<TAbilityApplicationDTO> page = tAbilityApplicationService.page(params);
@ -229,10 +235,7 @@ public class TAbilityApplicationController {
@PostMapping("updateInstanceId")
@ApiOperation("更新实例ID")
@LogOperation("更新实例ID")
@ApiImplicitParams({
@ApiImplicitParam(name = "businessKey", value = "业务KEY", paramType = "query", required = true, dataType = "String"),
@ApiImplicitParam(name = "processInstanceId", value = "实例ID", paramType = "query", required = true, dataType = "String")
})
@ApiImplicitParams({@ApiImplicitParam(name = "businessKey", value = "业务KEY", paramType = "query", required = true, dataType = "String"), @ApiImplicitParam(name = "processInstanceId", value = "实例ID", paramType = "query", required = true, dataType = "String")})
public Result updateInstanceId(String businessKey, String processInstanceId) {
Long id = Long.valueOf(businessKey);
tAbilityApplicationService.updateInstanceId(processInstanceId, id);