Browse Source

修改绑定党员中心户接口

dev_power_axis
YUJT 3 years ago
parent
commit
77bd26a838
  1. 5
      epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/PowerAxisLeaderDTO.java
  2. 23
      epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelHouseFormDTO.java
  3. 18
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerKernelHouseholdDao.java
  4. 2
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisLeaderServiceImpl.java
  5. 38
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerKernelHouseholdServiceImpl.java
  6. 13
      epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerKernelHouseholdDao.xml

5
epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/PowerAxisLeaderDTO.java

@ -4,6 +4,8 @@ import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 动力主轴领导人
@ -29,16 +31,19 @@ public class PowerAxisLeaderDTO implements Serializable {
/**
* 姓名
*/
@NotBlank(message = "姓名不能为空")
private String name;
/**
* 关联动力主轴ID
*/
@NotBlank(message = "绑定动力主轴不能为空")
private String structReferenceId;
/**
* 性别 1男2女0未知
*/
@NotBlank(message = "性别不能为空")
private String gender;
/**

23
epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelHouseFormDTO.java

@ -2,8 +2,27 @@ package com.epmet.plugin.power.dto.axis.form;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 绑定党员中心户房屋
*
* @author work@yujt.net.cn
* @date 2022/4/25/0025 16:48
*/
@Data
public class PowerKernelHouseFormDTO {
public class PowerKernelHouseFormDTO implements Serializable {
private static final long serialVersionUID = -3319310604730621237L;
/**
* 动力主轴节点ID
*/
private String axisStructId;
private String[] houseIdList;
/**
* 要绑定的房屋ID集合
*/
private List<String> houseIdList;
}

18
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerKernelHouseholdDao.java

@ -1,7 +1,6 @@
package com.epmet.plugin.power.modules.axis.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.plugin.power.dto.axis.form.PowerKernelHouseFormDTO;
import com.epmet.plugin.power.dto.axis.form.PowerKernelHouseHoldViewListFormDTO;
@ -28,12 +27,23 @@ public interface PowerKernelHouseholdDao extends BaseDao<PowerKernelHouseholdEnt
long getTotal(PowerKernelHouseHoldViewListFormDTO form);
List<PowerKernelListPostitionResultDTO> getListPosition(PowerKernelListPostitionFormDTO form,List<String> axisStructIds);
List<PowerKernelListPostitionResultDTO> getListPosition(PowerKernelListPostitionFormDTO form, List<String> axisStructIds);
long getListTotal(PowerKernelListPostitionFormDTO form);
List<String> queryHouseIdList(String[] houseIdList, String customerId,String axisStructId);
/**
* 根据节点ID查询已绑定的房屋ID
*
* @param houseIdList 需要绑定的房屋ID
* @param customerId 客户ID
* @param axisStructId 动力主轴节点
* @return java.util.List<java.lang.String>
* @author work@yujt.net.cn
* @date 2022/4/25/0025 16:49
*/
List<String> queryHouseIdList(@Param("houseIdList") List<String> houseIdList,
@Param("customerId") String customerId,
@Param("axisStructId") String axisStructId);
List<String> queryIds(String customerId, String axisStructId);

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

@ -1,6 +1,5 @@
package com.epmet.plugin.power.modules.axis.service.impl;
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.epmet.commons.mybatis.service.impl.BaseServiceImpl;
@ -15,7 +14,6 @@ import com.epmet.plugin.power.dto.axis.result.PowerAxisSimpleListDTO;
import com.epmet.plugin.power.modules.axis.dao.PowerAxisLeaderDao;
import com.epmet.plugin.power.modules.axis.dao.PowerAxisStructLeaderDao;
import com.epmet.plugin.power.modules.axis.entity.PowerAxisLeaderEntity;
import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructEntity;
import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructLeaderEntity;
import com.epmet.plugin.power.modules.axis.service.PowerAxisLeaderService;
import org.apache.commons.lang3.StringUtils;

38
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerKernelHouseholdServiceImpl.java

@ -1,5 +1,6 @@
package com.epmet.plugin.power.modules.axis.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -27,6 +28,7 @@ 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.PowerAxisTagService;
import com.epmet.plugin.power.modules.axis.service.PowerKernelHouseholdService;
import com.google.common.collect.Sets;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -135,7 +137,7 @@ public class PowerKernelHouseholdServiceImpl extends BaseServiceImpl<PowerKernel
@Override
public List<PowerKernelListPostitionResultDTO> getListPosition(PowerKernelListPostitionFormDTO form) {
return baseDao.queryListPosition(form.getAxisStructId(),form.getCustomerId(),form.getLimit());
return baseDao.queryListPosition(form.getAxisStructId(), form.getCustomerId(), form.getLimit());
}
@ -148,29 +150,35 @@ public class PowerKernelHouseholdServiceImpl extends BaseServiceImpl<PowerKernel
@Override
public void bind(PowerKernelHouseFormDTO form) {
String customerId = loginUserUtil.getLoginUserCustomerId();
// 查询出重复的houseId
List<String> idList = baseDao.queryHouseIdList(form.getHouseIdList(), form.getAxisStructId(), customerId);
// 将idList转换为Set集合进行去重
Set<String> setIdList = new HashSet<>();
for (String id : idList) {
setIdList.add(id);
// 需要绑定的房屋ID集合
List<String> houseIdList = form.getHouseIdList();
// 查询已绑定的houseId集合
List<String> existHouseIdList = baseDao.queryHouseIdList(houseIdList, form.getAxisStructId(), customerId);
// 倒序,取差集
for (int i = houseIdList.size() - 1; i >= 0; i--) {
for (String existHouseId : existHouseIdList) {
if (existHouseId.equals(houseIdList.get(i))) {
houseIdList.remove(i);
}
}
}
// 将前端发送的houseId放入Set集合
Set<String> houseIds = new HashSet<>();
Collections.addAll(houseIds, form.getHouseIdList());
// 去重
houseIds.removeAll(setIdList);
Result<List<HouseInfoDTO>> listResult = govOrgOpenFeignClient.queryListHouseInfo(houseIds, customerId);
if (CollUtil.isEmpty(houseIdList)) {
return;
}
// 查询房屋信息
Result<List<HouseInfoDTO>> listResult = govOrgOpenFeignClient.queryListHouseInfo(Sets.newHashSet(houseIdList), customerId);
if (!listResult.success()) {
return;
}
List<HouseInfoDTO> houseList = listResult.getData();
PowerKernelHouseholdEntity entity;
Result<IcHouseDTO> icHouseDTOResult;
for (HouseInfoDTO houseInfo : houseList) {
Result<IcHouseDTO> icHouseDTOResult = govOrgOpenFeignClient.get(houseInfo.getHomeId());
// 查询房屋与房主信息
icHouseDTOResult = govOrgOpenFeignClient.get(houseInfo.getHomeId());
if (!icHouseDTOResult.success()) {
continue;
}

13
epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerKernelHouseholdDao.xml

@ -94,16 +94,17 @@
FROM
pli_power_kernel_household
<where>
house_id in
<foreach collection="houseIdList" item="houseId" open="(" close=")" separator=",">
#{houseId}
</foreach>
del_flag = '0'
<if test="houseIdList != null and houseIdList.size() > 0">
and house_id in
<foreach collection="houseIdList" item="houseId" open="(" close=")" separator=",">
#{houseId}
</foreach>
</if>
AND
STRUCT_REFERENCE_ID = #{axisStructId}
AND
customer_id = #{customerId}
AND
del_flag = '0'
</where>
</select>
<select id="queryIds" resultType="java.lang.String">

Loading…
Cancel
Save