Browse Source

发送-储存错误信息逻辑

feature/hk_device
zhangyuan 3 years ago
parent
commit
dd27674522
  1. 2
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/service/impl/HikCommunityInfoServiceImpl.java
  2. 2
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/service/impl/HikDeviceInfoServiceImpl.java
  3. 9
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentContractInfoController.java
  4. 10
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentContractInfoService.java
  5. 67
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentContractInfoServiceImpl.java

2
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/service/impl/HikCommunityInfoServiceImpl.java

@ -50,9 +50,11 @@ public class HikCommunityInfoServiceImpl extends BaseServiceImpl<HikCommunityInf
private QueryWrapper<HikCommunityInfoEntity> getWrapper(Map<String, Object> params){ private QueryWrapper<HikCommunityInfoEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP); String id = (String)params.get(FieldConstant.ID_HUMP);
String communityName = (String)params.get("communityName");
QueryWrapper<HikCommunityInfoEntity> wrapper = new QueryWrapper<>(); QueryWrapper<HikCommunityInfoEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
wrapper.eq(StringUtils.isNotBlank(communityName), "COMMUNITY_NAME", communityName);
return wrapper; return wrapper;
} }

2
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/service/impl/HikDeviceInfoServiceImpl.java

@ -50,9 +50,11 @@ public class HikDeviceInfoServiceImpl extends BaseServiceImpl<HikDeviceInfoDao,
private QueryWrapper<HikDeviceInfoEntity> getWrapper(Map<String, Object> params){ private QueryWrapper<HikDeviceInfoEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP); String id = (String)params.get(FieldConstant.ID_HUMP);
String communityId = (String)params.get("communityId");
QueryWrapper<HikDeviceInfoEntity> wrapper = new QueryWrapper<>(); QueryWrapper<HikDeviceInfoEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
wrapper.eq(StringUtils.isNotBlank(communityId), "COMMUNITY_ID", communityId);
return wrapper; return wrapper;
} }

9
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentContractInfoController.java

@ -63,6 +63,15 @@ public class RentContractInfoController {
return new Result(); return new Result();
} }
@NoRepeatSubmit
@PostMapping("send")
public Result send(@RequestBody RentContractInfoDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
rentContractInfoService.send(dto);
return new Result();
}
@NoRepeatSubmit @NoRepeatSubmit
@PostMapping("update") @PostMapping("update")
public Result update(@RequestBody RentContractInfoDTO dto) { public Result update(@RequestBody RentContractInfoDTO dto) {

10
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentContractInfoService.java

@ -67,6 +67,16 @@ public interface RentContractInfoService extends BaseService<RentContractInfoEnt
*/ */
void review(RentContractInfoDTO dto); void review(RentContractInfoDTO dto);
/**
* 下发
*
* @param dto
* @return void
* @author generator
* @date 2022-04-22
*/
void send(RentContractInfoDTO dto);
/** /**
* 默认更新 * 默认更新
* *

67
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentContractInfoServiceImpl.java

@ -20,9 +20,17 @@ import com.epmet.dto.form.IcHouseAddFormDTO;
import com.epmet.dto.form.RentTenantFormDTO; import com.epmet.dto.form.RentTenantFormDTO;
import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient; 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.RentContractFileDTO;
import com.epmet.plugin.power.dto.rent.RentContractInfoDTO; import com.epmet.plugin.power.dto.rent.RentContractInfoDTO;
import com.epmet.plugin.power.dto.rent.RentTenantInfoDTO; 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.dao.RentContractInfoDao;
import com.epmet.plugin.power.modules.rent.entity.RentContractFileEntity; import com.epmet.plugin.power.modules.rent.entity.RentContractFileEntity;
import com.epmet.plugin.power.modules.rent.entity.RentContractInfoEntity; 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.RentContractFileService;
import com.epmet.plugin.power.modules.rent.service.RentContractInfoService; import com.epmet.plugin.power.modules.rent.service.RentContractInfoService;
import com.epmet.plugin.power.modules.rent.service.RentTenantInfoService; 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.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -54,6 +63,9 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl<RentContractInf
@Autowired @Autowired
private LoginUserUtil loginUserUtil; private LoginUserUtil loginUserUtil;
@Autowired
private HkDeviceUtil hkDeviceUtil;
@Autowired @Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@ -66,6 +78,15 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl<RentContractInf
@Autowired @Autowired
private RentContractFileService rentContractFileService; private RentContractFileService rentContractFileService;
@Autowired
private HikErrorInfoService hikErrorInfoService;
@Autowired
private HikCommunityInfoService hikCommunityInfoService;
@Autowired
private HikDeviceInfoService hikDeviceInfoService;
@Override @Override
public PageData<RentContractInfoDTO> page(Map<String, Object> params) { public PageData<RentContractInfoDTO> page(Map<String, Object> params) {
params.put("customerId", loginUserUtil.getLoginUserCustomerId()); 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 @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(RentContractInfoDTO dto) { public void update(RentContractInfoDTO dto) {

Loading…
Cancel
Save