Merge branch 'master' into docker_package
This commit is contained in:
commit
1e370568a7
|
@ -1,6 +1,5 @@
|
|||
package io.renren.common.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.renren.common.dto.AuditingBaseDTO;
|
||||
|
@ -20,6 +19,7 @@ import io.renren.modules.resource.dto.ResourceDTO;
|
|||
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.ApiOperation;
|
||||
|
@ -28,6 +28,7 @@ import org.codehaus.jackson.map.ObjectMapper;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
@ -47,7 +48,7 @@ import java.util.stream.Collectors;
|
|||
@RestController
|
||||
@RequestMapping("/ability/center/v2")
|
||||
public class AbilityCenterControllerV2 {
|
||||
private static Logger logger = LoggerFactory.getLogger(AbilityCenterController.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(AbilityCenterController.class);
|
||||
private static final ObjectMapper oMapper = new ObjectMapper();
|
||||
@Autowired
|
||||
private ActProcessService actProcessService;
|
||||
|
@ -61,7 +62,9 @@ public class AbilityCenterControllerV2 {
|
|||
private JdbcTemplate jdbcTemplate;
|
||||
@Autowired
|
||||
private SysDeptService sysDeptService;
|
||||
private static String key = "abilityprocess_v2";
|
||||
@Value("${big_date.name}")
|
||||
private String bigDateDeptName; // 大数据局名称
|
||||
private static final String key = "abilityprocess_v2";
|
||||
|
||||
private static Map<String, Object> params = new HashMap<String, Object>() {
|
||||
{
|
||||
|
@ -72,9 +75,6 @@ public class AbilityCenterControllerV2 {
|
|||
|
||||
/**
|
||||
* 批量进行批量能力申请(按资源所属部门分配审核人)
|
||||
*
|
||||
* @param abilityBatchApplicationDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/apply")
|
||||
@ApiOperation("批量进行能力申请")
|
||||
|
@ -84,6 +84,7 @@ public class AbilityCenterControllerV2 {
|
|||
if (page.getTotal() <= 0) { //
|
||||
return new Result().error("联系管理员添加流程");
|
||||
}
|
||||
final Optional<SysDeptDTO> deptDTO = Optional.ofNullable(sysDeptService.getByName(bigDateDeptName));
|
||||
final UserDetail user = SecurityUser.getUser();
|
||||
List<TAbilityApplicationDTO> tAbilityApplicationDTOList =
|
||||
abilityBatchApplicationDTO.getSystem().stream().map(index -> {
|
||||
|
@ -108,6 +109,7 @@ public class AbilityCenterControllerV2 {
|
|||
tAbilityApplicationDTO.setApproveStatus("审核中");
|
||||
tAbilityApplicationDTO.setDelFlag(0);
|
||||
// v2 新增字段
|
||||
tAbilityApplicationDTO.setCameraList(index.get("cameraId"));
|
||||
tAbilityApplicationDTO.setTitle(abilityBatchApplicationDTO.getTitle());
|
||||
tAbilityApplicationDTO.setApplicationBackground(abilityBatchApplicationDTO.getApplicationBackground());
|
||||
tAbilityApplicationDTO.setApplicationScene(abilityBatchApplicationDTO.getApplicationScene());
|
||||
|
@ -122,13 +124,13 @@ public class AbilityCenterControllerV2 {
|
|||
}
|
||||
tAbilityApplicationDTO.setCompleteEntry(Boolean.TRUE);
|
||||
return tAbilityApplicationDTO;
|
||||
}).filter(index -> ObjectUtil.isNotNull(index)).collect(Collectors.toList()); // 申请入库
|
||||
}).filter(ObjectUtil::isNotNull).collect(Collectors.toList()); // 申请入库
|
||||
if (!tAbilityApplicationDTOList.isEmpty()) {
|
||||
Map<Long, List<TAbilityApplicationDTO>> temp =
|
||||
tAbilityApplicationDTOList.stream().filter(index -> StringUtils.isNotEmpty(index.getResourceId())).collect(Collectors.groupingBy(t -> {
|
||||
ResourceDTO resourceDTO = resourceService.get(Long.valueOf(t.getResourceId()));
|
||||
if (resourceDTO == null) { // 资源不存在时
|
||||
return 0L;
|
||||
if (resourceDTO == null && deptDTO.isPresent()) { // 资源不存在时
|
||||
return deptDTO.get().getId();
|
||||
}
|
||||
return resourceDTO.getDeptId();
|
||||
})); // 按部门分组
|
||||
|
@ -140,19 +142,28 @@ public class AbilityCenterControllerV2 {
|
|||
return;
|
||||
}
|
||||
List<TAbilityApplicationDTO> dtoList = temp.get(deptId);
|
||||
final List<Long> ids = dtoList.stream().map(index -> index.getId()).collect(Collectors.toList()); // 发起申请的表单id
|
||||
Boolean basic_facilities =
|
||||
dtoList.stream().map(index -> {
|
||||
Optional<ResourceDTO> resourceDTOOptional =
|
||||
Optional.ofNullable(resourceService.get(Long.valueOf(index.getResourceId())));
|
||||
return !resourceDTOOptional.isPresent() || !"基础设施".equals(resourceDTOOptional.get().getType());
|
||||
}
|
||||
|
||||
)
|
||||
.filter(index -> !index).findAny().orElse(Boolean.TRUE);
|
||||
logger.error("--------------------是否全是基础设施{}----------------------------------------------", basic_facilities);
|
||||
final List<Long> ids = dtoList.stream().map(TAbilityApplicationDTO::getId).collect(Collectors.toList()); // 发起申请的表单id
|
||||
// 仿照请求接口 /act/running/startOfBusinessKey
|
||||
ProcessStartDTO processStartDTO = new ProcessStartDTO();
|
||||
processStartDTO.setBusinessKey(JSON.toJSONString(ids)); // 申请的id列表 json字符 做businesskey
|
||||
processStartDTO.setBusinessKey(basic_facilities ?
|
||||
tAbilityApplicationDTOList.stream().filter(index -> StringUtils.isNotEmpty(index.getResourceId())).map(TAbilityApplicationDTO::getResourceId).findFirst().orElse(null)
|
||||
: JSON.toJSONString(ids)); // 申请的id列表 json字符 做businesskey
|
||||
processStartDTO.setProcessDefinitionKey(key); //限定
|
||||
AuditingBaseDTO auditingBaseDTO = new AuditingBaseDTO();
|
||||
auditingBaseDTO.setCompleteEntry(Boolean.TRUE); // 首次录入
|
||||
|
||||
Map<String, Object> variables = oMapper.convertValue(auditingBaseDTO, Map.class);
|
||||
Boolean basic_facilities =
|
||||
dtoList.stream().map(index -> !"基础设施".equals(resourceService.get(Long.valueOf(index.getResourceId())).getType()))
|
||||
.filter(index -> !index).findAny().orElse(Boolean.TRUE);
|
||||
logger.error("--------------------是否全是基础设施{}----------------------------------------------", basic_facilities);
|
||||
|
||||
|
||||
variables.putAll(new HashMap<String, Object>() { // 流程内携带属性值
|
||||
{
|
||||
|
|
|
@ -57,7 +57,7 @@ public class ActProcessService {
|
|||
public PageData<Map<String, Object>> page(Map<String, Object> params) {
|
||||
String key = (String)params.get("key");
|
||||
String processName = (String)params.get("processName");
|
||||
boolean isLatestVersion = params.get("isLatestVersion")== null? false : (boolean)params.get("isLatestVersion");
|
||||
boolean isLatestVersion = params.get("isLatestVersion") != null && (boolean) params.get("isLatestVersion");
|
||||
|
||||
//分页参数
|
||||
int curPage = 1;
|
||||
|
|
|
@ -54,8 +54,8 @@ public class TAbilityApplicationDTO extends AuditingBaseDTO implements Serializa
|
|||
@ApiModelProperty(value = "附件")
|
||||
private String enclosure;
|
||||
|
||||
@ApiModelProperty(value = "摄像头ID数组")
|
||||
private List<CameraChannel> cameraList;
|
||||
@ApiModelProperty(value = "摄像头ID")
|
||||
private String cameraList;
|
||||
|
||||
@ApiModelProperty(value = "能力申请标题")
|
||||
private String title;
|
||||
|
|
|
@ -50,7 +50,7 @@ public class TAbilityBatchApplicationDTO extends AuditingBaseDTO implements Seri
|
|||
private String enclosure;
|
||||
|
||||
@ApiModelProperty(value = "摄像头ID数组")
|
||||
private List<CameraChannel> cameraList;
|
||||
private String cameraList;
|
||||
|
||||
@ApiModelProperty(value = "能力申请标题")
|
||||
private String title;
|
||||
|
|
|
@ -99,7 +99,7 @@ public class TAbilityApplicationEntity implements Serializable {
|
|||
* 摄像头列表
|
||||
*/
|
||||
@TableField(value = "camera_list", typeHandler = FastjsonTypeHandler.class)
|
||||
private List<CameraChannel> cameraList;
|
||||
private String cameraList;
|
||||
|
||||
/**
|
||||
* 能力申请标题
|
||||
|
|
|
@ -187,7 +187,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
@CacheEvict(cacheNames = {selectDeptListKey}, allEntries = true)
|
||||
@CacheEvict(cacheNames = {selectDeptListKey, selectDTOPageSpecilTotalKey}, allEntries = true)
|
||||
public void insertWithAttrs(ResourceDTO dto) {
|
||||
ResourceEntity resourceEntity = new ResourceEntity();
|
||||
BeanUtils.copyProperties(dto, resourceEntity);
|
||||
|
@ -215,7 +215,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
@CacheEvict(cacheNames = {selectDeptListKey}, allEntries = true)
|
||||
@CacheEvict(cacheNames = {selectDeptListKey, selectDTOPageSpecilTotalKey}, allEntries = true)
|
||||
public void deleteWithAttrs(JSONObject jsonObject) {
|
||||
JSONArray jsonArray = jsonObject.getJSONArray("ids");
|
||||
List<Long> idList = jsonArray.toJavaList(Long.class);
|
||||
|
@ -229,7 +229,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
@CacheEvict(cacheNames = {selectDeptListKey}, allEntries = true)
|
||||
@CacheEvict(cacheNames = {selectDeptListKey, selectDTOPageSpecilTotalKey}, allEntries = true)
|
||||
public void updateWithAttrs(ResourceDTO dto) {
|
||||
ResourceEntity resourceEntity = new ResourceEntity();
|
||||
BeanUtils.copyProperties(dto, resourceEntity);
|
||||
|
@ -879,7 +879,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
@Override
|
||||
public Object getApplyCameraList(Long instanceId) {
|
||||
QueryWrapper<TAbilityApplicationEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("instance_id", instanceId);
|
||||
queryWrapper.eq("instance_id", instanceId)
|
||||
.eq("approve_status", "通过");
|
||||
List<TAbilityApplicationEntity> applicationEntities = tAbilityApplicationDao.selectList(queryWrapper);
|
||||
ArrayList cameraList = new ArrayList();
|
||||
applicationEntities.forEach(index -> cameraList.add(resourceDao.selectCameraDTOById(Long.parseLong(index.getResourceId()))));
|
||||
|
@ -900,7 +901,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
* 同步知识库
|
||||
*/
|
||||
@Override
|
||||
@CacheEvict(cacheNames = {selectDeptListKey}, allEntries = true)
|
||||
@CacheEvict(cacheNames = {selectDeptListKey, selectDTOPageSpecilTotalKey}, allEntries = true)
|
||||
public void KnowledgeBase() {
|
||||
final List<String> knowledgeUUID = jdbcTemplate.queryForList("SELECT note1 FROM tb_data_resource WHERE type ='知识库' AND note1 IS NOT NULL FOR UPDATE;", String.class).stream().distinct().collect(Collectors.toList());
|
||||
final int pageSize = 100;
|
||||
|
|
|
@ -58,6 +58,7 @@ public class ResourceCarServiceImpl extends CrudServiceImpl<ResourceCarDao, Reso
|
|||
selectMap.put("user_id", userId);
|
||||
selectMap.put("del_flag", 0);
|
||||
List<ResourceCarEntity> carEntities = resourceCarDao.selectByMap(selectMap);
|
||||
//TODO: 固定资源id改为配置文件
|
||||
if (carEntities.isEmpty() || dto.getResourceId() == 8888888880000000001L) {
|
||||
ResourceCarEntity carEntity = new ResourceCarEntity();
|
||||
dto.setUserId(userId);
|
||||
|
|
|
@ -1333,6 +1333,7 @@
|
|||
</select>
|
||||
|
||||
<select id="selectCameraDTOById" resultMap="resourceDTO">
|
||||
SELECT tdr.*, tda.* FROM tb_data_resource tdr, tb_data_attr tda WHERE tdr.id = tda.data_resource_id AND tdr.del_flag = 0 AND tdr.id = #{id}
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -77,7 +77,7 @@
|
|||
tdr.*
|
||||
FROM
|
||||
tb_data_resource_rel tdrr
|
||||
LEFT JOIN tb_data_resource tdr ON tdrr.reference_id = tdr.id
|
||||
LEFT JOIN tb_data_resource tdr ON tdrr.key_id = tdr.id
|
||||
WHERE
|
||||
tdrr.del_flag = 0
|
||||
AND tdr.del_flag = 0
|
||||
|
|
|
@ -88,7 +88,8 @@
|
|||
res.description,
|
||||
res.type,
|
||||
res.del_flag AS "delFlag",
|
||||
car.note1
|
||||
car.note1,
|
||||
car.create_date AS "time"
|
||||
FROM
|
||||
tb_resource_car car,
|
||||
tb_data_resource res
|
||||
|
|
Loading…
Reference in New Issue