|
@ -24,6 +24,8 @@ import com.epmet.commons.tools.constant.FieldConstant; |
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
import com.epmet.commons.tools.enums.DictTypeEnum; |
|
|
import com.epmet.commons.tools.enums.DictTypeEnum; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
|
|
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.dao.IcPartyUnitDao; |
|
|
import com.epmet.dao.IcPartyUnitDao; |
|
@ -38,16 +40,15 @@ import com.epmet.service.IcPartyUnitService; |
|
|
import com.epmet.service.IcUserDemandRecService; |
|
|
import com.epmet.service.IcUserDemandRecService; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageInfo; |
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
import java.util.ArrayList; |
|
|
import java.util.*; |
|
|
import java.util.Arrays; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 联建单位 |
|
|
* 联建单位 |
|
@ -74,11 +75,16 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa |
|
|
wrapper.eq(StringUtils.isNotBlank(formDTO.getType()), IcPartyUnitEntity::getType, formDTO.getType()); |
|
|
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.getContact()), IcPartyUnitEntity::getContact, formDTO.getContact()); |
|
|
wrapper.like(StringUtils.isNotBlank(formDTO.getContactMobile()), IcPartyUnitEntity::getContactMobile, formDTO.getContactMobile()); |
|
|
wrapper.like(StringUtils.isNotBlank(formDTO.getContactMobile()), IcPartyUnitEntity::getContactMobile, formDTO.getContactMobile()); |
|
|
|
|
|
wrapper.orderByDesc(IcPartyUnitEntity::getUpdatedTime); |
|
|
List<IcPartyUnitEntity> list = baseDao.selectList(wrapper); |
|
|
List<IcPartyUnitEntity> list = baseDao.selectList(wrapper); |
|
|
List<IcPartyUnitDTO> dtoList = ConvertUtils.sourceToTarget(list, IcPartyUnitDTO.class); |
|
|
List<IcPartyUnitDTO> dtoList = ConvertUtils.sourceToTarget(list, IcPartyUnitDTO.class); |
|
|
Result<Map<String, String>> unitTypeMap = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.PARTY_UNIT_TYPE.getCode()); |
|
|
Result<Map<String, String>> unitTypeMap = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.PARTY_UNIT_TYPE.getCode()); |
|
|
dtoList.forEach(item -> { |
|
|
dtoList.forEach(item -> { |
|
|
item.setType(unitTypeMap.getData().get(item.getType())); |
|
|
item.setType(unitTypeMap.getData().get(item.getType())); |
|
|
|
|
|
//TODO 服务事项
|
|
|
|
|
|
if (StringUtils.isNotBlank(item.getServiceMatter())) { |
|
|
|
|
|
List<String> matters = Arrays.asList(item.getServiceMatter().split(StrConstant.COMMA)); |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
PageInfo<IcPartyUnitDTO> pageInfo = new PageInfo<>(dtoList); |
|
|
PageInfo<IcPartyUnitDTO> pageInfo = new PageInfo<>(dtoList); |
|
|
return new PageData<>(dtoList, pageInfo.getTotal()); |
|
|
return new PageData<>(dtoList, pageInfo.getTotal()); |
|
@ -103,6 +109,10 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa |
|
|
@Override |
|
|
@Override |
|
|
public IcPartyUnitDTO get(String id) { |
|
|
public IcPartyUnitDTO get(String id) { |
|
|
IcPartyUnitEntity entity = baseDao.selectById(id); |
|
|
IcPartyUnitEntity entity = baseDao.selectById(id); |
|
|
|
|
|
IcPartyUnitDTO dto = ConvertUtils.sourceToTarget(entity, IcPartyUnitDTO.class); |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getServiceMatter())) { |
|
|
|
|
|
dto.setServiceMatterList(Arrays.asList(dto.getServiceMatter().split(StrConstant.COMMA))); |
|
|
|
|
|
} |
|
|
return ConvertUtils.sourceToTarget(entity, IcPartyUnitDTO.class); |
|
|
return ConvertUtils.sourceToTarget(entity, IcPartyUnitDTO.class); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -110,21 +120,21 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void save(IcPartyUnitDTO dto) { |
|
|
public void save(IcPartyUnitDTO dto) { |
|
|
IcPartyUnitEntity entity = ConvertUtils.sourceToTarget(dto, IcPartyUnitEntity.class); |
|
|
IcPartyUnitEntity entity = ConvertUtils.sourceToTarget(dto, IcPartyUnitEntity.class); |
|
|
|
|
|
AgencyInfoCache agency = CustomerOrgRedis.getAgencyInfo(entity.getAgencyId()); |
|
|
|
|
|
entity.setPids(agency.getPids()); |
|
|
|
|
|
if(StringUtils.isBlank(entity.getId())) { |
|
|
insert(entity); |
|
|
insert(entity); |
|
|
} |
|
|
} else { |
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
public void update(IcPartyUnitDTO dto) { |
|
|
|
|
|
IcPartyUnitEntity entity = ConvertUtils.sourceToTarget(dto, IcPartyUnitEntity.class); |
|
|
|
|
|
updateById(entity); |
|
|
updateById(entity); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void delete(String[] ids) { |
|
|
public void delete(String id) { |
|
|
// 逻辑删除(@TableLogic 注解)
|
|
|
// 逻辑删除(@TableLogic 注解)
|
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
baseDao.deleteById(id); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -151,4 +161,29 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa |
|
|
return resultList; |
|
|
return resultList; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @Description 获取组织下单位列表 |
|
|
|
|
|
* @param dto |
|
|
|
|
|
* @Return {@link List< OptionDTO>} |
|
|
|
|
|
* @Author zhaoqifeng |
|
|
|
|
|
* @Date 2021/11/22 14:35 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public List<OptionDTO> option(IcPartyUnitDTO dto) { |
|
|
|
|
|
LambdaQueryWrapper<IcPartyUnitEntity> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
|
wrapper.eq(IcPartyUnitEntity::getAgencyId, dto.getAgencyId()); |
|
|
|
|
|
wrapper.orderByDesc(IcPartyUnitEntity::getUpdatedTime); |
|
|
|
|
|
wrapper.eq(StringUtils.isNotBlank(dto.getServiceMatter()), IcPartyUnitEntity::getServiceMatter, dto.getServiceMatter()); |
|
|
|
|
|
List<IcPartyUnitEntity> list = baseDao.selectList(wrapper); |
|
|
|
|
|
if (CollectionUtils.isEmpty(list)) { |
|
|
|
|
|
return Collections.emptyList(); |
|
|
|
|
|
} |
|
|
|
|
|
return list.stream().map(item -> { |
|
|
|
|
|
OptionDTO option = new OptionDTO(); |
|
|
|
|
|
option.setValue(item.getId()); |
|
|
|
|
|
option.setLabel(item.getUnitName()); |
|
|
|
|
|
return option; |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |