|
|
@ -27,6 +27,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dao.IcSocietyOrgDao; |
|
|
|
import com.epmet.dto.CustomerStaffDTO; |
|
|
|
import com.epmet.dto.IcSocietyOrgDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.form.demand.ServiceQueryFormDTO; |
|
|
|
import com.epmet.dto.result.*; |
|
|
@ -179,20 +180,36 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl<IcSocietyOrgDao, Ic |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author sun |
|
|
|
* @Description 九小场所下组织列表导入 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public List<Integer> importExcel(String customerId, List<IcSocietyOrgExcel> list, String staffId, List<Integer> numList) throws ParseException { |
|
|
|
//1.数据校验 只允许导入当前组织下社会组织
|
|
|
|
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(customerId, staffId); |
|
|
|
//查询当前组织下的社会组织数据
|
|
|
|
List<IcSocietyOrgDTO> societyOrgList = baseDao.getByAgencyId(staffInfoCache.getAgencyId()); |
|
|
|
//1.数据校验 只允许导入当前组织下社会组织且是当前组织下不存在的社会组织
|
|
|
|
//组织名称不一样的数据舍弃
|
|
|
|
Iterator<IcSocietyOrgExcel> iterator = list.iterator(); |
|
|
|
while (iterator.hasNext()) { |
|
|
|
IcSocietyOrgExcel obj = iterator.next(); |
|
|
|
if (!obj.getAgencyName().trim().equals(staffInfoCache.getAgencyName())) { |
|
|
|
numList.add(obj.getRowNum()); |
|
|
|
log.warn(String.format("不是当前组织下可导入的数据,组织名称->%s,行号->%s", obj.getAgencyName(), obj.getRowNum())); |
|
|
|
iterator.remove(); |
|
|
|
continue; |
|
|
|
} |
|
|
|
societyOrgList.forEach(org -> { |
|
|
|
if (obj.getSocietyName().equals(org.getSocietyName())) { |
|
|
|
numList.add(obj.getRowNum()); |
|
|
|
log.warn(String.format("当前组织下的社会组织已存在,社会组织名称->%s,行号->%s", obj.getSocietyName(), obj.getRowNum())); |
|
|
|
iterator.remove(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
if(CollectionUtils.isEmpty(list)){ |
|
|
|
if (CollectionUtils.isEmpty(list)) { |
|
|
|
return numList; |
|
|
|
} |
|
|
|
|
|
|
@ -205,12 +222,21 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl<IcSocietyOrgDao, Ic |
|
|
|
if (!staffResult.success()) { |
|
|
|
throw new RenException("获取工作人员基础信息失败......"); |
|
|
|
} |
|
|
|
if (null == staffResult.getData()) { |
|
|
|
Iterator<IcSocietyOrgExcel> iter = list.iterator(); |
|
|
|
while (iter.hasNext()) { |
|
|
|
IcSocietyOrgExcel obj = iter.next(); |
|
|
|
numList.add(obj.getRowNum()); |
|
|
|
iterator.remove(); |
|
|
|
} |
|
|
|
return numList; |
|
|
|
} |
|
|
|
Map<String, String> map = staffResult.getData().stream().collect(Collectors.toMap(CustomerStaffDTO::getRealName, CustomerStaffDTO::getUserId)); |
|
|
|
|
|
|
|
//3.遍历封装有效数据
|
|
|
|
List<IcSocietyOrgEntity> houseEntityList = new ArrayList<>(); |
|
|
|
Iterator<IcSocietyOrgExcel> iterator1 = list.iterator(); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
while (iterator1.hasNext()) { |
|
|
|
IcSocietyOrgExcel icHouseExcel = iterator1.next(); |
|
|
|
IcSocietyOrgEntity entity = new IcSocietyOrgEntity(); |
|
|
@ -223,9 +249,10 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl<IcSocietyOrgDao, Ic |
|
|
|
entity.setMobile(icHouseExcel.getMobile()); |
|
|
|
entity.setServiceStartTime(sdf.parse(icHouseExcel.getServiceStartTime())); |
|
|
|
entity.setServiceEndTime(sdf.parse(icHouseExcel.getServiceEndTime())); |
|
|
|
entity.setAdminStaffId(map.containsKey(icHouseExcel.getAdminStaffName().trim())?map.get(icHouseExcel.getAdminStaffName().trim()):""); |
|
|
|
entity.setAdminStaffId(map.containsKey(icHouseExcel.getAdminStaffName().trim()) ? map.get(icHouseExcel.getAdminStaffName().trim()) : ""); |
|
|
|
if ("".equals(entity.getAdminStaffId())) { |
|
|
|
numList.add(icHouseExcel.getRowNum()); |
|
|
|
log.warn(String.format("绑定的管理员不存在,管理员名称->%s,行号->%s", icHouseExcel.getAdminStaffName(), icHouseExcel.getRowNum())); |
|
|
|
iterator1.remove(); |
|
|
|
continue; |
|
|
|
} |
|
|
|