Commit 9d58b762 authored by huyuchen's avatar huyuchen

huych-户配置调整

parent dea4ef0d
...@@ -28,9 +28,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; ...@@ -28,9 +28,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.check.entity.TCheckMobile; import com.yifu.cloud.plus.v1.check.entity.TCheckMobile;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysArea;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser; import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AllUserNaVo; import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AllUserNaVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaMap; import com.yifu.cloud.plus.v1.yifu.admin.api.vo.AreaVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*; import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
...@@ -129,6 +130,16 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap ...@@ -129,6 +130,16 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap
if (Common.isEmpty(sysHouseHoldInfo.getAuditUser()) || Common.isEmpty(sysHouseHoldInfo.getHandleUser())) { if (Common.isEmpty(sysHouseHoldInfo.getAuditUser()) || Common.isEmpty(sysHouseHoldInfo.getHandleUser())) {
return R.failed("审核人或办理人必填!"); return R.failed("审核人或办理人必填!");
} }
//获取行政区化代码
if (CommonConstants.ZERO_STRING.equals(sysHouseHoldInfo.getType())) {
HashMap<String, SysArea> map = initAreaMap();
if (Common.isNotNull(map) && map.size() > 0) {
SysArea area = map.get(sysHouseHoldInfo.getCity());
if (Common.isNotNull(area)) {
sysHouseHoldInfo.setAreaCode(area.getAreaCode());
}
}
}
baseMapper.insert(sysHouseHoldInfo); baseMapper.insert(sysHouseHoldInfo);
//维护附件信息 //维护附件信息
if (Common.isNotNull(sysHouseHoldInfo.getAttaId())) { if (Common.isNotNull(sysHouseHoldInfo.getAttaId())) {
...@@ -225,6 +236,16 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap ...@@ -225,6 +236,16 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap
.ge(SysBaseSetInfo::getApplyEndDate,DateUtil.getCurrentDateTime()))) > CommonConstants.ZERO_INT){ .ge(SysBaseSetInfo::getApplyEndDate,DateUtil.getCurrentDateTime()))) > CommonConstants.ZERO_INT){
return R.failed("户下存在可用基数配置,请禁用可用基数配置后禁用户配置!"); return R.failed("户下存在可用基数配置,请禁用可用基数配置后禁用户配置!");
} }
//更新行政区划代码
if (CommonConstants.ZERO_STRING.equals(hold.getType()) && Common.isNotNull(hold.getCity())) {
HashMap<String, SysArea> map = initAreaMap();
if (Common.isNotNull(map) && map.size() > 0) {
SysArea area = map.get(hold.getCity());
if (Common.isNotNull(area)) {
hold.setAreaCode(area.getAreaCode());
}
}
}
int res = baseMapper.updateById(hold); int res = baseMapper.updateById(hold);
if (res >= 0){ if (res >= 0){
if (isEdit) { if (isEdit) {
...@@ -401,11 +422,8 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap ...@@ -401,11 +422,8 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap
return; return;
} }
//获取所有区域数据 //获取所有区域数据
Map<String,String> areaMap = new HashMap<>(); HashMap<String, SysArea> areaMap = initAreaMap();
R<AreaMap> areaListR = upmsDaprUtils.getAreaMapR(); if (Common.isEmpty(areaMap)) {
if (null != areaListR && !Common.isEmpty(areaListR.getData())) {
areaMap = areaListR.getData().getIdLabelMap();
} else {
errorMessageList.add(new ErrorMessage(1, "获取区域数据失败")); errorMessageList.add(new ErrorMessage(1, "获取区域数据失败"));
} }
//获取所有的人员信息 //获取所有的人员信息
...@@ -433,10 +451,10 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap ...@@ -433,10 +451,10 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap
excel.setOrganName(excel.getOrganName().trim()); excel.setOrganName(excel.getOrganName().trim());
SysHouseHoldInfo household = new SysHouseHoldInfo(); SysHouseHoldInfo household = new SysHouseHoldInfo();
BeanCopyUtils.copyProperties(excel,household); BeanCopyUtils.copyProperties(excel,household);
excel.setProvince(areaMap.get(excel.getProvince())); excel.setProvince(areaMap.get(excel.getProvince()).getAreaName());
excel.setCity(areaMap.get(excel.getCity())); excel.setCity(areaMap.get(excel.getCity()).getAreaName());
if (Common.isNotNull(excel.getTown())) { if (Common.isNotNull(excel.getTown())) {
excel.setTown(areaMap.get(excel.getTown())); excel.setTown(areaMap.get(excel.getTown()).getAreaName());
} }
//判断模板中是否有户重复的数据 //判断模板中是否有户重复的数据
if (null == exitNameMap.get(excel.getName())) { if (null == exitNameMap.get(excel.getName())) {
...@@ -490,6 +508,7 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap ...@@ -490,6 +508,7 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap
continue; continue;
} }
//封装和插入数据 //封装和插入数据
household.setAreaCode(areaMap.get(household.getCity()).getAreaCode());
household.setAutoStatus(excel.getAutoStatus().equals(CommonConstants.IS_TRUE) ? "0" : "1"); household.setAutoStatus(excel.getAutoStatus().equals(CommonConstants.IS_TRUE) ? "0" : "1");
household.setType("0"); household.setType("0");
household.setHouseType(excel.getHouseType().equals(HouseConfigConstants.HOUSE_TYPE_ONE) ? "0" : "1"); household.setHouseType(excel.getHouseType().equals(HouseConfigConstants.HOUSE_TYPE_ONE) ? "0" : "1");
...@@ -511,11 +530,8 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap ...@@ -511,11 +530,8 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap
return; return;
} }
//获取所有区域数据 //获取所有区域数据
Map<String,String> areaMap = new HashMap<>(); HashMap<String, SysArea> areaMap = initAreaMap();
R<AreaMap> areaListR = upmsDaprUtils.getAreaMapR(); if (Common.isEmpty(areaMap)) {
if (null != areaListR && !Common.isEmpty(areaListR.getData())) {
areaMap = areaListR.getData().getIdLabelMap();
} else {
errorMessageList.add(new ErrorMessage(1, "获取区域数据失败")); errorMessageList.add(new ErrorMessage(1, "获取区域数据失败"));
} }
//获取所有的人员信息 //获取所有的人员信息
...@@ -548,6 +564,7 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap ...@@ -548,6 +564,7 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap
if (Common.isNotNull(excel.getProvince()) && Common.isNotNull(excel.getCity())) { if (Common.isNotNull(excel.getProvince()) && Common.isNotNull(excel.getCity())) {
info.setProvince(excel.getProvince()); info.setProvince(excel.getProvince());
info.setCity(excel.getCity()); info.setCity(excel.getCity());
info.setAreaCode(areaMap.get(excel.getCity()).getAreaCode());
if (Common.isNotNull(excel.getTown())) { if (Common.isNotNull(excel.getTown())) {
info.setTown(excel.getTown()); info.setTown(excel.getTown());
} else { } else {
...@@ -555,13 +572,13 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap ...@@ -555,13 +572,13 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap
} }
} }
if (Common.isNotNull(excel.getProvince())) { if (Common.isNotNull(excel.getProvince())) {
excel.setProvince(areaMap.get(excel.getProvince())); excel.setProvince(areaMap.get(excel.getProvince()).getAreaName());
} }
if (Common.isNotNull(excel.getCity())) { if (Common.isNotNull(excel.getCity())) {
excel.setCity(areaMap.get(excel.getCity())); excel.setCity(areaMap.get(excel.getCity()).getAreaName());
} }
if (Common.isNotNull(excel.getTown())) { if (Common.isNotNull(excel.getTown())) {
excel.setTown(areaMap.get(excel.getTown())); excel.setTown(areaMap.get(excel.getTown()).getAreaName());
} }
if (Common.isEmpty(info)){ if (Common.isEmpty(info)){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), HouseConfigConstants.ERROR_NOT_EXIT,excel)); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), HouseConfigConstants.ERROR_NOT_EXIT,excel));
...@@ -696,4 +713,22 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap ...@@ -696,4 +713,22 @@ public class SysHouseHoldInfoServiceImpl extends ServiceImpl<SysHouseHoldInfoMap
} }
baseMapper.updateById(info); baseMapper.updateById(info);
} }
//获取所有区域数据
private HashMap<String,SysArea> initAreaMap() {
HashMap<String,SysArea> areaMap = new HashMap<>();
R<AreaVo> areaListR = upmsDaprUtils.getAreaListR();
if (null == areaListR || areaListR.getCode() != CommonConstants.SUCCESS) {
return new HashMap<>();
}
AreaVo areaList = areaListR.getData();
if (null != areaList && !areaList.getSysAreaList().isEmpty()) {
for (SysArea area : areaList.getSysAreaList()) {
areaMap.put(Integer.toString(area.getId()), area);
}
} else {
return new HashMap<>();
}
return areaMap;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment