|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.enums.DictTypeEnum; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
@ -17,6 +18,7 @@ import com.epmet.dto.IcServiceOrgDTO; |
|
|
|
import com.epmet.dto.form.IcServiceOrgAddEditFormDTO; |
|
|
|
import com.epmet.dto.form.IcServiceOrgListFormDTO; |
|
|
|
import com.epmet.dto.result.IcServiceOrgListResultDTO; |
|
|
|
import com.epmet.dto.result.IcServiceOrgSelectListResultDTO; |
|
|
|
import com.epmet.entity.IcServiceOrgEntity; |
|
|
|
import com.epmet.feign.EpmetAdminOpenFeignClient; |
|
|
|
import com.epmet.service.IcServiceOrgService; |
|
|
@ -115,7 +117,7 @@ public class IcServiceOrgServiceImpl extends BaseServiceImpl<IcServiceOrgDao, Ic |
|
|
|
//3.新增服务组织数据
|
|
|
|
IcServiceOrgEntity entity = ConvertUtils.sourceToTarget(formDTO, IcServiceOrgEntity.class); |
|
|
|
entity.setAgencyId(staffInfo.getAgencyId()); |
|
|
|
entity.setAgencyIdPath(staffInfo.getAgencyPIds()); |
|
|
|
entity.setAgencyIdPath(StringUtils.isEmpty(staffInfo.getAgencyPIds()) ? staffInfo.getAgencyId() : staffInfo.getAgencyPIds() + ":" + staffInfo.getAgencyId()); |
|
|
|
insert(entity); |
|
|
|
} |
|
|
|
|
|
|
@ -144,9 +146,50 @@ public class IcServiceOrgServiceImpl extends BaseServiceImpl<IcServiceOrgDao, Ic |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void delete(String icServiceOrgId) { |
|
|
|
// 逻辑删除(@TableLogic 注解)
|
|
|
|
baseDao.deleteById(icServiceOrgId); |
|
|
|
public void delete(IcServiceOrgAddEditFormDTO formDTO) { |
|
|
|
IcServiceOrgEntity entity = new IcServiceOrgEntity(); |
|
|
|
entity.setId(formDTO.getIcServiceOrgId()); |
|
|
|
entity.setUpdatedBy(formDTO.getUserId()); |
|
|
|
baseDao.del(entity); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public IcServiceOrgListResultDTO detail(IcServiceOrgListFormDTO formDTO) { |
|
|
|
IcServiceOrgListResultDTO resultDTO = new IcServiceOrgListResultDTO(); |
|
|
|
//1.查询服务组织信息
|
|
|
|
List<IcServiceOrgListResultDTO> list = baseDao.selectServiceOrgList(formDTO); |
|
|
|
|
|
|
|
//封装服务类别数据
|
|
|
|
if (!CollectionUtils.isEmpty(list)) { |
|
|
|
resultDTO = list.get(NumConstant.ZERO); |
|
|
|
//服务类别字典表数据
|
|
|
|
Result<Map<String, String>> statusRes = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.IC_SERVICE_TYPE.getCode()); |
|
|
|
Map<String, String> statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>(); |
|
|
|
List<IcServiceOrgListResultDTO.ServiceType> stList = new ArrayList<>(); |
|
|
|
IcServiceOrgListResultDTO.ServiceType st = null; |
|
|
|
for (String str : resultDTO.getServiceType().split(",")) { |
|
|
|
st = new IcServiceOrgListResultDTO.ServiceType(); |
|
|
|
st.setValue(str); |
|
|
|
st.setName(null != statusMap.get(str) ? statusMap.get(str) : ""); |
|
|
|
stList.add(st); |
|
|
|
} |
|
|
|
resultDTO.setServiceTypeList(stList); |
|
|
|
} |
|
|
|
|
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<IcServiceOrgSelectListResultDTO> selectList(IcServiceOrgListFormDTO formDTO) { |
|
|
|
//1.获取当前工作人员缓存信息
|
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); |
|
|
|
if (null == staffInfo) { |
|
|
|
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getStaffId())); |
|
|
|
} |
|
|
|
//2.按条件查询当前组织及下级服务组织数据
|
|
|
|
List<IcServiceOrgSelectListResultDTO> resultList = baseDao.selectServiceOrgSelectList(formDTO); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
} |