From e55127388abe16a13eafa2a22562742d209e2396 Mon Sep 17 00:00:00 2001
From: infrasys00 <blackdancers@163.com>
Date: 星期四, 25 二月 2021 11:27:42 +0800
Subject: [PATCH] Merge branch 'master' of http://gitlab.nhys.cdnhxx.com/root/zhihuishequ
---
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/SysUserInputServiceImpl.java | 180 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 170 insertions(+), 10 deletions(-)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/SysUserInputServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/SysUserInputServiceImpl.java
index a35c520..74edfb1 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/SysUserInputServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/SysUserInputServiceImpl.java
@@ -1,11 +1,171 @@
-package com.panzhihua.service_user.service.impl;/**
-* @program: springcloud_k8s_panzhihuazhihuishequ
-*
-* @description: 居民导入
-*
-* @author: huang.hongfa weixin hhf9596 qq 959656820
-*
-* @create: 2021-02-05 17:42
-**/
-public class SysUserInputServiceImpl {
+package com.panzhihua.service_user.service.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.panzhihua.common.exceptions.ServiceException;
+import com.panzhihua.common.model.dtos.user.EexcelUserDTO;
+import com.panzhihua.common.model.vos.R;
+import com.panzhihua.common.model.vos.community.ComMngStructAreaVO;
+import com.panzhihua.common.model.vos.community.ComMngStructHouseVO;
+import com.panzhihua.common.model.vos.community.ComMngVolunteerMngVO;
+import com.panzhihua.common.model.vos.user.ComMngFamilyInfoVO;
+import com.panzhihua.common.model.vos.user.CommunityUserInfoVO;
+import com.panzhihua.common.utlis.IdCard;
+import com.panzhihua.service_user.dao.SysUserInputDAO;
+import com.panzhihua.service_user.model.dos.ComMngFamilyInfoDO;
+import com.panzhihua.service_user.model.dos.SysUserDO;
+import com.panzhihua.service_user.model.dos.SysUserInputDO;
+import com.panzhihua.service_user.service.SysUserInputService;
+import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.data.redis.core.ValueOperations;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @program: springcloud_k8s_panzhihuazhihuishequ
+ * @description: 居民导入
+ * @author: huang.hongfa weixin hhf9596 qq 959656820
+ * @create: 2021-02-05 17:42
+ **/
+@Service
+public class SysUserInputServiceImpl extends ServiceImpl<SysUserInputDAO, SysUserInputDO> implements SysUserInputService {
+ @Resource
+ private SysUserInputDAO sysUserInputDAO;
+ @Resource
+ private StringRedisTemplate stringRedisTemplate;
+ /**
+ * 批量导入居民用户
+ * @param list 居民用户集合
+ * @param areaName 小区名字
+ * @return 导入结果
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public R batchSaveUser(List<EexcelUserDTO> list, StringBuffer areaName) {
+ List<SysUserInputDO> sysUserInputDOS=new ArrayList<>();
+ if (!ObjectUtils.isEmpty(list)) {
+ ComMngStructAreaVO comMngStructAreaVO=sysUserInputDAO.selectByAreaName(areaName.toString());
+// 查询该小区所有房屋信息用来进行匹配房屋编码
+ String key="house_"+areaName;
+ Boolean aBoolean = stringRedisTemplate.hasKey(key);
+ ValueOperations<String, String> stringStringValueOperations = stringRedisTemplate.opsForValue();
+ List<ComMngStructHouseVO> comMngStructHouseVOS=new ArrayList<>();
+ if (aBoolean) {
+ String value = stringStringValueOperations.get(key);
+ comMngStructHouseVOS= JSONArray.parseArray(value,ComMngStructHouseVO.class);
+ }else{
+ comMngStructHouseVOS=sysUserInputDAO.selectHouserByareaName(areaName.toString());
+ }
+ List<ComMngStructHouseVO> comMngStructHouseVOS1=comMngStructHouseVOS;
+ list.forEach(eexcelUserDTO -> {
+ SysUserInputDO sysUserInputDO=new SysUserInputDO();
+ String doorNumber = eexcelUserDTO.getDoorNumber();
+ List<ComMngStructHouseVO> collect = comMngStructHouseVOS1.stream().filter(comMngStructHouseVO -> comMngStructHouseVO.getHouseName().equals(doorNumber)).collect(Collectors.toList());
+ if (ObjectUtils.isEmpty(collect)) {
+ throw new ServiceException("门牌号后台不存在或格式错误,错误门牌号为"+doorNumber);
+ }else{
+ sysUserInputDO.setHouseCode(collect.get(0).getHouseCode());
+ }
+ sysUserInputDO.setAreaId(comMngStructAreaVO.getId());
+ sysUserInputDO.setCommunityId(comMngStructAreaVO.getCommunityId());
+ sysUserInputDO.setCompany(eexcelUserDTO.getCompany());
+ sysUserInputDO.setDoorNumber(doorNumber);
+ sysUserInputDO.setEducation(eexcelUserDTO.getEducation());
+ sysUserInputDO.setIdCard(eexcelUserDTO.getIdCard());
+ sysUserInputDO.setIsContact(eexcelUserDTO.getIsContact().equals("是")?1:0);
+ sysUserInputDO.setIsPanzhihua(eexcelUserDTO.getIsPanZhiHua().equals("是")?1:0);
+ sysUserInputDO.setIsRent(eexcelUserDTO.getIsRent().equals("是")?1:0);
+ sysUserInputDO.setKeyPersonnel(eexcelUserDTO.getKeyPersonnel().equals("是")?1:0);
+ sysUserInputDO.setLowincomeHouseholds(eexcelUserDTO.getLowIncomeHouseholds().equals("是")?1:0);
+ sysUserInputDO.setLowincomePeople(eexcelUserDTO.getLowIncomePeople().equals("是")?1:0);
+ sysUserInputDO.setMajor(eexcelUserDTO.getMajor().equals("是")?1:0);
+ sysUserInputDO.setMaritalStatus(eexcelUserDTO.getMaritalStatus().equals("是")?1:0);
+ sysUserInputDO.setName(eexcelUserDTO.getName());
+ sysUserInputDO.setNation(eexcelUserDTO.getNation());
+ sysUserInputDO.setOldPeople(eexcelUserDTO.getOldPeople().equals("是")?1:0);
+ sysUserInputDO.setDisability(eexcelUserDTO.getDisability().equals("是")?1:0);
+ sysUserInputDO.setPhone(eexcelUserDTO.getPhone());
+ String politicalOutlook = eexcelUserDTO.getPoliticalOutlook();
+ sysUserInputDO.setPoliticalOutlook(politicalOutlook.equals("党员")?1:politicalOutlook.equals("团员")?2:3);
+ sysUserInputDO.setResidence(eexcelUserDTO.getResidence());
+ sysUserInputDO.setSituation(eexcelUserDTO.getSituation());
+ sysUserInputDO.setSoldier(eexcelUserDTO.getSoldier().equals("是")?1:0);
+ sysUserInputDO.setSpecialServiceFamily(eexcelUserDTO.getSpecialServiceFamily().equals("是")?1:0);
+
+ sysUserInputDOS.add(sysUserInputDO);
+ });
+ this.saveBatch(sysUserInputDOS);
+ }
+ return R.ok();
+ }
+
+ /**
+ * 社区人员详情包括导入人员
+ *
+ * @param userId 人员id
+ * @return CommunityUserInfoVO
+ */
+ @Override
+ public CommunityUserInfoVO detailUserComunity(Long userId) {
+ CommunityUserInfoVO communityUserInfoVO=new CommunityUserInfoVO();
+ userId=userId-100000000l;
+ SysUserInputDO sysUserInputDO = sysUserInputDAO.selectById(userId);
+ if (!org.springframework.util.ObjectUtils.isEmpty(sysUserInputDO)) {
+ BeanUtils.copyProperties(sysUserInputDO,communityUserInfoVO);
+ String idCard = sysUserInputDO.getIdCard();
+ if (!org.springframework.util.ObjectUtils.isEmpty(idCard)) {
+ communityUserInfoVO.setAge(IdCard.IdNOToAge(idCard));
+ communityUserInfoVO.setBirthday(IdCard.birthDay(idCard));
+ communityUserInfoVO.setIdCard(idCard);
+ communityUserInfoVO.setSex(IdCard.sex(idCard));
+ }
+ String phone = sysUserInputDO.getPhone();
+ communityUserInfoVO.setPhone(phone);
+ Integer keyPersonnel = sysUserInputDO.getKeyPersonnel();
+ Integer specialServiceFamily = sysUserInputDO.getSpecialServiceFamily();
+ Integer soldier = sysUserInputDO.getSoldier();
+ Integer lowincomeHouseholds = sysUserInputDO.getLowincomeHouseholds();
+ Integer lowincomePeople = sysUserInputDO.getLowincomePeople();
+ Integer oldPeople = sysUserInputDO.getOldPeople();
+ Integer disability = sysUserInputDO.getDisability();
+
+ StringBuilder stringBuilder=new StringBuilder("");
+ if (keyPersonnel.intValue()==1) {
+ stringBuilder.append("重点人员,");
+ }
+ if (specialServiceFamily.intValue()==1) {
+ stringBuilder.append("特服家庭,");
+ }
+ if (soldier.intValue()==1) {
+ stringBuilder.append("军人,");
+ }
+ if (lowincomeHouseholds.intValue()==1) {
+ stringBuilder.append("低保户,");
+ }
+ if (lowincomePeople.intValue()==1) {
+ stringBuilder.append("低收入人员,");
+ }
+ if (oldPeople.intValue()==1) {
+ stringBuilder.append("高龄老人,");
+ }
+ if (disability.intValue()==1) {
+ stringBuilder.append("残疾人,");
+ }
+ communityUserInfoVO.setTags(stringBuilder.toString());
+ communityUserInfoVO.setUserId(userId);
+ communityUserInfoVO.setIsVolunteer(0);
+ String doorNumber = sysUserInputDO.getDoorNumber();
+ List<ComMngFamilyInfoVO> comMngFamilyInfoVOS = sysUserInputDAO.selectListFamily(doorNumber,userId);
+ communityUserInfoVO.setComMngFamilyInfoVOS(comMngFamilyInfoVOS);
+ }
+ return communityUserInfoVO;
+ }
}
--
Gitblit v1.7.1