|
|
@ -35,6 +35,7 @@ import com.epmet.commons.tools.redis.common.bean.GridInfoCache; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.constant.PartyServiceCenterConstant; |
|
|
|
import com.epmet.dao.IcMatterAppointmentRecordDao; |
|
|
|
import com.epmet.dao.IcPartyServiceCenterDao; |
|
|
@ -45,6 +46,7 @@ import com.epmet.dto.result.*; |
|
|
|
import com.epmet.entity.IcMatterAppointmentRecordEntity; |
|
|
|
import com.epmet.entity.IcPartyServiceCenterEntity; |
|
|
|
import com.epmet.entity.IcPartyServiceCenterMatterEntity; |
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
import com.epmet.service.IcPartyServiceCenterMatterService; |
|
|
|
import com.epmet.service.IcPartyServiceCenterService; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
@ -75,6 +77,8 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ |
|
|
|
private IcPartyServiceCenterMatterService matterService; |
|
|
|
@Autowired |
|
|
|
private IcMatterAppointmentRecordDao matterAppointmentRecordDao; |
|
|
|
@Autowired |
|
|
|
private EpmetUserOpenFeignClient userOpenFeignClient; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<IcPartyServiceCenterDTO> page(Map<String, Object> params) { |
|
|
@ -313,6 +317,59 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl<IcPartyServ |
|
|
|
matterAppointmentRecordDao.insert(e); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void appointmentMini(AppointmentMiniFormDTO formDTO, TokenDto tokenDto) { |
|
|
|
String customerId = tokenDto.getCustomerId(); |
|
|
|
LambdaQueryWrapper<IcMatterAppointmentRecordEntity> l = new LambdaQueryWrapper<>(); |
|
|
|
l.eq(IcMatterAppointmentRecordEntity::getMatterId,formDTO.getMatterId()) |
|
|
|
.eq(IcMatterAppointmentRecordEntity::getAppointmentDate,formDTO.getAppointmentDate()) |
|
|
|
.eq(IcMatterAppointmentRecordEntity::getStatus,PartyServiceCenterConstant.APPOINTMENT_STATUS_APPOINTING) |
|
|
|
.eq(BaseEpmetEntity::getDelFlag,NumConstant.ZERO); |
|
|
|
List<IcMatterAppointmentRecordEntity> records = matterAppointmentRecordDao.selectList(l); |
|
|
|
Result<ResiUserBaseInfoResultDTO> userInfoResult = userOpenFeignClient.selectUserBaseInfo(tokenDto); |
|
|
|
if (!userInfoResult.success()){ |
|
|
|
throw new EpmetException("查询用户信息失败..."); |
|
|
|
} |
|
|
|
formDTO.setAppointmentName(userInfoResult.getData().getRealName()); |
|
|
|
formDTO.setAppointmentPhone(userInfoResult.getData().getMobile()); |
|
|
|
if (CollectionUtils.isNotEmpty(records)){ |
|
|
|
List<String> timeIds = new ArrayList<>(); |
|
|
|
records.forEach(r -> { |
|
|
|
timeIds.addAll(Arrays.asList(r.getTimeId().split(","))); |
|
|
|
}); |
|
|
|
List<String> formTimeId = Arrays.asList(formDTO.getTimeId().split(",")); |
|
|
|
int before = timeIds.size() + formTimeId.size(); |
|
|
|
List<String> endTimeId = new ArrayList<>(); |
|
|
|
endTimeId.addAll(timeIds);endTimeId.addAll(formTimeId); |
|
|
|
List<String> collect = endTimeId.stream().distinct().collect(Collectors.toList()); |
|
|
|
if (collect.size() < before){ |
|
|
|
throw new RenException(EpmetErrorCode.APPOINTMENT_TIME_ERROR.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, tokenDto.getUserId()); |
|
|
|
if (null == staffInfo){ |
|
|
|
throw new RenException(String.format("查询人员{%s}信息失败",tokenDto.getUserId())); |
|
|
|
} |
|
|
|
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId()); |
|
|
|
if (null == agencyInfo){ |
|
|
|
throw new RenException(String.format("查询组织信息失败%s",staffInfo.getAgencyId())); |
|
|
|
} |
|
|
|
IcMatterAppointmentRecordEntity e = ConvertUtils.sourceToTarget(formDTO, IcMatterAppointmentRecordEntity.class); |
|
|
|
e.setCustomerId(customerId); |
|
|
|
if (StringUtils.isNotBlank(formDTO.getOrgId())){ |
|
|
|
e.setOrgId(formDTO.getOrgId()); |
|
|
|
e.setOrgType(formDTO.getOrgType()); |
|
|
|
}else { |
|
|
|
e.setOrgId(staffInfo.getAgencyId()); |
|
|
|
e.setOrgType(PartyServiceCenterConstant.ORG_TYPE_AGENCY); |
|
|
|
} |
|
|
|
e.setPid(agencyInfo.getPid()); |
|
|
|
e.setPids(agencyInfo.getPids()); |
|
|
|
e.setStatus(PartyServiceCenterConstant.APPOINTMENT_STATUS_APPOINTING); |
|
|
|
matterAppointmentRecordDao.insert(e); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 党群服务中心列表 |
|
|
|
* @param formDTO |
|
|
|