|
|
@ -6,7 +6,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.security.user.LoginUserUtil; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dto.IcHouseDTO; |
|
|
|
import com.epmet.dto.result.HouseInfoDTO; |
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
import com.epmet.plugin.power.dto.axis.PowerKernelHouseholdDTO; |
|
|
|
import com.epmet.plugin.power.dto.axis.form.PowerKernelHouseFormDTO; |
|
|
|
import com.epmet.plugin.power.dto.axis.form.PowerKernelHouseHoldViewListFormDTO; |
|
|
@ -17,14 +22,14 @@ import com.epmet.plugin.power.modules.axis.dao.PowerKernelHouseholdDao; |
|
|
|
import com.epmet.plugin.power.modules.axis.entity.PowerKernelHouseholdEntity; |
|
|
|
import com.epmet.plugin.power.modules.axis.redis.PowerKernelHouseholdRedis; |
|
|
|
import com.epmet.plugin.power.modules.axis.service.PowerKernelHouseholdService; |
|
|
|
import org.apache.commons.compress.utils.Lists; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
/** |
|
|
|
* 动力主轴党员中心户 |
|
|
@ -38,6 +43,15 @@ public class PowerKernelHouseholdServiceImpl extends BaseServiceImpl<PowerKernel |
|
|
|
@Autowired |
|
|
|
private PowerKernelHouseholdRedis powerKernelHouseholdRedis; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private LoginUserUtil loginUserUtil; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private PowerKernelHouseholdService powerKernelHouseholdService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<PowerKernelHouseholdDTO> page(Map<String, Object> params) { |
|
|
|
IPage<PowerKernelHouseholdEntity> page = baseDao.selectPage( |
|
|
@ -100,25 +114,70 @@ public class PowerKernelHouseholdServiceImpl extends BaseServiceImpl<PowerKernel |
|
|
|
@Override |
|
|
|
public List<PowerKernelHouseHoldViewListResultDTO> getList(PowerKernelHouseHoldViewListFormDTO form) { |
|
|
|
form.setPageNo((form.getPageNo() - 1) * form.getPageSize()); |
|
|
|
form.setCustomerId(loginUserUtil.getLoginUserCustomerId()); |
|
|
|
List<PowerKernelHouseHoldViewListResultDTO> dto = baseDao.getList(form); |
|
|
|
return dto; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public long getTotal(PowerKernelHouseHoldViewListFormDTO form) { |
|
|
|
form.setCustomerId(loginUserUtil.getLoginUserCustomerId()); |
|
|
|
return baseDao.getTotal(form); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<PowerKernelListPostitionResultDTO> getListPosition(PowerKernelListPostitionFormDTO form) { |
|
|
|
form.setCustomerId(loginUserUtil.getLoginUserCustomerId()); |
|
|
|
List<PowerKernelListPostitionResultDTO> dto = baseDao.getListPosition(form); |
|
|
|
return dto; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public long getListTotal(PowerKernelListPostitionFormDTO form) { |
|
|
|
form.setCustomerId(loginUserUtil.getLoginUserCustomerId()); |
|
|
|
return baseDao.getListTotal(form); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void bind(PowerKernelHouseFormDTO form) { |
|
|
|
String customerId = loginUserUtil.getLoginUserCustomerId(); |
|
|
|
Set<String> houseIds = new HashSet<>(); |
|
|
|
Collections.addAll(houseIds,form.getHouseIdList()); |
|
|
|
Result<List<HouseInfoDTO>> listResult = govOrgOpenFeignClient.queryListHouseInfo(houseIds, customerId); |
|
|
|
if(!listResult.success()){ |
|
|
|
return ; |
|
|
|
} |
|
|
|
List<HouseInfoDTO> houseList = listResult.getData(); |
|
|
|
List<PowerKernelHouseholdEntity> list = Lists.newArrayList(); |
|
|
|
PowerKernelHouseholdEntity entity; |
|
|
|
|
|
|
|
for(HouseInfoDTO houseInfo : houseList){ |
|
|
|
Result<IcHouseDTO> icHouseDTOResult = govOrgOpenFeignClient.get(houseInfo.getHomeId()); |
|
|
|
if(!icHouseDTOResult.success()){ |
|
|
|
continue ; |
|
|
|
} |
|
|
|
IcHouseDTO houseDto = icHouseDTOResult.getData(); |
|
|
|
entity = new PowerKernelHouseholdEntity(); |
|
|
|
entity.setHouseId(houseInfo.getHomeId()); |
|
|
|
|
|
|
|
if(!org.springframework.util.StringUtils.isEmpty(houseInfo.getBuildingLatitude()) && !org.springframework.util.StringUtils.isEmpty(houseInfo.getBuildingLongitude())){ |
|
|
|
entity.setLatitude(new BigDecimal(houseInfo.getBuildingLatitude())); |
|
|
|
entity.setLongitude(new BigDecimal(houseInfo.getBuildingLongitude())); |
|
|
|
} else { |
|
|
|
entity.setLatitude(BigDecimal.ZERO); |
|
|
|
entity.setLongitude(BigDecimal.ZERO); |
|
|
|
} |
|
|
|
entity.setAddress(houseInfo.getAllName()); |
|
|
|
entity.setCustomerId(loginUserUtil.getLoginUserCustomerId()); |
|
|
|
|
|
|
|
entity.setOwnerPhone(houseDto.getOwnerPhone()); |
|
|
|
entity.setOwnerIdCard(houseDto.getOwnerIdCard()); |
|
|
|
entity.setOwnerName(houseDto.getOwnerName()); |
|
|
|
|
|
|
|
entity.setStructReferenceId(form.getAxisStructId()); |
|
|
|
powerKernelHouseholdService.insert(entity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |