Commit 62d9297b authored by tianbo's avatar tianbo

防火监督修复数据接口添加

parent d187f4d4
......@@ -239,4 +239,5 @@ public interface IOrgUsrService {
OrgUsr selectByAmosOrgId(Long id);
List<OrgUsrFormDto> getUnSyncOrgCompanyList(List<Long> companyIdList);
}
......@@ -20,13 +20,17 @@ public enum LatentDangerProcessStateEnum {
*/
待整改("待整改", "2"),
/**
* 待整改资料提交
*/
待整改资料提交("待整改资料提交", "3"),
/**
* 待复核
*/
待复核("待复核", "3"),
待复核("待复核", "4"),
/**
* 治理完毕
*/
治理完毕("治理完毕", "4");
治理完毕("治理完毕", "5");
/**
* 名称,描述
......
......@@ -79,7 +79,7 @@ public interface LatentDangerState {
/**
* 整改完毕
*/
整改完毕("整改完毕", "endOfGovernance", "","", "4");
整改完毕("整改完毕", "endOfGovernance", "","", "5");
/**
* 名称,描述
......
......@@ -30,12 +30,15 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
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.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
......@@ -517,4 +520,16 @@ public class OrgUsrController extends BaseController {
public ResponseModel<AgencyUserModel> getAmosIdByOrgUserId(@PathVariable String orgUserId) throws Exception {
return ResponseHelper.buildResponse(iOrgUsrService.getAmosIdByOrgUserId(orgUserId));
}
/**
* 根据单位id列表或未同步的机场单位列表
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/unSync/orgCompany")
@ApiOperation(httpMethod = "GET", value = "将所有机场单位数据同步到消防监督服务p_point表", notes = "将所有机场单位数据同步到消防监督服务p_point表")
public ResponseModel getUnSyncOrgCompanyList(@RequestParam List<Long> companyIdList) {
return ResponseHelper.buildResponse(iOrgUsrService.getUnSyncOrgCompanyList(companyIdList));
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
......@@ -43,6 +44,8 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -77,6 +80,8 @@ import java.util.stream.Collectors;
@Service
public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapper> implements IOrgUsrService {
private final Logger logger = LoggerFactory.getLogger(OrgUsrServiceImpl.class);
private static final String TYPE = "PERSON,COMPANY";
private static final String CODE = "amosAccount";
......@@ -1696,4 +1701,23 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
}
return amosUser;
}
@Override
public List<OrgUsrFormDto> getUnSyncOrgCompanyList(List<Long> companyIdList) {
LambdaQueryWrapper<OrgUsr> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.notIn(OrgUsr::getSequenceNbr, companyIdList).eq(OrgUsr::getIsDelete, false).eq(OrgUsr::getBizOrgType, "COMPANY");
List<OrgUsr> unSyncCompanyList = this.baseMapper.selectList(queryWrapper);
List<OrgUsrFormDto> allUnSyncCompanyList = Lists.newArrayList();
if (!ValidationUtil.isEmpty(unSyncCompanyList)) {
unSyncCompanyList.forEach(company -> {
try {
OrgUsrFormDto orgUsrFormDto = this.selectCompanyById(company.getSequenceNbr());
allUnSyncCompanyList.add(orgUsrFormDto);
} catch (Exception e) {
logger.info(e.getMessage());
}
});
}
return allUnSyncCompanyList;
}
}
......@@ -147,7 +147,8 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
private WorkflowFeignService workflowFeignService;
// 有启动后执行现场确认的角色名称
private String onSiteConfirmRole = "Person_charge_unit_fire_protection_supervision_inspection";
@Value("${onSite.confirm.roleName}")
private String onSiteConfirmRole;
@Autowired
JcsFeignClient jcsFeignClient;
......@@ -1156,7 +1157,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
RoleBo roleBo = reginParams.getRole();
if (!onSiteConfirmRole.equals(roleBo.getRoleName())) {
executeSubmitDto.setIsOk(false);
executeSubmitDto.setMsg("没有权限执行");
executeSubmitDto.setMsg("没有执行权限");
return executeSubmitDto;
}
// 2、开启工作流
......
......@@ -823,4 +823,15 @@ public class PointController extends AbstractBaseController {
return ResponseHelper.buildResponse(iPointService.getPlanExecuteTeams());
}
/**
* 修复历史数据(将所有机场单位数据同步到消防监督服务p_point表)
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "将所有机场单位数据同步到消防监督服务p_point表", notes = "将所有机场单位数据同步到消防监督服务p_point表")
@PutMapping(value = "/amos/temp/syncCompany")
public ResponseModel syncOrgCompany() {
return ResponseHelper.buildResponse(iPointService.syncOrgCompany());
}
}
......@@ -171,4 +171,6 @@ public interface PointMapper extends BaseMapper {
* @return
*/
List<Point> getPointByPlanId(String planId);
List<Long> queryAllPointList();
}
......@@ -4,6 +4,9 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @author DELL
......@@ -18,4 +21,11 @@ public interface JCSFeignClient {
*/
@GetMapping(value = "jcs/org-usr/getLoginUserDetails/{userId}")
FeignClientResult getUserUnit(@PathVariable String userId);
/**
* 查询所有未同步的机场单位
* @return ResponseModel
*/
@GetMapping(value = "jcs/org-usr/unSync/orgCompany")
FeignClientResult getUnSyncOrgCompanyList(@RequestParam List<Long> companyIdList);
}
......@@ -20,6 +20,7 @@ import com.yeejoin.amos.supervision.business.dto.PointDto;
import com.yeejoin.amos.supervision.business.entity.mybatis.CheckPtListBo;
import com.yeejoin.amos.supervision.business.feign.DangerFeignClient;
import com.yeejoin.amos.supervision.business.feign.EquipFeign;
import com.yeejoin.amos.supervision.business.feign.JCSFeignClient;
import com.yeejoin.amos.supervision.business.param.*;
import com.yeejoin.amos.supervision.business.service.intfc.IPointService;
import com.yeejoin.amos.supervision.business.util.DaoCriteria;
......@@ -47,12 +48,14 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.annotation.Resource;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import java.beans.Beans;
import java.math.BigInteger;
import java.util.*;
import java.util.stream.Collectors;
......@@ -111,6 +114,9 @@ public class PointServiceImpl implements IPointService {
@Autowired
private DangerFeignClient dangerFeignClient;
@Autowired
private JCSFeignClient jcsFeignClient;
private final int HTTP_OK_STATUS = 200;
@Override
......@@ -1242,4 +1248,17 @@ public class PointServiceImpl implements IPointService {
return pointMapper.getPlanExecuteTeams();
}
@Override
public Boolean syncOrgCompany() {
FeignClientResult result = jcsFeignClient.getUnSyncOrgCompanyList(pointMapper.queryAllPointList());
List<Object> list = (List<Object>) result.getResult();
if (!ValidationUtil.isEmpty(list)) {
list.forEach(company -> {
OrgUsrFormDto orgUsrFormDto = JSON.parseObject(JSON.toJSON(company).toString(), OrgUsrFormDto.class);
syncSavePoint(orgUsrFormDto);
});
return true;
}
return false;
}
}
......@@ -331,4 +331,10 @@ public interface IPointService {
List<Map<String, Object>> getPlanExecuteTeams();
/**
* 将所有机场单位数据同步到消防监督服务p_point表
*
* @return
*/
Boolean syncOrgCompany();
}
......@@ -93,3 +93,5 @@ control.fegin.name=JCS-API-CONTROL
supervision.feign.name=AMOS-SUPERVISION-API
jcs.fegin.name=JCS
onSite.confirm.roleName="Person_charge_unit_fire_protection_supervision_inspection"
\ No newline at end of file
......@@ -1193,4 +1193,7 @@
and pl.id = #{planId}
and po.id = rp.point_id)
</select>
<select id="queryAllPointList" resultType="java.lang.Long">
select original_id from p_point where is_delete = 0;
</select>
</mapper>
\ No newline at end of file
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