|
|
@ -20,9 +20,17 @@ import com.epmet.dto.form.IcHouseAddFormDTO; |
|
|
|
import com.epmet.dto.form.RentTenantFormDTO; |
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
import com.epmet.plugin.power.dto.hik.HikCommunityInfoDTO; |
|
|
|
import com.epmet.plugin.power.dto.hik.HikDeviceInfoDTO; |
|
|
|
import com.epmet.plugin.power.dto.hik.HikErrorInfoDTO; |
|
|
|
import com.epmet.plugin.power.dto.hik.form.HikAuthorityFormDTO; |
|
|
|
import com.epmet.plugin.power.dto.hik.form.HikPersonFormDTO; |
|
|
|
import com.epmet.plugin.power.dto.rent.RentContractFileDTO; |
|
|
|
import com.epmet.plugin.power.dto.rent.RentContractInfoDTO; |
|
|
|
import com.epmet.plugin.power.dto.rent.RentTenantInfoDTO; |
|
|
|
import com.epmet.plugin.power.modules.hik.service.HikCommunityInfoService; |
|
|
|
import com.epmet.plugin.power.modules.hik.service.HikDeviceInfoService; |
|
|
|
import com.epmet.plugin.power.modules.hik.service.HikErrorInfoService; |
|
|
|
import com.epmet.plugin.power.modules.rent.dao.RentContractInfoDao; |
|
|
|
import com.epmet.plugin.power.modules.rent.entity.RentContractFileEntity; |
|
|
|
import com.epmet.plugin.power.modules.rent.entity.RentContractInfoEntity; |
|
|
@ -31,6 +39,7 @@ import com.epmet.plugin.power.modules.rent.redis.RentContractInfoRedis; |
|
|
|
import com.epmet.plugin.power.modules.rent.service.RentContractFileService; |
|
|
|
import com.epmet.plugin.power.modules.rent.service.RentContractInfoService; |
|
|
|
import com.epmet.plugin.power.modules.rent.service.RentTenantInfoService; |
|
|
|
import com.epmet.plugin.power.modules.utils.HkDeviceUtil; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -54,6 +63,9 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl<RentContractInf |
|
|
|
@Autowired |
|
|
|
private LoginUserUtil loginUserUtil; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private HkDeviceUtil hkDeviceUtil; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
|
|
|
|
@ -66,6 +78,15 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl<RentContractInf |
|
|
|
@Autowired |
|
|
|
private RentContractFileService rentContractFileService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private HikErrorInfoService hikErrorInfoService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private HikCommunityInfoService hikCommunityInfoService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private HikDeviceInfoService hikDeviceInfoService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<RentContractInfoDTO> page(Map<String, Object> params) { |
|
|
|
params.put("customerId", loginUserUtil.getLoginUserCustomerId()); |
|
|
@ -233,6 +254,52 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl<RentContractInf |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void send(RentContractInfoDTO dto) { |
|
|
|
dto.getTenantList().forEach(item -> { |
|
|
|
try { |
|
|
|
HikPersonFormDTO person = new HikPersonFormDTO(); |
|
|
|
person.setFaceUrl(item.getImgList().get(0).getFileUrl()); |
|
|
|
person.setMobile(item.getMobile()); |
|
|
|
person.setCredentialType(NumConstant.ONE); |
|
|
|
person.setCredentialNumber(item.getIdCard()); |
|
|
|
person.setPersonName(item.getName()); |
|
|
|
person.setGender(NumConstant.ONE_NEG); |
|
|
|
String personId = hkDeviceUtil.sendPerson(person); |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(personId)) { |
|
|
|
HikAuthorityFormDTO authority = new HikAuthorityFormDTO(); |
|
|
|
authority.setPersonType(NumConstant.ONE); |
|
|
|
authority.setPersonId(personId); |
|
|
|
|
|
|
|
Map<String, Object> communityParams = new HashMap<>(4); |
|
|
|
communityParams.put("communityName", dto.getVillageName()); |
|
|
|
List<HikCommunityInfoDTO> communityList = hikCommunityInfoService.list(communityParams); |
|
|
|
|
|
|
|
communityList.forEach(community -> { |
|
|
|
authority.setCommunityId(community.getCommunityId()); |
|
|
|
|
|
|
|
Map<String, Object> deviceParams = new HashMap<>(4); |
|
|
|
deviceParams.put("communityName", dto.getVillageName()); |
|
|
|
List<HikDeviceInfoDTO> deviceList = hikDeviceInfoService.list(deviceParams); |
|
|
|
|
|
|
|
deviceList.forEach(device -> { |
|
|
|
authority.setDeviceId(device.getDeviceId()); |
|
|
|
|
|
|
|
hkDeviceUtil.authorityIssued(authority); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} catch (EpmetException e) { |
|
|
|
HikErrorInfoDTO error = new HikErrorInfoDTO(); |
|
|
|
error.setIdCard(item.getIdCard()); |
|
|
|
error.setErrorInfo(e.getMessage()); |
|
|
|
hikErrorInfoService.save(error); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void update(RentContractInfoDTO dto) { |
|
|
|