房屋管理功能新增数据权限,批量导入功能修改。
This commit is contained in:
parent
58252cc5f5
commit
c4a650d4f0
@ -165,7 +165,9 @@ public class BuildingHouseController extends AbstractController {
|
|||||||
String fileName = URLEncoder.encode(excelName, "UTF-8");
|
String fileName = URLEncoder.encode(excelName, "UTF-8");
|
||||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||||
|
|
||||||
String [] headers = {"序号", "小区名称(必填)", "楼宇名称", "房屋编号(必填)", "房屋状态(必填)", "房主姓名(必填)", "房主身份证号(必填)", "房主联系方式(必填)", "住户身份证号(多个用逗号隔开)"};
|
String [] headers = {"序号", "小区名称(必填)", "楼宇名称", "房屋编号(必填)",
|
||||||
|
"房屋状态(必填)", "房主姓名(必填)", "房主身份证号(必填)",
|
||||||
|
"房主联系方式(必填)", "住户姓名(必填)", "身份证号(必填)", "联系方式(必填)", "与户主关系"};
|
||||||
List<List<String>> listHeader = new ArrayList<>();
|
List<List<String>> listHeader = new ArrayList<>();
|
||||||
for(String item : headers) {
|
for(String item : headers) {
|
||||||
List<String> title = new ArrayList<>();
|
List<String> title = new ArrayList<>();
|
||||||
@ -188,7 +190,10 @@ public class BuildingHouseController extends AbstractController {
|
|||||||
data.add(buildingHouseModel.getOwnerName());
|
data.add(buildingHouseModel.getOwnerName());
|
||||||
data.add(buildingHouseModel.getOwnerCard());
|
data.add(buildingHouseModel.getOwnerCard());
|
||||||
data.add(buildingHouseModel.getOwnerPhone());
|
data.add(buildingHouseModel.getOwnerPhone());
|
||||||
data.add(buildingHouseModel.getCardNumbers());
|
data.add(buildingHouseModel.getHouseholdName());
|
||||||
|
data.add(buildingHouseModel.getHouseholdCard());
|
||||||
|
data.add(buildingHouseModel.getHouseholdPhone());
|
||||||
|
data.add(buildingHouseModel.getRelationship());
|
||||||
data.add(dto.getErrMsg());
|
data.add(dto.getErrMsg());
|
||||||
listData.add(data);
|
listData.add(data);
|
||||||
}
|
}
|
||||||
|
@ -1,33 +1,23 @@
|
|||||||
package com.cm.population.controller.apis.buildinghouseuser;
|
package com.cm.population.controller.apis.buildinghouseuser;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.cm.common.annotation.CheckRequestBodyAnnotation;
|
import com.cm.common.annotation.CheckRequestBodyAnnotation;
|
||||||
import com.cm.common.base.AbstractController;
|
import com.cm.common.base.AbstractController;
|
||||||
import com.cm.common.constants.ISystemConstant;
|
import com.cm.common.constants.ISystemConstant;
|
||||||
import com.cm.common.plugin.oauth.token.ClientTokenManager;
|
|
||||||
import com.cm.common.plugin.pojo.bos.ClientTokenBO;
|
|
||||||
import com.cm.common.pojo.ListPage;
|
import com.cm.common.pojo.ListPage;
|
||||||
import com.cm.common.result.ErrorResult;
|
import com.cm.common.result.ErrorResult;
|
||||||
import com.cm.common.result.SuccessResult;
|
import com.cm.common.result.SuccessResult;
|
||||||
import com.cm.common.result.SuccessResultData;
|
import com.cm.common.result.SuccessResultData;
|
||||||
import com.cm.common.result.SuccessResultList;
|
import com.cm.common.result.SuccessResultList;
|
||||||
import com.cm.population.config.properties.ProjectProperties;
|
|
||||||
import com.cm.population.pojo.dtos.buildinghouseuser.BuildingHouseUserDTO;
|
import com.cm.population.pojo.dtos.buildinghouseuser.BuildingHouseUserDTO;
|
||||||
import com.cm.population.pojo.vos.buildinghouseuser.BuildingHouseUserVO;
|
import com.cm.population.pojo.vos.buildinghouseuser.BuildingHouseUserVO;
|
||||||
import com.cm.population.service.buildinghouseuser.IBuildingHouseUserService;
|
import com.cm.population.service.buildinghouseuser.IBuildingHouseUserService;
|
||||||
import com.cm.population.service.personmsg.IPersonMsgService;
|
import com.cm.population.service.personmsg.IPersonMsgService;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpMethod;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.client.RestTemplate;
|
|
||||||
import org.springframework.web.util.UriComponentsBuilder;
|
|
||||||
|
|
||||||
import javax.mail.search.SearchException;
|
import javax.mail.search.SearchException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -26,7 +26,13 @@ public class BuildingHouseModel {
|
|||||||
@ExcelProperty(index = 7)
|
@ExcelProperty(index = 7)
|
||||||
private String ownerPhone;
|
private String ownerPhone;
|
||||||
@ExcelProperty(index = 8)
|
@ExcelProperty(index = 8)
|
||||||
private String cardNumbers;
|
private String householdName;
|
||||||
|
@ExcelProperty(index = 9)
|
||||||
|
private String householdCard;
|
||||||
|
@ExcelProperty(index = 10)
|
||||||
|
private String householdPhone;
|
||||||
|
@ExcelProperty(index = 11)
|
||||||
|
private String relationship;
|
||||||
|
|
||||||
private String districtId;
|
private String districtId;
|
||||||
private String cityBuildingId;
|
private String cityBuildingId;
|
||||||
@ -95,12 +101,36 @@ public class BuildingHouseModel {
|
|||||||
this.ownerPhone = ownerPhone;
|
this.ownerPhone = ownerPhone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCardNumbers() {
|
public String getHouseholdName() {
|
||||||
return cardNumbers;
|
return householdName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCardNumbers(String cardNumbers) {
|
public void setHouseholdName(String householdName) {
|
||||||
this.cardNumbers = cardNumbers;
|
this.householdName = householdName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHouseholdCard() {
|
||||||
|
return householdCard;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHouseholdCard(String householdCard) {
|
||||||
|
this.householdCard = householdCard;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHouseholdPhone() {
|
||||||
|
return householdPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHouseholdPhone(String householdPhone) {
|
||||||
|
this.householdPhone = householdPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRelationship() {
|
||||||
|
return relationship;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRelationship(String relationship) {
|
||||||
|
this.relationship = relationship;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDistrictId() {
|
public String getDistrictId() {
|
||||||
|
@ -2,7 +2,10 @@ package com.cm.population.service.buildinghouseuser.impl;
|
|||||||
|
|
||||||
import com.cm.common.base.AbstractService;
|
import com.cm.common.base.AbstractService;
|
||||||
import com.cm.common.pojo.ListPage;
|
import com.cm.common.pojo.ListPage;
|
||||||
|
import com.cm.common.pojo.bos.UserInfoBO;
|
||||||
import com.cm.common.result.SuccessResultList;
|
import com.cm.common.result.SuccessResultList;
|
||||||
|
import com.cm.common.token.app.AppTokenManager;
|
||||||
|
import com.cm.common.token.app.entity.AppTokenUser;
|
||||||
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.buildinghouseuser.IBuildingHouseUserDao;
|
import com.cm.population.dao.buildinghouseuser.IBuildingHouseUserDao;
|
||||||
|
@ -3,6 +3,7 @@ package com.cm.population.service.handleimportexcelhouse.impl;
|
|||||||
import com.alibaba.excel.util.StringUtils;
|
import com.alibaba.excel.util.StringUtils;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.cm.common.base.AbstractService;
|
import com.cm.common.base.AbstractService;
|
||||||
|
import com.cm.common.exception.SaveException;
|
||||||
import com.cm.common.plugin.oauth.token.ClientTokenManager;
|
import com.cm.common.plugin.oauth.token.ClientTokenManager;
|
||||||
import com.cm.common.plugin.pojo.bos.ClientTokenBO;
|
import com.cm.common.plugin.pojo.bos.ClientTokenBO;
|
||||||
import com.cm.common.result.SuccessResultData;
|
import com.cm.common.result.SuccessResultData;
|
||||||
@ -77,17 +78,6 @@ public class HandleImportExcelHouseServiceImpl extends AbstractService implement
|
|||||||
BuildingHouseDTO buildinghouseDTO = buildingHouseDao.get(params);
|
BuildingHouseDTO buildinghouseDTO = buildingHouseDao.get(params);
|
||||||
params = new HashMap<>();
|
params = new HashMap<>();
|
||||||
if(null != buildinghouseDTO) {
|
if(null != buildinghouseDTO) {
|
||||||
/*params.put("cityBuildingId",buildingHouseModel.getCityBuildingId());
|
|
||||||
params.put("cityBuildingName",buildingHouseModel.getCityBuildingName());
|
|
||||||
params.put("houseNumber",buildingHouseModel.getHouseNumber());
|
|
||||||
params.put("districtName",buildingHouseModel.getDistrictName());
|
|
||||||
params.put("districtId",buildingHouseModel.getDistrictId());
|
|
||||||
params.put("houseStatus",buildingHouseModel.getHouseStatus());
|
|
||||||
params.put("dataType",3);
|
|
||||||
params.put("ownerName",buildingHouseModel.getOwnerName());
|
|
||||||
params.put("ownerCard",buildingHouseModel.getOwnerCard());
|
|
||||||
params.put("ownerPhone",buildingHouseModel.getOwnerPhone());
|
|
||||||
buildingHouseDao.update(params);*/
|
|
||||||
saveHouseUser(buildingHouseModel, buildinghouseDTO.getBuildingHouseId());
|
saveHouseUser(buildingHouseModel, buildinghouseDTO.getBuildingHouseId());
|
||||||
}else {
|
}else {
|
||||||
BuildingHouseVO buildingHouseVO = new BuildingHouseVO();
|
BuildingHouseVO buildingHouseVO = new BuildingHouseVO();
|
||||||
@ -109,6 +99,74 @@ public class HandleImportExcelHouseServiceImpl extends AbstractService implement
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void saveHouseUser(BuildingHouseModel buildingHouseModel, String buildingHouseId) throws Exception {
|
private void saveHouseUser(BuildingHouseModel buildingHouseModel, String buildingHouseId) throws Exception {
|
||||||
|
String ownerCard = buildingHouseModel.getOwnerCard();
|
||||||
|
String householdCard = buildingHouseModel.getHouseholdCard();
|
||||||
|
if(!StringUtils.isEmpty(ownerCard)) {
|
||||||
|
// 将所有的非英文半角逗号都转为英文半角
|
||||||
|
ownerCard = ownerCard.replaceAll("\\n", ",");
|
||||||
|
ownerCard = ownerCard.replaceAll("\\r", ",");
|
||||||
|
ownerCard = ownerCard.replaceAll(" ", ",");
|
||||||
|
ownerCard = ownerCard.replaceAll(",", ",");
|
||||||
|
|
||||||
|
ownerCard = ownerCard.replaceAll("[\\s]*[,][\\s]*[,]{1,}([\\s]+|[,]+)*", ",");
|
||||||
|
|
||||||
|
buildingHouseModel.setOwnerCard(ownerCard);
|
||||||
|
}
|
||||||
|
if(!StringUtils.isEmpty(householdCard)) {
|
||||||
|
// 将所有的非英文半角逗号都转为英文半角
|
||||||
|
householdCard = householdCard.replaceAll("\\n", ",");
|
||||||
|
householdCard = householdCard.replaceAll("\\r", ",");
|
||||||
|
householdCard = householdCard.replaceAll(" ", ",");
|
||||||
|
householdCard = householdCard.replaceAll(",", ",");
|
||||||
|
|
||||||
|
householdCard = householdCard.replaceAll("[\\s]*[,][\\s]*[,]{1,}([\\s]+|[,]+)*", ",");
|
||||||
|
|
||||||
|
buildingHouseModel.setHouseholdCard(householdCard);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("cardNumber", householdCard);
|
||||||
|
params.put("buildingHouseId", buildingHouseId);
|
||||||
|
SuccessResultData<Map<String, Object>> data = userMsg(householdCard);
|
||||||
|
Map<String, Object> userParam = data.getData();
|
||||||
|
if(null == userParam || userParam.isEmpty()) {
|
||||||
|
throw new SaveException("当前人员不存在于系统中");
|
||||||
|
}
|
||||||
|
BuildingHouseUserVO buildingHouseUserVO = new BuildingHouseUserVO();
|
||||||
|
buildingHouseUserVO.setBuildingHouseId(buildingHouseId);
|
||||||
|
buildingHouseUserVO.setCardNumber(householdCard);
|
||||||
|
buildingHouseUserVO.setName(userParam.get("name") == null ? buildingHouseModel.getHouseholdName() : userParam.get("name").toString());
|
||||||
|
buildingHouseUserVO.setSex(userParam.get("sex") == null ? "" : userParam.get("sex").toString());
|
||||||
|
buildingHouseUserVO.setPhone(userParam.get("phone") == null ? buildingHouseModel.getHouseholdPhone() : userParam.get("phone").toString());
|
||||||
|
buildingHouseUserVO.setRelationship(buildingHouseModel.getRelationship());
|
||||||
|
List<BuildingHouseUserDTO> buildingHouseUserDTOList = buildingHouseUserService.list(params);
|
||||||
|
BuildingHouseUserDTO updateDto = null;
|
||||||
|
Boolean userDo = false;
|
||||||
|
if(null != buildingHouseUserDTOList && buildingHouseUserDTOList.size() > 0) {
|
||||||
|
for(BuildingHouseUserDTO buildingHouseUserDTO: buildingHouseUserDTOList) {
|
||||||
|
if(buildingHouseUserDTO.getCardNumber().equals(householdCard) || buildingHouseUserDTO.getName().equals(userParam.get("name"))) {
|
||||||
|
userDo = true;
|
||||||
|
updateDto = buildingHouseUserDTO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(userDo) {
|
||||||
|
buildingHouseUserService.update(updateDto.getBuildingHouseUserId(), buildingHouseUserVO);
|
||||||
|
}else {
|
||||||
|
buildingHouseUserService.save(buildingHouseUserVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*String ownerName = buildingHouseModel.getOwnerName();
|
||||||
|
if(!StringUtils.isEmpty(ownerName)) {
|
||||||
|
saveUserMsg(buildingHouseId, buildingHouseModel);
|
||||||
|
}else {
|
||||||
|
if(!StringUtils.isEmpty(ownerCard)) {
|
||||||
|
saveUserMsg(buildingHouseId, buildingHouseModel);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/*private void saveHouseUser(BuildingHouseModel buildingHouseModel, String buildingHouseId) throws Exception {
|
||||||
String userIds = buildingHouseModel.getCardNumbers();
|
String userIds = buildingHouseModel.getCardNumbers();
|
||||||
if(!StringUtils.isEmpty(userIds)) {
|
if(!StringUtils.isEmpty(userIds)) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
@ -163,7 +221,7 @@ public class HandleImportExcelHouseServiceImpl extends AbstractService implement
|
|||||||
saveUserMsg(buildingHouseId, buildingHouseModel);
|
saveUserMsg(buildingHouseId, buildingHouseModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
private void saveUserMsg(String buildingHouseId, BuildingHouseModel buildingHouseModel) throws Exception {
|
private void saveUserMsg(String buildingHouseId, BuildingHouseModel buildingHouseModel) throws Exception {
|
||||||
String ownerName = buildingHouseModel.getOwnerName();
|
String ownerName = buildingHouseModel.getOwnerName();
|
||||||
@ -176,10 +234,11 @@ public class HandleImportExcelHouseServiceImpl extends AbstractService implement
|
|||||||
buildingHouseUserVO.setName(ownerName);
|
buildingHouseUserVO.setName(ownerName);
|
||||||
buildingHouseUserVO.setCardNumber(ownerCard);
|
buildingHouseUserVO.setCardNumber(ownerCard);
|
||||||
buildingHouseUserVO.setPhone(buildingHouseModel.getOwnerPhone());
|
buildingHouseUserVO.setPhone(buildingHouseModel.getOwnerPhone());
|
||||||
|
buildingHouseUserVO.setRelationship(buildingHouseModel.getRelationship());
|
||||||
List<BuildingHouseUserDTO> buildingHouseUserDTOList = buildingHouseUserService.list(params);
|
List<BuildingHouseUserDTO> buildingHouseUserDTOList = buildingHouseUserService.list(params);
|
||||||
BuildingHouseUserDTO updateDto = null;
|
BuildingHouseUserDTO updateDto = null;
|
||||||
Boolean userDo = false;
|
Boolean userDo = false;
|
||||||
if(null == buildingHouseUserDTOList) {
|
if(null != buildingHouseUserDTOList && buildingHouseUserDTOList.size() > 0) {
|
||||||
for(BuildingHouseUserDTO buildingHouseUserDTO: buildingHouseUserDTOList) {
|
for(BuildingHouseUserDTO buildingHouseUserDTO: buildingHouseUserDTOList) {
|
||||||
if(buildingHouseUserDTO.getCardNumber().equals(ownerCard) || buildingHouseUserDTO.getName().equals(ownerName)) {
|
if(buildingHouseUserDTO.getCardNumber().equals(ownerCard) || buildingHouseUserDTO.getName().equals(ownerName)) {
|
||||||
userDo = true;
|
userDo = true;
|
||||||
@ -198,23 +257,6 @@ public class HandleImportExcelHouseServiceImpl extends AbstractService implement
|
|||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("idCardNumber", idCard);
|
params.put("idCardNumber", idCard);
|
||||||
return new SuccessResultData<>(personMsgService.userMsg(params));
|
return new SuccessResultData<>(personMsgService.userMsg(params));
|
||||||
/*ClientTokenBO token = ClientTokenManager.getInstance().getClientToken();
|
|
||||||
RestTemplate restTemplate = new RestTemplate();
|
|
||||||
String url = projectProperties.getPopulationUrl();
|
|
||||||
url += "/resource/personMsg/userMsg/" + idCard;
|
|
||||||
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url)
|
|
||||||
.queryParam("access_token", token.getAccessToken());
|
|
||||||
ResponseEntity<String> responseEntity = restTemplate.exchange(builder.build().encode().toUri(), HttpMethod.GET, null, String.class);
|
|
||||||
String str = responseEntity.getBody();
|
|
||||||
if(org.springframework.util.StringUtils.isEmpty(str)) {
|
|
||||||
return new SuccessResultData<>(new HashMap<>());
|
|
||||||
}
|
|
||||||
JSONObject jsonObject = null;
|
|
||||||
jsonObject = JSONObject.parseObject(str).getJSONObject("data");
|
|
||||||
if(null == jsonObject || jsonObject.size() <= 0) {
|
|
||||||
return new SuccessResultData<>(new HashMap<>());
|
|
||||||
}
|
|
||||||
return new SuccessResultData<>(jsonObject);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -248,6 +248,9 @@
|
|||||||
<if test="cityBuildingId != null and cityBuildingId != ''">
|
<if test="cityBuildingId != null and cityBuildingId != ''">
|
||||||
AND t1.city_building_id = #{cityBuildingId}
|
AND t1.city_building_id = #{cityBuildingId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="userId != null and userId != ''">
|
||||||
|
AND t1.gmt_create = #{userId}
|
||||||
|
</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}
|
||||||
@ -263,6 +266,7 @@
|
|||||||
#{buildingHouseIds[${index}]}
|
#{buildingHouseIds[${index}]}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
ORDER BY t1.id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 房屋管理表统计 -->
|
<!-- 房屋管理表统计 -->
|
||||||
|
Loading…
Reference in New Issue
Block a user