创建房屋时,导入人口数据 --renpc
This commit is contained in:
parent
fd950b875f
commit
108b017969
@ -117,4 +117,12 @@ public interface IPopulationDao {
|
|||||||
*/
|
*/
|
||||||
Integer count(Map<String, Object> params) throws SearchException;
|
Integer count(Map<String, Object> params) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过房屋ID删除人员信息
|
||||||
|
*
|
||||||
|
* @param populationId
|
||||||
|
* @throws UpdateException
|
||||||
|
*/
|
||||||
|
void deleteById(String populationId) throws RemoveException;
|
||||||
|
|
||||||
}
|
}
|
@ -22,6 +22,7 @@ public class PopulationBO {
|
|||||||
private String modifier;
|
private String modifier;
|
||||||
private String gmtModified;
|
private String gmtModified;
|
||||||
private Integer isDelete;
|
private Integer isDelete;
|
||||||
|
private String outHouse;
|
||||||
|
|
||||||
public String getPopulationId() {
|
public String getPopulationId() {
|
||||||
return populationId == null ? "" : populationId.trim();
|
return populationId == null ? "" : populationId.trim();
|
||||||
@ -119,5 +120,11 @@ public class PopulationBO {
|
|||||||
this.isDelete = isDelete;
|
this.isDelete = isDelete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getOutHouse() {
|
||||||
|
return outHouse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOutHouse(String outHouse) {
|
||||||
|
this.outHouse = outHouse;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package com.cm.population.pojo.dtos.house;
|
package com.cm.population.pojo.dtos.house;
|
||||||
|
|
||||||
|
import com.cm.population.pojo.vos.population.PopulationVO;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @ClassName: HouseDTO
|
* @ClassName: HouseDTO
|
||||||
@ -124,6 +127,8 @@ public class HouseDTO {
|
|||||||
private String streetName;
|
private String streetName;
|
||||||
@ApiModelProperty(name = "houseType", value = "房屋类型")
|
@ApiModelProperty(name = "houseType", value = "房屋类型")
|
||||||
private String houseType;
|
private String houseType;
|
||||||
|
@ApiModelProperty(name = "populationVOList", value = "同住人信息")
|
||||||
|
private List<PopulationVO> populationVOList;
|
||||||
|
|
||||||
public String getHouseId() {
|
public String getHouseId() {
|
||||||
return houseId;
|
return houseId;
|
||||||
@ -564,4 +569,12 @@ public class HouseDTO {
|
|||||||
public void setHouseType(String houseType) {
|
public void setHouseType(String houseType) {
|
||||||
this.houseType = houseType;
|
this.houseType = houseType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<PopulationVO> getPopulationVOList() {
|
||||||
|
return populationVOList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPopulationVOList(List<PopulationVO> populationVOList) {
|
||||||
|
this.populationVOList = populationVOList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,8 @@ public class PopulationDTO {
|
|||||||
private String phone;
|
private String phone;
|
||||||
@ApiModelProperty(name = "bindTime", value = "绑定时间")
|
@ApiModelProperty(name = "bindTime", value = "绑定时间")
|
||||||
private String bindTime;
|
private String bindTime;
|
||||||
|
@ApiModelProperty(name = "outHouse", value = "离开状态")
|
||||||
|
private String outHouse;
|
||||||
@ApiModelProperty(name = "creator", value = "创建人")
|
@ApiModelProperty(name = "creator", value = "创建人")
|
||||||
private String creator;
|
private String creator;
|
||||||
@ApiModelProperty(name = "gmtCreate", value = "创建时间")
|
@ApiModelProperty(name = "gmtCreate", value = "创建时间")
|
||||||
@ -103,6 +105,14 @@ public class PopulationDTO {
|
|||||||
this.bindTime = bindTime;
|
this.bindTime = bindTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getOutHouse() {
|
||||||
|
return outHouse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOutHouse(String outHouse) {
|
||||||
|
this.outHouse = outHouse;
|
||||||
|
}
|
||||||
|
|
||||||
public String getCreator() {
|
public String getCreator() {
|
||||||
return creator == null ? "" : creator.trim();
|
return creator == null ? "" : creator.trim();
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ public class PopulationPO {
|
|||||||
private String modifier;
|
private String modifier;
|
||||||
private String gmtModified;
|
private String gmtModified;
|
||||||
private Integer isDelete;
|
private Integer isDelete;
|
||||||
|
private String outHouse;
|
||||||
|
|
||||||
public String getPopulationId() {
|
public String getPopulationId() {
|
||||||
return populationId == null ? "" : populationId.trim();
|
return populationId == null ? "" : populationId.trim();
|
||||||
@ -119,5 +120,11 @@ public class PopulationPO {
|
|||||||
this.isDelete = isDelete;
|
this.isDelete = isDelete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getOutHouse() {
|
||||||
|
return outHouse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOutHouse(String outHouse) {
|
||||||
|
this.outHouse = outHouse;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
package com.cm.population.pojo.vos.house;
|
package com.cm.population.pojo.vos.house;
|
||||||
|
|
||||||
import com.cm.common.annotation.CheckNumberAnnotation;
|
import com.cm.common.annotation.CheckNumberAnnotation;
|
||||||
|
import com.cm.population.pojo.vos.population.PopulationVO;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @ClassName: HouseVO
|
* @ClassName: HouseVO
|
||||||
@ -113,6 +116,8 @@ public class HouseVO {
|
|||||||
private String street;
|
private String street;
|
||||||
@ApiModelProperty(name = "streetName", value = "街道名称")
|
@ApiModelProperty(name = "streetName", value = "街道名称")
|
||||||
private String streetName;
|
private String streetName;
|
||||||
|
@ApiModelProperty(name = "populationVOList", value = "同住人信息")
|
||||||
|
private List<PopulationVO> populationVOList;
|
||||||
|
|
||||||
public String getCommunity() {
|
public String getCommunity() {
|
||||||
return community == null ? "" : community.trim();
|
return community == null ? "" : community.trim();
|
||||||
@ -481,4 +486,12 @@ public class HouseVO {
|
|||||||
public void setStreetName(String streetName) {
|
public void setStreetName(String streetName) {
|
||||||
this.streetName = streetName;
|
this.streetName = streetName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<PopulationVO> getPopulationVOList() {
|
||||||
|
return populationVOList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPopulationVOList(List<PopulationVO> populationVOList) {
|
||||||
|
this.populationVOList = populationVOList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,8 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
@ApiModel
|
@ApiModel
|
||||||
public class PopulationVO {
|
public class PopulationVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "populationId", value = "主键UUID")
|
||||||
|
private String populationId;
|
||||||
@ApiModelProperty(name = "houseId", value = "房屋ID")
|
@ApiModelProperty(name = "houseId", value = "房屋ID")
|
||||||
private String houseId;
|
private String houseId;
|
||||||
@ApiModelProperty(name = "populationInfoId", value = "人口信息ID")
|
@ApiModelProperty(name = "populationInfoId", value = "人口信息ID")
|
||||||
@ -26,6 +28,16 @@ public class PopulationVO {
|
|||||||
private String bindTime;
|
private String bindTime;
|
||||||
@ApiModelProperty(name = "phone", value = "联系方式")
|
@ApiModelProperty(name = "phone", value = "联系方式")
|
||||||
private String phone;
|
private String phone;
|
||||||
|
@ApiModelProperty(name = "outHouse", value = "离开状态")
|
||||||
|
private String outHouse;
|
||||||
|
|
||||||
|
public String getPopulationId() {
|
||||||
|
return populationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPopulationId(String populationId) {
|
||||||
|
this.populationId = populationId;
|
||||||
|
}
|
||||||
|
|
||||||
public String getHouseId() {
|
public String getHouseId() {
|
||||||
return houseId == null ? "" : houseId.trim();
|
return houseId == null ? "" : houseId.trim();
|
||||||
@ -74,4 +86,12 @@ public class PopulationVO {
|
|||||||
public void setPhone(String phone) {
|
public void setPhone(String phone) {
|
||||||
this.phone = phone;
|
this.phone = phone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getOutHouse() {
|
||||||
|
return outHouse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOutHouse(String outHouse) {
|
||||||
|
this.outHouse = outHouse;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import com.cm.common.result.SuccessResultList;
|
|||||||
import com.cm.common.utils.HashMapUtil;
|
import com.cm.common.utils.HashMapUtil;
|
||||||
import com.cm.common.utils.UUIDUtil;
|
import com.cm.common.utils.UUIDUtil;
|
||||||
import com.cm.population.dao.house.IHouseDao;
|
import com.cm.population.dao.house.IHouseDao;
|
||||||
|
import com.cm.population.dao.population.IPopulationDao;
|
||||||
import com.cm.population.pojo.bos.house.HouseBO;
|
import com.cm.population.pojo.bos.house.HouseBO;
|
||||||
import com.cm.population.pojo.dtos.building.BuildingDTO;
|
import com.cm.population.pojo.dtos.building.BuildingDTO;
|
||||||
import com.cm.population.pojo.dtos.house.AutoHouseDTO;
|
import com.cm.population.pojo.dtos.house.AutoHouseDTO;
|
||||||
@ -16,14 +17,17 @@ import com.cm.population.pojo.dtos.residential.ResidentialDTO;
|
|||||||
import com.cm.population.pojo.pos.house.HousePO;
|
import com.cm.population.pojo.pos.house.HousePO;
|
||||||
import com.cm.population.pojo.vos.building.BuildingBatchVO;
|
import com.cm.population.pojo.vos.building.BuildingBatchVO;
|
||||||
import com.cm.population.pojo.vos.house.HouseVO;
|
import com.cm.population.pojo.vos.house.HouseVO;
|
||||||
|
import com.cm.population.pojo.vos.population.PopulationVO;
|
||||||
import com.cm.population.service.building.IBuildingService;
|
import com.cm.population.service.building.IBuildingService;
|
||||||
import com.cm.population.service.house.IHouseService;
|
import com.cm.population.service.house.IHouseService;
|
||||||
|
import com.cm.population.service.population.IPopulationService;
|
||||||
import com.cm.population.service.residential.IResidentialService;
|
import com.cm.population.service.residential.IResidentialService;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
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;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -45,6 +49,10 @@ public class HouseServiceImpl extends AbstractService implements IHouseService {
|
|||||||
private IBuildingService buildingService;
|
private IBuildingService buildingService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IResidentialService residentialService;
|
private IResidentialService residentialService;
|
||||||
|
@Autowired
|
||||||
|
private IPopulationService populationService;
|
||||||
|
@Autowired
|
||||||
|
private IPopulationDao populationdao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save(HouseVO houseVO) {
|
public void save(HouseVO houseVO) {
|
||||||
@ -77,6 +85,14 @@ public class HouseServiceImpl extends AbstractService implements IHouseService {
|
|||||||
setSaveInfo(token, params);
|
setSaveInfo(token, params);
|
||||||
}
|
}
|
||||||
houseDao.save(params);
|
houseDao.save(params);
|
||||||
|
|
||||||
|
if(!CollectionUtils.isEmpty(houseVO.getPopulationVOList())) {
|
||||||
|
List<PopulationVO> populationVOList = houseVO.getPopulationVOList();
|
||||||
|
for (PopulationVO populationVO : populationVOList) {
|
||||||
|
populationVO.setHouseId(houseId);
|
||||||
|
populationService.saveReturnId(token, populationVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
return houseId;
|
return houseId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,6 +140,27 @@ public class HouseServiceImpl extends AbstractService implements IHouseService {
|
|||||||
setUpdateInfo(token, params);
|
setUpdateInfo(token, params);
|
||||||
}
|
}
|
||||||
houseDao.update(params);
|
houseDao.update(params);
|
||||||
|
|
||||||
|
// 1. 判断创建房屋时,是否有人员信息一起
|
||||||
|
// 2. 有的话,删除旧的人员信息,并录入新的人员信息
|
||||||
|
if(!CollectionUtils.isEmpty(houseVO.getPopulationVOList())) {
|
||||||
|
List<PopulationVO> populationVOList = houseVO.getPopulationVOList();
|
||||||
|
for (PopulationVO populationVO : populationVOList) {
|
||||||
|
if("1".equals(populationVO.getOutHouse())) {
|
||||||
|
populationService.update(populationVO.getPopulationId(), populationVO);
|
||||||
|
} else if(StringUtils.isEmpty(populationVO.getPopulationId())) {
|
||||||
|
populationService.save(token, populationVO);
|
||||||
|
}else {
|
||||||
|
populationdao.deleteById(populationVO.getPopulationId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
populationdao.deleteById(houseId);
|
||||||
|
for (PopulationVO populationVO : populationVOList) {
|
||||||
|
if(!"1".equals(populationVO.getOutHouse())) {
|
||||||
|
populationService.save(token, populationVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
<result column="card_num" property="cardNum"/>
|
<result column="card_num" property="cardNum"/>
|
||||||
<result column="bind_time" property="bindTime"/>
|
<result column="bind_time" property="bindTime"/>
|
||||||
<result column="phone" property="phone"/>
|
<result column="phone" property="phone"/>
|
||||||
|
<result column="out_house" property="outHouse"/>
|
||||||
<result column="creator" property="creator"/>
|
<result column="creator" property="creator"/>
|
||||||
<result column="gmt_create" property="gmtCreate"/>
|
<result column="gmt_create" property="gmtCreate"/>
|
||||||
<result column="modifier" property="modifier"/>
|
<result column="modifier" property="modifier"/>
|
||||||
@ -25,6 +26,7 @@
|
|||||||
<result column="card_num" property="cardNum"/>
|
<result column="card_num" property="cardNum"/>
|
||||||
<result column="bind_time" property="bindTime"/>
|
<result column="bind_time" property="bindTime"/>
|
||||||
<result column="phone" property="phone"/>
|
<result column="phone" property="phone"/>
|
||||||
|
<result column="out_house" property="outHouse"/>
|
||||||
<result column="creator" property="creator"/>
|
<result column="creator" property="creator"/>
|
||||||
<result column="gmt_create" property="gmtCreate"/>
|
<result column="gmt_create" property="gmtCreate"/>
|
||||||
<result column="modifier" property="modifier"/>
|
<result column="modifier" property="modifier"/>
|
||||||
@ -40,6 +42,7 @@
|
|||||||
<result column="card_num" property="cardNum"/>
|
<result column="card_num" property="cardNum"/>
|
||||||
<result column="bind_time" property="bindTime"/>
|
<result column="bind_time" property="bindTime"/>
|
||||||
<result column="phone" property="phone"/>
|
<result column="phone" property="phone"/>
|
||||||
|
<result column="out_house" property="outHouse"/>
|
||||||
<result column="creator" property="creator"/>
|
<result column="creator" property="creator"/>
|
||||||
<result column="gmt_create" property="gmtCreate"/>
|
<result column="gmt_create" property="gmtCreate"/>
|
||||||
<result column="modifier" property="modifier"/>
|
<result column="modifier" property="modifier"/>
|
||||||
@ -57,6 +60,7 @@
|
|||||||
card_num,
|
card_num,
|
||||||
phone,
|
phone,
|
||||||
bind_time,
|
bind_time,
|
||||||
|
out_house,
|
||||||
creator,
|
creator,
|
||||||
gmt_create,
|
gmt_create,
|
||||||
modifier,
|
modifier,
|
||||||
@ -70,6 +74,7 @@
|
|||||||
#{cardNum},
|
#{cardNum},
|
||||||
#{phone},
|
#{phone},
|
||||||
#{bindTime},
|
#{bindTime},
|
||||||
|
#{outHouse},
|
||||||
#{creator},
|
#{creator},
|
||||||
#{gmtCreate},
|
#{gmtCreate},
|
||||||
#{modifier},
|
#{modifier},
|
||||||
@ -104,6 +109,15 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<!-- 删除人房绑定(物理) -->
|
||||||
|
<update id="deleteById" parameterType="String">
|
||||||
|
DELETE FROM
|
||||||
|
house_population
|
||||||
|
WHERE
|
||||||
|
population_id = #{population_id}
|
||||||
|
AND out_house != 1
|
||||||
|
</update>
|
||||||
|
|
||||||
<!-- 修改人房绑定 -->
|
<!-- 修改人房绑定 -->
|
||||||
<update id="update" parameterType="map">
|
<update id="update" parameterType="map">
|
||||||
UPDATE
|
UPDATE
|
||||||
@ -126,6 +140,9 @@
|
|||||||
</if>
|
</if>
|
||||||
<if test="bindTime != null and bindTime != ''">
|
<if test="bindTime != null and bindTime != ''">
|
||||||
bind_time = #{bindTime},
|
bind_time = #{bindTime},
|
||||||
|
</if>
|
||||||
|
<if test="outHouse != null and outHouse != ''">
|
||||||
|
out_house = #{outHouse},
|
||||||
</if>
|
</if>
|
||||||
gmt_modified = #{gmtModified},
|
gmt_modified = #{gmtModified},
|
||||||
modifier = #{modifier},
|
modifier = #{modifier},
|
||||||
@ -143,6 +160,7 @@
|
|||||||
t1.card_num,
|
t1.card_num,
|
||||||
t1.phone,
|
t1.phone,
|
||||||
t1.bind_time,
|
t1.bind_time,
|
||||||
|
t1.out_house,
|
||||||
t1.population_id
|
t1.population_id
|
||||||
FROM
|
FROM
|
||||||
house_population t1
|
house_population t1
|
||||||
@ -164,6 +182,7 @@
|
|||||||
t1.card_num,
|
t1.card_num,
|
||||||
t1.phone,
|
t1.phone,
|
||||||
t1.bind_time,
|
t1.bind_time,
|
||||||
|
t1.out_house,
|
||||||
t1.creator,
|
t1.creator,
|
||||||
t1.gmt_create,
|
t1.gmt_create,
|
||||||
t1.modifier,
|
t1.modifier,
|
||||||
@ -189,6 +208,7 @@
|
|||||||
t1.card_num,
|
t1.card_num,
|
||||||
t1.phone,
|
t1.phone,
|
||||||
t1.bind_time,
|
t1.bind_time,
|
||||||
|
t1.out_house,
|
||||||
t1.creator,
|
t1.creator,
|
||||||
t1.gmt_create,
|
t1.gmt_create,
|
||||||
t1.modifier,
|
t1.modifier,
|
||||||
@ -214,6 +234,7 @@
|
|||||||
t1.card_num,
|
t1.card_num,
|
||||||
t1.phone,
|
t1.phone,
|
||||||
t1.bind_time,
|
t1.bind_time,
|
||||||
|
t1.out_house,
|
||||||
t1.creator,
|
t1.creator,
|
||||||
t1.gmt_create,
|
t1.gmt_create,
|
||||||
t1.modifier,
|
t1.modifier,
|
||||||
@ -240,6 +261,9 @@
|
|||||||
<if test="houseId != null and houseId != ''">
|
<if test="houseId != null and houseId != ''">
|
||||||
AND t1.house_id = #{houseId}
|
AND t1.house_id = #{houseId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="outHouse != null and outHouse != ''">
|
||||||
|
AND t1.out_house = #{outHouse}
|
||||||
|
</if>
|
||||||
<if test="startTime != null and startTime != ''">
|
<if test="startTime != null and startTime != ''">
|
||||||
AND
|
AND
|
||||||
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||||||
@ -267,6 +291,7 @@
|
|||||||
t1.card_num,
|
t1.card_num,
|
||||||
t1.phone,
|
t1.phone,
|
||||||
t1.bind_time,
|
t1.bind_time,
|
||||||
|
t1.out_house,
|
||||||
t1.creator,
|
t1.creator,
|
||||||
t1.gmt_create,
|
t1.gmt_create,
|
||||||
t1.modifier,
|
t1.modifier,
|
||||||
@ -309,6 +334,7 @@
|
|||||||
t1.card_num,
|
t1.card_num,
|
||||||
t1.phone,
|
t1.phone,
|
||||||
t1.bind_time,
|
t1.bind_time,
|
||||||
|
t1.out_house,
|
||||||
t1.creator,
|
t1.creator,
|
||||||
t1.gmt_create,
|
t1.gmt_create,
|
||||||
t1.modifier,
|
t1.modifier,
|
||||||
|
Loading…
Reference in New Issue
Block a user