Commit 5492919b authored by helinlin's avatar helinlin

Merge remote-tracking branch 'origin/developer' into developer

parents 8e581753 f1d60af1
package com.yeejoin.amos.boot.module.common.api.feign;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.feign.MultipartSupportConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.yeejoin.amos.boot.biz.common.feign.MultipartSupportConfig;
/**
* 隐患服务feign
*
......@@ -25,5 +22,13 @@ public interface LatentDangerFeignClient {
*/
@RequestMapping(value = "/api/latent/danger/app/unFinished", method = RequestMethod.GET)
ResponseModel<Object> getUnFinishedDangerCount();
/**
* 获取未完成隐患数量
*
* @return
*/
@RequestMapping(value = "/api/latent/danger/app/currentLandgerCount", method = RequestMethod.GET)
ResponseModel<Object> currentLandgerCount();
}
......@@ -33,6 +33,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -492,8 +493,8 @@ public class AlertCalledController extends BaseController {
dto.setIotDetection(fireAlarmNum + faultAlarmNum + monitorEventNum);
ResponseModel<Object> currentHiddenDanger = latentDangerFeignClient.getUnFinishedDangerCount();
Integer currentHiddenDangerNum = (Integer) currentHiddenDanger.getResult();
ResponseModel<Object> currentHiddenDanger = latentDangerFeignClient.currentLandgerCount();
Integer currentHiddenDangerNum = JSONObject.parseObject(JSONObject.toJSONString(currentHiddenDanger.getResult())).getInteger("count") ;
dto.setCurrentHiddenDanger(currentHiddenDangerNum);
dto.setAllNum(dto.getAlarmNum() + dto.getIotDetection() + currentHiddenDangerNum);
......
......@@ -384,6 +384,18 @@ public class LatentDangerController extends BaseController {
@GetMapping(value = "/app/unFinishedDanger")
@TycloudOperation(ApiLevel = UserType.AGENCY)
public ResponseModel getUnFinishedDangerCountMap() {
return ResponseHelper.buildResponse(iLatentDangerService.getUnFinishedDangerCountMap());
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
return ResponseHelper.buildResponse(iLatentDangerService.getUnFinishedDangerCountMap( loginOrgCode));
}
@ApiOperation(value = "当前隐患--所有未关闭隐患数量", notes = "当前隐患--所有未关闭隐患数量")
@GetMapping(value = "/app/currentLandgerCount")
@TycloudOperation(ApiLevel = UserType.AGENCY)
public ResponseModel currentLandgerCount() {
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
return ResponseHelper.buildResponse(iLatentDangerService.currentLandgerCount(null,loginOrgCode));
}
}
......@@ -86,5 +86,6 @@ public interface LatentDangerMapper extends BaseMapper<LatentDanger> {
Integer selectUnFinishedCount(@Param("dangerState1") List<String> dangerState1, @Param("dangerState2") List<String> dangerState2);
Integer selectUnFinishedCountByParam(@Param("bizType") String bizType,
@Param("dangerState") List<String> dangerState);
@Param("dangerState") List<String> dangerState,
String orgCode);
}
package com.yeejoin.amos.latentdanger.business.service.impl;
import static com.yeejoin.amos.latentdanger.business.util.RandomUtil.buildOrderNo;
import static org.typroject.tyboot.core.foundation.context.RequestContext.getProduct;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.lang3.ObjectUtils;
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.data.domain.PageImpl;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
......@@ -20,8 +55,10 @@ import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.feign.SupervisionFeignClient;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
......@@ -82,30 +119,6 @@ import com.yeejoin.amos.latentdanger.dao.entity.LatentDangerFlowRecord;
import com.yeejoin.amos.latentdanger.exception.YeeException;
import com.yeejoin.amos.latentdanger.feign.RemoteSecurityService;
import com.yeejoin.amos.latentdanger.mqtt.WebMqttComponent;
import org.apache.commons.lang3.ObjectUtils;
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.data.domain.PageImpl;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.*;
import java.util.stream.Collectors;
import static com.yeejoin.amos.latentdanger.business.util.RandomUtil.buildOrderNo;
import static org.typroject.tyboot.core.foundation.context.RequestContext.getProduct;
@Service("latentDangerService")
public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentDanger, LatentDangerMapper> implements ILatentDangerService {
......@@ -1958,7 +1971,6 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
} else if (LatentDangerBizTypeEnum.巡检.getCode().equals(bizType)) {
pageParam.put("dangerState", LatentDangerState.PatrolDangerStateEnum.待评审.getCode());
}
pageParam.put("bizType", bizType);
}
}
// 获取隐患地点的子节点
......@@ -2006,10 +2018,6 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
pageParam.put("bizOrgCode", person.get("bizOrgCode").toString().substring(0, 12));
// 登录人为治理人
pageParam.put("governUserId", jcsUserId);
//暂时注释掉,web巡查隐患查不出
//pageParam.put("bizType", bizType);
}
}
// pageParam.put("bizType", bizType);
......@@ -2387,7 +2395,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
}
@Override
public Map<String,Integer> getUnFinishedDangerCountMap() {
public Map<String,Integer> getUnFinishedDangerCountMap( String loginOrgCode) {
Map<String, Integer> resultMap = Maps.newHashMap();
// 巡检隐患未关闭状态集合
List<LatentDangerState.PatrolDangerStateEnum> pDangerStateEnumList = Lists.newArrayList();
......@@ -2396,7 +2404,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
pDangerStateEnumList.add(LatentDangerState.PatrolDangerStateEnum.已撤销);
Integer pDangerCount =
this.baseMapper.selectUnFinishedCountByParam("patrol",
pDangerStateEnumList.stream().map(LatentDangerState.PatrolDangerStateEnum::getCode).collect(Collectors.toList()));
pDangerStateEnumList.stream().map(LatentDangerState.PatrolDangerStateEnum::getCode).collect(Collectors.toList()),loginOrgCode);
resultMap.put("patrol", pDangerCount);
// 防火监督未关闭隐患状态集合
List<LatentDangerState.SupervisionDangerStateEnum> sDangerStateEnumList = Lists.newArrayList();
......@@ -2404,8 +2412,32 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
sDangerStateEnumList.addAll(LatentDangerState.SupervisionDangerStateEnum.getEnumListByProcessState(LatentDangerProcessStateEnum.待审核.getCode()));
sDangerStateEnumList.addAll(LatentDangerState.SupervisionDangerStateEnum.getEnumListByProcessState(LatentDangerProcessStateEnum.治理完毕.getCode()));
Integer sDangerCount = this.baseMapper.selectUnFinishedCountByParam("supervision",
sDangerStateEnumList.stream().map(LatentDangerState.SupervisionDangerStateEnum::getCode).collect(Collectors.toList()));
sDangerStateEnumList.stream().map(LatentDangerState.SupervisionDangerStateEnum::getCode).collect(Collectors.toList()),loginOrgCode);
resultMap.put("supervision", sDangerCount);
return resultMap;
}
}
@Autowired
OrgUsrServiceImpl iOrgUsrService;
@Override
public Map<String, Integer> currentLandgerCount(String companyId,String loginOrgCode) {
Map<String, Integer> resultMap = new HashMap<String, Integer>();
List<String> dangerState = new ArrayList<String>();
dangerState.add(LatentDangerState.PatrolDangerStateEnum.治理完毕.getCode());
dangerState.add(LatentDangerState.PatrolDangerStateEnum.待评审.getCode());
dangerState.add(LatentDangerState.PatrolDangerStateEnum.已撤销.getCode());
dangerState.add("dangerSubmit");
dangerState.add("onSiteConfirm");
dangerState.add("leaderConfirm");
dangerState.add("secondConfirm");
dangerState.add("endOfGovernance");
LambdaQueryWrapper<LatentDanger> wrapper = new LambdaQueryWrapper<LatentDanger>();
wrapper.likeRight(LatentDanger::getOrgCode, loginOrgCode);
wrapper.isNotNull(LatentDanger::getInstanceId);
wrapper.notIn(LatentDanger::getDangerState, dangerState);
wrapper.eq(LatentDanger::getDeleted, false);
int count = this.baseMapper.selectCount(wrapper);
resultMap.put("count", count);
return resultMap;
}
}
\ No newline at end of file
......@@ -191,5 +191,7 @@ public interface ILatentDangerService {
*
* @return
*/
Map<String, Integer> getUnFinishedDangerCountMap();
Map<String, Integer> getUnFinishedDangerCountMap( String loginOrgCode);
public Map<String, Integer> currentLandgerCount(String companyId,String loginOrgCode);
}
......@@ -1065,6 +1065,8 @@
FROM p_latent_danger
WHERE deleted = 0
AND biz_type = #{bizType}
and org_code LIKE concat(#{orgCode},'%')
and instance_id is not null
<if test="dangerState != null and !dangerState.isEmpty()">
AND danger_state NOT IN
<foreach collection="dangerState" item="state" open="(" separator="," close=")">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment