Browse Source

社会组织导入初版

dev_shibei_match
sunyuchao 4 years ago
parent
commit
73d4f5f0ac
  1. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcSocietyOrgController.java
  2. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcSocietyOrgService.java
  3. 66
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java
  4. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlaceOrgResultDTO.java
  5. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlacePatrolRecordResultDTO.java
  6. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlacePatrolReviewRecordResultDTO.java
  7. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlacePatrolTeamResultDTO.java
  8. 3
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PlacePatrolTeamDetailResultDTO.java
  9. 26
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GetByRealNamesFormDTO.java
  10. 7
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  11. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  12. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
  13. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
  14. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
  15. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  16. 26
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

3
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcSocietyOrgController.java

@ -43,6 +43,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -141,7 +142,7 @@ public class IcSocietyOrgController {
* @Description 九小场所下组织列表导入---咱不能使用 程序未开发
**/
@PostMapping("import")
public Result importExcel(@LoginUser TokenDto tokenDTO, @RequestParam("file") MultipartFile file) throws IOException {
public Result importExcel(@LoginUser TokenDto tokenDTO, @RequestParam("file") MultipartFile file) throws IOException, ParseException {
ExcelImportResult<IcSocietyOrgExcel> importResult = ExcelPoiUtils.importExcelMore(file, 0, 1, IcSocietyOrgExcel.class);
List<IcSocietyOrgExcel> failList = importResult.getFailList();

3
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcSocietyOrgService.java

@ -27,6 +27,7 @@ import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.entity.IcSocietyOrgEntity;
import com.epmet.excel.IcSocietyOrgExcel;
import java.text.ParseException;
import java.util.List;
/**
@ -72,6 +73,6 @@ public interface IcSocietyOrgService extends BaseService<IcSocietyOrgEntity> {
* @Author sun
* @Description 九小场所下组织列表导入
**/
List<Integer> importExcel(String customerId, List<IcSocietyOrgExcel> result, String userId, List<Integer> numList);
List<Integer> importExcel(String customerId, List<IcSocietyOrgExcel> list, String staffId, List<Integer> numList) throws ParseException;
}

66
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java

@ -26,6 +26,7 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
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.form.*;
import com.epmet.dto.form.demand.ServiceQueryFormDTO;
import com.epmet.dto.result.*;
@ -46,9 +47,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -179,7 +180,64 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl<IcSocietyOrgDao, Ic
}
@Override
public List<Integer> importExcel(String customerId, List<IcSocietyOrgExcel> result, String userId, List<Integer> numList) {
public List<Integer> importExcel(String customerId, List<IcSocietyOrgExcel> list, String staffId, List<Integer> numList) throws ParseException {
//1.数据校验 只允许导入当前组织下社会组织
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(customerId, staffId);
//组织名称不一样的数据舍弃
Iterator<IcSocietyOrgExcel> iterator = list.iterator();
while (iterator.hasNext()) {
IcSocietyOrgExcel obj = iterator.next();
if (!obj.getAgencyName().trim().equals(staffInfoCache.getAgencyName())) {
numList.add(obj.getRowNum());
iterator.remove();
}
}
if(CollectionUtils.isEmpty(list)){
return numList;
}
//2.查询绑定的管理员信息
Set<String> staffNames = list.stream().map(item -> item.getAdminStaffName().trim()).collect(Collectors.toSet());
GetByRealNamesFormDTO dto = new GetByRealNamesFormDTO();
dto.setCustomerId(customerId);
dto.setRealNames(staffNames);
Result<List<CustomerStaffDTO>> staffResult = epmetUserOpenFeignClient.getByRealNames(dto);
if (!staffResult.success()) {
throw new RenException("获取工作人员基础信息失败......");
}
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");
while (iterator1.hasNext()) {
IcSocietyOrgExcel icHouseExcel = iterator1.next();
IcSocietyOrgEntity entity = new IcSocietyOrgEntity();
entity.setCustomerId(customerId);
entity.setAgencyId(staffInfoCache.getAgencyId());
entity.setPids(staffInfoCache.getAgencyPIds());
entity.setSocietyName(icHouseExcel.getSocietyName());
entity.setServiceMatters(icHouseExcel.getServiceMatters());
entity.setPersonInCharge(icHouseExcel.getPersonInCharge());
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()):"");
if ("".equals(entity.getAdminStaffId())) {
numList.add(icHouseExcel.getRowNum());
iterator1.remove();
continue;
}
entity.setAddress(icHouseExcel.getAddress());
entity.setLongitude(icHouseExcel.getLongitude());
entity.setLatitude(icHouseExcel.getLatitude());
houseEntityList.add(entity);
}
//3.批量保存数据
insertBatch(houseEntityList);
return numList;
}

5
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlaceOrgResultDTO.java

@ -3,6 +3,7 @@ package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
@ -12,8 +13,8 @@ import java.util.List;
@Data
public class GetListPlaceOrgResultDTO implements Serializable {
//集合总条数
private Integer total;
private Integer total = 0;
//社会组织信息
private List<PlaceOrgDetailResultDTO> list;
private List<PlaceOrgDetailResultDTO> list = new ArrayList<>();
}

5
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlacePatrolRecordResultDTO.java

@ -3,6 +3,7 @@ package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
@ -12,8 +13,8 @@ import java.util.List;
@Data
public class GetListPlacePatrolRecordResultDTO implements Serializable {
//集合总条数
private Integer total;
private Integer total = 0;
//社会组织信息
private List<PlacePatrolRecordDetailResultDTO> list;
private List<PlacePatrolRecordDetailResultDTO> list = new ArrayList<>();
}

5
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlacePatrolReviewRecordResultDTO.java

@ -3,6 +3,7 @@ package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
@ -12,8 +13,8 @@ import java.util.List;
@Data
public class GetListPlacePatrolReviewRecordResultDTO implements Serializable {
//集合总条数
private Integer total;
private Integer total = 0;
//社会组织信息
private List<PlacePatrolReviewRecordDetailResultDTO> list;
private List<PlacePatrolReviewRecordDetailResultDTO> list = new ArrayList<>();
}

5
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GetListPlacePatrolTeamResultDTO.java

@ -3,6 +3,7 @@ package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
@ -12,8 +13,8 @@ import java.util.List;
@Data
public class GetListPlacePatrolTeamResultDTO implements Serializable {
//集合总条数
private Integer total;
private Integer total = 0;
//社会组织信息
private List<PlacePatrolTeamDetailResultDTO> list;
private List<PlacePatrolTeamDetailResultDTO> list = new ArrayList<>();
}

3
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/PlacePatrolTeamDetailResultDTO.java

@ -4,6 +4,7 @@ import com.epmet.dto.IcPlacePatrolTeamStaffDTO;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
@ -33,6 +34,6 @@ public class PlacePatrolTeamDetailResultDTO implements Serializable {
//创建时间
private String time;
//分队成员信息
private List<IcPlacePatrolTeamStaffDTO> memberList;
private List<IcPlacePatrolTeamStaffDTO> memberList = new ArrayList<>();
}

26
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GetByRealNamesFormDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.form;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Set;
/**
* @Author sun
* @Description 根据工作人员姓名批量查询基础信息数据
**/
@NoArgsConstructor
@Data
public class GetByRealNamesFormDTO implements Serializable {
private static final long serialVersionUID = -5220529162950147825L;
/**
* 客户Id
*/
private String customerId;
/**
* 工作人员姓名集合
*/
private Set<String> realNames;
}

7
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -653,4 +653,11 @@ public interface EpmetUserOpenFeignClient {
@PostMapping("/epmetuser/icresiuser/categorycount")
Result<Map<String, Map<String, String>>> getHomeUserCategoryCount(@RequestBody IcResiUserDTO formDTO);
/**
* @Author sun
* @Description 根据工作人员姓名批量查询基础信息数据
**/
@GetMapping(value = "epmetuser/customerstaff/getbyrealnames")
Result<List<CustomerStaffDTO>> getByRealNames(@RequestBody GetByRealNamesFormDTO formDTO);
}

5
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -474,4 +474,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
public Result<Map<String, Map<String, String>>> getHomeUserCategoryCount(IcResiUserDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getHomeUserCategoryCount", formDTO);
}
@Override
public Result<List<CustomerStaffDTO>> getByRealNames(GetByRealNamesFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getByRealNames", formDTO);
}
}

9
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java

@ -446,5 +446,14 @@ public class CustomerStaffController {
return new Result();
}
/**
* @Author sun
* @Description 根据工作人员姓名批量查询基础信息数据
**/
@PostMapping(value = "getbyrealnames")
public Result<List<CustomerStaffDTO>> getByRealNames(@RequestBody GetByRealNamesFormDTO formDTO) {
return new Result<List<CustomerStaffDTO>>().ok(customerStaffService.getByRealNames(formDTO));
}
}

6
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java

@ -215,4 +215,10 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
List<CustomerStaffDTO> listDTOS(@Param("customerId") String customerId, @Param("realName") String realName, @Param("mobile") String mobile, @Param("userIds") List<String> userIds);
List<String> selectStaffRoles(@Param("userId") String userId,@Param("customerId") String customerId);
/**
* @Author sun
* @Description 根据工作人员姓名批量查询基础信息数据
**/
List<CustomerStaffDTO> getByRealNames(GetByRealNamesFormDTO formDTO);
}

6
epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java

@ -335,4 +335,10 @@ public interface CustomerStaffService extends BaseService<CustomerStaffEntity> {
* @author sun
*/
void enableStaff(EnableStaffFormDTO fromDTO);
/**
* @Author sun
* @Description 根据工作人员姓名批量查询基础信息数据
**/
List<CustomerStaffDTO> getByRealNames(GetByRealNamesFormDTO formDTO);
}

9
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

@ -784,4 +784,13 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
baseDao.updateById(staffEntity);
}
/**
* @Author sun
* @Description 根据工作人员姓名批量查询基础信息数据
**/
@Override
public List<CustomerStaffDTO> getByRealNames(GetByRealNamesFormDTO formDTO) {
return baseDao.getByRealNames(formDTO);
}
}

26
epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

@ -426,4 +426,30 @@
and sr.STAFF_ID=#{userId}
)
</select>
<select id="getByRealNames" resultType="com.epmet.dto.CustomerStaffDTO">
SELECT
id,
customer_id,
user_id,
real_name,
gender,
email,
mobile,
address,
work_type,
head_photo,
active_flag,
active_time,
enable_flag
FROM
customer_staff
WHERE
del_flag = '0'
AND customer_id = #{customerId}
<foreach collection="realNames" item="name" open="AND real_name IN (" separator="," close=")">
#{name}
</foreach>
</select>
</mapper>

Loading…
Cancel
Save