* 'dev' of http://221.0.232.152:9393/ability-center/share-platform:
  ...
  1、新增摄像头聚合展示
  普通资源的npe问题
  。。。
  配置文件的调整
  ...
This commit is contained in:
huangweixiong 2022-07-13 15:26:54 +08:00
commit 508aef594f
30 changed files with 566 additions and 44 deletions

View File

@ -15,6 +15,13 @@ import java.lang.annotation.Target;
@Documented
public @interface LogOperation {
/**
* 操作名称
*/
String value() default "";
/**
* 操作数据库表
*/
String operationTable() default "";
}

View File

@ -43,9 +43,11 @@ import java.util.concurrent.Executors;
@Aspect
@Component
public class ActivitiNoticeAspect {
private static Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm * 3);
private static Logger logger = LoggerFactory.getLogger(ActivitiNoticeAspect.class);
private static final Logger logger = LoggerFactory.getLogger(ActivitiNoticeAspect.class);
@Autowired
private SysNoticeService sysNoticeService;
@Autowired
@ -56,6 +58,7 @@ public class ActivitiNoticeAspect {
private SysDeptService sysDeptService;
@Autowired
private SysRoleService sysRoleService;
private Set<String> work_ = new CopyOnWriteArraySet<>();
@Value("${big_date.name}")

View File

@ -1,16 +1,10 @@
package io.renren.common.config;
import org.apache.catalina.connector.Connector;
import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.List;
import static com.google.common.collect.Lists.newArrayList;
/**
* Swagger配置
*
@ -21,12 +15,7 @@ public class TomcatConfig {
@Bean
public ConfigurableServletWebServerFactory webServerFactory() {
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {
@Override
public void customize(Connector connector) {
connector.setProperty("relaxedQueryChars", "^|{}[]");
}
});
factory.addConnectorCustomizers(connector -> connector.setProperty("relaxedQueryChars", "^|{}[]"));
return factory;
}
}

View File

@ -4,6 +4,7 @@ package io.renren.common.controller;
import cn.hutool.core.util.ObjectUtil;
import io.renren.common.annotation.LogOperation;
import io.renren.common.page.PageData;
import io.renren.common.utils.CodeGenerationUtils;
import io.renren.common.utils.Result;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
@ -44,7 +45,7 @@ import java.util.stream.Collectors;
@RestController
@RequestMapping("/ability/center")
public class AbilityCenterController {
private static Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm);
private static final Logger logger = LoggerFactory.getLogger(AbilityCenterController.class);
@ -57,6 +58,8 @@ public class AbilityCenterController {
private TAbilityApplicationService tAbilityApplicationService;
@Autowired
private ActRunningService actRunningService;
@Autowired
private CodeGenerationUtils codeGenerationUtils;
private static final String key = "abilityprocess";
@ -83,6 +86,7 @@ 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");
@ -93,6 +97,7 @@ public class AbilityCenterController {
return null;
}
TAbilityApplicationDTO tAbilityApplicationDTO = new TAbilityApplicationDTO();
tAbilityApplicationDTO.setApplyNumber(applyNumber);
tAbilityApplicationDTO.setArea(abilityBatchApplicationDTO.getArea());
tAbilityApplicationDTO.setAttachment(abilityBatchApplicationDTO.getAttachment());
tAbilityApplicationDTO.setBasis(abilityBatchApplicationDTO.getBasis());

View File

@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import io.renren.common.dto.AuditingBaseDTO;
import io.renren.common.page.PageData;
import io.renren.common.utils.CodeGenerationUtils;
import io.renren.common.utils.Result;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
@ -29,6 +30,7 @@ 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.context.annotation.Lazy;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -62,10 +64,14 @@ public class AbilityCenterControllerV2 {
private ActRunningService actRunningService;
@Autowired
private ResourceService resourceService;
@Lazy
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
private SysDeptService sysDeptService;
@Autowired
private CodeGenerationUtils codeGenerationUtils;
@Value("${big_date.name}")
private String bigDateDeptName; // 大数据局名称
private static final String key = "abilityprocess_v2";
@ -90,6 +96,7 @@ public class AbilityCenterControllerV2 {
}
final String applyFlag = UUID.randomUUID().toString();
abilityBatchApplicationDTO.setApplyFlag(applyFlag); // 同一次的申请标识
String applyNumber = codeGenerationUtils.getApplyNumber("NLSY");
final Optional<SysDeptDTO> deptDTO = Optional.ofNullable(sysDeptService.getByName(bigDateDeptName));
final UserDetail user = SecurityUser.getUser();
@ -99,6 +106,7 @@ public class AbilityCenterControllerV2 {
return null;
}
TAbilityApplicationDTO tAbilityApplicationDTO = new TAbilityApplicationDTO();
tAbilityApplicationDTO.setApplyNumber(applyNumber);
tAbilityApplicationDTO.setArea(abilityBatchApplicationDTO.getArea());
tAbilityApplicationDTO.setAttachment(abilityBatchApplicationDTO.getAttachment());
tAbilityApplicationDTO.setBasis(abilityBatchApplicationDTO.getBasis());
@ -115,7 +123,7 @@ public class AbilityCenterControllerV2 {
tAbilityApplicationDTO.setApproveStatus("审核中");
tAbilityApplicationDTO.setDelFlag(0);
// v2 新增字段
tAbilityApplicationDTO.setCameraList(index.get("cameraId"));
tAbilityApplicationDTO.setCameraList(index.get("cameraId").toString());
tAbilityApplicationDTO.setTitle(abilityBatchApplicationDTO.getTitle());
tAbilityApplicationDTO.setApplicationBackground(abilityBatchApplicationDTO.getApplicationBackground());
tAbilityApplicationDTO.setApplicationScene(abilityBatchApplicationDTO.getApplicationScene());

View File

@ -3,6 +3,7 @@ package io.renren.common.controller;
import io.renren.common.annotation.LogOperation;
import io.renren.common.page.PageData;
import io.renren.common.utils.CodeGenerationUtils;
import io.renren.common.utils.Result;
import io.renren.modules.activiti.dto.ProcessInstanceDTO;
import io.renren.modules.activiti.dto.ProcessStartDTO;
@ -47,6 +48,8 @@ public class CommentController {
private TDemandCommentService tDemandCommentService;
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
private CodeGenerationUtils codeGenerationUtils;
private static final Logger logger = LoggerFactory.getLogger(CommentController.class);
@ -81,6 +84,7 @@ 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);

View File

@ -4,6 +4,7 @@ package io.renren.common.controller;
import com.alibaba.fastjson.JSONObject;
import io.renren.common.annotation.LogOperation;
import io.renren.common.page.PageData;
import io.renren.common.utils.CodeGenerationUtils;
import io.renren.common.utils.Result;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
@ -43,6 +44,8 @@ public class DemandDataController {
private ActRunningService actRunningService;
@Autowired
private TDemandDataService tDemandDataService;
@Autowired
private CodeGenerationUtils codeGenerationUtils;
private static final String key = "abilitydemandapply";
@ -66,6 +69,7 @@ public class DemandDataController {
logger.info(JSONObject.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);

View File

@ -6,6 +6,7 @@ import cn.hutool.crypto.SecureUtil;
import com.alibaba.fastjson.JSONObject;
import io.renren.common.annotation.LogOperation;
import io.renren.common.page.PageData;
import io.renren.common.utils.CodeGenerationUtils;
import io.renren.common.utils.Result;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
@ -57,6 +58,8 @@ public class ResourceMountController {
private ResourceService resourceService;
@Autowired
private SysUserService sysUserService;
@Autowired
private CodeGenerationUtils codeGenerationUtils;
@Autowired
protected TaskService taskService;
@ -102,6 +105,7 @@ public class ResourceMountController {
tResourceMountApplyDTO.setParameterContentMd5(SecureUtil.md5(JSONObject.toJSONString(index)));
tResourceMountApplyDTO.setResourceDTO(index);
tResourceMountApplyDTO.setEnclosure(index.getEnclosure());
tResourceMountApplyDTO.setApplyNumber(codeGenerationUtils.getApplyNumber("NLSJ"));
try {
tResourceMountApplyDTO.setResourceId(tResourceMountApplyDTO.getResourceDTO().getId());
} catch (Exception e) {
@ -184,6 +188,7 @@ public class ResourceMountController {
}
dto.setUndercarriageReason(tResourceUndercarriageApplyDTO.getReason());
dto.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag()); // 设置为正常
dto.setApplyNumber(codeGenerationUtils.getApplyNumber("NLXJ"));
String userId = SecurityUser.getUserId().toString();
Optional<SysUserDTO> userDTO = Optional.ofNullable(sysUserService.get(Long.valueOf(userId)));
userDTO.ifPresent(user -> {

View File

@ -4,7 +4,6 @@ import lombok.Data;
import java.io.Serializable;
/**
* 审核流程各数据类 基础DTO
*/

View File

@ -1,6 +1,5 @@
package io.renren.common.interceptor;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;

View File

@ -1,6 +1,5 @@
package io.renren.common.listener;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializer;
@ -22,7 +21,8 @@ import java.util.Map;
*/
@Component
public class InitiatorDataEntryListener implements TaskListener {
private static Logger logger = LoggerFactory.getLogger(InitiatorDataEntryListener.class);
private static final Logger logger = LoggerFactory.getLogger(InitiatorDataEntryListener.class);
@Autowired
private TaskService taskService;

View File

@ -3,6 +3,7 @@ package io.renren.common.utils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -10,6 +11,7 @@ import java.util.Date;
/**
* 编码生成工具类
*/
@Component
public class CodeGenerationUtils {
@Autowired
@ -68,12 +70,16 @@ public class CodeGenerationUtils {
}
private String getApplyNumberString (String tableName, String applyNumberPattern) {
String sql = "SELECT SUBSTR(apply_number, 5) FROM" + tableName +
"WHERE 1 = 1 AND apply_number IS NOT NULL " +
"AND apply_number LIKE '" + applyNumberPattern + "%'" +
String sql = "SELECT SUBSTR(apply_number, 5) FROM " + tableName +
" WHERE 1 = 1 AND apply_number IS NOT NULL " +
"AND apply_number LIKE '" + applyNumberPattern + "%' " +
"ORDER BY apply_number DESC " +
"LIMIT 1";
String s = jdbcTemplate.queryForObject(sql, String.class);
return StringUtils.isNotBlank(s) ? applyNumberPattern + "0001" : String.valueOf(Long.parseLong(s) + 1);
try {
String s = jdbcTemplate.queryForObject(sql, String.class);
return "NLSY" + (Long.parseLong(s) + 1);
} catch (Exception e) {
return applyNumberPattern + "0001";
}
}
}

View File

@ -1,5 +1,7 @@
package io.renren.modules.monitor.controller;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import io.renren.modules.monitor.dto.*;
import io.renren.modules.monitor.entity.*;
import io.renren.modules.monitor.mapper.*;
@ -581,5 +583,111 @@ public class Controller {
return success;
}
/******************************2022/07/13 ytl修改视频资源 start********************************************/
/**
* 根据parentId查询组织新,带摄像头通道数量
* @param parentId
* @return
*/
@GetMapping("selectSubOrganNew")
@ApiOperation("根据上级组织id查询组织,带摄像头通道数量")
@ApiImplicitParam(name = "parentId",value = "上级组织id",required = true,dataType = "String")
public Result selectSubOrganizationNew(String parentId){
if (parentId == null){
parentId = "";
}
//List<CameraOrganization> organs = cameraOrgenMapper.selectSubOrganization(parentId);
List<Map> maps = monitorService.selectSubOrganizationNew(parentId);
Result success = Result.success(maps);
return success;
}
/**
* 根据parentId和checkStatus查询摄像头
* @param
* @return
*/
@GetMapping("selectByParentIdNew")
@ApiOperation("根据摄像头的组织Id和异常状态查询摄像头")
@ApiImplicitParams({
@ApiImplicitParam(name = "parentId",value = "摄像头的组织Id",required = true,dataType = "String"),
@ApiImplicitParam(name = "checkStatus",value = "异常状态 1正常,0异常",required = false,dataType = "String"),
@ApiImplicitParam(name = "cameraName",value = "摄像头名称",dataType = "String"),
@ApiImplicitParam(name = "gpsX",value = "经度坐标",dataType = "Double"),
@ApiImplicitParam(name = "gpsY",value = "纬度坐标",dataType = "Double"),
@ApiImplicitParam(name = "pageNum",value = "页码",dataType = "Integer"),
@ApiImplicitParam(name = "pageSize",value = "页数大小",dataType = "Integer"),
@ApiImplicitParam(name = "radius",value = "半径",dataType = "Integer"),
@ApiImplicitParam(name = "labelCodes",value = "标签",dataType = "List")
})
public Result selectByParentIdNew(@RequestParam Map queryMap, String[] labelCodes){
if (!queryMap.containsKey("pageNum")) {
queryMap.put("pageNum", null);
queryMap.put("pageSize", null);
} else {
Integer pageNum = Integer.parseInt(queryMap.get("pageNum").toString());
Integer pageSize = Integer.parseInt(queryMap.get("pageSize").toString());
queryMap.replace("pageNum", (pageNum - 1) * pageSize);
queryMap.replace("pageSize", pageSize);
}
List<String> list1 = null;
if (null != labelCodes && labelCodes.length > 0) {
list1 = Arrays.asList(labelCodes);
}
List<Map> list = cameraChannelMapper.selectByParentIdNew(queryMap, list1);
Result success = Result.success(list);
success.setCount(cameraChannelMapper.selectByParentIdCountNew(queryMap, list1));
return success;
}
/**
* 摄像头按照市区进行聚合查询
*/
@GetMapping("selectChannelNumByRegion")
@ApiOperation("根据摄像头的组织Id和异常状态查询摄像头")
public Result selectChannelNumByRegion() throws Exception{
return monitorService.selectChannelNumByRegion();
}
/**
* 保存区域信息
*/
@GetMapping("/saveOrgenization")
public Result saveOrgenization() throws Exception{
List<JSONObject> orgenizationByPage = monitorService.getOrgenization(new ArrayList<JSONObject>());
List<Map> maps = JSONObject.parseArray(JSONObject.toJSONString(orgenizationByPage), Map.class);
if(maps.size() > 0){
List<List<Map>> lists = Lists.partition(maps,100);
lists.forEach(list->{
cameraOrgenMapper.batchSaveOrgenization(list);
});
maps.forEach(map->{
monitorService.setOrganizationPath(map,map.get("parentId").toString());
});
//修改path
maps.forEach(m->{
cameraOrgenMapper.updateOrganizationPaht(m.get("path").toString(),m.get("id").toString());
});
}
return Result.success();
}
/**
* 保存通道信息
* @return
*/
@GetMapping("saveChannelInfo")
public Result saveChannelInfo() throws Exception{
return monitorService.saveChannelInfo();
}
/******************************2022/07/13 ytl修改视频资源 end********************************************/
}

View File

@ -61,4 +61,12 @@ public interface CameraChannelMapper extends BaseDao<CameraChannel> {
List<CameraChannelNLDto> selectByLabel(@Param("page") Integer page,@Param("pageSize") Integer pageSize);
Integer selectByParentIdCount(@Param("map") Map queryMap, @Param("labelCodes") List labelCodes);
Integer selectChannelCounts(@Param("path") String path);
List<Map> selectByParentIdNew(@Param("map") Map queryMap, @Param("labelCodes") List labelCodes);
Integer selectByParentIdCountNew(@Param("map") Map queryMap, @Param("labelCodes") List labelCodes);
List<Map> selectChannelNumByRegion();
}

View File

@ -6,12 +6,36 @@ import io.renren.modules.monitor.entity.CameraOrganization;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
import java.util.Map;
@Mapper
public interface CameraOrgenizationMapper extends BaseDao<CameraOrganization> {
@Select("select * from t_camera_organization where parent_id = #{parentId}")
List<CameraOrganization> selectSubOrganization(@Param("parentId") String parentId);
@Select("select *,0 AS channelCount from t_camera_organization02 where parent_id = #{parentId}")
List<Map> selectSubOrganizationMap(@Param("parentId") String parentId);
void batchSaveOrgenization(List<Map> list);
@Select("SELECT name,parent_id FROM t_camera_organization02 WHERE id = #{id}")
Map selectOrgenizationById(@Param("id") String id);
@Update("UPDATE t_camera_organization02 SET path = TRIM( TRAILING '->' FROM #{path}) where id = #{id}")
void updateOrganizationPaht(@Param("path") String path,@Param("id") String id);
@Select(" SELECT id FROM t_camera_organization02")
List<Map> listOrgenization();
@Select(" SELECT name FROM t_camera_organization02 where substring(id,5) = #{idPart} and left(id,3) = '006'")
String getNameByidPart(@Param("idPart")String idPart);
@Update("UPDATE t_camera_organization02 SET COUNT = COUNT + 1 WHERE id = #{id}")
void updateOrganizationCount(@Param("id") String id);
void batchSaveCameraChannel(List<Map> list);
}

View File

@ -1091,6 +1091,166 @@ public class MonitorService {
return yestDay.format(formatter);
}
//根据父id查询查询通道的数量
public List<Map> selectSubOrganizationNew(String parentId) {
if (parentId == null){
parentId = "";
}
List<Map> organs = cameraOrgenMapper.selectSubOrganizationMap(parentId);//查询某个区域下的所有地区
if(organs.size() > 0){
for(int i=0;i< organs.size();i++){
String path = organs.get(i).get("path").toString();
Integer count = cameraChannelMapper.selectChannelCounts(path);
organs.get(i).put("channelCount",count);
};
}
return organs;
}
public Result selectChannelNumByRegion() throws Exception{
List<Map> maps = cameraChannelMapper.selectChannelNumByRegion();
return Result.success(maps);
}
public List<JSONObject> getOrgenization(List<JSONObject> list){
try {
List<JSONObject> list1 = this.getOrgenizationRoot();
list.addAll(list1);
list1.forEach(a->{
if(a.getBooleanValue("isParent")){
getOrgenizationByParent(list,a.getString("id"));
}
});
return list;
}catch (Exception e){
log.info(e.getMessage());
return null;
}
}
//获取根组织
public List<JSONObject> getOrgenizationRoot() throws Exception{
List<JSONObject> list = new ArrayList<>();
String url = monitorDomain + "/videoService/devicesManager/deviceTree?id=&nodeType=1&typeCode=01&page=1&pageSize=3000";
HttpHeaders headers = new HttpHeaders();
headers.add("X-Subject-Token",token);
ResponseEntity<JSONObject> responseEntity = null;
HttpEntity<Map> httpEntity = new HttpEntity<>(null, headers);
responseEntity = restTemplate.exchange(url, HttpMethod.GET,httpEntity,JSONObject.class);
JSONObject re = responseEntity.getBody();
List<JSONObject> results = re.getJSONArray("results").toJavaList(JSONObject.class);
return results;
}
//组织递归根据父ID查,简化了分页
public List<JSONObject> getOrgenizationByParent(List<JSONObject> list,String id){
HttpHeaders headers = new HttpHeaders();
headers.add("X-Subject-Token",token);
String url;
Map<String,Object> map = new HashMap<>();
HttpEntity<Map> httpEntity;
ResponseEntity<JSONObject> responseEntity = null;
url = monitorDomain + "/videoService/devicesManager/deviceTree?id="+id+"&nodeType=1&typeCode=01&page=1&pageSize=3000";
httpEntity = new HttpEntity<>(null, headers);
responseEntity = restTemplate.exchange(url, HttpMethod.GET,httpEntity,JSONObject.class);
JSONObject re = responseEntity.getBody();
if(re.getIntValue("totalCount")>0){
JSONArray results = re.getJSONArray("results");
List<JSONObject> jsonObjects = results.toJavaList(JSONObject.class);
list.addAll(jsonObjects);
jsonObjects.forEach(js->{
if(js.getBooleanValue("isParent")){
getOrgenizationByParent(list,js.getString("id"));
}
});
}
return list;
}
//更新组织的path
public void setOrganizationPath(Map map ,String parentId){
Map map2 = cameraOrgenMapper.selectOrgenizationById(parentId);
if(map2 != null){
String path = map2.get("name").toString();
String newNodeName = path + "->" + (map.get("path")==null?"":map.get("path").toString());
map.put("path",newNodeName);
setOrganizationPath(map,map2.get("parent_id").toString());
}
}
//保存通道信息
public Result saveChannelInfo() throws Exception {
List<Map> orgenList = cameraOrgenMapper.listOrgenization();
for(Map m:orgenList){
List<Map> cameChannels = getChannelInfo(m.get("id").toString());
List<Map> needSave = new ArrayList<>();
if(cameChannels.size() > 0){
boolean flag = false;
for(Map j:cameChannels){
if(Integer.parseInt(j.get("nodeType").toString()) ==3){
flag = true;
String channelSn = j.get("channelSn").toString();
String channelOrngin = channelSn.substring(0,6);
String deptName = cameraOrgenMapper.getNameByidPart(channelOrngin);
j.put("regionName",deptName);
j.put("regionCode",channelOrngin);
j.put("parentId",m.get("id").toString());
j.put("nodeName","");
needSave.add(j);
}
}
if(!flag){//更新count字段
cameraOrgenMapper.updateOrganizationCount(m.get("id").toString());
}
}else{//更新count字段
cameraOrgenMapper.updateOrganizationCount(m.get("id").toString());
}
needSave.forEach(map->setNodeName(map,map.get("parentId").toString()));
//保存并更新count字段
if(needSave.size() > 0){
List<List<Map>> partition = Lists.partition(needSave, 100);
partition.forEach(list->{
cameraOrgenMapper.batchSaveCameraChannel(list);
});
cameraOrgenMapper.updateOrganizationCount(m.get("id").toString());
}
}
return Result.success();
}
//根据组织id获取通道信息
public List<Map> getChannelInfo(String orgenId) throws Exception{
String url = monitorDomain +"/videoService/devicesManager/deviceTree?nodeType=1&typeCode=01;0;ALL;ALL&page=1&pageSize=3000&id="+orgenId;
HttpHeaders headers = new HttpHeaders();
headers.add("X-Subject-Token",token);
ResponseEntity<JSONObject> responseEntity = null;
HttpEntity<Map> httpEntity = new HttpEntity<>(null, headers);
responseEntity = restTemplate.exchange(url, HttpMethod.GET,httpEntity,JSONObject.class);
JSONObject re = responseEntity.getBody();
List<Map> results = re.getJSONArray("results").toJavaList(Map.class);
return results;
}
//查询nodename
public void setNodeName(Map map,String id){
Map map2 = cameraOrgenMapper.selectOrgenizationById(id);
if(map2 != null){
String nodeName = map2.get("name").toString();
String newNodeName = nodeName + "->" + (map.get("nodeName")==null?"":map.get("nodeName").toString());
map.put("nodeName",newNodeName);
setNodeName(map,map2.get("parent_id").toString());
}
}
}

View File

@ -1,6 +1,7 @@
package io.renren.modules.processForm.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
@ -14,8 +15,12 @@ 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;
import io.renren.modules.processForm.dto.TAbilityApplicationV2DTO;
import io.renren.modules.processForm.entity.TAbilityApplicationEntity;
import io.renren.modules.processForm.excel.TAbilityApplicationExcel;
import io.renren.modules.processForm.service.TAbilityApplicationService;
import io.renren.modules.resource.dto.ResourceDTO;
@ -44,7 +49,6 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 能力申请表单
*
@ -64,6 +68,10 @@ public class TAbilityApplicationController {
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
private TAbilityApplicationDao tAbilityApplicationDao;
@Autowired
private CameraChannelMapper cameraChannelMapper;
@Autowired
private SysDeptService sysDeptService;
@Value("${project.place}")
private Integer projectPlace;
@ -77,7 +85,10 @@ public class TAbilityApplicationController {
*/
@GetMapping("my_page")
@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 来分页
@ -113,7 +124,6 @@ public class TAbilityApplicationController {
*
* @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;");
@ -150,24 +160,40 @@ public class TAbilityApplicationController {
return new Result<TAbilityApplicationV2DTO>().ok(null);
}
TAbilityApplicationV2DTO tAbilityApplicationV2DTO = ConvertUtils.sourceToTarget(applicationDTOS.get(0), TAbilityApplicationV2DTO.class);
applicationDTOS.stream().limit(1l).forEach(dto -> {
if (StringUtils.isNotEmpty(dto.getCameraList())) {
if (applicationDTOS.size() > 1) {
tAbilityApplicationV2DTO.setSystem("视频资源申请:(" + dto.getSystem() + "" + applicationDTOS.size() + "个摄像头)");
} else {
tAbilityApplicationV2DTO.setSystem("视频资源申请:" + dto.getSystem());
}
}
});
Map<String, List<Map<String, Object>>> re = result.keySet().stream().map(index -> {
final List<TAbilityApplicationDTO> tAbilityApplicationDTOList = result.get(index);
if (tAbilityApplicationDTOList.isEmpty()) {
return null;
}
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<Object> camera = new ArrayList<>();
switch (Constant.ProjectPlace.getByFlag(projectPlace)) { // 处理基础设施
case TSINGTAO_XHA:
break;
case TSINGTAO: { // 大数据局
camera = (List<Object>) resourceService.getApplyCameraList(Long.valueOf(tAbilityApplicationDTOList.get(0).getInstanceId()));
List<Object> camera;
ArrayList cameraList = new ArrayList();
QueryWrapper<TAbilityApplicationEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("instance_id", tAbilityApplicationDTOList.get(0).getInstanceId());
List<TAbilityApplicationEntity> applicationEntities = tAbilityApplicationDao.selectList(queryWrapper);
applicationEntities.forEach(index_ -> {
if (StringUtils.isEmpty(index_.getCameraList())) {
return;
}
break;
case BAOTOU:
case UNKNOWN:
default:
}
List<CameraChannelDto1> channelDto1s = cameraChannelMapper.selectByChannelCode(index_.getCameraList().replaceAll("\"", ""));
if (!channelDto1s.isEmpty()) {
cameraList.add(channelDto1s.get(0));
}
});
camera = cameraList;
List<Object> finalCamera = camera;
Map<String, Object> resourceApplication = new HashMap<String, Object>() {
@ -182,7 +208,7 @@ public class TAbilityApplicationController {
}
};
return resourceApplication;
}).collect(Collectors.groupingBy(t -> {
}).filter(index -> index != null).collect(Collectors.groupingBy(t -> {
SysDeptDTO sysDeptDTO = (SysDeptDTO) t.get("resourceOwnerDept");
if (sysDeptDTO == null) {
return "未知部门"; // 无部门信息

View File

@ -51,6 +51,9 @@ public class TAbilityApplicationV2DTO implements Serializable {
@ApiModelProperty(value = "申请单标识(同一次的申请标识)")
private String applyFlag;
@ApiModelProperty(value = "审核状态:审核中,通过,不通过")
private String approveStatus;
// 以上为申请时公共信息
@ApiModelProperty(value = "资源申请情况(包含资源信息和流程流转)")

View File

@ -107,6 +107,9 @@ public class ResourceDTO extends AuditingBaseDTO implements Serializable {
@ApiModelProperty(value = "总体评价")
private Integer total;
@ApiModelProperty(value = "申请单号")
private String applyNumber;
public String getDelFlagTip() {
if (this.delFlag != null) {
Optional<ResourceEntityDelFlag> resourceEntityDelFlagOptional = Optional.ofNullable(ResourceEntityDelFlag.getByFlag(this.delFlag));

View File

@ -136,4 +136,9 @@ public class ResourceEntity extends BaseEntity {
@TableField(value = "info_list", typeHandler = FastjsonTypeHandler.class)
private List<AttrEntity> infoList;
/**
* 申请单号
*/
private String applyNumber;
}

View File

@ -0,0 +1,23 @@
DROP PROCEDURE IF EXISTS del_idx;
create procedure del_idx(IN p_tablename varchar(200), IN p_idxname VARCHAR(200))
begin
DECLARE str VARCHAR(250);
set @str=concat(' drop index ',p_idxname,' on ',p_tablename);
select count(*) into @cnt from information_schema.statistics where table_name=p_tablename and index_name=p_idxname ;
if @cnt >0 then
PREPARE stmt FROM @str;
EXECUTE stmt ;
end if;
end ;
call del_idx('sys_user_token','user_id');

View File

@ -54,8 +54,8 @@
<logger name="org.springframework.web" level="ERROR">
<appender-ref ref="FILE_INFO"/>
</logger>
<logger name="org.springboot.sample" level="ERROR"></logger>
<logger name="io.renren" level="ERROR"></logger>
<logger name="org.springboot.sample" level="ERROR"/>
<logger name="io.renren" level="ERROR"/>
</springProfile>
<root level="INFO">

View File

@ -22,6 +22,7 @@
<result property="approvalUserName" column="approval_user_name"/>
<result property="approvalUserDeptName" column="approval_user_dept_name"/>
<result property="visits" column="visits"/>
<result property="applyNumber" column="apply_number"/>
</resultMap>
<update id="updateInstanceId">

View File

@ -16,6 +16,7 @@
<result property="note3" column="note3"/>
<result property="note4" column="note4"/>
<result property="note5" column="note5"/>
<result property="applyNumber" column="apply_number"/>
</resultMap>
<select id="commentCount" resultType="java.lang.Long">
SELECT

View File

@ -116,4 +116,103 @@
</if> ) temp
</select>
<select id="selectChannelCounts" parameterType="java.lang.String" resultType="integer">
SELECT COUNT(a.idt_camera_channel) FROM t_camera_channel01 a inner join t_camera_organization02 b on a.parent_id = b.id
WHERE b.path like concat(#{path},'%')
</select>
<select id="selectByParentIdNew" resultType="java.util.Map">
SELECT
tcc.*
<if test = "(map.gpsX != null and map.gpsX != '') and (map.gpsY != null and map.gpsY != '')">
, 6371 * 1000 * acos(cos(radians( ${map.gpsY} ))
* cos(radians( tcc.gps_y ))
* cos(radians( tcc.gps_x ) - radians( ${map.gpsX} ))
+ sin(radians( ${map.gpsY} ))
* sin(radians( tcc.gps_y ))) AS `distance`
</if>
FROM
t_camera_channel01 tcc
<if test = "labelCodes != null and labelCodes.size > 0">
JOIN t_channel_mtm_label tcml ON tcml.channel_code = tcc.channel_code
JOIN t_label tl ON tl.label_code = tcml.label_code
</if>
WHERE 1 = 1
<if test = "map.parentId != null and map.parentId != ''">
AND tcc.parent_id = #{map.parentId}
</if>
AND tcc.check_status IN (${map.checkStatus})
AND tcc.gps_x != ''
AND tcc.gps_y != ''
AND tcc.gps_x IS NOT NULL
AND tcc.gps_y IS NOT NULL
<if test = "map.cameraName != null and map.cameraName != ''">
AND tcc.channel_name LIKE CONCAT('%',#{map.cameraName},'%')
</if>
<if test = "labelCodes != null and labelCodes.size > 0">
AND tl.label_code IN
<foreach collection="labelCodes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test = "map.radius != null and map.radius != ''">
HAVING
distance &lt; ${map.radius}
ORDER BY
distance
</if>
<if test = "map.pageNum != null and map.pageSize != null">
LIMIT ${map.pageNum}, ${map.pageSize}
</if>
</select>
<select id="selectByParentIdNew" resultType="java.util.Map">
SELECT
tcc.*
<if test = "(map.gpsX != null and map.gpsX != '') and (map.gpsY != null and map.gpsY != '')">
, 6371 * 1000 * acos(cos(radians( ${map.gpsY} ))
* cos(radians( tcc.gps_y ))
* cos(radians( tcc.gps_x ) - radians( ${map.gpsX} ))
+ sin(radians( ${map.gpsY} ))
* sin(radians( tcc.gps_y ))) AS `distance`
</if>
FROM
t_camera_channel01 tcc
<if test = "labelCodes != null and labelCodes.size > 0">
JOIN t_channel_mtm_label tcml ON tcml.channel_code = tcc.channel_code
JOIN t_label tl ON tl.label_code = tcml.label_code
</if>
WHERE 1 = 1
<if test = "map.parentId != null and map.parentId != ''">
AND tcc.parent_id = #{map.parentId}
</if>
AND tcc.check_status IN (${map.checkStatus})
AND tcc.gps_x != ''
AND tcc.gps_y != ''
AND tcc.gps_x IS NOT NULL
AND tcc.gps_y IS NOT NULL
<if test = "map.cameraName != null and map.cameraName != ''">
AND tcc.channel_name LIKE CONCAT('%',#{map.cameraName},'%')
</if>
<if test = "labelCodes != null and labelCodes.size > 0">
AND tl.label_code IN
<foreach collection="labelCodes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test = "map.radius != null and map.radius != ''">
HAVING
distance &lt; ${map.radius}
ORDER BY
distance
</if>
<if test = "map.pageNum != null and map.pageSize != null">
LIMIT ${map.pageNum}, ${map.pageSize}
</if>
</select>
<select id="selectChannelNumByRegion" resultType="java.util.Map">
SELECT COUNT(idt_camera_channel) AS channelNum,region_code,region_name FROM t_camera_channel01 GROUP BY region_code,region_name
</select>
</mapper>

View File

@ -1,5 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.renren.modules.monitor.mapper.CameraOrgenizationMapper">
<insert id="batchSaveOrgenization" parameterType="java.util.List">
INSERT INTO t_camera_organization02 (
id,name,parent_id,sort,subCount,is_parent,path
) VALUES
<foreach collection="list" item="item" separator="," >
(
#{item.id},#{item.name},#{item.parentId},#{item.sort},#{item.subCount},case when #{item.isParent} = true then 1 else 0 end,#{item.name}
)
</foreach>
</insert>
<insert id="batchSaveCameraChannel" parameterType="java.util.List">
INSERT INTO t_camera_channel01
(
channel_code,channel_id,channel_name,gps_x,gps_y,status,
parent_id,region_code,region_name,node_name
)
VALUES
<foreach collection="list" item="item" separator="," >
(
#{item.channelCode},#{item.channelId},#{item.channelName},#{item.gpsX},#{item.gpsY},#{item.status},
#{item.parentId},#{item.regionCode},#{item.regionName},TRIM(TRAILING '->' FROM #{item.nodeName})
)
</foreach>
</insert>
</mapper>

View File

@ -27,6 +27,7 @@
<result property="applyFlag" column="apply_flag"/>
<result property="resourceOwnerDept" column="resource_owner_dept"
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
<result property="applyNumber" column="apply_number"/>
</resultMap>
<resultMap id="resourceDTO" type="io.renren.modules.processForm.dto.TAbilityApplicationDTO">
<result property="id" column="id"/>
@ -51,6 +52,7 @@
<result property="applyFlag" column="apply_flag"/>
<result property="resourceOwnerDept" column="resource_owner_dept"
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
<result property="applyNumber" column="apply_number"/>
</resultMap>
<update id="updateInstanceId">

View File

@ -35,6 +35,7 @@
<result property="undercarriageUserName" column="undercarriage_user_name"/>
<result property="infoList" column="info_list"
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
<result property="applyNumber" column="apply_number"/>
</resultMap>
<resultMap id="resourceDTO" type="io.renren.modules.resource.dto.ResourceDTO">
@ -77,6 +78,7 @@
<result property="infoList" column="info_list"
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
<result property="total" column="total"/>
<result property="applyNumber" column="apply_number"/>
</resultMap>
<update id="deleteByIds">

View File

@ -17,6 +17,7 @@
<result property="resourceDTO" column="resource_dto"
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
<result property="createtime" column="createtime"/>
<result property="applyNumber" column="apply_number"/>
</resultMap>
<update id="updateInstanceId">

View File

@ -36,7 +36,7 @@
</select>
<select id="getByUsername" resultType="io.renren.modules.sys.entity.SysUserEntity">
select * from sys_user where username = #{value}
select * from sys_user where BINARY username = #{value}
</select>
<update id="updatePassword">
@ -44,7 +44,7 @@
</update>
<select id="getCountByDeptId" resultType="int">
select count(*) from sys_user where dept_id = #{value}
SELECT count(*) FROM sys_user WHERE dept_id = #{value}
</select>
<select id="getUserIdListByDeptId" resultType="Long">