Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-11-10 15:26:18 +08:00
commit 376eb698f6
3 changed files with 65 additions and 13 deletions

View File

@ -912,4 +912,28 @@ public class ResourceController {
}
}
@PostMapping("/getResourceBusinessList")
@ApiOperation("/获取申请云资源业务列表")
@LogOperation("/获取申请云资源业务列表")
public Object getResourceBusinessList(String userAccount, String status) {
try {
return resourceService.getResourceBusinessList(userAccount, status);
} catch (Exception e) {
e.printStackTrace();
return new Result<>().error("云资源查询接口调用失败!");
}
}
@PostMapping("/getVideoBusinessList")
@ApiOperation("/获取云视频业务列表")
@LogOperation("/获取云视频业务列表")
public Object getVideoBusinessList(String userAccount, String status) {
try {
return resourceService.getVideoBusinessList(userAccount, status);
} catch (Exception e) {
e.printStackTrace();
return new Result<>().error("云视频查询接口调用失败!");
}
}
}

View File

@ -165,4 +165,8 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
void delResBySuAd(Long id);
void delProcinstBySuAd(Long id, String type, Long resourceId);
Object getResourceBusinessList(String userAccount, String status);
Object getVideoBusinessList(String userAccount, String status);
}

View File

@ -76,9 +76,14 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.Lazy;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.text.ParseException;
@ -102,6 +107,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
private static final Integer CPU_NUM = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newWorkStealingPool(CPU_NUM * 3);
@Autowired
private RestTemplate restTemplate;
/**
* 公共http客户端
*/
@ -2098,10 +2106,6 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
List<String> temp = new ArrayList<>();
resultList.forEach(map -> {
temp.add(map.get("type").toString());
if ("基础设施".equals(map.get("type").toString())) {
int num = meetCountNew[0] + Integer.parseInt(map.get("count").toString());
map.replace("count", num);
}
});
Arrays.stream(censusTypes).filter(index -> !temp.contains(index)).forEach(index -> {
Map<String, Object> nullMap = new HashMap<String, Object>() {
@ -2112,6 +2116,12 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
};
resultList.add(nullMap);
});
resultList.forEach(map -> {
if ("基础设施".equals(map.get("type").toString())) {
int num = meetCountNew[0] + Integer.parseInt(map.get("count").toString());
map.replace("count", num);
}
});
return resultList;
}
@ -2628,21 +2638,13 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
//会客厅
CompletableFuture<Void> delRoom = CompletableFuture.runAsync(() -> {
Map<String, Object> map = new HashMap<>();
map.put("room_id", id);
meetingroomMapper.deleteById(id);
//获取当前会客厅预约记录用于删除消息数据
List<Long> idList = meetingroomBookMapper.selectBookIdByRoomId(id);
if (!idList.isEmpty()) {
//清除消息数据
idList.forEach(x -> {
Map<String, Object> deleteMap = new HashMap() {{
put("apply_id", x.toString());
}};
sysNoticeDao.deleteByMap(deleteMap);
});
idList.forEach(x -> this.delProcinstBySuAd(x, "会客厅申请", null));
}
meetingroomBookMapper.deleteByMap(map);
}, executor);
//删除申请表单数据
@ -2665,6 +2667,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
//删除会客厅申请单独处理
if ("会客厅申请".equals(type)) {
meetingroomBookMapper.deleteById(id);
Map<String, Object> deleteMap = new HashMap() {{
put("apply_id", id.toString());
}};
sysNoticeDao.deleteByMap(deleteMap);
} else {
//清除流程实例数据
@ -2728,5 +2734,23 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
}
}
@Override
public Object getResourceBusinessList(String userAccount, String status) {
MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
param.add("userAccount", userAccount);
param.add("status", status);
HttpEntity<String> requestEntity = new HttpEntity(param, new HttpHeaders());
return restTemplate.postForEntity("http://15.72.183.88:8760/yzy/main/cloudresource/getResourceBusinessList", requestEntity, String.class).getBody();
}
@Override
public Object getVideoBusinessList(String userAccount, String status) {
MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
param.add("userAccount", userAccount);
param.add("status", status);
HttpEntity<String> requestEntity = new HttpEntity(param, new HttpHeaders());
return restTemplate.postForEntity("http://15.72.183.88:8760/yzy/main/cloudresource/getVideoBusinessList", requestEntity, String.class).getBody();
}
}