|
|
@ -33,16 +33,17 @@ import com.epmet.dto.IcPartyUnitDTO; |
|
|
|
import com.epmet.dto.IcUserDemandRecDTO; |
|
|
|
import com.epmet.dto.form.PartyUnitFormDTO; |
|
|
|
import com.epmet.dto.form.demand.ServiceQueryFormDTO; |
|
|
|
import com.epmet.dto.form.demand.SubCodeFormDTO; |
|
|
|
import com.epmet.dto.result.demand.OptionDTO; |
|
|
|
import com.epmet.entity.IcPartyUnitEntity; |
|
|
|
import com.epmet.feign.EpmetAdminOpenFeignClient; |
|
|
|
import com.epmet.service.IcPartyUnitService; |
|
|
|
import com.epmet.service.IcResiDemandDictService; |
|
|
|
import com.epmet.service.IcUserDemandRecService; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
@ -61,8 +62,10 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa |
|
|
|
|
|
|
|
@Resource |
|
|
|
private EpmetAdminOpenFeignClient epmetAdminOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
@Resource |
|
|
|
private IcUserDemandRecService icUserDemandRecService; |
|
|
|
@Resource |
|
|
|
private IcResiDemandDictService icResiDemandDictService; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@ -79,11 +82,17 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa |
|
|
|
List<IcPartyUnitEntity> list = baseDao.selectList(wrapper); |
|
|
|
List<IcPartyUnitDTO> dtoList = ConvertUtils.sourceToTarget(list, IcPartyUnitDTO.class); |
|
|
|
Result<Map<String, String>> unitTypeMap = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.PARTY_UNIT_TYPE.getCode()); |
|
|
|
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO(); |
|
|
|
codeFormDTO.setCustomerId(formDTO.getCustomerId()); |
|
|
|
codeFormDTO.setParentCategoryCode("1010"); |
|
|
|
Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); |
|
|
|
dtoList.forEach(item -> { |
|
|
|
item.setType(unitTypeMap.getData().get(item.getType())); |
|
|
|
//TODO 服务事项
|
|
|
|
if (StringUtils.isNotBlank(item.getServiceMatter())) { |
|
|
|
List<String> matters = Arrays.asList(item.getServiceMatter().split(StrConstant.COMMA)); |
|
|
|
item.setServiceMatterList(matters.stream().map(categoryMap::get).collect(Collectors.toList())); |
|
|
|
} else { |
|
|
|
item.setServiceMatterList(new ArrayList<>()); |
|
|
|
} |
|
|
|
}); |
|
|
|
PageInfo<IcPartyUnitDTO> pageInfo = new PageInfo<>(dtoList); |
|
|
@ -91,10 +100,32 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<IcPartyUnitDTO> list(Map<String, Object> params) { |
|
|
|
List<IcPartyUnitEntity> entityList = baseDao.selectList(getWrapper(params)); |
|
|
|
|
|
|
|
return ConvertUtils.sourceToTarget(entityList, IcPartyUnitDTO.class); |
|
|
|
public List<IcPartyUnitDTO> list(PartyUnitFormDTO formDTO) { |
|
|
|
LambdaQueryWrapper<IcPartyUnitEntity> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
wrapper.eq(IcPartyUnitEntity::getAgencyId, formDTO.getAgencyId()); |
|
|
|
wrapper.like(StringUtils.isNotBlank(formDTO.getUnitName()), IcPartyUnitEntity::getUnitName, formDTO.getUnitName()); |
|
|
|
wrapper.eq(StringUtils.isNotBlank(formDTO.getServiceMatter()), IcPartyUnitEntity::getServiceMatter, formDTO.getServiceMatter()); |
|
|
|
wrapper.eq(StringUtils.isNotBlank(formDTO.getType()), IcPartyUnitEntity::getType, formDTO.getType()); |
|
|
|
wrapper.like(StringUtils.isNotBlank(formDTO.getContact()), IcPartyUnitEntity::getContact, formDTO.getContact()); |
|
|
|
wrapper.like(StringUtils.isNotBlank(formDTO.getContactMobile()), IcPartyUnitEntity::getContactMobile, formDTO.getContactMobile()); |
|
|
|
wrapper.orderByDesc(IcPartyUnitEntity::getUpdatedTime); |
|
|
|
List<IcPartyUnitEntity> list = baseDao.selectList(wrapper); |
|
|
|
List<IcPartyUnitDTO> dtoList = ConvertUtils.sourceToTarget(list, IcPartyUnitDTO.class); |
|
|
|
Result<Map<String, String>> unitTypeMap = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.PARTY_UNIT_TYPE.getCode()); |
|
|
|
SubCodeFormDTO codeFormDTO = new SubCodeFormDTO(); |
|
|
|
codeFormDTO.setCustomerId(formDTO.getCustomerId()); |
|
|
|
codeFormDTO.setParentCategoryCode("1010"); |
|
|
|
Map<String, String> categoryMap = icResiDemandDictService.querySubCodeList(codeFormDTO).stream().collect(Collectors.toMap(OptionDTO::getValue, OptionDTO::getLabel)); |
|
|
|
dtoList.forEach(item -> { |
|
|
|
item.setType(unitTypeMap.getData().get(item.getType())); |
|
|
|
if (StringUtils.isNotBlank(item.getServiceMatter())) { |
|
|
|
List<String> matters = Arrays.asList(item.getServiceMatter().split(StrConstant.COMMA)); |
|
|
|
item.setServiceMatterList(matters.stream().map(categoryMap::get).collect(Collectors.toList())); |
|
|
|
} else { |
|
|
|
item.setServiceMatterList(new ArrayList<>()); |
|
|
|
} |
|
|
|
}); |
|
|
|
return dtoList; |
|
|
|
} |
|
|
|
|
|
|
|
private QueryWrapper<IcPartyUnitEntity> getWrapper(Map<String, Object> params){ |
|
|
|