|
@ -38,12 +38,13 @@ import com.epmet.dto.CustomerGridDTO; |
|
|
import com.epmet.dto.IcUserDemandRecDTO; |
|
|
import com.epmet.dto.IcUserDemandRecDTO; |
|
|
import com.epmet.dto.form.CustomerGridFormDTO; |
|
|
import com.epmet.dto.form.CustomerGridFormDTO; |
|
|
import com.epmet.dto.form.demand.*; |
|
|
import com.epmet.dto.form.demand.*; |
|
|
|
|
|
import com.epmet.dto.result.AllGridsByUserIdResultDTO; |
|
|
|
|
|
import com.epmet.dto.result.UserBaseInfoResultDTO; |
|
|
import com.epmet.dto.result.demand.DemandRecResultDTO; |
|
|
import com.epmet.dto.result.demand.DemandRecResultDTO; |
|
|
import com.epmet.entity.IcUserDemandOperateLogEntity; |
|
|
import com.epmet.entity.*; |
|
|
import com.epmet.entity.IcUserDemandRecEntity; |
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
import com.epmet.entity.IcUserDemandSatisfactionEntity; |
|
|
|
|
|
import com.epmet.entity.IcUserDemandServiceEntity; |
|
|
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
|
|
import com.epmet.service.IcResiDemandDictService; |
|
|
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; |
|
@ -53,10 +54,9 @@ 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 java.util.Arrays; |
|
|
import java.util.*; |
|
|
import java.util.Date; |
|
|
import java.util.function.Function; |
|
|
import java.util.List; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 居民需求记录表 |
|
|
* 居民需求记录表 |
|
@ -74,6 +74,10 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
private IcUserDemandSatisfactionDao demandSatisfactionDao; |
|
|
private IcUserDemandSatisfactionDao demandSatisfactionDao; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|
|
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IcResiDemandDictService demandDictService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -116,9 +120,41 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void update(IcUserDemandRecDTO dto) { |
|
|
public DemandRecId update(DemandAddFromDTO dto) { |
|
|
IcUserDemandRecEntity entity = ConvertUtils.sourceToTarget(dto, IcUserDemandRecEntity.class); |
|
|
IcUserDemandRecEntity origin = baseDao.selectById(dto.getDemandRecId()); |
|
|
updateById(entity); |
|
|
if (null == origin) { |
|
|
|
|
|
throw new RenException(EpmetErrorCode.DEMAND_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_NOT_EXITS.getMsg()); |
|
|
|
|
|
} |
|
|
|
|
|
if(!UserDemandConstant.PENDING.equals(origin.getStatus())){ |
|
|
|
|
|
//待处理的才可以修改需求
|
|
|
|
|
|
throw new RenException(EpmetErrorCode.DEMAND_CAN_NOT_UPDATE.getCode(),EpmetErrorCode.DEMAND_CAN_NOT_UPDATE.getMsg()); |
|
|
|
|
|
} |
|
|
|
|
|
CustomerGridFormDTO customerGridFormDTO=new CustomerGridFormDTO(); |
|
|
|
|
|
customerGridFormDTO.setGridId(dto.getGridId()); |
|
|
|
|
|
Result<CustomerGridDTO> gridInfoRes=govOrgOpenFeignClient.getGridBaseInfoByGridId(customerGridFormDTO); |
|
|
|
|
|
if(!gridInfoRes.success()||null==gridInfoRes.getData()){ |
|
|
|
|
|
throw new RenException("查询网格信息失败"); |
|
|
|
|
|
} |
|
|
|
|
|
IcUserDemandRecEntity updateEntity=ConvertUtils.sourceToTarget(dto,IcUserDemandRecEntity.class); |
|
|
|
|
|
updateEntity.setAgencyId(gridInfoRes.getData().getPid()); |
|
|
|
|
|
updateEntity.setGridPids(gridInfoRes.getData().getPids()); |
|
|
|
|
|
updateEntity.setDemandUserType(UserDemandConstant.IC_RESI_USER); |
|
|
|
|
|
updateEntity.setStatus(UserDemandConstant.PENDING); |
|
|
|
|
|
updateEntity.setEvaluateFlag(false); |
|
|
|
|
|
updateEntity.setId(dto.getDemandRecId()); |
|
|
|
|
|
baseDao.updateById(updateEntity); |
|
|
|
|
|
|
|
|
|
|
|
IcUserDemandOperateLogEntity logEntity=new IcUserDemandOperateLogEntity(); |
|
|
|
|
|
logEntity.setCustomerId(dto.getCustomerId()); |
|
|
|
|
|
logEntity.setDemandRecId(dto.getDemandRecId()); |
|
|
|
|
|
logEntity.setUserType(UserDemandConstant.STAFF); |
|
|
|
|
|
logEntity.setUserId(dto.getCurrentUserId()); |
|
|
|
|
|
logEntity.setActionCode(UserDemandConstant.UPDATE); |
|
|
|
|
|
logEntity.setOperateTime(new Date()); |
|
|
|
|
|
operateLogDao.insert(logEntity); |
|
|
|
|
|
DemandRecId resultDto=new DemandRecId(); |
|
|
|
|
|
resultDto.setDemandRecId(updateEntity.getId()); |
|
|
|
|
|
return resultDto; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -180,9 +216,87 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.pageSelect(formDTO)); |
|
|
formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.pageSelect(formDTO)); |
|
|
List<DemandRecResultDTO> list=pageInfo.getList(); |
|
|
List<DemandRecResultDTO> list=pageInfo.getList(); |
|
|
if(CollectionUtils.isNotEmpty(list)){ |
|
|
if(CollectionUtils.isNotEmpty(list)){ |
|
|
/*for(){ |
|
|
//1、查询网格信息
|
|
|
|
|
|
List<String> gridIds=list.stream().map(DemandRecResultDTO::getGridId).collect(Collectors.toList()); |
|
|
|
|
|
Result<List<AllGridsByUserIdResultDTO>> gridInfoRes=govOrgOpenFeignClient.getGridListByGridIds(gridIds); |
|
|
|
|
|
List<AllGridsByUserIdResultDTO> gridInfoList = gridInfoRes.success() && !CollectionUtils.isEmpty(gridInfoRes.getData()) ? gridInfoRes.getData() : new ArrayList<>(); |
|
|
|
|
|
Map<String, AllGridsByUserIdResultDTO> gridInfoMap = gridInfoList.stream().collect(Collectors.toMap(AllGridsByUserIdResultDTO::getGridId, Function.identity())); |
|
|
|
|
|
|
|
|
}*/ |
|
|
//2、查询分类名称
|
|
|
|
|
|
List<String> categoryCodes=list.stream().map(DemandRecResultDTO::getCategoryCode).collect(Collectors.toList()); |
|
|
|
|
|
List<IcResiDemandDictEntity> dictList=demandDictService.listByCodes(formDTO.getCustomerId(),categoryCodes); |
|
|
|
|
|
Map<String, String> dictMap = dictList.stream().collect(Collectors.toMap(IcResiDemandDictEntity::getCategoryCode, IcResiDemandDictEntity::getCategoryName)); |
|
|
|
|
|
|
|
|
|
|
|
//3、查询志愿者
|
|
|
|
|
|
// 服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
|
|
|
|
|
|
List<String> userIdList=list.stream().filter(item->item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getCategoryCode).collect(Collectors.toList()); |
|
|
|
|
|
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList); |
|
|
|
|
|
if(CollectionUtils.isEmpty(userIdList)||!userInfoRes.success()||CollectionUtils.isEmpty(userInfoRes.getData())){ |
|
|
|
|
|
throw new RenException("查询志愿者信息异常"); |
|
|
|
|
|
} |
|
|
|
|
|
Map<String,String> userInfoMap=userInfoRes.getData().stream().collect(Collectors.toMap(UserBaseInfoResultDTO::getUserId, UserBaseInfoResultDTO::getRealName)); |
|
|
|
|
|
|
|
|
|
|
|
for(DemandRecResultDTO res:list){ |
|
|
|
|
|
if (null != gridInfoMap && gridInfoMap.containsKey(res.getGridId())) { |
|
|
|
|
|
res.setGridName(gridInfoMap.get(res.getGridId()).getGridName()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (null != dictMap && dictMap.containsKey(res.getCategoryCode())) { |
|
|
|
|
|
res.setCategoryName(dictMap.get(res.getCategoryCode())); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (null != userInfoMap && userInfoMap.containsKey(res.getServerId())) { |
|
|
|
|
|
res.setServiceName(userInfoMap.get(res.getServerId())); |
|
|
|
|
|
} |
|
|
|
|
|
//社区帮办:community;楼长帮办:building_caption;党员帮办:party;自身上报:self_help
|
|
|
|
|
|
switch(res.getReportType()){ |
|
|
|
|
|
case UserDemandConstant.COMMUNITY_REPORT : |
|
|
|
|
|
res.setReportTypeName("社区帮办"); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.BUILDING_CAPTION_REPORT : |
|
|
|
|
|
res.setReportTypeName("楼长帮办"); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.PARTY_REPORT : |
|
|
|
|
|
res.setReportTypeName("党员帮办"); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.SELF_HELP_REPORT : |
|
|
|
|
|
res.setReportTypeName("自身上报"); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
//待处理:pending;已取消canceled;已派单:assigned;已接单:have_order;已完成:finished
|
|
|
|
|
|
switch(res.getStatus()){ |
|
|
|
|
|
case UserDemandConstant.PENDING : |
|
|
|
|
|
res.setStatusName("待处理"); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.CANCELED : |
|
|
|
|
|
res.setStatusName("已取消"); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.ASSIGNED : |
|
|
|
|
|
res.setStatusName("已指派"); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.HAVE_ORDER : |
|
|
|
|
|
res.setStatusName("已接单"); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.FINISHED : |
|
|
|
|
|
res.setStatusName("已完成"); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
//服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
|
|
|
|
|
|
switch(res.getServiceType()){ |
|
|
|
|
|
case UserDemandConstant.VOLUNTEER : |
|
|
|
|
|
res.setServiceShowName(res.getServiceName().concat("(志愿者)")); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.SOCIAL_ORG : |
|
|
|
|
|
res.setServiceShowName(res.getServiceName().concat("(社会组织)")); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.COMMUNITY_ORG : |
|
|
|
|
|
res.setServiceShowName(res.getServiceName().concat("(社区自组织")); |
|
|
|
|
|
break; |
|
|
|
|
|
case UserDemandConstant.PARTY_UNIT : |
|
|
|
|
|
res.setServiceShowName(res.getServiceName().concat("(区域化党建单位)")); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
return new PageData<>(list, pageInfo.getTotal()); |
|
|
return new PageData<>(list, pageInfo.getTotal()); |
|
|
} |
|
|
} |
|
@ -197,7 +311,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
public void cancel(StaffCancelFormDTO formDTO) { |
|
|
public void cancel(StaffCancelFormDTO formDTO) { |
|
|
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId()); |
|
|
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId()); |
|
|
if (null == entity) { |
|
|
if (null == entity) { |
|
|
throw new RenException("需求不存在"); |
|
|
throw new RenException(EpmetErrorCode.DEMAND_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_NOT_EXITS.getMsg()); |
|
|
} |
|
|
} |
|
|
if (UserDemandConstant.FINISH.equals(entity.getStatus())) { |
|
|
if (UserDemandConstant.FINISH.equals(entity.getStatus())) { |
|
|
//需求已完成,不可取消
|
|
|
//需求已完成,不可取消
|
|
@ -232,7 +346,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
public void assign(AssignFormDTO formDTO) { |
|
|
public void assign(AssignFormDTO formDTO) { |
|
|
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId()); |
|
|
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId()); |
|
|
if (null == entity) { |
|
|
if (null == entity) { |
|
|
throw new RenException("需求不存在"); |
|
|
throw new RenException(EpmetErrorCode.DEMAND_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_NOT_EXITS.getMsg()); |
|
|
} |
|
|
} |
|
|
if (!UserDemandConstant.PENDING.equals(entity.getStatus()) && !UserDemandConstant.ASSIGNED.equals(entity.getStatus())) { |
|
|
if (!UserDemandConstant.PENDING.equals(entity.getStatus()) && !UserDemandConstant.ASSIGNED.equals(entity.getStatus())) { |
|
|
//待处理+已派单才可以指派
|
|
|
//待处理+已派单才可以指派
|
|
@ -274,7 +388,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD |
|
|
public void finish(FinishStaffFromDTO formDTO) { |
|
|
public void finish(FinishStaffFromDTO formDTO) { |
|
|
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId()); |
|
|
IcUserDemandRecEntity entity = baseDao.selectById(formDTO.getDemandRecId()); |
|
|
if (null == entity) { |
|
|
if (null == entity) { |
|
|
throw new RenException("需求不存在"); |
|
|
throw new RenException(EpmetErrorCode.DEMAND_NOT_EXITS.getCode(), EpmetErrorCode.DEMAND_NOT_EXITS.getMsg()); |
|
|
} |
|
|
} |
|
|
if (UserDemandConstant.PENDING.equals(entity.getStatus()) ||UserDemandConstant.CANCELED.equals(entity.getStatus())) { |
|
|
if (UserDemandConstant.PENDING.equals(entity.getStatus()) ||UserDemandConstant.CANCELED.equals(entity.getStatus())) { |
|
|
//待处理或者已取消的不能评价
|
|
|
//待处理或者已取消的不能评价
|
|
|